PageSourceSearch

https://wooshair.com/cdn/shop/t/58/assets/split-type.min.js?v=100947066967010440601782421386

js wooshair.com collected 2026-09-24 13:25:44 UTC 19,915 bytes, 706 lines download raw bytes

1/**
2 * SplitType
3 * https://github.com/lukePeavey/SplitType
4 * @version 0.3.4
5 * @author Luke Peavey <[email protected]>
6 */
7
8!(function (t, e) {
9  "object" == typeof exports && "undefined" != typeof module
10    ? (module.exports = e())
11    : "function" == typeof define && define.amd
12    ? define(e)
13    : ((t =
14        "undefined" != typeof globalThis ? globalThis : t || self).SplitType =
15        e());
16})(this, function () {
17  "use strict";
18  function t(t, e) {
19    for (var n = 0; n < e.length; n++) {
20      var r = e[n];
21      (r.enumerable = r.enumerable || !1),
22        (r.configurable = !0),
23        "value" in r && (r.writable = !0),
24        Object.defineProperty(t, r.key, r);
25    }
26  }
27  function e(e, n, r) {
28    return n && t(e.prototype, n), r && t(e, r), e;
29  }
30  function n(t, e, n) {
31    return (
32      e in t
33        ? Object.defineProperty(t, e, {
34            value: n,
35            enumerable: !0,
36            configurable: !0,
37            writable: !0,
38          })
39        : (t[e] = n),
40      t
41    );
42  }
43  function r(t, e) {
44    var n = Object.keys(t);
45    if (Object.getOwnPropertySymbols) {
46      var r = Object.getOwnPropertySymbols(t);
47      e &&
48        (r = r.filter(function (e) {
49          return Object.getOwnPropertyDescriptor(t, e).enumerable;
50        })),
51        n.push.apply(n, r);
52    }
53    return n;
54  }
55  function o(t) {
56    for (var e = 1; e < arguments.length; e++) {
57      var o = null != arguments[e] ? arguments[e] : {};
58      e % 2
59        ? r(Object(o), !0).forEach(function (e) {
60            n(t, e, o[e]);
61          })
62        : Object.getOwnPropertyDescriptors
63        ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(o))
64        : r(Object(o)).forEach(function (e) {
65            Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(o, e));
66          });
67    }
68    return t;
69  }
70  function i(t, e) {
71    return (
72      (function (t) {
73        if (Array.isArray(t)) return t;
74      })(t) ||
75      (function (t, e) {
76        if ("undefined" == typeof Symbol || !(Symbol.iterator in Object(t)))
77          return;
78        var n = [],
79          r = !0,
80          o = !1,
81          i = void 0;
82        try {
83          for (
84            var a, c = t[Symbol.iterator]();
85            !(r = (a = c.next()).done) &&
86            (n.push(a.value), !e || n.length !== e);
87            r = !0
88          );
89        } catch (t) {
90          (o = !0), (i = t);
91        } finally {
92          try {
93            r || null == c.return || c.return();
94          } finally {
95            if (o) throw i;
96          }
97        }
98        return n;
99      })(t, e) ||
100      c(t, e) ||
101      (function () {
102        throw new TypeError(
103          "Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."
104        );
105      })()
106    );
107  }
108  function a(t) {
109    return (
110      (function (t) {
111        if (Array.isArray(t)) return s(t);
112      })(t) ||
113      (function (t) {
114        if ("undefined" != typeof Symbol && Symbol.iterator in Object(t))
115          return Array.from(t);
116      })(t) ||
117      c(t) ||
118      (function () {
119        throw new TypeError(
120          "Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."
121        );
122      })()
123    );
124  }
125  function c(t, e) {
126    if (t) {
127      if ("string" == typeof t) return s(t, e);
128      var n = Object.prototype.toString.call(t).slice(8, -1);
129      return (
130        "Object" === n && t.constructor && (n = t.constructor.name),
131        "Map" === n || "Set" === n
132          ? Array.from(t)
133          : "Arguments" === n ||
134            /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)
135          ? s(t, e)
136          : void 0
137      );
138    }
139  }
140  function s(t, e) {
141    (null == e || e > t.length) && (e = t.length);
142    for (var n = 0, r = new Array(e); n < e; n++) r[n] = t[n];
143    return r;
144  }
145  function l(t, e) {
146    return Object.getOwnPropertyNames(Object(t)).reduce(function (n, r) {
147      var o = Object.getOwnPropertyDescriptor(Object(t), r),
148        i = Object.getOwnPropertyDescriptor(Object(e), r);
149      return Object.defineProperty(n, r, i || o);
150    }, {});
151  }
152  function u(t) {
153    return "string" == typeof t;
154  }
155  function f(t) {
156    return Array.isArray(t);
157  }
158  function p() {
159    var t,
160      e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},
161      n = l(e);
162    return (
163      void 0 !== n.types ? (t = n.types) : void 0 !== n.split && (t = n.split),
164      void 0 !== t &&
165        (n.types = (u(t) || f(t) ? String(t) : "")
166          .split(",")
167          .map(function (t) {
168            return String(t).trim();
169          })
170          .filter(function (t) {
171            return /((line)|(word)|(char))/i.test(t);
172          })),
173      (n.absolute || n.position) &&
174        (n.absolute = n.absolute || /absolute/.test(e.position)),
175      n
176    );
177  }
178  function d(t) {
179    var e = u(t) || f(t) ? String(t) : "";
180    return {
181      none: !e,
182      lines: /line/i.test(e),
183      words: /word/i.test(e),
184      chars: /char/i.test(e),
185    };
186  }
187  function h(t) {
188    return null !== t && "object" == typeof t;
189  }
190  function y(t) {
191    return h(t) && /^(1|3|11)$/.test(t.nodeType);
192  }
193  function g(t) {
194    return f(t)
195      ? t
196      : null == t
197      ? []
198      : (function (t) {
199          return (
200            h(t) &&
201            (function (t) {
202              return "number" == typeof t && t > -1 && t % 1 == 0;
203            })(t.length)
204          );
205        })(t)
206      ? Array.prototype.slice.call(t)
207      : [t];
208  }
209  function v(t) {
210    var e = t;
211    return (
212      u(t) &&
213        (e = /^(#[a-z]\w+)$/.test(t.trim())
214          ? document.getElementById(t.trim().slice(1))
215          : document.querySelectorAll(t)),
216      g(e).reduce(function (t, e) {
217        return [].concat(a(t), a(g(e).filter(y)));
218      }, [])
219    );
220  }
221  !(function () {
222    function t() {
223      for (var t = arguments.length, e = 0; e < t; e++) {
224        var n = e < 0 || arguments.length <= e ? void 0 : arguments[e];
225        1 === n.nodeType || 11 === n.nodeType
226          ? this.appendChild(n)
227          : this.appendChild(document.createTextNode(String(n)));
228      }
229    }
230    function e() {
231      for (; this.lastChild; ) this.removeChild(this.lastChild);
232      arguments.length && this.append.apply(this, arguments);
233    }
234    function n() {
235      for (
236        var t = this.parentNode, e = arguments.length, n = new Array(e), r = 0;
237        r < e;
238        r++
239      )
240        n[r] = arguments[r];
241      var o = n.length;
242      if (t)
243        for (o || t.removeChild(this); o--; ) {
244          var i = n[o];
245          "object" != typeof i
246            ? (i = this.ownerDocument.createTextNode(i))
247            : i.parentNode && i.parentNode.removeChild(i),
248            o
249              ? t.insertBefore(this.previousSibling, i)
250              : t.replaceChild(i, this);
251        }
252    }
253    "undefined" != typeof Element &&
254      (Element.prototype.append ||
255        ((Element.prototype.append = t),
256        (DocumentFragment.prototype.append = t)),
257      Element.prototype.replaceChildren ||
258        ((Element.prototype.replaceChildren = e),
259        (DocumentFragment.prototype.replaceChildren = e)),
260      Element.prototype.replaceWith ||
261        ((Element.prototype.replaceWith = n),
262        (DocumentFragment.prototype.replaceWith = n)));
263  })();
264  var m = Object.entries,
265    b = "_splittype",
266    w = {},
267    O = 0;
268  function j(t, e, n) {
269    if (!h(t)) return console.warn("[data.set] owner is not an object"), null;
270    var r = t[b] || (t[b] = ++O),
271      i = w[r] || (w[r] = {});
272    return (
273      void 0 === n
274        ? e &&
275          Object.getPrototypeOf(e) === Object.prototype &&
276          (w[r] = o(o({}, i), e))
277        : void 0 !== e && (i[e] = n),
278      n
279    );
280  }
281  function C(t, e) {
282    var n = h(t) ? t[b] : null,
283      r = (n && w[n]) || {};
284    return void 0 === e ? r : r[e];
285  }
286  function E(t) {
287    var e = t && t[b];
288    e && (delete t[e], delete w[e]);
289  }
290  var S = "\\ud800-\\udfff",
291    x = "\\u0300-\\u036f\\ufe20-\\ufe23",
292    T = "\\u20d0-\\u20f0",
293    W = "\\ufe0e\\ufe0f",
294    k = "[".concat(S, "]"),
295    A = "[".concat(x).concat(T, "]"),
296    P = "\\ud83c[\\udffb-\\udfff]",
297    D = "(?:".concat(A, "|").concat(P, ")"),
298    N = "[^".concat(S, "]"),
299    R = "(?:\\ud83c[\\udde6-\\uddff]){2}",
300    $ = "[\\ud800-\\udbff][\\udc00-\\udfff]",
301    B = "\\u200d",
302    F = "".concat(D, "?"),
303    I = "[".concat(W, "]?"),
304    L = I + F + ("(?:\\u200d(?:" + [N, R, $].join("|") + ")" + I + F + ")*"),
305    H = "(?:".concat(
306      ["".concat(N).concat(A, "?"), A, R, $, k].join("|"),
307      "\n)"
308    ),
309    M = RegExp("".concat(P, "(?=").concat(P, ")|").concat(H).concat(L), "g"),
310    z = RegExp("[".concat([B, S, x, T, W].join(""), "]"));
311  function V(t) {
312    return z.test(t);
313  }
314  function q(t) {
315    return V(t)
316      ? (function (t) {
317          return t.match(M) || [];
318        })(t)
319      : (function (t) {
320          return t.split("");
321        })(t);
322  }
323  function U(t) {
324    return null == t ? "" : String(t);
325  }
326  function X(t, e) {
327    var n = document.createElement(t);
328    return e
329      ? (Object.keys(e).forEach(function (t) {
330          var r = e[t],
331            o = u(r) ? r.trim() : r;
332          null !== o &&
333            "" !== o &&
334            ("children" === t
335              ? n.append.apply(n, a(g(o)))
336              : n.setAttribute(t, o));
337        }),
338        n)
339      : n;
340  }
341  var Y = {
342    splitClass: "",
343    lineClass: "line",
344    wordClass: "word",
345    charClass: "char",
346    types: ["lines", "words", "chars"],
347    absolute: !1,
348    tagName: "div",
349  };
350  function _(t, e) {
351    var n,
352      r = d((e = l(Y, e)).types),
353      o = e.tagName,
354      i = t.nodeValue,
355      c = document.createDocumentFragment(),
356      s = [];
357    return (
358      /^\s/.test(i) && c.append(" "),
359      (n = (function (t) {
360        var e =
361          arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : " ";
362        return (t ? String(t) : "").trim().replace(/\s+/g, " ").split(e);
363      })(i).reduce(function (t, n, i, l) {
364        var f, p;
365        return (
366          r.chars &&
367            (p = (function (t) {
368              var e =
369                arguments.length > 1 && void 0 !== arguments[1]
370                  ? arguments[1]
371                  : "";
372              return (t = U(t)) && u(t) && !e && V(t) ? q(t) : t.split(e);
373            })(n).map(function (t) {
374              var n = X(o, {
375                class: "".concat(e.splitClass, " ").concat(e.charClass),
376                style: "display: inline-block;",
377                children: t,
378              });
379              return j(n, "isChar", !0), (s = [].concat(a(s), [n])), n;
380            })),
381          r.words || r.lines
382            ? (j(
383                (f = X(o, {
384                  class: "".concat(e.wordClass, " ").concat(e.splitClass),
385                  style: "display: inline-block; ".concat(
386                    r.words && e.absolute ? "position: relative;" : ""
387                  ),
388                  children: r.chars ? p : n,
389                })),
390                {
391                  isWord: !0,
392                  isWordStart: !0,
393                  isWordEnd: !0,
394                }
395              ),
396              c.appendChild(f))
397            : p.forEach(function (t) {
398                c.appendChild(t);
399              }),
400          i < l.length - 1 && c.append(" "),
401          r.words ? t.concat(f) : t
402        );
403      }, [])),
404      /\s$/.test(i) && c.append(" "),
405      t.replaceWith(c),
406      {
407        words: n,
408        chars: s,
409      }
410    );
411  }
412  function G(t, e) {
413    var n = t.nodeType,
414      r = {
415        words: [],
416        chars: [],
417      };
418    if (!/(1|3|11)/.test(n)) return r;
419    if (3 === n && /\S/.test(t.nodeValue)) return _(t, e);
420    var o = g(t.childNodes);
421    if (o.length && (j(t, "isSplit", !0), !C(t).isRoot)) {
422      (t.style.display = "inline-block"), (t.style.position = "relative");
423      var i = t.nextSibling,
424        c = t.previousSibling,
425        s = t.textContent || "",
426        l = i ? i.textContent : " ",
427        u = c ? c.textContent : " ";
428      j(t, {
429        isWordEnd: /\s$/.test(s) || /^\s/.test(l),
430        isWordStart: /^\s/.test(s) || /\s$/.test(u),
431      });
432    }
433    return o.reduce(function (t, n) {
434      var r = G(n, e),
435        o = r.words,
436        i = r.chars;
437      return {
438        words: [].concat(a(t.words), a(o)),
439        chars: [].concat(a(t.chars), a(i)),
440      };
441    }, r);
442  }
443  function J(t) {
444    C(t).isWord
445      ? (E(t), t.replaceWith.apply(t, a(t.childNodes)))
446      : g(t.children).forEach(function (t) {
447          return J(t);
448        });
449  }
450  function K(t, e, n) {
451    var r,
452      o,
453      a,
454      c = d(e.types),
455      s = e.tagName,
456      l = t.getElementsByTagName("*"),
457      u = [],
458      f = [],
459      p = null,
460      h = [],
461      y = t.parentElement,
462      v = t.nextElementSibling,
463      m = document.createDocumentFragment(),
464      b = window.getComputedStyle(t),
465      w = b.textAlign,
466      O = 0.2 * parseFloat(b.fontSize);
467    return (
468      e.absolute &&
469        ((a = {
470          left: t.offsetLeft,
471          top: t.offsetTop,
472          width: t.offsetWidth,
473        }),
474        (o = t.offsetWidth),
475        (r = t.offsetHeight),
476        j(t, {
477          cssWidth: t.style.width,
478          cssHeight: t.style.height,
479        })),
480      g(l).forEach(function (r) {
481        var o = r.parentElement === t,
482          a = (function (t, e, n, r) {
483            if (!n.absolute)
484              return {
485                top: e ? t.offsetTop : null,
486              };
487            var o = t.offsetParent,
488              a = i(r, 2),
489              c = a[0],
490              s = a[1],
491              l = 0,
492              u = 0;
493            if (o && o !== document.body) {
494              var f = o.getBoundingClientRect();
495              (l = f.x + c), (u = f.y + s);
496            }
497            var p = t.getBoundingClientRect(),
498              d = p.width,
499              h = p.height,
500              y = p.x;
501            return {
502              width: d,
503              height: h,
504              top: p.y + s - u,
505              left: y + c - l,
506            };
507          })(r, o, e, n),
508          s = a.width,
509          l = a.height,
510          d = a.top,
511          h = a.left;
512        /^br$/i.test(r.nodeName) ||
513          (c.lines &&
514            o &&
515            ((null === p || d - p >= O) && ((p = d), u.push((f = []))),
516            f.push(r)),
517          e.absolute &&
518            j(r, {
519              top: d,
520              left: h,
521              width: s,
522              height: l,
523            }));
524      }),
525      y && y.removeChild(t),
526      c.lines &&
527        ((h = u.map(function (t) {
528          var n = X(s, {
529            class: "".concat(e.splitClass, " ").concat(e.lineClass),
530            style: "display: block; text-align: ".concat(w, "; width: 100%;"),
531          });
532          j(n, "isLine", !0);
533          var r = {
534            height: 0,
535            top: 1e4,
536          };
537          return (
538            m.appendChild(n),
539            t.forEach(function (t, e, o) {
540              var i = C(t),
541                a = i.isWordEnd,
542                c = i.top,
543                s = i.height,
544                l = o[e + 1];
545              (r.height = Math.max(r.height, s)),
546                (r.top = Math.min(r.top, c)),
547                n.appendChild(t),
548                a && C(l).isWordStart && n.append(" ");
549            }),
550            e.absolute &&
551              j(n, {
552                height: r.height,
553                top: r.top,
554              }),
555            n
556          );
557        })),
558        c.words || J(m),
559        t.replaceChildren(m)),
560      e.absolute &&
561        ((t.style.width = "".concat(t.style.width || o, "px")),
562        (t.style.height = "".concat(r, "px")),
563        g(l).forEach(function (t) {
564          var e = C(t),
565            n = e.isLine,
566            r = e.top,
567            o = e.left,
568            i = e.width,
569            c = e.height,
570            s = C(t.parentElement),
571            l = !n && s.isLine;
572          (t.style.top = "".concat(l ? r - s.top : r, "px")),
573            (t.style.left = "".concat(n ? a.left : o - (l ? a.left : 0), "px")),
574            (t.style.height = "".concat(c, "px")),
575            (t.style.width = "".concat(n ? a.width : i, "px")),
576            (t.style.position = "absolute");
577        })),
578      y && (v ? y.insertBefore(t, v) : y.appendChild(t)),
579      h
580    );
581  }
582  var Q = l(Y, {});
583  return (function () {
584    function t(e, n) {
585      !(function (t, e) {
586        if (!(t instanceof e))
587          throw new TypeError("Cannot call a class as a function");
588      })(this, t),
589        (this.isSplit = !1),
590        (this.settings = l(Q, p(n))),
591        (this.elements = v(e)),
592        this.split();
593    }
594    return (
595      e(t, null, [
596        {
597          key: "clearData",
598          value: function () {
599            Object.keys(w).forEach(function (t) {
600              delete w[t];
601            });
602          },
603        },
604        {
605          key: "setDefaults",
606          value: function (t) {
607            return (Q = l(Q, p(t))), Y;
608          },
609        },
610        {
611          key: "revert",
612          value: function (t) {
613            v(t).forEach(function (t) {
614              var e = C(t),
615                n = e.isSplit,
616                r = e.html,
617                o = e.cssWidth,
618                i = e.cssHeight;
619              n &&
620                ((t.innerHTML = r),
621                (t.style.width = o || ""),
622                (t.style.height = i || ""),
623                E(t));
624            });
625          },
626        },
627        {
628          key: "create",
629          value: function (e, n) {
630            return new t(e, n);
631          },
632        },
633        {
634          key: "data",
635          get: function () {
636            return w;
637          },
638        },
639        {
640          key: "defaults",
641          get: function () {
642            return Q;
643          },
644          set: function (t) {
645            Q = l(Q, p(t));
646          },
647        },
648      ]),
649      e(t, [
650        {
651          key: "split",
652          value: function (t) {
653            var e = this;
654            this.revert(),
655              this.elements.forEach(function (t) {
656                j(t, "html", t.innerHTML);
657              }),
658              (this.lines = []),
659              (this.words = []),
660              (this.chars = []);
661            var n = [window.pageXOffset, window.pageYOffset];
662            void 0 !== t && (this.settings = l(this.settings, p(t)));
663            var r = d(this.settings.types);
664            r.none ||
665              (this.elements.forEach(function (t) {
666                j(t, "isRoot", !0);
667                var n = G(t, e.settings),
668                  r = n.words,
669                  o = n.chars;
670                (e.words = [].concat(a(e.words), a(r))),
671                  (e.chars = [].concat(a(e.chars), a(o)));
672              }),
673              this.elements.forEach(function (t) {
674                if (r.lines || e.settings.absolute) {
675                  var o = K(t, e.settings, n);
676                  e.lines = [].concat(a(e.lines), a(o));
677                }
678              }),
679              (this.isSplit = !0),
680              window.scrollTo(n[0], n[1]),
681              m(w).forEach(function (t) {
682                var e = i(t, 2),
683                  n = e[0],
684                  r = e[1],
685                  o = r.isRoot,
686                  a = r.isSplit;
687                (o && a) || ((w[n] = null), delete w[n]);
688              }));
689          },
690        },
691        {
692          key: "revert",
693          value: function () {
694            this.isSplit &&
695              ((this.lines = null),
696              (this.words = null),
697              (this.chars = null),
698              (this.isSplit = !1)),
699              t.revert(this.elements);
700          },
701        },
702      ]),
703      t
704    );
705  })();
706});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.