draftify-react 0.2.7 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import * as rr from "react";
2
- import Ei, { createContext as Ye, useRef as Gt, useLayoutEffect as Lu, useEffect as It, useId as ir, useContext as wt, useInsertionEffect as Po, useMemo as Ee, useCallback as Co, Children as Ou, isValidElement as _u, useState as nt, Fragment as Eo, createElement as Vu, forwardRef as Nu, Component as Uu } from "react";
2
+ import Ei, { createContext as Ye, useRef as Gt, useLayoutEffect as Lu, useEffect as It, useId as ir, useContext as wt, useInsertionEffect as Po, useMemo as Ee, useCallback as Co, Children as Ou, isValidElement as _u, useState as rt, Fragment as Eo, createElement as Vu, forwardRef as Nu, Component as Uu } from "react";
3
3
  import { normalizeDocument as zu, normalizeBlock as yr, handleCopy as Bu, imageToBase64 as $u, modifyCustomBlock as Wu, modifyCodeBlock as Hu, modifyLinkBlock as Yu, modifyVideoBlock as Gu, modifyImageBlock as Ku, modifyTableBlock as Xu, modifyListBlock as qu, modifyQuoteBlock as Qu, modifyParagraphBlock as Zu, modifySubheadingBlock as Ju, modifyHeadingBlock as tf, createCustomBlock as vr, createCodeBlock as ef, createLinkBlock as nf, createVideoBlock as rf, createImageBlock as af, createTableBlock as sf, createListBlock as of, createQuoteBlock as lf, createParagraphBlock as cf, createSubheadingBlock as uf, createHeadingBlock as ff, handleDownloadJSON as df, exportBlocksToDocx as hf } from "draftify";
4
4
  const mf = "_container_1mz3p_3", pf = "_mediaWrapper_1mz3p_19", gf = "_mediaItem_1mz3p_37", yf = "_footerOverlay_1mz3p_49", vf = "_refreshButton_1mz3p_69", bf = "_dropzone_1mz3p_95", xf = "_uploadLabel_1mz3p_111", wf = "_uploadIconCircle_1mz3p_135", Af = "_donutContainer_1mz3p_159", Sf = "_donutOuter_1mz3p_175", Tf = "_donutInner_1mz3p_191", Ft = {
5
5
  container: mf,
@@ -2247,7 +2247,7 @@ function Ka(t) {
2247
2247
  }), e;
2248
2248
  }
2249
2249
  const Fh = ({ children: t, custom: e, initial: n = !0, onExitComplete: r, presenceAffectsLayout: i = !0, mode: a = "sync", propagate: s = !1, anchorX: o = "left", root: c }) => {
2250
- const [d, l] = xl(s), u = Ee(() => Ka(t), [t]), f = s && !d ? [] : u.map(Dn), h = Gt(!0), m = Gt(u), b = ki(() => /* @__PURE__ */ new Map()), [w, v] = nt(u), [I, S] = nt(u);
2250
+ const [d, l] = xl(s), u = Ee(() => Ka(t), [t]), f = s && !d ? [] : u.map(Dn), h = Gt(!0), m = Gt(u), b = ki(() => /* @__PURE__ */ new Map()), [w, v] = rt(u), [I, S] = rt(u);
2251
2251
  Io(() => {
2252
2252
  h.current = !1, m.current = u;
2253
2253
  for (let A = 0; A < I.length; A++) {
@@ -5244,9 +5244,9 @@ try {
5244
5244
  typeof window < "u" && (la = window), typeof document < "u" && (lc = document), typeof MutationObserver < "u" && (cc = MutationObserver), typeof performance < "u" && (uc = performance);
5245
5245
  } catch {
5246
5246
  }
5247
- var w0 = la.navigator || {}, Ws = w0.userAgent, Hs = Ws === void 0 ? "" : Ws, fe = la, at = lc, Ys = cc, Fn = uc;
5247
+ var w0 = la.navigator || {}, Ws = w0.userAgent, Hs = Ws === void 0 ? "" : Ws, fe = la, st = lc, Ys = cc, Fn = uc;
5248
5248
  fe.document;
5249
- var ie = !!at.documentElement && !!at.head && typeof at.addEventListener == "function" && typeof at.createElement == "function", fc = ~Hs.indexOf("MSIE") || ~Hs.indexOf("Trident/"), Fr, A0 = /fa(k|kd|s|r|l|t|d|dr|dl|dt|b|slr|slpr|wsb|tl|ns|nds|es|jr|jfr|jdr|usb|ufsb|udsb|cr|ss|sr|sl|st|sds|sdr|sdl|sdt)?[\-\ ]/, S0 = /Font ?Awesome ?([567 ]*)(Solid|Regular|Light|Thin|Duotone|Brands|Free|Pro|Sharp Duotone|Sharp|Kit|Notdog Duo|Notdog|Chisel|Etch|Thumbprint|Jelly Fill|Jelly Duo|Jelly|Utility|Utility Fill|Utility Duo|Slab Press|Slab|Whiteboard)?.*/i, dc = {
5249
+ var ie = !!st.documentElement && !!st.head && typeof st.addEventListener == "function" && typeof st.createElement == "function", fc = ~Hs.indexOf("MSIE") || ~Hs.indexOf("Trident/"), Fr, A0 = /fa(k|kd|s|r|l|t|d|dr|dl|dt|b|slr|slpr|wsb|tl|ns|nds|es|jr|jfr|jdr|usb|ufsb|udsb|cr|ss|sr|sl|st|sds|sdr|sdl|sdt)?[\-\ ]/, S0 = /Font ?Awesome ?([567 ]*)(Solid|Regular|Light|Thin|Duotone|Brands|Free|Pro|Sharp Duotone|Sharp|Kit|Notdog Duo|Notdog|Chisel|Etch|Thumbprint|Jelly Fill|Jelly Duo|Jelly|Utility|Utility Fill|Utility Duo|Slab Press|Slab|Whiteboard)?.*/i, dc = {
5250
5250
  classic: {
5251
5251
  fa: "solid",
5252
5252
  fas: "solid",
@@ -5945,14 +5945,14 @@ var tg = A0, Nc = "fa-layers-text", eg = S0, ng = B({}, $0);
5945
5945
  Pn(ng);
5946
5946
  var rg = ["class", "data-prefix", "data-icon", "data-fa-transform", "data-fa-mask"], Or = T0, ig = [].concat($t(G0), $t(K1)), un = fe.FontAwesomeConfig || {};
5947
5947
  function ag(t) {
5948
- var e = at.querySelector("script[" + t + "]");
5948
+ var e = st.querySelector("script[" + t + "]");
5949
5949
  if (e)
5950
5950
  return e.getAttribute(t);
5951
5951
  }
5952
5952
  function sg(t) {
5953
5953
  return t === "" ? !0 : t === "false" ? !1 : t === "true" ? !0 : t;
5954
5954
  }
5955
- if (at && typeof at.querySelector == "function") {
5955
+ if (st && typeof st.querySelector == "function") {
5956
5956
  var og = [["data-family-prefix", "familyPrefix"], ["data-css-prefix", "cssPrefix"], ["data-family-default", "familyDefault"], ["data-style-default", "styleDefault"], ["data-replacement-class", "replacementClass"], ["data-auto-replace-svg", "autoReplaceSvg"], ["data-auto-add-css", "autoAddCss"], ["data-search-pseudo-elements", "searchPseudoElements"], ["data-search-pseudo-elements-warnings", "searchPseudoElementsWarnings"], ["data-search-pseudo-elements-full-scan", "searchPseudoElementsFullScan"], ["data-observe-mutations", "observeMutations"], ["data-mutate-approach", "mutateApproach"], ["data-keep-original-source", "keepOriginalSource"], ["data-measure-performance", "measurePerformance"], ["data-show-missing-icons", "showMissingIcons"]];
5957
5957
  og.forEach(function(t) {
5958
5958
  var e = cr(t, 2), n = e[0], r = e[1], i = sg(ag(n));
@@ -6020,13 +6020,13 @@ var Re = hi, Yt = {
6020
6020
  };
6021
6021
  function cg(t) {
6022
6022
  if (!(!t || !ie)) {
6023
- var e = at.createElement("style");
6023
+ var e = st.createElement("style");
6024
6024
  e.setAttribute("type", "text/css"), e.innerHTML = t;
6025
- for (var n = at.head.childNodes, r = null, i = n.length - 1; i > -1; i--) {
6025
+ for (var n = st.head.childNodes, r = null, i = n.length - 1; i > -1; i--) {
6026
6026
  var a = n[i], s = (a.tagName || "").toUpperCase();
6027
6027
  ["STYLE", "LINK"].indexOf(s) > -1 && (r = a);
6028
6028
  }
6029
- return at.head.insertBefore(e, r), t;
6029
+ return st.head.insertBefore(e, r), t;
6030
6030
  }
6031
6031
  }
6032
6032
  var ug = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
@@ -6667,11 +6667,11 @@ re[ne].styles || (re[ne].styles = {});
6667
6667
  re[ne].hooks || (re[ne].hooks = {});
6668
6668
  re[ne].shims || (re[ne].shims = []);
6669
6669
  var zt = re[ne], $c = [], Wc = function() {
6670
- at.removeEventListener("DOMContentLoaded", Wc), Qn = 1, $c.map(function(e) {
6670
+ st.removeEventListener("DOMContentLoaded", Wc), Qn = 1, $c.map(function(e) {
6671
6671
  return e();
6672
6672
  });
6673
6673
  }, Qn = !1;
6674
- ie && (Qn = (at.documentElement.doScroll ? /^loaded|^c/ : /^loaded|^i|^c/).test(at.readyState), Qn || at.addEventListener("DOMContentLoaded", Wc));
6674
+ ie && (Qn = (st.documentElement.doScroll ? /^loaded|^c/ : /^loaded|^i|^c/).test(st.readyState), Qn || st.addEventListener("DOMContentLoaded", Wc));
6675
6675
  function gg(t) {
6676
6676
  ie && (Qn ? setTimeout(t, 0) : $c.push(t));
6677
6677
  }
@@ -7031,7 +7031,7 @@ var eu = new kg(), Dg = function() {
7031
7031
  findIconDefinition: xi,
7032
7032
  toHtml: Cn
7033
7033
  }, Lg = function() {
7034
- var e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, n = e.autoReplaceSvgRoot, r = n === void 0 ? at : n;
7034
+ var e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, n = e.autoReplaceSvgRoot, r = n === void 0 ? st : n;
7035
7035
  (Object.keys(zt.styles).length > 0 || G.autoFetchSvg) && ie && G.autoReplaceSvg && Rt.dom.i2svg({
7036
7036
  node: r
7037
7037
  });
@@ -7048,7 +7048,7 @@ function hr(t, e) {
7048
7048
  }), Object.defineProperty(t, "node", {
7049
7049
  get: function() {
7050
7050
  if (ie) {
7051
- var r = at.createElement("div");
7051
+ var r = st.createElement("div");
7052
7052
  return r.innerHTML = t.html, r.children;
7053
7053
  }
7054
7054
  }
@@ -7252,15 +7252,15 @@ function Hg() {
7252
7252
  return t || Bn.replace;
7253
7253
  }
7254
7254
  function Yg(t) {
7255
- return at.createElementNS("http://www.w3.org/2000/svg", t);
7255
+ return st.createElementNS("http://www.w3.org/2000/svg", t);
7256
7256
  }
7257
7257
  function Gg(t) {
7258
- return at.createElement(t);
7258
+ return st.createElement(t);
7259
7259
  }
7260
7260
  function ru(t) {
7261
7261
  var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, n = e.ceFn, r = n === void 0 ? t.tag === "svg" ? Yg : Gg : n;
7262
7262
  if (typeof t == "string")
7263
- return at.createTextNode(t);
7263
+ return st.createTextNode(t);
7264
7264
  var i = r(t.tag);
7265
7265
  Object.keys(t.attributes || []).forEach(function(s) {
7266
7266
  i.setAttribute(s, t.attributes[s]);
@@ -7283,7 +7283,7 @@ var Bn = {
7283
7283
  if (e[1].forEach(function(i) {
7284
7284
  n.parentNode.insertBefore(ru(i), n);
7285
7285
  }), n.getAttribute(Ie) === null && G.keepOriginalSource) {
7286
- var r = at.createComment(Kg(n));
7286
+ var r = st.createComment(Kg(n));
7287
7287
  n.parentNode.replaceChild(r, n);
7288
7288
  } else
7289
7289
  n.remove();
@@ -7334,7 +7334,7 @@ function Ti() {
7334
7334
  var Zn = null;
7335
7335
  function lo(t) {
7336
7336
  if (Ys && G.observeMutations) {
7337
- var e = t.treeCallback, n = e === void 0 ? zn : e, r = t.nodeCallback, i = r === void 0 ? zn : r, a = t.pseudoElementsCallback, s = a === void 0 ? zn : a, o = t.observeMutationsRoot, c = o === void 0 ? at : o;
7337
+ var e = t.treeCallback, n = e === void 0 ? zn : e, r = t.nodeCallback, i = r === void 0 ? zn : r, a = t.pseudoElementsCallback, s = a === void 0 ? zn : a, o = t.observeMutationsRoot, c = o === void 0 ? st : o;
7338
7338
  Zn = new Ys(function(d) {
7339
7339
  if (!va) {
7340
7340
  var l = de();
@@ -7428,7 +7428,7 @@ function ey() {
7428
7428
  function uo(t) {
7429
7429
  var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null;
7430
7430
  if (!ie) return Promise.resolve();
7431
- var n = at.documentElement.classList, r = function(u) {
7431
+ var n = st.documentElement.classList, r = function(u) {
7432
7432
  return n.add("".concat(Xs, "-").concat(u));
7433
7433
  }, i = function(u) {
7434
7434
  return n.remove("".concat(Xs, "-").concat(u));
@@ -7529,7 +7529,7 @@ var iy = function(e) {
7529
7529
  },
7530
7530
  provides: function(e) {
7531
7531
  e.i2svg = function(n) {
7532
- var r = n.node, i = r === void 0 ? at : r, a = n.callback, s = a === void 0 ? function() {
7532
+ var r = n.node, i = r === void 0 ? st : r, a = n.callback, s = a === void 0 ? function() {
7533
7533
  } : a;
7534
7534
  return uo(i, s);
7535
7535
  }, e.generateSvgReplacementMutation = function(n, r) {
@@ -7720,7 +7720,7 @@ function mo(t, e) {
7720
7720
  iconName: I,
7721
7721
  extra: P,
7722
7722
  watchable: !0
7723
- })), p = at.createElementNS("http://www.w3.org/2000/svg", "svg");
7723
+ })), p = st.createElementNS("http://www.w3.org/2000/svg", "svg");
7724
7724
  e === "::before" ? t.insertBefore(p, t.firstChild) : t.appendChild(p), p.outerHTML = L.map(function(y) {
7725
7725
  return Cn(y);
7726
7726
  }).join(`
@@ -7841,7 +7841,7 @@ var yy = {
7841
7841
  },
7842
7842
  provides: function(e) {
7843
7843
  e.pseudoElements2svg = function(n) {
7844
- var r = n.node, i = r === void 0 ? at : r;
7844
+ var r = n.node, i = r === void 0 ? st : r;
7845
7845
  G.searchPseudoElements && po(i);
7846
7846
  };
7847
7847
  }
@@ -8660,7 +8660,7 @@ function tv({ tableBlock: t }) {
8660
8660
  ] }, t.id);
8661
8661
  }
8662
8662
  function ev({ handleClick: t }) {
8663
- const [e, n] = nt(!1), [r, i] = nt(0), [a, s] = nt(0), [o, c] = nt({ rows: 2, cols: 2 }), [d, l] = nt(!1), u = 10, f = {
8663
+ const [e, n] = rt(!1), [r, i] = rt(0), [a, s] = rt(0), [o, c] = rt({ rows: 2, cols: 2 }), [d, l] = rt(!1), u = 10, f = {
8664
8664
  position: "absolute",
8665
8665
  transform: "translateX(-40px) translateY(10px)",
8666
8666
  backgroundColor: "white",
@@ -9766,117 +9766,117 @@ const Nt = (function() {
9766
9766
  const D = M[0], C = M[1], O = M[2], x = M[3], g = M[4], _ = M[5];
9767
9767
  let F = 6, U = 8, j = 255;
9768
9768
  for (var N = 0; N < p.length; N++) {
9769
- const ot = new Uint8Array(p[N]);
9770
- for (var $ = ot.length, z = 0; z < $; z += 4) j &= ot[z + 3];
9769
+ const gt = new Uint8Array(p[N]);
9770
+ for (var $ = gt.length, z = 0; z < $; z += 4) j &= gt[z + 3];
9771
9771
  }
9772
- const V = j != 255, K = (function(rt, et, gt, St, ft, kt) {
9772
+ const V = j != 255, K = (function(et, it, nt, St, ft, kt) {
9773
9773
  const dt = [];
9774
- for (var it = 0; it < rt.length; it++) {
9775
- const Tt = new Uint8Array(rt[it]), _t = new Uint32Array(Tt.buffer);
9774
+ for (var at = 0; at < et.length; at++) {
9775
+ const Tt = new Uint8Array(et[at]), _t = new Uint32Array(Tt.buffer);
9776
9776
  var Mt;
9777
- let Dt = 0, qt = 0, Wt = et, ge = gt, pr = St ? 1 : 0;
9778
- if (it != 0) {
9779
- const ju = kt || St || it == 1 || dt[it - 2].dispose != 0 ? 1 : 2;
9777
+ let Dt = 0, qt = 0, Wt = it, ge = nt, pr = St ? 1 : 0;
9778
+ if (at != 0) {
9779
+ const ju = kt || St || at == 1 || dt[at - 2].dispose != 0 ? 1 : 2;
9780
9780
  let gr = 0, wa = 1e9;
9781
9781
  for (let Ze = 0; Ze < ju; Ze++) {
9782
- var ae = new Uint8Array(rt[it - 1 - Ze]);
9783
- const Fu = new Uint32Array(rt[it - 1 - Ze]);
9784
- let se = et, oe = gt, Me = -1, Je = -1;
9785
- for (let ye = 0; ye < gt; ye++) for (let ve = 0; ve < et; ve++)
9786
- _t[bt = ye * et + ve] != Fu[bt] && (ve < se && (se = ve), ve > Me && (Me = ve), ye < oe && (oe = ye), ye > Je && (Je = ye));
9782
+ var ae = new Uint8Array(et[at - 1 - Ze]);
9783
+ const Fu = new Uint32Array(et[at - 1 - Ze]);
9784
+ let se = it, oe = nt, Me = -1, Je = -1;
9785
+ for (let ye = 0; ye < nt; ye++) for (let ve = 0; ve < it; ve++)
9786
+ _t[bt = ye * it + ve] != Fu[bt] && (ve < se && (se = ve), ve > Me && (Me = ve), ye < oe && (oe = ye), ye > Je && (Je = ye));
9787
9787
  Me == -1 && (se = oe = Me = Je = 0), ft && ((1 & se) == 1 && se--, (1 & oe) == 1 && oe--);
9788
9788
  const Aa = (Me - se + 1) * (Je - oe + 1);
9789
9789
  Aa < wa && (wa = Aa, gr = Ze, Dt = se, qt = oe, Wt = Me - se + 1, ge = Je - oe + 1);
9790
9790
  }
9791
- ae = new Uint8Array(rt[it - 1 - gr]), gr == 1 && (dt[it - 1].dispose = 2), Mt = new Uint8Array(Wt * ge * 4), t(ae, et, gt, Mt, Wt, ge, -Dt, -qt, 0), pr = t(Tt, et, gt, Mt, Wt, ge, -Dt, -qt, 3) ? 1 : 0, pr == 1 ? f(Tt, et, gt, Mt, { x: Dt, y: qt, width: Wt, height: ge }) : t(Tt, et, gt, Mt, Wt, ge, -Dt, -qt, 0);
9791
+ ae = new Uint8Array(et[at - 1 - gr]), gr == 1 && (dt[at - 1].dispose = 2), Mt = new Uint8Array(Wt * ge * 4), t(ae, it, nt, Mt, Wt, ge, -Dt, -qt, 0), pr = t(Tt, it, nt, Mt, Wt, ge, -Dt, -qt, 3) ? 1 : 0, pr == 1 ? f(Tt, it, nt, Mt, { x: Dt, y: qt, width: Wt, height: ge }) : t(Tt, it, nt, Mt, Wt, ge, -Dt, -qt, 0);
9792
9792
  } else Mt = Tt.slice(0);
9793
9793
  dt.push({ rect: { x: Dt, y: qt, width: Wt, height: ge }, img: Mt, blend: pr, dispose: 0 });
9794
9794
  }
9795
- if (St) for (it = 0; it < dt.length; it++) {
9796
- if ((pe = dt[it]).blend == 1) continue;
9797
- const Tt = pe.rect, _t = dt[it - 1].rect, Dt = Math.min(Tt.x, _t.x), qt = Math.min(Tt.y, _t.y), Wt = { x: Dt, y: qt, width: Math.max(Tt.x + Tt.width, _t.x + _t.width) - Dt, height: Math.max(Tt.y + Tt.height, _t.y + _t.height) - qt };
9798
- dt[it - 1].dispose = 1, it - 1 != 0 && u(rt, et, gt, dt, it - 1, Wt, ft), u(rt, et, gt, dt, it, Wt, ft);
9795
+ if (St) for (at = 0; at < dt.length; at++) {
9796
+ if ((pe = dt[at]).blend == 1) continue;
9797
+ const Tt = pe.rect, _t = dt[at - 1].rect, Dt = Math.min(Tt.x, _t.x), qt = Math.min(Tt.y, _t.y), Wt = { x: Dt, y: qt, width: Math.max(Tt.x + Tt.width, _t.x + _t.width) - Dt, height: Math.max(Tt.y + Tt.height, _t.y + _t.height) - qt };
9798
+ dt[at - 1].dispose = 1, at - 1 != 0 && u(et, it, nt, dt, at - 1, Wt, ft), u(et, it, nt, dt, at, Wt, ft);
9799
9799
  }
9800
9800
  let En = 0;
9801
- if (rt.length != 1) for (var bt = 0; bt < dt.length; bt++) {
9801
+ if (et.length != 1) for (var bt = 0; bt < dt.length; bt++) {
9802
9802
  var pe;
9803
9803
  En += (pe = dt[bt]).rect.width * pe.rect.height;
9804
9804
  }
9805
9805
  return dt;
9806
9806
  })(p, y, T, D, C, O), q = {}, J = [], tt = [];
9807
9807
  if (k != 0) {
9808
- const ot = [];
9809
- for (z = 0; z < K.length; z++) ot.push(K[z].img.buffer);
9810
- const rt = (function(ft) {
9808
+ const gt = [];
9809
+ for (z = 0; z < K.length; z++) gt.push(K[z].img.buffer);
9810
+ const et = (function(ft) {
9811
9811
  let kt = 0;
9812
9812
  for (var dt = 0; dt < ft.length; dt++) kt += ft[dt].byteLength;
9813
- const it = new Uint8Array(kt);
9813
+ const at = new Uint8Array(kt);
9814
9814
  let Mt = 0;
9815
9815
  for (dt = 0; dt < ft.length; dt++) {
9816
9816
  const ae = new Uint8Array(ft[dt]), En = ae.length;
9817
9817
  for (let bt = 0; bt < En; bt += 4) {
9818
9818
  let pe = ae[bt], Tt = ae[bt + 1], _t = ae[bt + 2];
9819
9819
  const Dt = ae[bt + 3];
9820
- Dt == 0 && (pe = Tt = _t = 0), it[Mt + bt] = pe, it[Mt + bt + 1] = Tt, it[Mt + bt + 2] = _t, it[Mt + bt + 3] = Dt;
9820
+ Dt == 0 && (pe = Tt = _t = 0), at[Mt + bt] = pe, at[Mt + bt + 1] = Tt, at[Mt + bt + 2] = _t, at[Mt + bt + 3] = Dt;
9821
9821
  }
9822
9822
  Mt += En;
9823
9823
  }
9824
- return it.buffer;
9825
- })(ot), et = b(rt, k);
9826
- for (z = 0; z < et.plte.length; z++) J.push(et.plte[z].est.rgba);
9827
- let gt = 0;
9824
+ return at.buffer;
9825
+ })(gt), it = b(et, k);
9826
+ for (z = 0; z < it.plte.length; z++) J.push(it.plte[z].est.rgba);
9827
+ let nt = 0;
9828
9828
  for (z = 0; z < K.length; z++) {
9829
9829
  const St = (Y = K[z]).img.length;
9830
- var H = new Uint8Array(et.inds.buffer, gt >> 2, St >> 2);
9830
+ var H = new Uint8Array(it.inds.buffer, nt >> 2, St >> 2);
9831
9831
  tt.push(H);
9832
- const ft = new Uint8Array(et.abuf, gt, St);
9833
- _ && o(Y.img, Y.rect.width, Y.rect.height, J, ft, H), Y.img.set(ft), gt += St;
9832
+ const ft = new Uint8Array(it.abuf, nt, St);
9833
+ _ && o(Y.img, Y.rect.width, Y.rect.height, J, ft, H), Y.img.set(ft), nt += St;
9834
9834
  }
9835
9835
  } else for (N = 0; N < K.length; N++) {
9836
9836
  var Y = K[N];
9837
- const ot = new Uint32Array(Y.img.buffer);
9837
+ const gt = new Uint32Array(Y.img.buffer);
9838
9838
  var W = Y.rect.width;
9839
- for ($ = ot.length, H = new Uint8Array($), tt.push(H), z = 0; z < $; z++) {
9840
- const rt = ot[z];
9841
- if (z != 0 && rt == ot[z - 1]) H[z] = H[z - 1];
9842
- else if (z > W && rt == ot[z - W]) H[z] = H[z - W];
9839
+ for ($ = gt.length, H = new Uint8Array($), tt.push(H), z = 0; z < $; z++) {
9840
+ const et = gt[z];
9841
+ if (z != 0 && et == gt[z - 1]) H[z] = H[z - 1];
9842
+ else if (z > W && et == gt[z - W]) H[z] = H[z - W];
9843
9843
  else {
9844
- let et = q[rt];
9845
- if (et == null && (q[rt] = et = J.length, J.push(rt), J.length >= 300)) break;
9846
- H[z] = et;
9844
+ let it = q[et];
9845
+ if (it == null && (q[et] = it = J.length, J.push(et), J.length >= 300)) break;
9846
+ H[z] = it;
9847
9847
  }
9848
9848
  }
9849
9849
  }
9850
9850
  const Z = J.length;
9851
9851
  for (Z <= 256 && g == 0 && (U = Z <= 2 ? 1 : Z <= 4 ? 2 : Z <= 16 ? 4 : 8, U = Math.max(U, x)), N = 0; N < K.length; N++) {
9852
9852
  (Y = K[N]).rect.x, Y.rect.y, W = Y.rect.width;
9853
- const ot = Y.rect.height;
9854
- let rt = Y.img;
9855
- new Uint32Array(rt.buffer);
9856
- let et = 4 * W, gt = 4;
9853
+ const gt = Y.rect.height;
9854
+ let et = Y.img;
9855
+ new Uint32Array(et.buffer);
9856
+ let it = 4 * W, nt = 4;
9857
9857
  if (Z <= 256 && g == 0) {
9858
- et = Math.ceil(U * W / 8);
9859
- var pt = new Uint8Array(et * ot);
9858
+ it = Math.ceil(U * W / 8);
9859
+ var pt = new Uint8Array(it * gt);
9860
9860
  const St = tt[N];
9861
- for (let ft = 0; ft < ot; ft++) {
9862
- z = ft * et;
9861
+ for (let ft = 0; ft < gt; ft++) {
9862
+ z = ft * it;
9863
9863
  const kt = ft * W;
9864
- if (U == 8) for (var st = 0; st < W; st++) pt[z + st] = St[kt + st];
9865
- else if (U == 4) for (st = 0; st < W; st++) pt[z + (st >> 1)] |= St[kt + st] << 4 - 4 * (1 & st);
9866
- else if (U == 2) for (st = 0; st < W; st++) pt[z + (st >> 2)] |= St[kt + st] << 6 - 2 * (3 & st);
9867
- else if (U == 1) for (st = 0; st < W; st++) pt[z + (st >> 3)] |= St[kt + st] << 7 - 1 * (7 & st);
9864
+ if (U == 8) for (var ot = 0; ot < W; ot++) pt[z + ot] = St[kt + ot];
9865
+ else if (U == 4) for (ot = 0; ot < W; ot++) pt[z + (ot >> 1)] |= St[kt + ot] << 4 - 4 * (1 & ot);
9866
+ else if (U == 2) for (ot = 0; ot < W; ot++) pt[z + (ot >> 2)] |= St[kt + ot] << 6 - 2 * (3 & ot);
9867
+ else if (U == 1) for (ot = 0; ot < W; ot++) pt[z + (ot >> 3)] |= St[kt + ot] << 7 - 1 * (7 & ot);
9868
9868
  }
9869
- rt = pt, F = 3, gt = 1;
9869
+ et = pt, F = 3, nt = 1;
9870
9870
  } else if (V == 0 && K.length == 1) {
9871
- pt = new Uint8Array(W * ot * 3);
9872
- const St = W * ot;
9871
+ pt = new Uint8Array(W * gt * 3);
9872
+ const St = W * gt;
9873
9873
  for (z = 0; z < St; z++) {
9874
9874
  const ft = 3 * z, kt = 4 * z;
9875
- pt[ft] = rt[kt], pt[ft + 1] = rt[kt + 1], pt[ft + 2] = rt[kt + 2];
9875
+ pt[ft] = et[kt], pt[ft + 1] = et[kt + 1], pt[ft + 2] = et[kt + 2];
9876
9876
  }
9877
- rt = pt, F = 2, gt = 3, et = 3 * W;
9877
+ et = pt, F = 2, nt = 3, it = 3 * W;
9878
9878
  }
9879
- Y.img = rt, Y.bpl = et, Y.bpp = gt;
9879
+ Y.img = et, Y.bpl = it, Y.bpp = nt;
9880
9880
  }
9881
9881
  return { ctype: F, depth: U, plte: J, frames: K };
9882
9882
  }
@@ -10577,7 +10577,7 @@ function mv({ progress: t = null }) {
10577
10577
  ) });
10578
10578
  }
10579
10579
  function So({ mediaBlock: t, modifyMedia: e }) {
10580
- const [n, r] = nt(""), [i, a] = nt(""), [s, o] = nt(""), [c, d] = nt(""), [l, u] = nt(!1), [f, h] = nt(null), m = Gt(null);
10580
+ const [n, r] = rt(""), [i, a] = rt(""), [s, o] = rt(""), [c, d] = rt(""), [l, u] = rt(!1), [f, h] = rt(null), m = Gt(null);
10581
10581
  It(() => {
10582
10582
  window.addEventListener("dragover", (w) => w.preventDefault()), window.addEventListener("drop", (w) => w.preventDefault());
10583
10583
  }, []), It(() => {
@@ -10704,7 +10704,7 @@ const Ci = {
10704
10704
  fontSize: "14px"
10705
10705
  };
10706
10706
  function yv({ linkBlock: t, modifyLink: e }) {
10707
- const [n, r] = nt(t.data.linkText), [i, a] = nt(t.data.url);
10707
+ const [n, r] = rt(t.data.linkText), [i, a] = rt(t.data.url);
10708
10708
  return It(() => {
10709
10709
  e({ linkBlockId: t.id, linkText: n, url: i });
10710
10710
  }, [n, i, t.id]), /* @__PURE__ */ R.jsxs("div", { style: { display: "flex" }, children: [
@@ -10842,7 +10842,7 @@ function wv({
10842
10842
  }
10843
10843
  }
10844
10844
  function sn({ text: t, children: e }) {
10845
- const [n, r] = nt(!1), i = {
10845
+ const [n, r] = rt(!1), i = {
10846
10846
  position: "relative",
10847
10847
  display: "inline-block"
10848
10848
  }, a = {
@@ -10895,7 +10895,7 @@ const To = [
10895
10895
  { id: 13, type: "custom-3", iconText: "C3" }
10896
10896
  ];
10897
10897
  function Av({ handleClick: t, options: e }) {
10898
- const [n, r] = nt(null), i = (o, c) => {
10898
+ const [n, r] = rt(null), i = (o, c) => {
10899
10899
  r(o), t(c);
10900
10900
  }, a = e.map((o) => {
10901
10901
  if (o.includes("-")) {
@@ -10989,7 +10989,7 @@ function Tv({
10989
10989
  setPromptAction: i,
10990
10990
  handleCopy: a
10991
10991
  }) {
10992
- const [s, o] = nt(!1), [c, d] = nt(null), l = Gt(null);
10992
+ const [s, o] = rt(!1), [c, d] = rt(null), l = Gt(null);
10993
10993
  It(() => {
10994
10994
  l.current && (l.current.style.transform = t === "editor" ? "translateX(14px)" : "translateX(1px)");
10995
10995
  }, [t]), It(() => {
@@ -11121,7 +11121,7 @@ function Tv({
11121
11121
  );
11122
11122
  }
11123
11123
  function Pv() {
11124
- const [t, e] = nt(!1), n = {
11124
+ const [t, e] = rt(!1), n = {
11125
11125
  display: "flex",
11126
11126
  flexDirection: "column",
11127
11127
  justifyContent: "center",
@@ -11191,7 +11191,7 @@ function Ev({
11191
11191
  handlePromptAction: o,
11192
11192
  setPromptVisiblility: c
11193
11193
  }) {
11194
- const [d, l] = nt(null), u = {
11194
+ const [d, l] = rt(null), u = {
11195
11195
  width: "100%",
11196
11196
  border: "1px solid #d1d5db",
11197
11197
  borderRadius: "0.375rem",
@@ -11296,11 +11296,11 @@ function Iv({
11296
11296
  defaultCustomData3: i,
11297
11297
  localStorageEnable: a
11298
11298
  }) {
11299
- const [s, o] = nt({
11299
+ const [s, o] = rt({
11300
11300
  metadata: {},
11301
11301
  version: "1.0.0",
11302
11302
  blocks: t
11303
- }), [c, d] = nt(""), [l, u] = nt(""), [f, h] = nt(""), [m, b] = nt([]), [w, v] = nt("editor"), [I, S] = nt(!1), [E, P] = nt("");
11303
+ }), [c, d] = rt(""), [l, u] = rt(""), [f, h] = rt(""), [m, b] = rt([]), [w, v] = rt("editor"), [I, S] = rt(!1), [E, P] = rt("");
11304
11304
  It(() => {
11305
11305
  if (!Array.isArray(t))
11306
11306
  throw new Error(
@@ -11656,56 +11656,58 @@ function Qv({
11656
11656
  // enable localStorage
11657
11657
  localStorageEnable: f,
11658
11658
  // enable Draftify background
11659
- backgroundEnable: h
11659
+ backgroundEnable: h,
11660
+ // draftify container background set
11661
+ DraftifyBackground: m
11660
11662
  }) {
11661
11663
  const {
11662
11664
  // current view
11663
- view: m,
11664
- setView: b,
11665
+ view: b,
11666
+ setView: w,
11665
11667
  // background grid
11666
- gridDots: w,
11667
- setGridDots: v,
11668
+ gridDots: v,
11669
+ setGridDots: I,
11668
11670
  // document metadata
11669
- docTitle: I,
11670
- setDocTitle: S,
11671
- description: E,
11672
- setDescription: P,
11673
- author: A,
11674
- setAuthor: L,
11671
+ docTitle: S,
11672
+ setDocTitle: E,
11673
+ description: P,
11674
+ setDescription: A,
11675
+ author: L,
11676
+ setAuthor: p,
11675
11677
  // copy blocks
11676
- handleCopy: p,
11678
+ handleCopy: y,
11677
11679
  // prompt handlers
11678
- handlePromptAction: y,
11679
- promptAction: T,
11680
- setPromptAction: k,
11681
- promptVisibility: M,
11682
- setPromptVisiblility: D,
11680
+ handlePromptAction: T,
11681
+ promptAction: k,
11682
+ setPromptAction: M,
11683
+ promptVisibility: D,
11684
+ setPromptVisiblility: C,
11683
11685
  // block creator
11684
- handleClick: C,
11686
+ handleClick: O,
11685
11687
  // block modifiers
11686
- modifyHeading: O,
11687
- modifySubheading: x,
11688
- modifyParagraph: g,
11689
- modifyQuote: _,
11690
- modifyList: F,
11691
- modifyTable: U,
11692
- modifyImage: j,
11693
- modifyVideo: N,
11694
- modifyLink: $,
11695
- modifyCode: z,
11696
- modifyCustom: V,
11688
+ modifyHeading: x,
11689
+ modifySubheading: g,
11690
+ modifyParagraph: _,
11691
+ modifyQuote: F,
11692
+ modifyList: U,
11693
+ modifyTable: j,
11694
+ modifyImage: N,
11695
+ modifyVideo: $,
11696
+ modifyLink: z,
11697
+ modifyCode: V,
11698
+ modifyCustom: K,
11697
11699
  // drag and drop handlers
11698
- onDropHandler: K,
11699
- onDragStart: q,
11700
- onDragEnd: J,
11701
- onDragEnter: tt,
11702
- onDragLeave: H,
11703
- containerVariants: Y,
11704
- itemVariants: W,
11705
- transitions: Z,
11706
- whileHover: pt,
11700
+ onDropHandler: q,
11701
+ onDragStart: J,
11702
+ onDragEnd: tt,
11703
+ onDragEnter: H,
11704
+ onDragLeave: Y,
11705
+ containerVariants: W,
11706
+ itemVariants: Z,
11707
+ transitions: pt,
11708
+ whileHover: ot,
11707
11709
  // block delete
11708
- handleDelete: st
11710
+ handleDelete: gt
11709
11711
  } = Iv({
11710
11712
  blocksData: t,
11711
11713
  modifyBlocks: e,
@@ -11714,105 +11716,112 @@ function Qv({
11714
11716
  defaultCustomData3: u,
11715
11717
  localStorageEnable: f
11716
11718
  });
11717
- return kv(v), /* @__PURE__ */ R.jsxs("div", { className: "draftify-root", children: [
11718
- h && /* @__PURE__ */ R.jsx(Cv, { gridDots: w }),
11719
- /* @__PURE__ */ R.jsxs("div", { className: "draftify-container", children: [
11720
- /* @__PURE__ */ R.jsx(
11721
- Tv,
11722
- {
11723
- view: m,
11724
- setView: b,
11725
- blocksData: t,
11726
- setPromptAction: k,
11727
- setPromptVisiblility: D,
11728
- handleCopy: p
11729
- }
11730
- ),
11731
- M && /* @__PURE__ */ R.jsx(
11732
- Ev,
11733
- {
11734
- docTitle: I,
11735
- setDocTitle: S,
11736
- description: E,
11737
- setDescription: P,
11738
- author: A,
11739
- setAuthor: L,
11740
- promptAction: T,
11741
- handlePromptAction: y,
11742
- setPromptVisiblility: D
11743
- }
11744
- ),
11745
- m === "editor" && /* @__PURE__ */ R.jsxs(R.Fragment, { children: [
11746
- /* @__PURE__ */ R.jsx(Av, { handleClick: C, options: n }),
11747
- /* @__PURE__ */ R.jsx("div", { className: "editor-area", onSubmit: (ot) => ot.preventDefault(), children: /* @__PURE__ */ R.jsx(
11748
- zs.div,
11749
- {
11750
- style: { display: "grid", gap: "10px" },
11751
- variants: Y,
11752
- animate: "show",
11753
- exit: "hidden",
11754
- children: /* @__PURE__ */ R.jsx(Fh, { children: t.map((ot, rt) => /* @__PURE__ */ R.jsxs(
11719
+ return kv(I), /* @__PURE__ */ R.jsxs("div", { className: "draftify-root", children: [
11720
+ h && /* @__PURE__ */ R.jsx(Cv, { gridDots: v }),
11721
+ /* @__PURE__ */ R.jsxs(
11722
+ "div",
11723
+ {
11724
+ style: { backgroundColor: m },
11725
+ className: "draftify-container",
11726
+ children: [
11727
+ /* @__PURE__ */ R.jsx(
11728
+ Tv,
11729
+ {
11730
+ view: b,
11731
+ setView: w,
11732
+ blocksData: t,
11733
+ setPromptAction: M,
11734
+ setPromptVisiblility: C,
11735
+ handleCopy: y
11736
+ }
11737
+ ),
11738
+ D && /* @__PURE__ */ R.jsx(
11739
+ Ev,
11740
+ {
11741
+ docTitle: S,
11742
+ setDocTitle: E,
11743
+ description: P,
11744
+ setDescription: A,
11745
+ author: L,
11746
+ setAuthor: p,
11747
+ promptAction: k,
11748
+ handlePromptAction: T,
11749
+ setPromptVisiblility: C
11750
+ }
11751
+ ),
11752
+ b === "editor" && /* @__PURE__ */ R.jsxs(R.Fragment, { children: [
11753
+ /* @__PURE__ */ R.jsx(Av, { handleClick: O, options: n }),
11754
+ /* @__PURE__ */ R.jsx("div", { className: "editor-area", onSubmit: (et) => et.preventDefault(), children: /* @__PURE__ */ R.jsx(
11755
11755
  zs.div,
11756
11756
  {
11757
- layout: !0,
11757
+ style: { display: "grid", gap: "10px" },
11758
11758
  variants: W,
11759
- transition: Z,
11760
- whileHover: pt,
11761
- draggable: !0,
11762
- onDragStart: (et) => q(et, rt),
11763
- onDragEnd: (et) => J(et),
11764
- onDragOver: (et) => et.preventDefault(),
11765
- onDragEnter: (et) => tt(et),
11766
- onDragLeave: (et) => H(et),
11767
- onDrop: (et) => K(et, rt),
11768
- className: "block-container",
11769
- children: [
11770
- /* @__PURE__ */ R.jsx(Pv, {}),
11771
- /* @__PURE__ */ R.jsx(
11772
- wv,
11773
- {
11774
- block: ot,
11775
- modifyHeading: O,
11776
- modifySubheading: x,
11777
- modifyParagraph: g,
11778
- modifyQuote: _,
11779
- modifyList: F,
11780
- modifyTable: U,
11781
- modifyImage: j,
11782
- modifyVideo: N,
11783
- modifyLink: $,
11784
- modifyCode: z,
11785
- modifyCustom: V,
11786
- CustomEditor1: r,
11787
- CustomEditor2: i,
11788
- CustomEditor3: a
11789
- }
11790
- ),
11791
- /* @__PURE__ */ R.jsx(
11792
- Xt,
11793
- {
11794
- icon: ["fas", "trash"],
11795
- className: "delete-icon",
11796
- onClick: () => st(ot.id)
11797
- }
11798
- )
11799
- ]
11800
- },
11801
- ot.id
11802
- )) })
11803
- }
11804
- ) })
11805
- ] }),
11806
- m === "preview" && /* @__PURE__ */ R.jsx("div", { className: "output-area", onSubmit: (ot) => ot.preventDefault(), children: /* @__PURE__ */ R.jsx(
11807
- Sv,
11808
- {
11809
- blocksData: t,
11810
- CustomOutput1: s,
11811
- CustomOutput2: o,
11812
- CustomOutput3: c
11813
- }
11814
- ) })
11815
- ] })
11759
+ animate: "show",
11760
+ exit: "hidden",
11761
+ children: /* @__PURE__ */ R.jsx(Fh, { children: t.map((et, it) => /* @__PURE__ */ R.jsxs(
11762
+ zs.div,
11763
+ {
11764
+ layout: !0,
11765
+ variants: Z,
11766
+ transition: pt,
11767
+ whileHover: ot,
11768
+ draggable: !0,
11769
+ onDragStart: (nt) => J(nt, it),
11770
+ onDragEnd: (nt) => tt(nt),
11771
+ onDragOver: (nt) => nt.preventDefault(),
11772
+ onDragEnter: (nt) => H(nt),
11773
+ onDragLeave: (nt) => Y(nt),
11774
+ onDrop: (nt) => q(nt, it),
11775
+ className: "block-container",
11776
+ children: [
11777
+ /* @__PURE__ */ R.jsx(Pv, {}),
11778
+ /* @__PURE__ */ R.jsx(
11779
+ wv,
11780
+ {
11781
+ block: et,
11782
+ modifyHeading: x,
11783
+ modifySubheading: g,
11784
+ modifyParagraph: _,
11785
+ modifyQuote: F,
11786
+ modifyList: U,
11787
+ modifyTable: j,
11788
+ modifyImage: N,
11789
+ modifyVideo: $,
11790
+ modifyLink: z,
11791
+ modifyCode: V,
11792
+ modifyCustom: K,
11793
+ CustomEditor1: r,
11794
+ CustomEditor2: i,
11795
+ CustomEditor3: a
11796
+ }
11797
+ ),
11798
+ /* @__PURE__ */ R.jsx(
11799
+ Xt,
11800
+ {
11801
+ icon: ["fas", "trash"],
11802
+ className: "delete-icon",
11803
+ onClick: () => gt(et.id)
11804
+ }
11805
+ )
11806
+ ]
11807
+ },
11808
+ et.id
11809
+ )) })
11810
+ }
11811
+ ) })
11812
+ ] }),
11813
+ b === "preview" && /* @__PURE__ */ R.jsx("div", { className: "output-area", onSubmit: (et) => et.preventDefault(), children: /* @__PURE__ */ R.jsx(
11814
+ Sv,
11815
+ {
11816
+ blocksData: t,
11817
+ CustomOutput1: s,
11818
+ CustomOutput2: o,
11819
+ CustomOutput3: c
11820
+ }
11821
+ ) })
11822
+ ]
11823
+ }
11824
+ )
11816
11825
  ] });
11817
11826
  }
11818
11827
  export {