painter.js 87 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665
  1. ! function(t, e) {
  2. "object" == typeof exports && "undefined" != typeof module ? e(exports) : "function" == typeof define && define
  3. .amd ? define(["exports"], e) : e((t = "undefined" != typeof globalThis ? globalThis : t || self).Painter = {})
  4. }(this, (function(t) {
  5. "use strict";
  6. var e = function() {
  7. return e = Object.assign || function(t) {
  8. for (var e, i = 1, n = arguments.length; i < n; i++)
  9. for (var r in e = arguments[i]) Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[
  10. r]);
  11. return t
  12. }, e.apply(this, arguments)
  13. };
  14. function i(t, e, i, n) {
  15. return new(i || (i = Promise))((function(r, o) {
  16. function s(t) {
  17. try {
  18. h(n.next(t))
  19. } catch (t) {
  20. o(t)
  21. }
  22. }
  23. function a(t) {
  24. try {
  25. h(n.throw(t))
  26. } catch (t) {
  27. o(t)
  28. }
  29. }
  30. function h(t) {
  31. var e;
  32. t.done ? r(t.value) : (e = t.value, e instanceof i ? e : new i((function(t) {
  33. t(e)
  34. }))).then(s, a)
  35. }
  36. h((n = n.apply(t, e || [])).next())
  37. }))
  38. }
  39. function n(t, e) {
  40. var i, n, r, o, s = {
  41. label: 0,
  42. sent: function() {
  43. if (1 & r[0]) throw r[1];
  44. return r[1]
  45. },
  46. trys: [],
  47. ops: []
  48. };
  49. return o = {
  50. next: a(0),
  51. throw: a(1),
  52. return: a(2)
  53. }, "function" == typeof Symbol && (o[Symbol.iterator] = function() {
  54. return this
  55. }), o;
  56. function a(o) {
  57. return function(a) {
  58. return function(o) {
  59. if (i) throw new TypeError("Generator is already executing.");
  60. for (; s;) try {
  61. if (i = 1, n && (r = 2 & o[0] ? n.return : o[0] ? n.throw || ((r = n
  62. .return) && r.call(n), 0) : n.next) && !(r = r.call(n, o[1])).done)
  63. return r;
  64. switch (n = 0, r && (o = [2 & o[0], r.value]), o[0]) {
  65. case 0:
  66. case 1:
  67. r = o;
  68. break;
  69. case 4:
  70. return s.label++, {
  71. value: o[1],
  72. done: !1
  73. };
  74. case 5:
  75. s.label++, n = o[1], o = [0];
  76. continue;
  77. case 7:
  78. o = s.ops.pop(), s.trys.pop();
  79. continue;
  80. default:
  81. if (!(r = s.trys, (r = r.length > 0 && r[r.length - 1]) || 6 !== o[
  82. 0] && 2 !== o[0])) {
  83. s = 0;
  84. continue
  85. }
  86. if (3 === o[0] && (!r || o[1] > r[0] && o[1] < r[3])) {
  87. s.label = o[1];
  88. break
  89. }
  90. if (6 === o[0] && s.label < r[1]) {
  91. s.label = r[1], r = o;
  92. break
  93. }
  94. if (r && s.label < r[2]) {
  95. s.label = r[2], s.ops.push(o);
  96. break
  97. }
  98. r[2] && s.ops.pop(), s.trys.pop();
  99. continue
  100. }
  101. o = e.call(t, s)
  102. } catch (t) {
  103. o = [6, t], n = 0
  104. } finally {
  105. i = r = 0
  106. }
  107. if (5 & o[0]) throw o[1];
  108. return {
  109. value: o[0] ? o[1] : void 0,
  110. done: !0
  111. }
  112. }([o, a])
  113. }
  114. }
  115. }
  116. var r = {
  117. MP_WEIXIN: "mp-weixin",
  118. MP_QQ: "mp-qq",
  119. MP_ALIPAY: "mp-alipay",
  120. MP_BAIDU: "mp-baidu",
  121. MP_TOUTIAO: "mp-toutiao",
  122. MP_DINGDING: "mp-dingding",
  123. H5: "h5",
  124. WEB: "web",
  125. PLUS: "plus"
  126. },
  127. o = ["contentSize", "clientSize", "borderSize", "offsetSize"],
  128. s = "row",
  129. a = "column",
  130. h = "top",
  131. d = "middle",
  132. c = "bottom",
  133. l = "left",
  134. f = "center",
  135. u = "right",
  136. p = "view",
  137. g = "text",
  138. v = "image",
  139. y = "qrcode",
  140. b = "block",
  141. x = "inline-block",
  142. m = "none",
  143. w = "flex",
  144. S = "absolute",
  145. z = "fixed",
  146. M = "transparent",
  147. B = "fill",
  148. k = {
  149. display: b,
  150. color: "#000000",
  151. lineHeight: "1.4em",
  152. fontSize: 14,
  153. fontWeight: 400,
  154. fontFamily: "sans-serif",
  155. lineCap: "butt",
  156. flexDirection: s,
  157. flexWrap: "nowrap",
  158. textAlign: "left",
  159. alignItems: "flex-start",
  160. justifyContent: "flex-start",
  161. position: "static",
  162. transformOrigin: "center center"
  163. },
  164. I = {
  165. upx2px: function(t) {
  166. return window.innerWidth / 750 * t
  167. },
  168. getSystemInfoSync: function() {
  169. return {
  170. screenWidth: window.innerWidth
  171. }
  172. },
  173. getImageInfo: function(t) {
  174. var e = t.src,
  175. i = t.success,
  176. n = t.fail,
  177. r = new Image;
  178. r.onload = function() {
  179. i({
  180. width: r.naturalWidth,
  181. height: r.naturalHeight,
  182. path: r.src,
  183. src: e
  184. })
  185. }, r.onerror = n, r.src = e
  186. }
  187. },
  188. P = "object",
  189. W = "undefined",
  190. R = typeof window == P ? typeof uni == W || typeof uni !== W && !uni.addInterceptor ? r.WEB : r.H5 :
  191. typeof swan == P ? r.MP_BAIDU : typeof tt == P ? r.MP_TOUTIAO : typeof plus === P ? r.PLUS :
  192. typeof wx == P ? r.MP_WEIXIN : void 0,
  193. L = R == r.MP_WEIXIN ? wx : typeof uni != W ? uni.getImageInfo ? {
  194. upx2px: function(t) {
  195. return uni.upx2px(t)
  196. },
  197. getSystemInfoSync: function() {
  198. return uni.getSystemInfoSync()
  199. },
  200. getImageInfo: function(t) {
  201. return uni.getImageInfo(t)
  202. },
  203. downloadFile: function(t) {
  204. return uni.downloadFile(t)
  205. }
  206. } : Object.assign(uni, I) : typeof window != W ? I : uni;
  207. if (!L.upx2px) {
  208. var O = ((L.getSystemInfoSync && uni.getSystemInfoSync()).screenWidth || 375) / 750;
  209. L.upx2px = function(t) {
  210. return O * t
  211. }
  212. }
  213. function T(t) {
  214. return /^-?\d+(\.\d+)?$/.test(t)
  215. }
  216. function A(t, e, i) {
  217. if ("number" == typeof t) return t;
  218. if (T(t)) return 1 * t;
  219. if ("string" == typeof t) {
  220. var n = /^-?([0-9]+)?([.]{1}[0-9]+){0,1}(em|rpx|px|%)$/g.exec(t);
  221. if (!t || !n) return 0;
  222. var r = n[3];
  223. t = parseFloat(t);
  224. var o = 0;
  225. return "rpx" === r ? o = L.upx2px(t) : "px" === r ? o = 1 * t : "%" === r && e ? o = t * A(e) /
  226. 100 : "em" === r && e && (o = t * A(e || 14)), 1 * o.toFixed(2)
  227. }
  228. return 0
  229. }
  230. function F(t) {
  231. return /%$/.test(t)
  232. }
  233. var j = function(t) {
  234. return !(!t || !t.startsWith("linear") && !t.startsWith("radial"))
  235. },
  236. C = function(t, e, i, n, r, o) {
  237. t.startsWith("linear") ? function(t, e, i, n, r, o) {
  238. for (var s = function(t, e, i, n, r) {
  239. void 0 === n && (n = 0);
  240. void 0 === r && (r = 0);
  241. var o = t.match(/([-]?\d{1,3})deg/),
  242. s = o && o[1] ? parseFloat(o[1]) : 0;
  243. s >= 360 && (s -= 360);
  244. s < 0 && (s += 360);
  245. if (0 === (s = Math.round(s))) return {
  246. x0: Math.round(e / 2) + n,
  247. y0: i + r,
  248. x1: Math.round(e / 2) + n,
  249. y1: r
  250. };
  251. if (180 === s) return {
  252. x0: Math.round(e / 2) + n,
  253. y0: r,
  254. x1: Math.round(e / 2) + n,
  255. y1: i + r
  256. };
  257. if (90 === s) return {
  258. x0: n,
  259. y0: Math.round(i / 2) + r,
  260. x1: e + n,
  261. y1: Math.round(i / 2) + r
  262. };
  263. if (270 === s) return {
  264. x0: e + n,
  265. y0: Math.round(i / 2) + r,
  266. x1: n,
  267. y1: Math.round(i / 2) + r
  268. };
  269. var a = Math.round(180 * Math.asin(e / Math.sqrt(Math.pow(e, 2) + Math.pow(i,
  270. 2))) / Math.PI);
  271. if (s === a) return {
  272. x0: n,
  273. y0: i + r,
  274. x1: e + n,
  275. y1: r
  276. };
  277. if (s === 180 - a) return {
  278. x0: n,
  279. y0: r,
  280. x1: e + n,
  281. y1: i + r
  282. };
  283. if (s === 180 + a) return {
  284. x0: e + n,
  285. y0: r,
  286. x1: n,
  287. y1: i + r
  288. };
  289. if (s === 360 - a) return {
  290. x0: e + n,
  291. y0: i + r,
  292. x1: n,
  293. y1: r
  294. };
  295. var h = 0,
  296. d = 0,
  297. c = 0,
  298. l = 0;
  299. if (s < a || s > 180 - a && s < 180 || s > 180 && s < 180 + a || s > 360 - a) {
  300. var f = s * Math.PI / 180,
  301. u = s < a || s > 360 - a ? i / 2 : -i / 2,
  302. p = Math.tan(f) * u,
  303. g = s < a || s > 180 - a && s < 180 ? e / 2 - p : -e / 2 - p;
  304. h = -(c = p + (v = Math.pow(Math.sin(f), 2) * g)), d = -(l = u + v / Math
  305. .tan(f))
  306. }
  307. if (s > a && s < 90 || s > 90 && s < 90 + a || s > 180 + a && s < 270 || s >
  308. 270 && s < 360 - a) {
  309. var v;
  310. f = (90 - s) * Math.PI / 180, p = s > a && s < 90 || s > 90 && s < 90 + a ?
  311. e / 2 : -e / 2, u = Math.tan(f) * p, g = s > a && s < 90 || s > 270 &&
  312. s < 360 - a ? i / 2 - u : -i / 2 - u;
  313. h = -(c = p + (v = Math.pow(Math.sin(f), 2) * g) / Math.tan(f)), d = -(l =
  314. u + v)
  315. }
  316. return h = Math.round(h + e / 2) + n, d = Math.round(i / 2 - d) + r, c = Math
  317. .round(c + e / 2) + n, l = Math.round(i / 2 - l) + r, {
  318. x0: h,
  319. y0: d,
  320. x1: c,
  321. y1: l
  322. }
  323. }(r, t, e, i, n), a = s.x0, h = s.y0, d = s.x1, c = s.y1, l = o
  324. .createLinearGradient(a, h, d, c), f = r.match(/linear-gradient\((.+)\)/)[1], u = E(
  325. f.substring(f.indexOf(",") + 1)), p = 0; p < u.colors.length; p++) l
  326. .addColorStop(u.percents[p], u.colors[p]);
  327. o.setFillStyle(l)
  328. }(e, i, n, r, t, o) : t.startsWith("radial") && function(t, e, i, n, r, o) {
  329. for (var s = E(r.match(/radial-gradient\((.+)\)/)[1]), a = Math.round(t / 2) + i, h = Math
  330. .round(e / 2) + n, d = o.createRadialGradient(a, h, 0, a, h, Math.max(t, e) / 2),
  331. c = 0; c < s.colors.length; c++) d.addColorStop(s.percents[c], s.colors[c]);
  332. o.setFillStyle(d)
  333. }(e, i, n, r, t, o)
  334. };
  335. function E(t) {
  336. for (var e = [], i = [], n = 0, r = t.substring(0, t.length - 1).split("%,"); n < r.length; n++) {
  337. var o = r[n];
  338. e.push(o.substring(0, o.lastIndexOf(" ")).trim()), i.push(o.substring(o.lastIndexOf(" "), o
  339. .length) / 100)
  340. }
  341. return {
  342. colors: e,
  343. percents: i
  344. }
  345. }
  346. function H(t, e, i) {
  347. return e in t ? Object.defineProperty(t, e, {
  348. value: i,
  349. enumerable: !0,
  350. configurable: !0,
  351. writable: !0
  352. }) : t[e] = i, t
  353. }
  354. function U() {
  355. return U = Object.assign ? Object.assign.bind() : function(t) {
  356. for (var e = 1; e < arguments.length; e++) {
  357. var i = arguments[e];
  358. for (var n in i) Object.prototype.hasOwnProperty.call(i, n) && (t[n] = i[n])
  359. }
  360. return t
  361. }, U.apply(this, arguments)
  362. }
  363. function Y(t, e) {
  364. return Y = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
  365. return t.__proto__ = e, t
  366. }, Y(t, e)
  367. }
  368. function $(t, e) {
  369. (null == e || e > t.length) && (e = t.length);
  370. for (var i = 0, n = new Array(e); i < e; i++) n[i] = t[i];
  371. return n
  372. }
  373. function D(t, e) {
  374. var i = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
  375. if (i) return (i = i.call(t)).next.bind(i);
  376. if (Array.isArray(t) || (i = function(t, e) {
  377. if (t) {
  378. if ("string" == typeof t) return $(t, e);
  379. var i = Object.prototype.toString.call(t).slice(8, -1);
  380. return "Object" === i && t.constructor && (i = t.constructor.name), "Map" === i ||
  381. "Set" === i ? Array.from(t) : "Arguments" === i ||
  382. /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i) ? $(t, e) : void 0
  383. }
  384. }(t)) || e && t && "number" == typeof t.length) {
  385. i && (t = i);
  386. var n = 0;
  387. return function() {
  388. return n >= t.length ? {
  389. done: !0
  390. } : {
  391. done: !1,
  392. value: t[n++]
  393. }
  394. }
  395. }
  396. throw new TypeError(
  397. "Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."
  398. )
  399. }
  400. function _(t) {
  401. return "number" == typeof t
  402. }
  403. function X(t) {
  404. return "auto" === t || null === t
  405. }
  406. function N(t) {
  407. return /%$/.test(t)
  408. }
  409. var V, G = 0,
  410. q = function() {
  411. function t() {
  412. H(this, "elements", []), H(this, "afterElements", []), H(this, "beforeElements", []), H(this,
  413. "ids", []), H(this, "width", 0), H(this, "height", 0), H(this, "top", 0), H(this,
  414. "left", 0), H(this, "pre", null), H(this, "offsetX", 0), H(this, "offsetY", 0), G++,
  415. this.id = G
  416. }
  417. var e = t.prototype;
  418. return e.fixedBind = function(t, e) {
  419. void 0 === e && (e = 0), this.container = e ? t.parent : t.root, this.container.fixedLine =
  420. this, this.fixedAdd(t)
  421. }, e.fixedAdd = function(t) {
  422. this.elements.push(t);
  423. var e = t.computedStyle.zIndex;
  424. (void 0 === e ? 0 : e) >= 0 ? this.afterElements.push(t) : this.beforeElements.push(t), this
  425. .refreshLayout()
  426. }, e.bind = function(t) {
  427. this.container = t.parent, this.container.line = null, this.container.lines ? (this
  428. .container.lines.push(this), this.pre = this.getPreLine(), this.top = this.pre.top +
  429. this.pre.height, this.left = this.container.contentSize.left) : (this.top = this
  430. .container.contentSize.top, this.left = this.container.contentSize.left, this
  431. .container.lines = [this]), this.isInline = t.isInline(), this.container.line =
  432. this, this.outerWidth = t.parent && t.parent.contentSize.width ? t.parent.contentSize
  433. .width : 1 / 0, this.add(t)
  434. }, e.getPreLine = function() {
  435. return this.container.lines[this.container.lines.length - 2]
  436. }, e.canIEnter = function(t) {
  437. return this.outerWidth || t.parent && t.parent.contentSize.width, !((100 * t.offsetSize
  438. .width + 100 * this.width) / 100 > this.outerWidth) || (this.closeLine(), !1)
  439. }, e.closeLine = function() {
  440. delete this.container.line
  441. }, e.add = function(t) {
  442. this.ids.includes(t.id) || (this.ids.push(t.id), this.elements.push(t), this
  443. .refreshWidthHeight(t))
  444. }, e.refreshWidthHeight = function(t) {
  445. t.offsetSize.height > this.height && (this.height = t.offsetSize.height), this.width += t
  446. .offsetSize.width || 0, (this.container.lineMaxWidth || 0) < this.width && (this
  447. .container.lineMaxWidth = this.width)
  448. }, e.refreshXAlign = function() {
  449. if (this.isInline) {
  450. var t = this.container.contentSize.width - this.width,
  451. e = this.container.style.textAlign;
  452. "center" === e ? t /= 2 : "left" === e && (t = 0), this.offsetX = t
  453. }
  454. }, e.getOffsetY = function(t) {
  455. if (!t || !t.style) return 0;
  456. var e = (t.style || {}).verticalAlign;
  457. return "bottom" === e ? this.height - t.contentSize.height : "middle" === e ? (this.height -
  458. t.contentSize.height) / 2 : 0
  459. }, e.layout = function(t, e) {
  460. for (var i in this.refreshXAlign(), this.pre ? (this.top = this.pre.top + this.pre.height +
  461. this.offsetY, this.left = e + this.offsetX) : (this.top = Math.max(this.top,
  462. this.container.contentSize.top, t) + this.offsetY, this.left = Math.max(this
  463. .left, this.container.contentSize.left, e) + this.offsetX), this.elements) {
  464. var n = this.elements[i],
  465. r = this.elements[i - 1],
  466. o = this.getOffsetY(n);
  467. n.style.top = this.top + o, n.style.left = r ? r.offsetSize.left + r.offsetSize.width :
  468. this.left, n.getBoxPosition2()
  469. }
  470. }, e.refreshLayout = function() {
  471. this.afterElements = this.afterElements.sort((function(t, e) {
  472. return t.computedStyle.zIndex - e.computedStyle.zIndex
  473. })), this.beforeElements = this.beforeElements.sort((function(t, e) {
  474. return t.computedStyle.zIndex - e.computedStyle.zIndex
  475. }))
  476. }, t
  477. }(),
  478. J = ((V = {})[s] = {
  479. width: "width",
  480. contentWidth: "width",
  481. x: "x",
  482. y: "y",
  483. contentX: "left",
  484. height: "height",
  485. contentHeight: "height",
  486. marginLeft: "marginLeft"
  487. }, V[a] = {
  488. width: "height",
  489. contentWidth: "height",
  490. x: "y",
  491. y: "x",
  492. contentX: "top",
  493. height: "width",
  494. contentHeight: "width",
  495. marginLeft: "marginTop"
  496. }, V),
  497. Q = function(t) {
  498. var e, i;
  499. function n() {
  500. var e;
  501. return H(function(t) {
  502. if (void 0 === t) throw new ReferenceError(
  503. "this hasn't been initialised - super() hasn't been called");
  504. return t
  505. }(e = t.call(this) || this), "outerWidth", 0), e.exactValue = 0, e.flexTotal = 0, e.key =
  506. null, e
  507. }
  508. i = t, (e = n).prototype = Object.create(i.prototype), e.prototype.constructor = e, Y(e, i);
  509. var r = n.prototype;
  510. return r.bind = function(t) {
  511. console.warn("[painter] flex-box 功能未完善谨慎使用"), this.container = t.parent, this.container
  512. .line = this, this.container.lines ? (this.container.lines.push(this), this.pre = this
  513. .getPreLine(), this.top = this.pre.top + this.pre.height, this.left = this.container
  514. .contentSize.left) : (this.top = this.container.contentSize.top, this.left = this
  515. .container.contentSize.left, this.container.lines = [this]), t.parent && (this.key =
  516. J[t.parent.style.flexDirection]), this.initHeight(t), this.outerWidth = t.parent &&
  517. t.parent.contentSize[this.key.contentWidth] ? t.parent.contentSize[this.key
  518. .contentWidth] : 1 / 0, this.add(t)
  519. }, r.add = function(t) {
  520. this.ids.push(t.id), _(t.style.flex) ? this.flexTotal += t.style.flex : _(t.style[this.key
  521. .width]) && (this.exactValue += t.contentSize[this.key.width]), this.elements.push(
  522. t), this.refreshWidthHeight(t), t.next || this.closeLine()
  523. }, r.closeLine = function() {
  524. this.calcFlex()
  525. }, r.initHeight = function(t) {
  526. this[this.key.height] = 0
  527. }, r.calcFlex = function() {
  528. var t = this,
  529. e = this.container.contentSize[this.key.contentWidth];
  530. this.elements.forEach((function(i) {
  531. var n = i.style.width || 0;
  532. _(i.style.flex) && (n = i.style.flex / t.flexTotal * (e - t.exactValue)), i
  533. .computedStyle[t.key.width] = n, delete i.line, delete i.lines, delete i
  534. .lineMaxWidth, i.getBoxWidthHeight()
  535. }))
  536. }, r.refreshWidthHeight = function(t) {
  537. this.container.style.alignItems && !t.style.alignSelf && (t.style.alignSelf = this.container
  538. .style.alignItems), t.contentSize[this.key.height] > this[this.key.height] && (this[
  539. this.key.height] = t.offsetSize[this.key.height]), this[this.key.width] += t
  540. .offsetSize[this.key.width];
  541. var e = Math.min(this[this.key.width], this.container.contentSize[this.key.width]);
  542. (this.container.lineMaxWidth || 0) < e && (this.container.lineMaxWidth = e)
  543. }, r.refreshXAlign = function() {
  544. var t = this,
  545. e = this.elements.reduce((function(e, i) {
  546. return e + i.offsetSize[t.key.width]
  547. }), 0),
  548. i = this.outerWidth == 1 / 0 ? 0 : this.outerWidth - Math.max(this[this.key.width], e),
  549. n = this.container.style.justifyContent;
  550. "center" === n ? i /= 2 : "flex-start" === n ? i = 0 : ["space-between", "space-around"]
  551. .includes(n) && (! function(e, i) {
  552. void 0 === i && (i = 0), i /= t.elements.length + (e ? -1 : 1), t.elements
  553. .forEach((function(n, r) {
  554. var o;
  555. e && !r || (n.style.margin ? n.style.margin[t.key.marginLeft] +=
  556. i : n.style.margin = ((o = {})[t.key.marginLeft] = i, o)
  557. )
  558. })), i = 0
  559. }("space-between" == n, i), i = 0), this.offsetX = i || 0, this.refreshYAlign()
  560. }, r.refreshYAlign = function() {
  561. if (1 == this.container.lines.length) return 0;
  562. var t = this.container.lines.reduce((function(t, e) {
  563. return t + e.height
  564. }), 0);
  565. if ("center" === this.container.style.alignItems) {
  566. var e = (this.container.contentSize[this.key.contentHeight] - t) / (this.container.lines
  567. .length + 1);
  568. this.container.lines.forEach((function(t) {
  569. t.offsetY = e
  570. }))
  571. }
  572. if ("flex-end" === this.container.style.alignItems) {
  573. var i = this.container.contentSize[this.key.contentHeight] - t;
  574. this.container.lines[0].offsetY = i
  575. }
  576. }, r.getOffsetY = function(t) {
  577. return this.container.lines.length > 1 ? 0 : "flex-end" === t.style.alignSelf ? this
  578. .container.contentSize[this.key.contentHeight] - t.contentSize[this.key.height] :
  579. "center" === t.style.alignSelf ? (this.container.contentSize[this.key.contentHeight] - t
  580. .contentSize[this.key.height]) / 2 : 0
  581. }, n
  582. }(q),
  583. Z = v,
  584. K = g,
  585. et = p,
  586. it = y,
  587. nt = b,
  588. rt = x,
  589. ot = w,
  590. st = S,
  591. at = z,
  592. ht = 0,
  593. dt = {
  594. left: null,
  595. top: null,
  596. width: null,
  597. height: null
  598. },
  599. ct = function() {
  600. function t(t, e, i, n) {
  601. var r = this;
  602. H(this, "id", ht++), H(this, "style", {
  603. left: null,
  604. top: null,
  605. width: null,
  606. height: null
  607. }), H(this, "computedStyle", {}), H(this, "originStyle", {}), H(this, "children", {}), H(
  608. this, "layoutBox", U({}, dt)), H(this, "contentSize", U({}, dt)), H(this, "clientSize",
  609. U({}, dt)), H(this, "borderSize", U({}, dt)), H(this, "offsetSize", U({}, dt)), this
  610. .ctx = n, this.root = i, e && (this.parent = e), this.name = t.name || t.type, this
  611. .attributes = this.getAttributes(t);
  612. var o = this.getComputedStyle(t, e && e.computedStyle);
  613. this.isAbsolute = o.position == st, this.isFixed = o.position == at, this.originStyle = o,
  614. Object.keys(o).forEach((function(t) {
  615. Object.defineProperty(r.style, t, {
  616. configurable: !0,
  617. enumerable: !0,
  618. get: function() {
  619. return o[t]
  620. },
  621. set: function(e) {
  622. o[t] = e
  623. }
  624. })
  625. }));
  626. var s = {
  627. contentSize: U({}, this.contentSize),
  628. clientSize: U({}, this.clientSize),
  629. borderSize: U({}, this.borderSize),
  630. offsetSize: U({}, this.offsetSize)
  631. };
  632. Object.keys(s).forEach((function(t) {
  633. Object.keys(r[t]).forEach((function(e) {
  634. Object.defineProperty(r[t], e, {
  635. configurable: !0,
  636. enumerable: !0,
  637. get: function() {
  638. return s[t][e]
  639. },
  640. set: function(i) {
  641. s[t][e] = i
  642. }
  643. })
  644. }))
  645. })), this.computedStyle = this.style
  646. }
  647. var e = t.prototype;
  648. return e.add = function(t) {
  649. t.parent = this, this.children[t.id] = t
  650. }, e.getChildren = function() {
  651. var t = this;
  652. return Object.keys(this.children).map((function(e) {
  653. return t.children[e]
  654. }))
  655. }, e.getLineRect = function(t, e) {
  656. var i = {
  657. width: 0,
  658. height: 0
  659. },
  660. n = e ? e.lines : this.parent && this.parent.lines;
  661. return n && n.find((function(e) {
  662. return e.ids.includes(t)
  663. })) || i
  664. }, e.getComputedStyle = function(t, e) {
  665. var i = ["color", "fontSize", "lineHeight", "verticalAlign", "fontWeight", "textAlign"],
  666. n = t.css,
  667. r = void 0 === n ? {} : n,
  668. o = t.type,
  669. s = void 0 === o ? et : o,
  670. a = U({}, k);
  671. if ([K, Z, it].includes(s) && !r.display && (a.display = rt), e)
  672. for (var h = 0; h < i.length; h++) {
  673. var d = i[h];
  674. (r[d] || e[d]) && (r[d] = r[d] || e[d])
  675. }
  676. for (var c = function() {
  677. var t = f[l],
  678. e = r[t];
  679. if (/-/.test(t) && (t = t.replace(/-([a-z])/g, (function(t, e) {
  680. return e.toUpperCase()
  681. })), a.key = e), /^(box|text)?shadow$/i.test(t)) {
  682. var i = [];
  683. return e.replace(/((\d+(rpx|px)?\s+?){3})(.+)/, (function() {
  684. for (var t = arguments.length, e = new Array(t), n = 0; n <
  685. t; n++) e[n] = arguments[n];
  686. i = e[1].match(/\d+(rpx|px)?/g).map((function(t) {
  687. return A(t)
  688. })).concat(e[4])
  689. })), /^text/.test(t) ? a.textShadow = i : a.boxShadow = i, "continue"
  690. }
  691. if (/^border/i.test(t) && !/radius$/i.test(t)) {
  692. var n, o = t.match(/^border([BTRLa-z]+)?/)[0],
  693. h = t.match(/[W|S|C][a-z]+/),
  694. d = e.replace(/([\(,])\s+|\s+([\),])/g, "$1$2").split(" ").map((
  695. function(t) {
  696. return /^\d/.test(t) ? A(t, "") : t
  697. }));
  698. return a[o] = ((n = {})[o + "Width"] = T(d[0]) ? d[0] : 0, n[o + "Style"] =
  699. d[1] || "solid", n[o + "Color"] = d[2] || "black", n), 1 == d
  700. .length && h && (a[o][o + h[0]] = d[0]), "continue"
  701. }
  702. if (/^background(color)?$/i.test(t)) return a.backgroundColor = e, "continue";
  703. if (/^objectPosition$/i.test(t)) return a[t] = e.split(" "), "continue";
  704. if (/padding|margin|radius/i.test(t)) {
  705. var c = /radius$/i.test(t),
  706. u = c ? "borderRadius" : t.match(/[a-z]+/)[0],
  707. p = [0, 0, 0, 0].map((function(t, e) {
  708. return c ? ["borderTopLeftRadius", "borderTopRightRadius",
  709. "borderBottomRightRadius", "borderBottomLeftRadius"
  710. ][e] : [u + "Top", u + "Right", u + "Bottom", u +
  711. "Left"][e]
  712. })),
  713. g = "margin";
  714. if ("padding" === t || t === g || /^(border)?radius$/i.test(t)) {
  715. var v, y = ("" + e).split(" ").map((function(e) {
  716. return /^\d+(rpx|px)?$/.test(e) ? A(e) : t != g &&
  717. /auto/.test(e) ? 0 : e
  718. }), []) || [0],
  719. b = c ? "borderRadius" : t,
  720. x = y[0],
  721. m = y[1],
  722. w = y[2],
  723. S = y[3];
  724. a[b] = ((v = {})[p[0]] = X(x) ? 0 : x, v[p[1]] = T(m) || X(m) ? m : x,
  725. v[p[2]] = X(T(w) ? w : x) ? 0 : T(w) ? w : x, v[p[3]] = T(S) ?
  726. S : m || x, v)
  727. } else {
  728. var z;
  729. if ("object" == typeof a[u]) a[u][t] = u == g && X(e) || N(e) ? e : A(
  730. e);
  731. else a[u] = ((z = {})[p[0]] = a[u] || 0, z[p[1]] = a[u] || 0, z[p[2]] =
  732. a[u] || 0, z[p[3]] = a[u] || 0, z), a[u][t] = u == g && X(e) ||
  733. N(e) ? e : A(e)
  734. }
  735. return "continue"
  736. }
  737. if (/^transform$/i.test(t)) return a[t] = {}, e.replace(
  738. /([a-zA-Z]+)\(([0-9,-\.%rpxdeg\s]+)\)/g, (function(e, i, n) {
  739. var o = n.split(",").map((function(t) {
  740. return t.replace(/(^\s*)|(\s*$)/g, "")
  741. })),
  742. s = function(t, e) {
  743. return t.includes("deg") ? 1 * t : e && !N(e) ? A(t,
  744. e) : t
  745. };
  746. i.includes("matrix") ? a[t][i] = o.map((function(t) {
  747. return 1 * t
  748. })) : i.includes("rotate") ? a[t][i] = 1 * n.match(
  749. /^-?\d+(\.\d+)?/)[0] : /[X, Y]/.test(i) ? a[t][i] =
  750. /[X]/.test(i) ? s(o[0], r.width) : s(o[0], r.height) : (
  751. a[t][i + "X"] = s(o[0], r.width), a[t][i + "Y"] = s(
  752. o[1] || o[0], r.height))
  753. })), "continue";
  754. /^font$/i.test(t) && console.warn("font 不支持简写"), /^left|top$/i.test(t) && ![st,
  755. at
  756. ].includes(r.position) ? a[t] = 0 : a[t] = /^[\d\.]+(px|rpx)?$/.test(e) ? A(
  757. e) : /em$/.test(e) && s == K ? A(e, r.fontSize) : e
  758. }, l = 0, f = Object.keys(r); l < f.length; l++) c();
  759. return a
  760. }, e.setPosition = function(t, e) {
  761. var i = {
  762. left: "width",
  763. top: "height",
  764. right: "width",
  765. bottom: "height"
  766. };
  767. Object.keys(i).forEach((function(n) {
  768. var r = "right" == n ? "left" : "top";
  769. ["right", "bottom"].includes(n) && void 0 !== t.style[n] && "number" !=
  770. typeof t.originStyle[r] ? t.style[r] = e[i[n]] - t.offsetSize[i[n]] - A(
  771. t.style[n], e[i[n]]) : t.style[n] = A(t.style[n], e[i[n]])
  772. }))
  773. }, e.getAttributes = function(t) {
  774. var e = t.attributes || {};
  775. return (t.url || t.src) && (e.src = e.src || t.url || t.src), t.replace && (e.replace = t
  776. .replace), t.text && (e.text = t.text), e
  777. }, e.getOffsetSize = function(t, e, i) {
  778. void 0 === i && (i = o[3]);
  779. var n = e || {},
  780. r = n.margin,
  781. s = (r = void 0 === r ? {} : r).marginLeft,
  782. a = void 0 === s ? 0 : s,
  783. h = r.marginTop,
  784. d = void 0 === h ? 0 : h,
  785. c = r.marginRight,
  786. l = void 0 === c ? 0 : c,
  787. f = r.marginBottom,
  788. u = void 0 === f ? 0 : f,
  789. p = n.padding,
  790. g = (p = void 0 === p ? {} : p).paddingLeft,
  791. v = void 0 === g ? 0 : g,
  792. y = p.paddingTop,
  793. b = void 0 === y ? 0 : y,
  794. x = p.paddingRight,
  795. m = void 0 === x ? 0 : x,
  796. w = p.paddingBottom,
  797. S = void 0 === w ? 0 : w,
  798. z = n.border,
  799. M = (z = void 0 === z ? {} : z).borderWidth,
  800. B = void 0 === M ? 0 : M,
  801. k = n.borderTop,
  802. I = (k = void 0 === k ? {} : k).borderTopWidth,
  803. P = void 0 === I ? B : I,
  804. W = n.borderBottom,
  805. R = (W = void 0 === W ? {} : W).borderBottomWidth,
  806. L = void 0 === R ? B : R,
  807. O = n.borderRight,
  808. T = (O = void 0 === O ? {} : O).borderRightWidth,
  809. A = void 0 === T ? B : T,
  810. F = n.borderLeft,
  811. j = (F = void 0 === F ? {} : F).borderLeftWidth,
  812. C = void 0 === j ? B : j,
  813. E = a < 0 && l < 0 ? Math.abs(a + l) : 0,
  814. H = d < 0 && u < 0 ? Math.abs(d + u) : 0,
  815. U = a >= 0 && l < 0,
  816. Y = d >= 0 && u < 0;
  817. return i == o[0] && (this[i].left = t.left + a + v + C + (U ? 2 * -l : 0), this[i].top = t
  818. .top + d + b + P + (Y ? 2 * -u : 0), this[i].width = t.width + (this[i].widthAdd ?
  819. 0 : E), this[i].height = t.height + (this[i].heightAdd ? 0 : H), this[i]
  820. .widthAdd = E, this[i].heightAdd = H), i == o[1] && (this[i].left = t.left + a + C +
  821. (U < 0 ? -l : 0), this[i].top = t.top + d + P + (Y ? -u : 0), this[i].width = t
  822. .width + v + m, this[i].height = t.height + b + S), i == o[2] && (this[i].left = t
  823. .left + a + C / 2 + (U < 0 ? -l : 0), this[i].top = t.top + d + P / 2 + (Y ? -u :
  824. 0), this[i].width = t.width + v + m + C / 2 + A / 2, this[i].height = t.height + b +
  825. S + L / 2 + P / 2), i == o[3] && (this[i].left = t.left + (U < 0 ? -l : 0), this[i]
  826. .top = t.top + (Y ? -u : 0), this[i].width = t.width + v + m + C + A + a + l, this[
  827. i].height = t.height + b + S + L + P + u + d), this[i]
  828. }, e.layoutBoxUpdate = function(t, e, i, n) {
  829. var r = this;
  830. if (void 0 === i && (i = -1), "border-box" == e.boxSizing) {
  831. var s = e || {},
  832. a = s.border,
  833. h = (a = void 0 === a ? {} : a).borderWidth,
  834. d = void 0 === h ? 0 : h,
  835. c = s.borderTop,
  836. l = (c = void 0 === c ? {} : c).borderTopWidth,
  837. f = void 0 === l ? d : l,
  838. u = s.borderBottom,
  839. p = (u = void 0 === u ? {} : u).borderBottomWidth,
  840. g = void 0 === p ? d : p,
  841. v = s.borderRight,
  842. y = (v = void 0 === v ? {} : v).borderRightWidth,
  843. b = void 0 === y ? d : y,
  844. x = s.borderLeft,
  845. m = (x = void 0 === x ? {} : x).borderLeftWidth,
  846. w = void 0 === m ? d : m,
  847. S = s.padding,
  848. z = (S = void 0 === S ? {} : S).paddingTop,
  849. M = void 0 === z ? 0 : z,
  850. B = S.paddingRight,
  851. k = void 0 === B ? 0 : B,
  852. I = S.paddingBottom,
  853. P = void 0 === I ? 0 : I,
  854. W = S.paddingLeft,
  855. R = void 0 === W ? 0 : W;
  856. i || (t.width -= R + k + b + w), 1 !== i || n || (t.height -= M + P + f + g)
  857. }
  858. this.layoutBox && (o.forEach((function(i) {
  859. return r.layoutBox[i] = r.getOffsetSize(t, e, i)
  860. })), this.layoutBox = Object.assign({}, this.layoutBox, this.layoutBox.borderSize))
  861. }, e.getBoxPosition2 = function() {
  862. var t = this.computedStyle,
  863. e = this.fixedLine,
  864. i = this.lines,
  865. n = t.left,
  866. r = void 0 === n ? 0 : n,
  867. o = t.top,
  868. s = void 0 === o ? 0 : o,
  869. a = t.padding || {},
  870. h = a.paddingBottom,
  871. d = void 0 === h ? 0 : h,
  872. c = a.paddingRight,
  873. l = void 0 === c ? 0 : c,
  874. f = U({}, this.contentSize, {
  875. left: r,
  876. top: s
  877. }),
  878. u = this.contentSize.top - this.offsetSize.top,
  879. p = this.contentSize.left - this.offsetSize.left;
  880. if (this.root.fixedLine && !this.root.isDone) {
  881. this.root.isDone = !0;
  882. for (var g, v = D(this.root.fixedLine.elements); !(g = v()).done;) {
  883. var y = g.value;
  884. y.setPosition(y, this.root.offsetSize), y.getBoxPosition2()
  885. }
  886. }
  887. if (e)
  888. for (var b, x = D(e.elements); !(b = x()).done;) {
  889. var m = b.value;
  890. m.setPosition(m, f), m.style.left += r + p + l, m.style.top += s + u + d, m
  891. .getBoxPosition2()
  892. }
  893. if (i)
  894. for (var w, S = D(i); !(w = S()).done;) {
  895. w.value.layout(f.top + u, f.left + p)
  896. }
  897. return this.layoutBoxUpdate(f, t), this.layoutBox
  898. }, e.getBoxState = function(t, e) {
  899. return this.isBlock(t) || this.isBlock(e)
  900. }, e.isBlock = function(t) {
  901. return void 0 === t && (t = this), t && t.style.display == nt
  902. }, e.isFlex = function(t) {
  903. return void 0 === t && (t = this), t && t.style.display == ot
  904. }, e.isInFlow = function() {
  905. return !(this.isAbsolute || this.isFixed)
  906. }, e.inFlexBox = function(t) {
  907. return void 0 === t && (t = this), !!t.isInFlow() && (!!t.parent && (!(!t.parent || t.parent
  908. .style.display !== ot) || void 0))
  909. }, e.isInline = function(t) {
  910. return void 0 === t && (t = this), t && t.style.display == rt
  911. }, e.contrastSize = function(t, e, i) {
  912. var n = t;
  913. return i && (n = Math.min(n, i)), e && (n = Math.max(n, e)), n
  914. }, e.measureText = function(t, e) {
  915. var i = this.ctx.measureText(t),
  916. n = i.width,
  917. r = i.actualBoundingBoxAscent,
  918. o = i.actualBoundingBoxDescent;
  919. return {
  920. ascent: r,
  921. descent: o,
  922. width: n,
  923. fontHeight: r + o || .7 * e + 1
  924. }
  925. }, e.getBoxWidthHeight = function() {
  926. var t = this,
  927. e = this.name,
  928. i = this.computedStyle,
  929. n = this.attributes,
  930. r = this.parent,
  931. o = void 0 === r ? {} : r,
  932. s = this.ctx,
  933. a = this.getChildren(),
  934. h = i.left,
  935. d = void 0 === h ? 0 : h,
  936. c = i.top,
  937. l = void 0 === c ? 0 : c,
  938. f = i.bottom,
  939. u = i.right,
  940. p = i.width,
  941. g = void 0 === p ? 0 : p,
  942. v = i.minWidth,
  943. y = i.maxWidth,
  944. b = i.minHeight,
  945. x = i.maxHeight,
  946. m = i.height,
  947. w = void 0 === m ? 0 : m,
  948. S = i.fontSize,
  949. z = void 0 === S ? 14 : S,
  950. M = i.fontWeight,
  951. B = i.fontFamily,
  952. k = i.fontStyle,
  953. I = i.position,
  954. P = i.lineClamp,
  955. W = i.lineHeight,
  956. R = i.padding,
  957. L = void 0 === R ? {} : R,
  958. O = i.margin,
  959. T = void 0 === O ? {} : O,
  960. F = i.border,
  961. j = (F = void 0 === F ? {} : F).borderWidth,
  962. C = void 0 === j ? 0 : j,
  963. E = i.borderRight,
  964. H = (E = void 0 === E ? {} : E).borderRightWidth,
  965. U = void 0 === H ? C : H,
  966. Y = i.borderLeft,
  967. $ = (Y = void 0 === Y ? {} : Y).borderLeftWidth,
  968. D = void 0 === $ ? C : $,
  969. _ = o.contentSize && o.contentSize.width,
  970. X = o.contentSize && o.contentSize.height;
  971. if (N(g) && _ && (g = A(g, _)), N(g) && !_ && (g = null), N(w) && X && (w = A(w, X)), N(
  972. w) && !X && (w = null), N(v) && _ && (v = A(v, _)), N(y) && _ && (y = A(y, _)), N(b) &&
  973. X && (b = A(b, X)), N(x) && X && (x = A(x, X)), i.padding && _)
  974. for (var V in i.padding) Object.hasOwnProperty.call(i.padding, V) && (i.padding[V] = A(i
  975. .padding[V], _));
  976. var G = L.paddingRight,
  977. J = void 0 === G ? 0 : G,
  978. tt = L.paddingLeft,
  979. it = void 0 === tt ? 0 : tt;
  980. if (i.margin && [i.margin.marginLeft, i.margin.marginRight].includes("auto"))
  981. if (g) {
  982. var nt = _ && _ - g - J - it - D - U || 0;
  983. i.margin.marginLeft == i.margin.marginRight ? i.margin.marginLeft = i.margin
  984. .marginRight = nt / 2 : "auto" == i.margin.marginLeft ? i.margin.marginLeft =
  985. nt : i.margin.marginRight = nt
  986. } else i.margin.marginLeft = i.margin.marginRight = 0;
  987. var rt = T.marginRight,
  988. ot = void 0 === rt ? 0 : rt,
  989. at = T.marginLeft,
  990. ht = {
  991. width: g,
  992. height: w,
  993. left: 0,
  994. top: 0
  995. },
  996. dt = it + J + D + U + (void 0 === at ? 0 : at) + ot;
  997. if (e == K && !this.attributes.widths) {
  998. var ct = n.text || "";
  999. s.save(), s.setFonts({
  1000. fontFamily: B,
  1001. fontSize: z,
  1002. fontWeight: M,
  1003. fontStyle: k
  1004. });
  1005. var lt = new Map;
  1006. ct.split("\n").map((function(e) {
  1007. var i = e.split("").map((function(e) {
  1008. var i = lt.get(e);
  1009. if (i) return i;
  1010. var n = t.measureText(e, z).width;
  1011. return lt.set(e, n), n
  1012. })),
  1013. n = t.measureText(e, z),
  1014. r = n.fontHeight,
  1015. o = n.ascent,
  1016. s = n.descent;
  1017. t.attributes.fontHeight = r, t.attributes.ascent = o, t.attributes
  1018. .descent = s, t.attributes.widths || (t.attributes.widths = []), t
  1019. .attributes.widths.push({
  1020. widths: i,
  1021. total: i.reduce((function(t, e) {
  1022. return t + e
  1023. }), 0)
  1024. })
  1025. })), s.restore()
  1026. }
  1027. if (e == Z && null == g) {
  1028. var ft = n.width,
  1029. ut = n.height;
  1030. ht.width = this.contrastSize(Math.round(ft * w / ut) || 0, v, y), this.layoutBoxUpdate(
  1031. ht, i, 0)
  1032. }
  1033. if (e == K && null == g) {
  1034. var pt = this.attributes.widths,
  1035. gt = Math.max.apply(Math, pt.map((function(t) {
  1036. return t.total
  1037. })));
  1038. if (o && _ > 0 && (gt > _ || this.isBlock(this)) && !this.isAbsolute && !this.isFixed)
  1039. gt = _ - dt;
  1040. ht.width = this.contrastSize(gt, v, y), this.layoutBoxUpdate(ht, i, 0)
  1041. }
  1042. if (e == K && (o.style.flex || !this.attributes.lines)) {
  1043. var vt = this.attributes.widths.length;
  1044. this.attributes.widths.forEach((function(t) {
  1045. return t.widths.reduce((function(t, e, i) {
  1046. return t + e > ht.width ? (vt++, e) : t + e
  1047. }), 0)
  1048. })), vt = P && vt > P ? P : vt, this.attributes.lines = vt
  1049. }
  1050. if (e == Z && null == w) {
  1051. var yt = n.width,
  1052. bt = n.height;
  1053. ht.height = this.contrastSize(A(ht.width * bt / yt) || 0, b, x), this.layoutBoxUpdate(
  1054. ht, i, 1)
  1055. }
  1056. e == K && null == w && (W = A(W, z), ht.height = this.contrastSize(A(this.attributes.lines *
  1057. W), b, x), this.layoutBoxUpdate(ht, i, 1, !0)), o && o.children && _ && ([et, K]
  1058. .includes(e) && this.isFlex() || e == et && this.isBlock(this) && this.isInFlow()
  1059. ) && (ht.width = this.contrastSize(_ - dt, v, y), this.layoutBoxUpdate(ht, i)), g &&
  1060. !N(g) && (ht.width = this.contrastSize(g, v, y), this.layoutBoxUpdate(ht, i, 0)), w && !
  1061. N(w) && (ht.height = this.contrastSize(ht.height, b, x), this.layoutBoxUpdate(ht, i,
  1062. 1));
  1063. var xt = 0;
  1064. if (a.length) {
  1065. var mt = null;
  1066. a.forEach((function(e, n) {
  1067. e.getBoxWidthHeight();
  1068. var r = a[n + 1];
  1069. if (r && r.isInFlow() && (e.next = r), e.isInFlow() && !e.inFlexBox()) {
  1070. var o = t.getBoxState(mt, e);
  1071. t.line && t.line.canIEnter(e) && !o ? t.line.add(e) : (new q).bind(
  1072. e), mt = e
  1073. } else e.inFlexBox() ? t.line && (t.line.canIEnter(e) || "nowrap" == i
  1074. .flexWrap) ? t.line.add(e) : (new Q).bind(e) : e.isFixed ? t
  1075. .root.fixedLine ? t.root.fixedLine.fixedAdd(e) : (new q).fixedBind(
  1076. e) : t.fixedLine ? t.fixedLine.fixedAdd(e) : (new q).fixedBind(
  1077. e, 1)
  1078. })), this.lines && (xt = this.lines.reduce((function(t, e) {
  1079. return t + e.height
  1080. }), 0))
  1081. }
  1082. var wt = 0,
  1083. St = 0;
  1084. if (!g && (this.isAbsolute || this.isFixed) && _) {
  1085. var zt = I == st ? _ : this.root.width,
  1086. Mt = zt - (N(d) ? A(d, zt) : d) - (N(u) ? A(u, zt) : u);
  1087. wt = i.left ? Mt : this.lineMaxWidth
  1088. }
  1089. if (!w && (null != l ? l : this.isAbsolute || this.isFixed && X)) {
  1090. var Bt = I == st ? X : this.root.height,
  1091. kt = Bt - (N(l) ? A(l, Bt) : l) - (N(f) ? A(f, Bt) : f);
  1092. St = i.top ? kt : 0
  1093. }
  1094. if (g && !N(g) || ht.width || (ht.width = wt || this.contrastSize((this.isBlock(this) && !
  1095. this.isInFlow() ? _ || o.lineMaxWidth : this.lineMaxWidth) || this
  1096. .lineMaxWidth, v, y), this.layoutBoxUpdate(ht, i, 0)), w || !xt && !St || (ht
  1097. .height = St || this.contrastSize(xt, b, x), this.layoutBoxUpdate(ht, i)), i
  1098. .borderRadius && this.borderSize && this.borderSize.width)
  1099. for (var V in i.borderRadius) Object.hasOwnProperty.call(i.borderRadius, V) && (i
  1100. .borderRadius[V] = A(i.borderRadius[V], this.borderSize.width));
  1101. return this.layoutBox
  1102. }, e.layout = function() {
  1103. return this.getBoxWidthHeight(), this.root.offsetSize = this.offsetSize, this
  1104. .getBoxPosition2(), this.offsetSize
  1105. }, t
  1106. }(),
  1107. lt = function() {
  1108. 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,
  1109. 26, 28, 28, 22, 24, 24, 26, 26, 28, 28, 24, 24, 26, 26, 26, 28, 28, 24, 26, 26, 26, 28, 28
  1110. ],
  1111. a = [3220, 1468, 2713, 1235, 3062, 1890, 2119, 1549, 2344, 2936, 1117, 2583, 1330, 2470, 1667,
  1112. 2249, 2028, 3780, 481, 4011, 142, 3098, 831, 3445, 592, 2517, 1776, 2234, 1951, 2827, 1070,
  1113. 2660, 1345, 3177
  1114. ],
  1115. h = [30660, 29427, 32170, 30877, 26159, 25368, 27713, 26998, 21522, 20773, 24188, 23371, 17913,
  1116. 16590, 20375, 19104, 13663, 12392, 16177, 14854, 9396, 8579, 11994, 11245, 5769, 5054, 7399,
  1117. 6608, 1890, 597, 3340, 2107
  1118. ],
  1119. 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,
  1120. 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,
  1121. 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,
  1122. 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,
  1123. 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,
  1124. 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,
  1125. 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,
  1126. 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,
  1127. 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,
  1128. 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,
  1129. 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,
  1130. 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,
  1131. 13, 41, 26, 15, 5, 24, 30, 15, 10, 15, 28, 4, 4, 116, 28, 17, 0, 42, 26, 17, 6, 22, 28, 19,
  1132. 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,
  1133. 47, 28, 11, 14, 24, 30, 16, 14, 15, 30, 6, 4, 117, 30, 6, 14, 45, 28, 11, 16, 24, 30, 30, 2,
  1134. 16, 30, 8, 4, 106, 26, 8, 13, 47, 28, 7, 22, 24, 30, 22, 13, 15, 30, 10, 2, 114, 28, 19, 4,
  1135. 46, 28, 28, 6, 22, 28, 33, 4, 16, 30, 8, 4, 122, 30, 22, 3, 45, 28, 8, 26, 23, 30, 12, 28,
  1136. 15, 30, 3, 10, 117, 30, 3, 23, 45, 28, 4, 31, 24, 30, 11, 31, 15, 30, 7, 7, 116, 30, 21, 7,
  1137. 45, 28, 1, 37, 23, 30, 19, 26, 15, 30, 5, 10, 115, 30, 19, 10, 47, 28, 15, 25, 24, 30, 23,
  1138. 25, 15, 30, 13, 3, 115, 30, 2, 29, 46, 28, 42, 1, 24, 30, 23, 28, 15, 30, 17, 0, 115, 30,
  1139. 10, 23, 46, 28, 10, 35, 24, 30, 19, 35, 15, 30, 17, 1, 115, 30, 14, 21, 46, 28, 29, 19, 24,
  1140. 30, 11, 46, 15, 30, 13, 6, 115, 30, 14, 23, 46, 28, 44, 7, 24, 30, 59, 1, 16, 30, 12, 7,
  1141. 121, 30, 12, 26, 47, 28, 39, 14, 24, 30, 22, 41, 15, 30, 6, 14, 121, 30, 6, 34, 47, 28, 46,
  1142. 10, 24, 30, 2, 64, 15, 30, 17, 4, 122, 30, 29, 14, 46, 28, 49, 10, 24, 30, 24, 46, 15, 30,
  1143. 4, 18, 122, 30, 13, 32, 46, 28, 48, 14, 24, 30, 42, 32, 15, 30, 20, 4, 117, 30, 40, 7, 47,
  1144. 28, 43, 22, 24, 30, 10, 67, 15, 30, 19, 6, 118, 30, 18, 31, 47, 28, 34, 34, 24, 30, 20, 61,
  1145. 15, 30
  1146. ],
  1147. c = [255, 0, 1, 25, 2, 50, 26, 198, 3, 223, 51, 238, 27, 104, 199, 75, 4, 100, 224, 14, 52, 141,
  1148. 239, 129, 28, 193, 105, 248, 200, 8, 76, 113, 5, 138, 101, 47, 225, 36, 15, 33, 53, 147,
  1149. 142, 218, 240, 18, 130, 69, 29, 181, 194, 125, 106, 39, 249, 185, 201, 154, 9, 120, 77, 228,
  1150. 114, 166, 6, 191, 139, 98, 102, 221, 48, 253, 226, 152, 37, 179, 16, 145, 34, 136, 54, 208,
  1151. 148, 206, 143, 150, 219, 189, 241, 210, 19, 92, 131, 56, 70, 64, 30, 66, 182, 163, 195, 72,
  1152. 126, 110, 107, 58, 40, 84, 250, 133, 186, 61, 202, 94, 155, 159, 10, 21, 121, 43, 78, 212,
  1153. 229, 172, 115, 243, 167, 87, 7, 112, 192, 247, 140, 128, 99, 13, 103, 74, 222, 237, 49, 197,
  1154. 254, 24, 227, 165, 153, 119, 38, 184, 180, 124, 17, 68, 146, 217, 35, 32, 137, 46, 55, 63,
  1155. 209, 91, 149, 188, 207, 205, 144, 135, 151, 178, 220, 252, 190, 97, 242, 86, 211, 171, 20,
  1156. 42, 93, 158, 132, 60, 57, 83, 71, 109, 65, 162, 31, 45, 67, 216, 183, 123, 164, 118, 196,
  1157. 23, 73, 236, 127, 12, 111, 246, 108, 161, 59, 82, 41, 157, 85, 170, 251, 96, 134, 177, 187,
  1158. 204, 62, 90, 203, 89, 95, 176, 156, 169, 160, 81, 11, 245, 22, 235, 122, 117, 44, 215, 79,
  1159. 174, 213, 233, 230, 231, 173, 232, 116, 214, 244, 234, 168, 80, 88, 175
  1160. ],
  1161. l = [1, 2, 4, 8, 16, 32, 64, 128, 29, 58, 116, 232, 205, 135, 19, 38, 76, 152, 45, 90, 180, 117,
  1162. 234, 201, 143, 3, 6, 12, 24, 48, 96, 192, 157, 39, 78, 156, 37, 74, 148, 53, 106, 212, 181,
  1163. 119, 238, 193, 159, 35, 70, 140, 5, 10, 20, 40, 80, 160, 93, 186, 105, 210, 185, 111, 222,
  1164. 161, 95, 190, 97, 194, 153, 47, 94, 188, 101, 202, 137, 15, 30, 60, 120, 240, 253, 231, 211,
  1165. 187, 107, 214, 177, 127, 254, 225, 223, 163, 91, 182, 113, 226, 217, 175, 67, 134, 17, 34,
  1166. 68, 136, 13, 26, 52, 104, 208, 189, 103, 206, 129, 31, 62, 124, 248, 237, 199, 147, 59, 118,
  1167. 236, 197, 151, 51, 102, 204, 133, 23, 46, 92, 184, 109, 218, 169, 79, 158, 33, 66, 132, 21,
  1168. 42, 84, 168, 77, 154, 41, 82, 164, 85, 170, 73, 146, 57, 114, 228, 213, 183, 115, 230, 209,
  1169. 191, 99, 198, 145, 63, 126, 252, 229, 215, 179, 123, 246, 241, 255, 227, 219, 171, 75, 150,
  1170. 49, 98, 196, 149, 55, 110, 220, 165, 87, 174, 65, 130, 25, 50, 100, 200, 141, 7, 14, 28, 56,
  1171. 112, 224, 221, 167, 83, 166, 81, 162, 89, 178, 121, 242, 249, 239, 195, 155, 43, 86, 172,
  1172. 69, 138, 9, 18, 36, 72, 144, 61, 122, 244, 245, 247, 243, 251, 235, 203, 139, 11, 22, 44,
  1173. 88, 176, 125, 250, 233, 207, 131, 27, 54, 108, 216, 173, 71, 142, 0
  1174. ],
  1175. f = [],
  1176. u = [],
  1177. p = [],
  1178. g = [],
  1179. v = [],
  1180. y = 2;
  1181. function b(t, e) {
  1182. var i;
  1183. t > e && (i = t, t = e, e = i), i = e, i *= e, i += e, i >>= 1, g[i += t] = 1
  1184. }
  1185. function x(t, i) {
  1186. var n;
  1187. for (p[t + e * i] = 1, n = -2; n < 2; n++) p[t + n + e * (i - 2)] = 1, p[t - 2 + e * (i + n +
  1188. 1)] = 1, p[t + 2 + e * (i + n)] = 1, p[t + n + 1 + e * (i + 2)] = 1;
  1189. 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)
  1190. }
  1191. function m(t) {
  1192. for (; t >= 255;) t = ((t -= 255) >> 8) + (255 & t);
  1193. return t
  1194. }
  1195. var w = [];
  1196. function S(t, e, i, n) {
  1197. var r, o, s;
  1198. for (r = 0; r < n; r++) f[i + r] = 0;
  1199. for (r = 0; r < e; r++) {
  1200. if (255 != (s = c[f[t + r] ^ f[i]]))
  1201. for (o = 1; o < n; o++) f[i + o - 1] = f[i + o] ^ l[m(s + w[n - o])];
  1202. else
  1203. for (o = i; o < i + n; o++) f[o] = f[o + 1];
  1204. f[i + n - 1] = 255 == s ? 0 : l[m(s + w[0])]
  1205. }
  1206. }
  1207. function z(t, e) {
  1208. var i;
  1209. return t > e && (i = t, t = e, e = i), i = e, i += e * e, i >>= 1, g[i += t]
  1210. }
  1211. function M(t) {
  1212. var i, n, r, o;
  1213. switch (t) {
  1214. case 0:
  1215. for (n = 0; n < e; n++)
  1216. for (i = 0; i < e; i++) i + n & 1 || z(i, n) || (p[i + n * e] ^= 1);
  1217. break;
  1218. case 1:
  1219. for (n = 0; n < e; n++)
  1220. for (i = 0; i < e; i++) 1 & n || z(i, n) || (p[i + n * e] ^= 1);
  1221. break;
  1222. case 2:
  1223. for (n = 0; n < e; n++)
  1224. for (r = 0, i = 0; i < e; i++, r++) 3 == r && (r = 0), r || z(i, n) || (p[i + n *
  1225. e] ^= 1);
  1226. break;
  1227. case 3:
  1228. for (o = 0, n = 0; n < e; n++, o++)
  1229. for (3 == o && (o = 0), r = o, i = 0; i < e; i++, r++) 3 == r && (r = 0), r || z(i,
  1230. n) || (p[i + n * e] ^= 1);
  1231. break;
  1232. case 4:
  1233. for (n = 0; n < e; n++)
  1234. for (r = 0, o = n >> 1 & 1, i = 0; i < e; i++, r++) 3 == r && (r = 0, o = !o), o ||
  1235. z(i, n) || (p[i + n * e] ^= 1);
  1236. break;
  1237. case 5:
  1238. for (o = 0, n = 0; n < e; n++, o++)
  1239. for (3 == o && (o = 0), r = 0, i = 0; i < e; i++, r++) 3 == r && (r = 0), (i & n &
  1240. 1) + !(!r | !o) || z(i, n) || (p[i + n * e] ^= 1);
  1241. break;
  1242. case 6:
  1243. for (o = 0, n = 0; n < e; n++, o++)
  1244. for (3 == o && (o = 0), r = 0, i = 0; i < e; i++, r++) 3 == r && (r = 0), (i & n &
  1245. 1) + (r && r == o) & 1 || z(i, n) || (p[i + n * e] ^= 1);
  1246. break;
  1247. case 7:
  1248. for (o = 0, n = 0; n < e; n++, o++)
  1249. for (3 == o && (o = 0), r = 0, i = 0; i < e; i++, r++) 3 == r && (r = 0), (r && r ==
  1250. o) + (i + n & 1) & 1 || z(i, n) || (p[i + n * e] ^= 1)
  1251. }
  1252. }
  1253. function B(t) {
  1254. var e, i = 0;
  1255. for (e = 0; e <= t; e++) v[e] >= 5 && (i += 3 + v[e] - 5);
  1256. for (e = 3; e < t - 1; e += 2) v[e - 2] == v[e + 2] && v[e + 2] == v[e - 1] && v[e - 1] == v[e +
  1257. 1] && 3 * v[e - 1] == v[e] && (0 == v[e - 3] || e + 3 > t || 3 * v[e - 3] >= 4 * v[e] ||
  1258. 3 * v[e + 3] >= 4 * v[e]) && (i += 40);
  1259. return i
  1260. }
  1261. function k() {
  1262. var t, i, n, r, o, s = 0,
  1263. a = 0;
  1264. for (i = 0; i < e - 1; i++)
  1265. for (t = 0; t < e - 1; t++)(p[t + e * i] && p[t + 1 + e * i] && p[t + e * (i + 1)] && p[t +
  1266. 1 + e * (i + 1)] || !(p[t + e * i] || p[t + 1 + e * i] || p[t + e * (i + 1)] ||
  1267. p[t + 1 + e * (i + 1)])) && (s += 3);
  1268. for (i = 0; i < e; i++) {
  1269. for (v[0] = 0, n = r = t = 0; t < e; t++)(o = p[t + e * i]) == r ? v[n]++ : v[++n] = 1, a +=
  1270. (r = o) ? 1 : -1;
  1271. s += B(n)
  1272. }
  1273. a < 0 && (a = -a);
  1274. var h = a,
  1275. d = 0;
  1276. for (h += h << 2, h <<= 1; h > e * e;) h -= e * e, d++;
  1277. for (s += 10 * d, t = 0; t < e; t++) {
  1278. for (v[0] = 0, n = r = i = 0; i < e; i++)(o = p[t + e * i]) == r ? v[n]++ : v[++n] = 1, r =
  1279. o;
  1280. s += B(n)
  1281. }
  1282. return s
  1283. }
  1284. var I = null;
  1285. return {
  1286. api: {
  1287. get ecclevel() {
  1288. return y
  1289. },
  1290. set ecclevel(t) {
  1291. y = t
  1292. },
  1293. get size() {
  1294. return _size
  1295. },
  1296. set size(t) {
  1297. _size = t
  1298. },
  1299. get canvas() {
  1300. return I
  1301. },
  1302. set canvas(t) {
  1303. I = t
  1304. },
  1305. getFrame: function(v) {
  1306. return function(v) {
  1307. var B, I, P, W, R, L, O, T;
  1308. W = v.length, t = 0;
  1309. do {
  1310. if (t++, P = 4 * (y - 1) + 16 * (t - 1), i = d[P++], n = d[P++], r = d[
  1311. P++], o = d[P], W <= (P = r * (i + n) + n - 3 + (t <= 9))) break
  1312. } while (t < 40);
  1313. for (e = 17 + 4 * t, R = r + (r + o) * (i + n) + n, W = 0; W < R; W++) u[
  1314. W] = 0;
  1315. for (f = v.slice(0), W = 0; W < e * e; W++) p[W] = 0;
  1316. for (W = 0; W < (e * (e + 1) + 1) / 2; W++) g[W] = 0;
  1317. for (W = 0; W < 3; W++) {
  1318. for (P = 0, I = 0, 1 == W && (P = e - 7), 2 == W && (I = e - 7), p[I +
  1319. 3 + e * (P + 3)] = 1, B = 0; B < 6; B++) p[I + B + e * P] = 1,
  1320. p[I + e * (P + B + 1)] = 1, p[I + 6 + e * (P + B)] = 1, p[I + B +
  1321. 1 + e * (P + 6)] = 1;
  1322. for (B = 1; B < 5; B++) b(I + B, P + 1), b(I + 1, P + B + 1), b(I + 5,
  1323. P + B), b(I + B + 1, P + 5);
  1324. for (B = 2; B < 4; B++) p[I + B + e * (P + 2)] = 1, p[I + 2 + e * (P +
  1325. B + 1)] = 1, p[I + 4 + e * (P + B)] = 1, p[I + B + 1 + e * (P +
  1326. 4)] = 1
  1327. }
  1328. if (t > 1)
  1329. for (W = s[t], I = e - 7;;) {
  1330. for (B = e - 7; B > W - 3 && (x(B, I), !(B < W));) B -= W;
  1331. if (I <= W + 9) break;
  1332. x(6, I -= W), x(I, 6)
  1333. }
  1334. for (p[8 + e * (e - 8)] = 1, I = 0; I < 7; I++) b(7, I), b(e - 8, I), b(7,
  1335. I + e - 7);
  1336. for (B = 0; B < 8; B++) b(B, 7), b(B + e - 8, 7), b(B, e - 8);
  1337. for (B = 0; B < 9; B++) b(B, 8);
  1338. for (B = 0; B < 8; B++) b(B + e - 8, 8), b(8, B);
  1339. for (I = 0; I < 7; I++) b(8, I + e - 7);
  1340. for (B = 0; B < e - 14; B++) 1 & B ? (b(8 + B, 6), b(6, 8 + B)) : (p[8 + B +
  1341. 6 * e] = 1, p[6 + e * (8 + B)] = 1);
  1342. if (t > 6)
  1343. for (W = a[t - 7], P = 17, B = 0; B < 6; B++)
  1344. for (I = 0; I < 3; I++, P--) 1 & (P > 11 ? t >> P - 12 : W >> P) ? (
  1345. p[5 - B + e * (2 - I + e - 11)] = 1, p[2 - I + e - 11 + e *
  1346. (5 - B)] = 1) : (b(5 - B, 2 - I + e - 11), b(2 - I + e -
  1347. 11, 5 - B));
  1348. for (I = 0; I < e; I++)
  1349. for (B = 0; B <= I; B++) p[B + e * I] && b(B, I);
  1350. for (R = f.length, L = 0; L < R; L++) u[L] = f.charCodeAt(L);
  1351. if (f = u.slice(0), R >= (B = r * (i + n) + n) - 2 && (R = B - 2, t > 9 &&
  1352. R--), L = R, t > 9) {
  1353. for (f[L + 2] = 0, f[L + 3] = 0; L--;) W = f[L], f[L + 3] |= 255 & W <<
  1354. 4, f[L + 2] = W >> 4;
  1355. f[2] |= 255 & R << 4, f[1] = R >> 4, f[0] = 64 | R >> 12
  1356. } else {
  1357. for (f[L + 1] = 0, f[L + 2] = 0; L--;) W = f[L], f[L + 2] |= 255 & W <<
  1358. 4, f[L + 1] = W >> 4;
  1359. f[1] |= 255 & R << 4, f[0] = 64 | R >> 4
  1360. }
  1361. for (L = R + 3 - (t < 10); L < B;) f[L++] = 236, f[L++] = 17;
  1362. for (w[0] = 1, L = 0; L < o; L++) {
  1363. for (w[L + 1] = 1, O = L; O > 0; O--) w[O] = w[O] ? w[O - 1] ^ l[m(c[w[
  1364. O]] + L)] : w[O - 1];
  1365. w[0] = l[m(c[w[0]] + L)]
  1366. }
  1367. for (L = 0; L <= o; L++) w[L] = c[w[L]];
  1368. for (P = B, I = 0, L = 0; L < i; L++) S(I, r, P, o), I += r, P += o;
  1369. for (L = 0; L < n; L++) S(I, r + 1, P, o), I += r + 1, P += o;
  1370. for (I = 0, L = 0; L < r; L++) {
  1371. for (O = 0; O < i; O++) u[I++] = f[L + O * r];
  1372. for (O = 0; O < n; O++) u[I++] = f[i * r + L + O * (r + 1)]
  1373. }
  1374. for (O = 0; O < n; O++) u[I++] = f[i * r + L + O * (r + 1)];
  1375. for (L = 0; L < o; L++)
  1376. for (O = 0; O < i + n; O++) u[I++] = f[B + L + O * o];
  1377. for (f = u, B = I = e - 1, P = R = 1, T = (r + o) * (i + n) + n, L = 0; L <
  1378. T; L++)
  1379. for (W = f[L], O = 0; O < 8; O++, W <<= 1) {
  1380. 128 & W && (p[B + e * I] = 1);
  1381. do {
  1382. R ? B-- : (B++, P ? 0 != I ? I-- : (P = !P, 6 == (B -= 2) && (
  1383. B--, I = 9)) : I != e - 1 ? I++ : (P = !P, 6 == (
  1384. B -= 2) && (B--, I -= 8))), R = !R
  1385. } while (z(B, I))
  1386. }
  1387. for (f = p.slice(0), W = 0, I = 3e4, P = 0; P < 8 && (M(P), (B = k()) < I &&
  1388. (I = B, W = P), 7 != W); P++) p = f.slice(0);
  1389. for (W != P && M(W), I = h[W + (y - 1 << 3)], P = 0; P < 8; P++, I >>= 1)
  1390. 1 & I && (p[e - 1 - P + 8 * e] = 1, P < 6 ? p[8 + e * P] = 1 : p[8 + e *
  1391. (P + 1)] = 1);
  1392. for (P = 0; P < 7; P++, I >>= 1) 1 & I && (p[8 + e * (e - 7 + P)] = 1, P ?
  1393. p[6 - P + 8 * e] = 1 : p[7 + 8 * e] = 1);
  1394. return p
  1395. }(v)
  1396. },
  1397. utf16to8: function(t) {
  1398. var e, i, n, r;
  1399. for (e = "", n = t.length, i = 0; i < n; i++)(r = t.charCodeAt(i)) >= 1 && r <=
  1400. 127 ? e += t.charAt(i) : r > 2047 ? (e += String.fromCharCode(224 | r >> 12 &
  1401. 15), e += String.fromCharCode(128 | r >> 6 & 63), e += String
  1402. .fromCharCode(128 | r >> 0 & 63)) : (e += String.fromCharCode(192 | r >> 6 &
  1403. 31), e += String.fromCharCode(128 | r >> 0 & 63));
  1404. return e
  1405. },
  1406. draw: function(t, i, n, r, o) {
  1407. i.drawView(n, r);
  1408. var s = i.ctx,
  1409. a = n.contentSize,
  1410. h = a.width,
  1411. d = a.height,
  1412. c = a.left,
  1413. l = a.top;
  1414. r.borderRadius, r.backgroundColor;
  1415. var f = r.color,
  1416. u = void 0 === f ? "#000000" : f;
  1417. r.border, n.contentSize.left, n.borderSize.left, n.contentSize.top, n.borderSize
  1418. .top;
  1419. if (y = o || y, s) {
  1420. s.save(), i.setOpacity(r), i.setTransform(n, r);
  1421. var p = Math.min(h, d);
  1422. t = this.utf16to8(t);
  1423. var g = this.getFrame(t),
  1424. v = p / e;
  1425. s.setFillStyle(u);
  1426. for (var b = 0; b < e; b++)
  1427. for (var x = 0; x < e; x++) g[x * e + b] && s.fillRect(c + v * b, l + v * x,
  1428. v, v);
  1429. s.restore(), i.setBorder(n, r)
  1430. } else console.warn("No canvas provided to draw QR code in!")
  1431. }
  1432. }
  1433. }
  1434. }(),
  1435. ft = v,
  1436. ut = g,
  1437. pt = y,
  1438. gt = p,
  1439. vt = h,
  1440. yt = d,
  1441. bt = c,
  1442. xt = l,
  1443. mt = f,
  1444. wt = u,
  1445. St = function() {
  1446. function t(t) {
  1447. var e, i = this;
  1448. this.v = "1.9.3.5", this.id = null, this.pixelRatio = 1, this.width = 0, this.height = 0, this
  1449. .sleep = 1e3 / 30, this.count = 0, this.isRate = !1, this.isDraw = !0, this.isCache = !0,
  1450. this.fixed = "", this.useCORS = !1, this.imageBus = [], this.createImage = function(t, e) {
  1451. return new Promise((function(i, n) {
  1452. if (window) {
  1453. var r = new Image;
  1454. e && r.setAttribute("crossOrigin", "Anonymous"), r.src = t, r
  1455. .onload = function() {
  1456. i({
  1457. width: r.naturalWidth || r.width,
  1458. height: r.naturalHeight || r.height,
  1459. path: r,
  1460. src: this.src
  1461. })
  1462. }, r.onerror = function(t) {
  1463. n(t)
  1464. }
  1465. } else n({
  1466. fail: "getImageInfo fail",
  1467. src: t
  1468. })
  1469. }))
  1470. }, this.options = t, Object.assign(this, t), this.ctx = ((e = t.context).setFonts =
  1471. function(t) {
  1472. var i = t.fontFamily,
  1473. n = void 0 === i ? "sans-serif" : i,
  1474. o = t.fontSize,
  1475. s = void 0 === o ? 14 : o,
  1476. a = t.fontWeight,
  1477. h = void 0 === a ? "normal" : a,
  1478. d = t.fontStyle,
  1479. c = void 0 === d ? "normal" : d;
  1480. R == r.MP_TOUTIAO && (h = "bold" == h ? "bold" : "", c = "italic" == c ? "italic" :
  1481. ""), e.font = "".concat(c, " ").concat(h, " ").concat(Math.round(s), "px ")
  1482. .concat(n)
  1483. }, e.draw && e.setFillStyle ? e : Object.assign(e, {
  1484. setStrokeStyle: function(t) {
  1485. e.strokeStyle = t
  1486. },
  1487. setLineWidth: function(t) {
  1488. e.lineWidth = t
  1489. },
  1490. setLineCap: function(t) {
  1491. e.lineCap = t
  1492. },
  1493. setFillStyle: function(t) {
  1494. e.fillStyle = t
  1495. },
  1496. setFontSize: function(t) {
  1497. e.font = "".concat(String(t), "px sans-serif")
  1498. },
  1499. setGlobalAlpha: function(t) {
  1500. e.globalAlpha = t
  1501. },
  1502. setLineJoin: function(t) {
  1503. e.lineJoin = t
  1504. },
  1505. setTextAlign: function(t) {
  1506. e.textAlign = t
  1507. },
  1508. setMiterLimit: function(t) {
  1509. e.miterLimit = t
  1510. },
  1511. setShadow: function(t, i, n, r) {
  1512. e.shadowOffsetX = t, e.shadowOffsetY = i, e.shadowBlur = n, e
  1513. .shadowColor = r
  1514. },
  1515. setTextBaseline: function(t) {
  1516. e.textBaseline = t
  1517. },
  1518. createCircularGradient: function() {},
  1519. draw: function() {}
  1520. })), this.progress = 0, this.root = {
  1521. width: t.width,
  1522. height: t.height,
  1523. fontSizeRate: 1,
  1524. fixedLine: null
  1525. }, this.size = this.root;
  1526. var n = 0;
  1527. Object.defineProperty(this, "progress", {
  1528. configurable: !0,
  1529. set: function(t) {
  1530. n = t, i.lifecycle("onProgress", t / i.count)
  1531. },
  1532. get: function() {
  1533. return n || 0
  1534. }
  1535. })
  1536. }
  1537. return t.prototype.lifecycle = function(t, e) {
  1538. this.options.listen && this.options.listen[t] && this.options.listen[t](e)
  1539. }, t.prototype.setContext = function(t) {
  1540. t && (this.ctx = t)
  1541. }, t.prototype.init = function() {
  1542. (this.canvas.height || r.WEB == R) && (this.canvas.height = this.size.height * this
  1543. .pixelRatio, this.canvas.width = this.size.width * this.pixelRatio, this.ctx.scale(this
  1544. .pixelRatio, this.pixelRatio))
  1545. }, t.prototype.clear = function() {
  1546. this.ctx.clearRect(0, 0, this.size.width, this.size.height)
  1547. }, t.prototype.clipPath = function(t, e, i, n, r, o, s) {
  1548. void 0 === o && (o = !1), void 0 === s && (s = !1);
  1549. var a = this.ctx;
  1550. if (/polygon/.test(r)) {
  1551. var h = r.match(/-?\d+(rpx|px|%)?\s+-?\d+(rpx|px|%)?/g) || [];
  1552. a.beginPath(), h.map((function(r) {
  1553. var o = r.split(" "),
  1554. s = o[0],
  1555. a = o[1];
  1556. return [A(s, i) + t, A(a, n) + e]
  1557. })).forEach((function(t, e) {
  1558. 0 == e ? a.moveTo(t[0], t[1]) : a.lineTo(t[0], t[1])
  1559. })), a.closePath(), s && a.stroke(), o && a.fill()
  1560. }
  1561. }, t.prototype.roundRect = function(t, e, i, n, r, o, s) {
  1562. if (void 0 === o && (o = !1), void 0 === s && (s = !1), !(r < 0)) {
  1563. var a = this.ctx;
  1564. if (a.beginPath(), r) {
  1565. var h = r || {},
  1566. d = h.borderTopLeftRadius,
  1567. c = void 0 === d ? r || 0 : d,
  1568. l = h.borderTopRightRadius,
  1569. f = void 0 === l ? r || 0 : l,
  1570. u = h.borderBottomRightRadius,
  1571. p = void 0 === u ? r || 0 : u,
  1572. g = h.borderBottomLeftRadius,
  1573. v = void 0 === g ? r || 0 : g;
  1574. a.arc(t + i - p, e + n - p, p, 0, .5 * Math.PI), a.lineTo(t + v, e + n), a.arc(t +
  1575. v, e + n - v, v, .5 * Math.PI, Math.PI), a.lineTo(t, e + c), a.arc(t + c,
  1576. e + c, c, Math.PI, 1.5 * Math.PI), a.lineTo(t + i - f, e), a.arc(t + i - f,
  1577. e + f, f, 1.5 * Math.PI, 2 * Math.PI), a.lineTo(t + i, e + n - p)
  1578. } else a.rect(t, e, i, n);
  1579. a.closePath(), s && a.stroke(), o && a.fill()
  1580. }
  1581. }, t.prototype.setTransform = function(t, e) {
  1582. var i = e.transform,
  1583. n = e.transformOrigin,
  1584. r = this.ctx,
  1585. o = i || {},
  1586. s = o.scaleX,
  1587. a = void 0 === s ? 1 : s,
  1588. h = o.scaleY,
  1589. d = void 0 === h ? 1 : h,
  1590. c = o.translateX,
  1591. l = void 0 === c ? 0 : c,
  1592. f = o.translateY,
  1593. u = void 0 === f ? 0 : f,
  1594. p = o.rotate,
  1595. g = void 0 === p ? 0 : p,
  1596. v = o.skewX,
  1597. y = void 0 === v ? 0 : v,
  1598. b = o.skewY,
  1599. x = void 0 === b ? 0 : b,
  1600. m = t.left,
  1601. w = t.top,
  1602. S = t.width,
  1603. z = t.height;
  1604. l = A(l, S) || 0, u = A(u, z) || 0;
  1605. var M = {
  1606. top: A("0%", 1),
  1607. center: A("50%", 1),
  1608. bottom: A("100%", 1)
  1609. },
  1610. B = {
  1611. left: A("0%", 1),
  1612. center: A("50%", 1),
  1613. right: A("100%", 1)
  1614. };
  1615. if (n = n.split(" ").filter((function(t, e) {
  1616. return e < 2
  1617. })).reduce((function(t, e) {
  1618. if (/\d+/.test(e)) {
  1619. var i = A(e, 1) / (/px|rpx$/.test(e) ? T(t.x) ? z : S : 1);
  1620. return T(t.x) ? Object.assign(t, {
  1621. y: i
  1622. }) : Object.assign(t, {
  1623. x: i
  1624. })
  1625. }
  1626. return T(B[e]) && !T(t.x) ? Object.assign(t, {
  1627. x: B[e]
  1628. }) : Object.assign(t, {
  1629. y: M[e] || .5
  1630. })
  1631. }), {}), (l || u) && r.translate(l, u), (a || d) && r.scale(a, d), g) {
  1632. var k = m + S * n.x,
  1633. I = w + z * n.y;
  1634. r.translate(k, I), r.rotate(g * Math.PI / 180), r.translate(-k, -I)
  1635. }(y || x) && r.transform(1, Math.tan(x * Math.PI / 180), Math.tan(y * Math.PI / 180), 1, 0,
  1636. 0)
  1637. }, t.prototype.setBackground = function(t, e, i, n, o) {
  1638. var s = this.ctx;
  1639. t && t != M ? j(t) ? C(t, e, i, n, o, s) : s.setFillStyle(t) : [r.MP_TOUTIAO, r.MP_BAIDU]
  1640. .includes(R) ? s.setFillStyle("rgba(0,0,0,0)") : s.setFillStyle(M)
  1641. }, t.prototype.setShadow = function(t) {
  1642. var e = t.boxShadow,
  1643. i = void 0 === e ? [] : e,
  1644. n = this.ctx;
  1645. if (i.length) {
  1646. var r = i[0],
  1647. o = i[1],
  1648. s = i[2],
  1649. a = i[3];
  1650. n.setShadow(r, o, s, a)
  1651. }
  1652. }, t.prototype.setBorder = function(t, e) {
  1653. var i = this.ctx,
  1654. n = t.width,
  1655. r = t.height,
  1656. o = t.left,
  1657. s = t.top,
  1658. a = e.border,
  1659. h = e.borderBottom,
  1660. d = e.borderTop,
  1661. c = e.borderRight,
  1662. l = e.borderLeft,
  1663. f = e.borderRadius,
  1664. u = e.lineCap,
  1665. p = a || {},
  1666. g = p.borderWidth,
  1667. v = void 0 === g ? 0 : g,
  1668. y = p.borderStyle,
  1669. b = p.borderColor,
  1670. x = h || {},
  1671. m = x.borderBottomWidth,
  1672. w = void 0 === m ? v : m,
  1673. S = x.borderBottomStyle,
  1674. z = void 0 === S ? y : S,
  1675. M = x.borderBottomColor,
  1676. B = void 0 === M ? b : M,
  1677. k = d || {},
  1678. I = k.borderTopWidth,
  1679. P = void 0 === I ? v : I,
  1680. W = k.borderTopStyle,
  1681. L = void 0 === W ? y : W,
  1682. O = k.borderTopColor,
  1683. T = void 0 === O ? b : O,
  1684. A = c || {},
  1685. F = A.borderRightWidth,
  1686. j = void 0 === F ? v : F,
  1687. C = A.borderRightStyle,
  1688. E = void 0 === C ? y : C,
  1689. H = A.borderRightColor,
  1690. U = void 0 === H ? b : H,
  1691. Y = l || {},
  1692. $ = Y.borderLeftWidth,
  1693. D = void 0 === $ ? v : $,
  1694. _ = Y.borderLeftStyle,
  1695. X = void 0 === _ ? y : _,
  1696. N = Y.borderLeftColor,
  1697. V = void 0 === N ? b : N,
  1698. G = f || {},
  1699. q = G.borderTopLeftRadius,
  1700. J = void 0 === q ? f || 0 : q,
  1701. Q = G.borderTopRightRadius,
  1702. Z = void 0 === Q ? f || 0 : Q,
  1703. K = G.borderBottomRightRadius,
  1704. tt = void 0 === K ? f || 0 : K,
  1705. et = G.borderBottomLeftRadius,
  1706. it = void 0 === et ? f || 0 : et;
  1707. if (h || l || d || c || a) {
  1708. var nt = function(t, e, n) {
  1709. "dashed" == e ? /mp/.test(R) ? i.setLineDash([Math.ceil(4 * t / 3), Math.ceil(
  1710. 4 * t / 3)]) : i.setLineDash([Math.ceil(6 * t), Math.ceil(6 * t)]) :
  1711. "dotted" == e && i.setLineDash([t, t]), i.setStrokeStyle(n)
  1712. },
  1713. rt = function(t, e, n, r, o, s, a, h, d, c, l, f, p, g, v) {
  1714. i.save(), i.setLineCap(v ? "square" : u), i.setLineWidth(f), nt(f, p, g), i
  1715. .beginPath(), i.arc(t, e, a, Math.PI * d, Math.PI * c), i.lineTo(n, r), i
  1716. .arc(o, s, h, Math.PI * c, Math.PI * l), i.stroke(), i.restore()
  1717. };
  1718. if (i.save(), a && !h && !l && !d && !c) return i.setLineWidth(v), nt(v, y, b), this
  1719. .roundRect(o, s, n, r, f, !1, !!b), void i.restore();
  1720. w && rt(o + n - tt, s + r - tt, o + it, s + r, o + it, s + r - it, tt, it, .25, .5, .75,
  1721. w, z, B, D && j), D && rt(o + it, s + r - it, o, s + J, o + J, s + J, it, J,
  1722. .75, 1, 1.25, D, X, V, P && w), P && rt(o + J, s + J, o + n - Z, s, o + n - Z,
  1723. s + Z, J, Z, 1.25, 1.5, 1.75, P, L, T, D && j), j && rt(o + n - Z, s + Z, o + n,
  1724. s + r - tt, o + n - tt, s + r - tt, Z, tt, 1.75, 2, .25, j, E, U, P && w)
  1725. }
  1726. }, t.prototype.setOpacity = function(t) {
  1727. var e = t.opacity,
  1728. i = void 0 === e ? 1 : e;
  1729. this.ctx.setGlobalAlpha(i)
  1730. }, t.prototype.drawPattern = function(t, e, r) {
  1731. return i(this, void 0, void 0, (function() {
  1732. var i = this;
  1733. return n(this, (function(n) {
  1734. return [2, new Promise((function(n, o) {
  1735. i.drawView(e, r, !0, !1, !0);
  1736. var s = i,
  1737. a = s.ctx;
  1738. s.canvas;
  1739. var h = e.width,
  1740. d = e.height,
  1741. c = e.left,
  1742. l = e.top,
  1743. f = r || {},
  1744. u = f.borderRadius,
  1745. p = void 0 === u ? 0 : u,
  1746. g = f.backgroundImage,
  1747. v = f.backgroundRepeat,
  1748. y = void 0 === v ? "repeat" : v;
  1749. g && function(t) {
  1750. var o = a.createPattern(t.src,
  1751. y);
  1752. a.setFillStyle(o), i.roundRect(
  1753. c, l, h, d, p, !0, !1),
  1754. i.setBorder(e, r), n()
  1755. }(t)
  1756. }))]
  1757. }))
  1758. }))
  1759. }, t.prototype.drawView = function(t, e, i, n, r) {
  1760. void 0 === i && (i = !0), void 0 === n && (n = !0), void 0 === r && (r = !0);
  1761. var o = this.ctx,
  1762. s = t.width,
  1763. a = t.height,
  1764. h = t.left,
  1765. d = t.top,
  1766. c = e || {},
  1767. l = c.borderRadius,
  1768. f = void 0 === l ? 0 : l,
  1769. u = c.backgroundColor,
  1770. p = void 0 === u ? M : u,
  1771. g = c.overflow;
  1772. e.opacity && this.setOpacity(e), this.setTransform(t, e), r && (o.save(), this.setShadow(
  1773. e)), i && this.setBackground(p, s, a, h, d), e.clipPath ? this.clipPath(h, d, s, a, e
  1774. .clipPath, i, !1) : this.roundRect(h, d, s, a, f, i, !1), r && o.restore(), n &&
  1775. this.setBorder(t, e), "hidden" == g && o.clip()
  1776. }, t.prototype.drawImage = function(t, e, o, s) {
  1777. return void 0 === e && (e = {}), void 0 === o && (o = {}), void 0 === s && (s = !0), i(this,
  1778. void 0, void 0, (function() {
  1779. var a = this;
  1780. return n(this, (function(h) {
  1781. switch (h.label) {
  1782. case 0:
  1783. return [4, new Promise((function(h, d) {
  1784. return i(a, void 0, void 0, (
  1785. function() {
  1786. var i, a, d, c,
  1787. l, f, u, p,
  1788. g, v, y, b,
  1789. x, m, w, S,
  1790. z, k, I, P,
  1791. W, L = this;
  1792. return n(this, (
  1793. function(
  1794. n
  1795. ) {
  1796. return i =
  1797. this
  1798. .ctx,
  1799. a =
  1800. o
  1801. .borderRadius,
  1802. d =
  1803. void 0 ===
  1804. a ?
  1805. 0 :
  1806. a,
  1807. c =
  1808. o
  1809. .backgroundColor,
  1810. l =
  1811. void 0 ===
  1812. c ?
  1813. M :
  1814. c,
  1815. f =
  1816. o
  1817. .objectFit,
  1818. u =
  1819. void 0 ===
  1820. f ?
  1821. B :
  1822. f,
  1823. p =
  1824. o
  1825. .backgroundSize,
  1826. g =
  1827. void 0 ===
  1828. p ?
  1829. B :
  1830. p,
  1831. v =
  1832. o
  1833. .objectPosition,
  1834. y =
  1835. o
  1836. .backgroundPosition,
  1837. b =
  1838. o
  1839. .boxShadow,
  1840. o
  1841. .backgroundImage &&
  1842. (u = g,
  1843. v =
  1844. y
  1845. ),
  1846. b &&
  1847. this
  1848. .drawView(
  1849. e,
  1850. Object
  1851. .assign(
  1852. o, {
  1853. backgroundColor: l ||
  1854. b &&
  1855. (l ||
  1856. "#ffffff"
  1857. )
  1858. }
  1859. ),
  1860. !
  1861. 0,
  1862. !
  1863. 1,
  1864. !
  1865. 0
  1866. ),
  1867. x =
  1868. e
  1869. .width,
  1870. m =
  1871. e
  1872. .height,
  1873. w =
  1874. e
  1875. .left,
  1876. S =
  1877. e
  1878. .top,
  1879. i
  1880. .save(),
  1881. z =
  1882. e
  1883. .contentSize
  1884. .left -
  1885. e
  1886. .borderSize
  1887. .left,
  1888. k =
  1889. e
  1890. .contentSize
  1891. .top -
  1892. e
  1893. .borderSize
  1894. .top,
  1895. s ||
  1896. (this
  1897. .setOpacity(
  1898. o
  1899. ),
  1900. this
  1901. .setTransform(
  1902. e,
  1903. o
  1904. ),
  1905. this
  1906. .setBackground(
  1907. l,
  1908. x,
  1909. m,
  1910. w,
  1911. S
  1912. ),
  1913. this
  1914. .roundRect(
  1915. w,
  1916. S,
  1917. x,
  1918. m,
  1919. d,
  1920. !
  1921. !
  1922. (d ||
  1923. !
  1924. b &&
  1925. l
  1926. ),
  1927. !
  1928. 1
  1929. )
  1930. ),
  1931. w +=
  1932. z,
  1933. S +=
  1934. k,
  1935. i
  1936. .clip(),
  1937. I =
  1938. function(
  1939. t
  1940. ) {
  1941. if (u !==
  1942. B
  1943. ) {
  1944. var n =
  1945. function(
  1946. t,
  1947. e,
  1948. i
  1949. ) {
  1950. var n =
  1951. t
  1952. .objectFit,
  1953. r =
  1954. t
  1955. .objectPosition,
  1956. o =
  1957. e
  1958. .width /
  1959. e
  1960. .height,
  1961. s =
  1962. i
  1963. .width /
  1964. i
  1965. .height,
  1966. a =
  1967. 1;
  1968. "contain" ==
  1969. n && o >=
  1970. s ||
  1971. "cover" ==
  1972. n &&
  1973. o <
  1974. s ?
  1975. a =
  1976. e
  1977. .height /
  1978. i
  1979. .height :
  1980. ("contain" ==
  1981. n &&
  1982. o <
  1983. s ||
  1984. "cover" ==
  1985. n &&
  1986. o >=
  1987. s
  1988. ) &&
  1989. (a = e
  1990. .width /
  1991. i
  1992. .width
  1993. );
  1994. var h =
  1995. i
  1996. .width *
  1997. a,
  1998. d =
  1999. i
  2000. .height *
  2001. a,
  2002. c =
  2003. r ||
  2004. [],
  2005. l =
  2006. c[
  2007. 0],
  2008. f =
  2009. c[
  2010. 1],
  2011. u =
  2012. /^\d+px|rpx$/
  2013. .test(
  2014. l
  2015. ) ?
  2016. A(l, e
  2017. .width
  2018. ) :
  2019. (e.width -
  2020. h
  2021. ) *
  2022. (F(l) ?
  2023. A(l,
  2024. 1) :
  2025. {
  2026. left: 0,
  2027. center: .5,
  2028. right: 1
  2029. }
  2030. [l ||
  2031. "center"
  2032. ]
  2033. ),
  2034. p =
  2035. /^\d+px|rpx$/
  2036. .test(
  2037. f
  2038. ) ?
  2039. A(f, e
  2040. .height
  2041. ) :
  2042. (e.height -
  2043. d
  2044. ) *
  2045. (F(f) ?
  2046. A(f,
  2047. 1) :
  2048. {
  2049. top: 0,
  2050. center: .5,
  2051. bottom: 1
  2052. }
  2053. [f ||
  2054. "center"
  2055. ]
  2056. ),
  2057. g =
  2058. function(
  2059. t,
  2060. e
  2061. ) {
  2062. return [(t -
  2063. u) /
  2064. a,
  2065. (e -
  2066. p) /
  2067. a
  2068. ]
  2069. },
  2070. v =
  2071. g(0,
  2072. 0),
  2073. y =
  2074. v[
  2075. 0],
  2076. b =
  2077. v[
  2078. 1],
  2079. x =
  2080. g(e.width,
  2081. e
  2082. .height
  2083. ),
  2084. m =
  2085. x[
  2086. 0],
  2087. w =
  2088. x[
  2089. 1];
  2090. return {
  2091. sx: Math
  2092. .max(
  2093. y,
  2094. 0
  2095. ),
  2096. sy: Math
  2097. .max(
  2098. b,
  2099. 0
  2100. ),
  2101. sw: Math
  2102. .min(
  2103. m -
  2104. y,
  2105. i
  2106. .width
  2107. ),
  2108. sh: Math
  2109. .min(
  2110. w -
  2111. b,
  2112. i
  2113. .height
  2114. ),
  2115. dx: Math
  2116. .max(
  2117. u,
  2118. 0
  2119. ),
  2120. dy: Math
  2121. .max(
  2122. p,
  2123. 0
  2124. ),
  2125. dw: Math
  2126. .min(
  2127. h,
  2128. e
  2129. .width
  2130. ),
  2131. dh: Math
  2132. .min(
  2133. d,
  2134. e
  2135. .height
  2136. )
  2137. }
  2138. }
  2139. ({
  2140. objectFit: u,
  2141. objectPosition: v
  2142. },
  2143. e
  2144. .contentSize,
  2145. t
  2146. ),
  2147. o =
  2148. n
  2149. .sx,
  2150. s =
  2151. n
  2152. .sy,
  2153. a =
  2154. n
  2155. .sh,
  2156. h =
  2157. n
  2158. .sw,
  2159. d =
  2160. n
  2161. .dx,
  2162. c =
  2163. n
  2164. .dy,
  2165. l =
  2166. n
  2167. .dh,
  2168. f =
  2169. n
  2170. .dw;
  2171. R == r
  2172. .MP_BAIDU ?
  2173. i
  2174. .drawImage(
  2175. t
  2176. .src,
  2177. d +
  2178. w,
  2179. c +
  2180. S,
  2181. f,
  2182. l,
  2183. o,
  2184. s,
  2185. h,
  2186. a
  2187. ) :
  2188. i
  2189. .drawImage(
  2190. t
  2191. .src,
  2192. o,
  2193. s,
  2194. h,
  2195. a,
  2196. d +
  2197. w,
  2198. c +
  2199. S,
  2200. f,
  2201. l
  2202. )
  2203. } else
  2204. i
  2205. .drawImage(
  2206. t
  2207. .src,
  2208. w,
  2209. S,
  2210. x,
  2211. m
  2212. )
  2213. },
  2214. P =
  2215. function() {
  2216. i.restore(),
  2217. L
  2218. .drawView(
  2219. e,
  2220. o,
  2221. !
  2222. 1,
  2223. !
  2224. 0,
  2225. !
  2226. 1
  2227. ),
  2228. h(
  2229. 1)
  2230. },
  2231. W =
  2232. function(
  2233. t
  2234. ) {
  2235. I(t),
  2236. P()
  2237. },
  2238. W(
  2239. t),
  2240. [
  2241. 2]
  2242. }))
  2243. }))
  2244. }))];
  2245. case 1:
  2246. return h.sent(), [2]
  2247. }
  2248. }))
  2249. }))
  2250. }, t.prototype.drawText = function(t, e, i, n) {
  2251. var r = this.ctx,
  2252. o = e.borderSize,
  2253. s = e.contentSize,
  2254. a = e.left,
  2255. h = e.top,
  2256. d = s.width,
  2257. c = s.height,
  2258. l = s.left - o.left,
  2259. f = s.top - o.top,
  2260. u = i.color,
  2261. p = void 0 === u ? "#000000" : u,
  2262. g = i.lineHeight,
  2263. v = void 0 === g ? "1.4em" : g,
  2264. y = i.fontSize,
  2265. b = void 0 === y ? 14 : y,
  2266. x = i.fontWeight,
  2267. m = i.fontFamily,
  2268. w = i.fontStyle,
  2269. S = i.textAlign,
  2270. z = void 0 === S ? "left" : S,
  2271. M = i.verticalAlign,
  2272. B = void 0 === M ? yt : M,
  2273. k = i.backgroundColor,
  2274. I = i.lineClamp,
  2275. P = i.backgroundClip,
  2276. W = i.textShadow,
  2277. R = i.textDecoration;
  2278. if (this.drawView(e, i, P != ut), v = A(v, b), t) {
  2279. r.save(), this.setShadow({
  2280. boxShadow: W
  2281. }), a += l, h += f;
  2282. var L = n.fontHeight,
  2283. O = n.descent + n.ascent;
  2284. switch (r.setFonts({
  2285. fontFamily: m,
  2286. fontSize: b,
  2287. fontWeight: x,
  2288. fontStyle: w
  2289. }), r.setTextBaseline(O ? yt : B), r.setTextAlign(z), P ? this.setBackground(k, d,
  2290. c, a, h) : r.setFillStyle(p), z) {
  2291. case xt:
  2292. break;
  2293. case mt:
  2294. a += .5 * d;
  2295. break;
  2296. case wt:
  2297. a += d
  2298. }
  2299. var T = n.lines * v,
  2300. F = Math.ceil((c - T) / 2);
  2301. switch (F < 0 && (F = 0), B) {
  2302. case vt:
  2303. break;
  2304. case yt:
  2305. h += F;
  2306. break;
  2307. case bt:
  2308. h += 2 * F
  2309. }
  2310. var j = (v - L) / 2,
  2311. C = function(t) {
  2312. var e = r.measureText(t),
  2313. i = e.actualBoundingBoxDescent,
  2314. n = void 0 === i ? 0 : i,
  2315. o = e.actualBoundingBoxAscent;
  2316. return B == vt ? {
  2317. fix: O ? void 0 === o ? 0 : o : 0,
  2318. lineY: O ? 2 * j : j
  2319. } : B == yt ? {
  2320. fix: O ? v / 2 + n / 4 : v / 2,
  2321. lineY: (v - L) / 2
  2322. } : B == bt ? {
  2323. fix: O ? v - n : v + j,
  2324. lineY: 0
  2325. } : {
  2326. fix: 0,
  2327. height: 0,
  2328. lineY: 0
  2329. }
  2330. },
  2331. E = function(t, e, i) {
  2332. var o = t;
  2333. switch (z) {
  2334. case xt:
  2335. o += i;
  2336. break;
  2337. case mt:
  2338. o = (t -= i / 2) + i;
  2339. break;
  2340. case wt:
  2341. o = t, t -= i
  2342. }
  2343. if (R) {
  2344. r.setLineWidth(b / 13), r.beginPath();
  2345. var s = .1 * n.fontHeight;
  2346. /\bunderline\b/.test(R) && (r.moveTo(t, e + s), r.lineTo(o, e + s)),
  2347. /\boverline\b/.test(R) && (O || (e -= j), r.moveTo(t, e - n.fontHeight -
  2348. s), r.lineTo(o, e - n.fontHeight - s)), /\bline-through\b/.test(
  2349. R) && (r.moveTo(t, e - .5 * n.fontHeight), r.lineTo(o, e - .5 * n
  2350. .fontHeight)), r.closePath(), r.setStrokeStyle(p), r.stroke()
  2351. }
  2352. };
  2353. if (!n.widths || 1 == n.widths.length && n.widths[0].total <= s.width) {
  2354. var H = C(t),
  2355. U = H.fix,
  2356. Y = H.lineY;
  2357. return r.fillText(t, a, h + U), E(a, (h += v) - Y, n && n.widths && n.widths[0]
  2358. .total || n.text), r.restore(), void this.setBorder(e, i)
  2359. }
  2360. for (var $ = t.split(""), D = h, _ = a, X = "", N = 0, V = 0; V <= $.length; V++) {
  2361. var G = $[V] || "",
  2362. q = "\n" === G,
  2363. J = "" == G,
  2364. Q = X + (G = q ? "" : G),
  2365. Z = r.measureText(Q).width;
  2366. if (N >= I) break;
  2367. if (_ = a, Z > s.width || q || J) {
  2368. if (N++, X = J && Z <= s.width ? Q : X, N === I && Z > d) {
  2369. for (; r.measureText("".concat(X, "...")).width > s.width && !(X.length <=
  2370. 1);) X = X.substring(0, X.length - 1);
  2371. X += "..."
  2372. }
  2373. var K = C(X);
  2374. U = K.fix, Y = K.lineY;
  2375. if (r.fillText(X, _, h + U), E(_, (h += v) - Y, Z), X = G, h > D + c) break
  2376. } else X = Q
  2377. }
  2378. r.restore()
  2379. }
  2380. }, t.prototype.source = function(t) {
  2381. return i(this, void 0, void 0, (function() {
  2382. var e, i, r, o = this;
  2383. return n(this, (function(n) {
  2384. switch (n.label) {
  2385. case 0:
  2386. if (this.node = null, e = +new Date, "{}" == JSON
  2387. .stringify(t)) return [2];
  2388. if (!t.type)
  2389. for (i in t.type = gt, t.css = t.css || {}, t)[
  2390. "views", "children", "type", "css"]
  2391. .includes(i) || (t.css[i] = t[i], delete t[
  2392. i]);
  2393. return t.css && !t.css.width && (t.css || (t
  2394. .css = {})), [4, this.create(t)];
  2395. case 1:
  2396. return (r = n.sent()) ? (this.size = r.layout() ||
  2397. {}, this.node = r, this.onEffectFinished()
  2398. .then((function(t) {
  2399. return o.lifecycle(
  2400. "onEffectSuccess", t)
  2401. })).catch((function(t) {
  2402. return o.lifecycle(
  2403. "onEffectFail", t)
  2404. })), console.log("布局用时:" + (+new Date - e) +
  2405. "ms"), [2, this.size]) : [2, console
  2406. .warn("no node")
  2407. ]
  2408. }
  2409. }))
  2410. }))
  2411. }, t.prototype.getImageInfo = function(t) {
  2412. return this.imageBus[t] || (this.imageBus[t] = this.createImage(t, this.useCORS)), this
  2413. .imageBus[t]
  2414. }, t.prototype.create = function(t, r) {
  2415. return i(this, void 0, void 0, (function() {
  2416. var i, o, s, a, h, d, c, l, f, u, p, g, v, y, b, x, w;
  2417. return n(this, (function(n) {
  2418. switch (n.label) {
  2419. case 0:
  2420. if (i = t.type == ft, o = [ut, pt].includes(t.type),
  2421. s = t.css || {}, a = s.backgroundImage, h = s
  2422. .display, i && !t.src && !t.url || o && !t.text)
  2423. return [2];
  2424. if (h == m) return [2];
  2425. if (o && (t.text = String(t.text)), !(i || t.type ==
  2426. gt && a)) return [3, 4];
  2427. d = i ? t.src : "", c = /url\((.+)\)/.exec(a), a &&
  2428. c && c[1] && (d = c[1] || ""), n.label = 1;
  2429. case 1:
  2430. return n.trys.push([1, 3, , 4]), [4, this
  2431. .getImageInfo(d)
  2432. ];
  2433. case 2:
  2434. return l = n.sent(), f = l.width, u = l.height, !(
  2435. p = l.path) && i ? [2] : (p && (t
  2436. .attributes = Object.assign(t
  2437. .attributes || {}, {
  2438. width: f,
  2439. height: u,
  2440. path: p,
  2441. src: p,
  2442. naturalSrc: d
  2443. })), [3, 4]);
  2444. case 3:
  2445. return g = n.sent(), t.type != gt ? [2] : (this
  2446. .lifecycle("onEffectFail", e(e({}, g), {
  2447. src: d
  2448. })), [3, 4]);
  2449. case 4:
  2450. if (this.count += 1, v = new ct(t, r, this.root,
  2451. this.ctx), !(y = t.views || t.children))
  2452. return [3, 8];
  2453. b = 0, n.label = 5;
  2454. case 5:
  2455. return b < y.length ? (x = y[b], [4, this.create(x,
  2456. v)]) : [3, 8];
  2457. case 6:
  2458. (w = n.sent()) && v.add(w), n.label = 7;
  2459. case 7:
  2460. return b++, [3, 5];
  2461. case 8:
  2462. return [2, v]
  2463. }
  2464. }))
  2465. }))
  2466. }, t.prototype.drawNode = function(t, e) {
  2467. return void 0 === e && (e = !1), i(this, void 0, void 0, (function() {
  2468. var i, r, o, s, a, h, d, c, l, f, u, p, g, v, y, b, x, m, w, S;
  2469. return n(this, (function(n) {
  2470. switch (n.label) {
  2471. case 0:
  2472. return i = t.layoutBox, r = t.computedStyle, o = t
  2473. .attributes, s = t.name, a = t.children, h = t
  2474. .fixedLine, d = t.attributes, c = d.src, l = d
  2475. .text, ["fixed"].includes(r.position) && !e ? [
  2476. 2] : (this.ctx.save(), s !== gt ? [3, 7] :
  2477. c ? r.backgroundRepeat ? [4, this
  2478. .drawPattern(o, i, r)
  2479. ] : [3, 2] : [3, 5]);
  2480. case 1:
  2481. return n.sent(), [3, 4];
  2482. case 2:
  2483. return [4, this.drawImage(o, i, r, !1)];
  2484. case 3:
  2485. n.sent(), n.label = 4;
  2486. case 4:
  2487. return [3, 6];
  2488. case 5:
  2489. this.drawView(i, r), n.label = 6;
  2490. case 6:
  2491. return [3, 10];
  2492. case 7:
  2493. return s === ft && c ? [4, this.drawImage(o, i, r, !
  2494. 1)] : [3, 9];
  2495. case 8:
  2496. return n.sent(), [3, 10];
  2497. case 9:
  2498. s === ut ? this.drawText(l, i, r, o) : s === pt &&
  2499. lt.api && lt.api.draw(l, this, i, r), n.label =
  2500. 10;
  2501. case 10:
  2502. if (this.progress += 1, u = (f = h || {})
  2503. .beforeElements, p = f.afterElements, !u)
  2504. return [3, 14];
  2505. g = 0, v = u, n.label = 11;
  2506. case 11:
  2507. return g < v.length ? (S = v[g], [4, this.drawNode(
  2508. S)]) : [3, 14];
  2509. case 12:
  2510. n.sent(), n.label = 13;
  2511. case 13:
  2512. return g++, [3, 11];
  2513. case 14:
  2514. if (!a) return [3, 18];
  2515. y = Object.values ? Object.values(a) : Object.keys(
  2516. a).map((function(t) {
  2517. return a[t]
  2518. })), b = 0, x = y, n.label = 15;
  2519. case 15:
  2520. return b < x.length ? "absolute" === (S = x[b])
  2521. .computedStyle.position ? [3, 17] : [4, this
  2522. .drawNode(S)
  2523. ] : [3, 18];
  2524. case 16:
  2525. n.sent(), n.label = 17;
  2526. case 17:
  2527. return b++, [3, 15];
  2528. case 18:
  2529. if (!p) return [3, 22];
  2530. m = 0, w = p, n.label = 19;
  2531. case 19:
  2532. return m < w.length ? (S = w[m], [4, this.drawNode(
  2533. S)]) : [3, 22];
  2534. case 20:
  2535. n.sent(), n.label = 21;
  2536. case 21:
  2537. return m++, [3, 19];
  2538. case 22:
  2539. return this.ctx.restore(), [2]
  2540. }
  2541. }))
  2542. }))
  2543. }, t.prototype.render = function(t) {
  2544. var e = this;
  2545. return void 0 === t && (t = 30), new Promise((function(r, o) {
  2546. return i(e, void 0, void 0, (function() {
  2547. var e, i, s, a, h, d, c, l, f, u;
  2548. return n(this, (function(n) {
  2549. switch (n.label) {
  2550. case 0:
  2551. return e = +new Date, this.init(), [
  2552. 4, (p = t, void 0 === p && (
  2553. p = 0), new Promise(
  2554. (function(t) {
  2555. return setTimeout(
  2556. t, p
  2557. )
  2558. })))
  2559. ];
  2560. case 1:
  2561. n.sent(), n.label = 2;
  2562. case 2:
  2563. if (n.trys.push([2, 14, , 15]), !
  2564. this.node) return [3, 12];
  2565. if (i = this.root.fixedLine || {},
  2566. s = i.beforeElements, a = i
  2567. .afterElements, !s) return [3,
  2568. 6];
  2569. h = 0, d = s, n.label = 3;
  2570. case 3:
  2571. return h < d.length ? (f = d[h], [4,
  2572. this.drawNode(f, !0)
  2573. ]) : [3, 6];
  2574. case 4:
  2575. n.sent(), n.label = 5;
  2576. case 5:
  2577. return h++, [3, 3];
  2578. case 6:
  2579. return [4, this.drawNode(this
  2580. .node)];
  2581. case 7:
  2582. if (n.sent(), !a) return [3, 11];
  2583. c = 0, l = a, n.label = 8;
  2584. case 8:
  2585. return c < l.length ? (f = l[c], [4,
  2586. this.drawNode(f, !0)
  2587. ]) : [3, 11];
  2588. case 9:
  2589. n.sent(), n.label = 10;
  2590. case 10:
  2591. return c++, [3, 8];
  2592. case 11:
  2593. return r(this.node), [3, 13];
  2594. case 12:
  2595. this.lifecycle("onEffectFail",
  2596. "node is empty"), n.label =
  2597. 13;
  2598. case 13:
  2599. return [3, 15];
  2600. case 14:
  2601. return u = n.sent(), this.lifecycle(
  2602. "onEffectFail", u), o(u), [
  2603. 3, 15
  2604. ];
  2605. case 15:
  2606. return console.log("渲染用时:" + (+
  2607. new Date - e - 30) +
  2608. "ms"), [2]
  2609. }
  2610. var p
  2611. }))
  2612. }))
  2613. }))
  2614. }, t.prototype.onEffectFinished = function() {
  2615. var t = this,
  2616. e = Object.keys(this.imageBus).map((function(e) {
  2617. return t.imageBus[e]
  2618. }));
  2619. return Promise.all(e)
  2620. }, t.prototype.destroy = function() {
  2621. this.node = []
  2622. }, t.prototype.save = function(t) {
  2623. try {
  2624. var e = t || {},
  2625. i = e.fileType,
  2626. n = void 0 === i ? "png" : i,
  2627. r = e.quality,
  2628. o = void 0 === r ? 1 : r;
  2629. return this.canvas.toDataURL("image/".concat(n), o)
  2630. } catch (t) {
  2631. return this.lifecycle("onEffectFail", "image cross domain"), t
  2632. }
  2633. }, t
  2634. }();
  2635. r.WEB == R && (window.Painter = St), t.Painter = St, t.default = St, Object.defineProperty(t,
  2636. "__esModule", {
  2637. value: !0
  2638. })
  2639. }));