PageSourceSearch

https://volley.win/wp-content/plugins/depay-donations/core/include…ncludes%2Fassets%2Fjs%2Freact-shadow-dom.js

js volley.win collected 2026-10-09 21:24:10 UTC 3,114 bytes, 105 lines download raw bytes

1(function (global, factory) {
2  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react-dom'), require('react')) :
3  typeof define === 'function' && define.amd ? define(['exports', 'react-dom', 'react'], factory) :
4  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ReactShadowDOM = {}, global.ReactDOM));
5}(this, (function (exports, ReactDOM) { 'use strict';
6
7  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
9  var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
10
11  const insideContainerClass = 'ReactShadowDOMInsideContainer';
12
13  function createInsideContainer({ document, shadow, style, classes = [] }) {
14    const container = document.createElement('div');
15    container.setAttribute('class', [insideContainerClass].concat(classes).join(' '));
16    shadow.appendChild(container);
17
18    if (style && style.length) {
19      const styleElement = document.createElement('style');
20      styleElement.type = 'text/css';
21      styleElement.appendChild(document.createTextNode(style));
22      shadow.appendChild(styleElement);
23    }
24
25    return container
26  }
27
28  const outsideContainerClass = 'ReactShadowDOMOutsideContainer';
29
30  function createOutsideContainer({ document, element, style }) {
31    const container = document.createElement('div');
32    container.setAttribute('class', outsideContainerClass);
33    container.setAttribute('style', style);
34    element.appendChild(container);
35    return container
36  }
37
38  function createShadow(container) {
39    let shadow;
40
41    if (container.shadowRoot) {
42      shadow = container.shadowRoot;
43    } else {
44      shadow = container.attachShadow({ mode: 'open' });
45    }
46
47    return shadow
48  }
49
50  function trimStyle(style) {
51    return style.replace(/\s*[\r\n]\s*/g, '')
52  }
53
54  function unmount(outsideContainer) {
55    if (outsideContainer && outsideContainer.shadowRoot) {
56      const shadowRoot = outsideContainer.shadowRoot;
57
58      if (shadowRoot) {
59        const insideContainer = shadowRoot.childNodes[0];
60        if (insideContainer) {
61          ReactDOM__default['default'].unmountComponentAtNode(insideContainer);
62        }
63      }
64
65      outsideContainer.remove();
66    }
67  }
68
69  function ReactShadowDOM({
70    document,
71    element,
72    content,
73    outsideStyle = '',
74    insideStyle = '',
75    insideClasses = [],
76  }) {
77    const outsideContainer = createOutsideContainer({
78      document,
79      element,
80      style: trimStyle(outsideStyle),
81    });
82
83    const shadow = createShadow(outsideContainer);
84
85    const insideContainer = createInsideContainer({
86      document,
87      shadow,
88      style: trimStyle(insideStyle),
89      classes: insideClasses,
90    });
91
92    if (typeof content === 'function') {
93      content = content(insideContainer);
94    }
95
96    ReactDOM__default['default'].render(content, insideContainer);
97
98    return { content, unmount: () => unmount(outsideContainer) }
99  }
100
101  exports.ReactShadowDOM = ReactShadowDOM;
102
103  Object.defineProperty(exports, '__esModule', { value: true });
104
105})));

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.