PageSourceSearch

https://www.fotojorgen.no/node_modules/swiper/shared/utils.mjs

js fotojorgen.no collected 2026-10-05 01:30:27 UTC 10,039 bytes, 300 lines download raw bytes

vendor: 5,240 bytes, lines 1-156
1import { a as getWindow, g as getDocument } from './ssr-window.esm.mjs';
2
3function classesToTokens(classes) {
4  if (classes === void 0) {
5    classes = '';
6  }
7  return classes.trim().split(' ').filter(c => !!c.trim());
8}
9
10function deleteProps(obj) {
11  const object = obj;
12  Object.keys(object).forEach(key => {
13    try {
14      object[key] = null;
15    } catch (e) {
16      // no getter for object
17    }
18    try {
19      delete object[key];
20    } catch (e) {
21      // something got wrong
22    }
23  });
24}
25function nextTick(callback, delay) {
26  if (delay === void 0) {
27    delay = 0;
28  }
29  return setTimeout(callback, delay);
30}
31function now() {
32  return Date.now();
33}
34function getComputedStyle(el) {
35  const window = getWindow();
36  let style;
37  if (window.getComputedStyle) {
38    style = window.getComputedStyle(el, null);
39  }
40  if (!style && el.currentStyle) {
41    style = el.currentStyle;
42  }
43  if (!style) {
44    style = el.style;
45  }
46  return style;
47}
48function getTranslate(el, axis) {
49  if (axis === void 0) {
50    axis = 'x';
51  }
52  const window = getWindow();
53  let matrix;
54  let curTransform;
55  let transformMatrix;
56  const curStyle = getComputedStyle(el);
57  if (window.WebKitCSSMatrix) {
58    curTransform = curStyle.transform || curStyle.webkitTransform;
59    if (curTransform.split(',').length > 6) {
60      curTransform = curTransform.split(', ').map(a => a.replace(',', '.')).join(', ');
61    }
62    // Some old versions of Webkit choke when 'none' is passed; pass
63    // empty string instead in this case
64    transformMatrix = new window.WebKitCSSMatrix(curTransform === 'none' ? '' : curTransform);
65  } else {
66    transformMatrix = curStyle.MozTransform || curStyle.OTransform || curStyle.MsTransform || curStyle.msTransform || curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,');
67    matrix = transformMatrix.toString().split(',');
68  }
69  if (axis === 'x') {
70    // Latest Chrome and webkits Fix
71    if (window.WebKitCSSMatrix) curTransform = transformMatrix.m41;
72    // Crazy IE10 Matrix
73    else if (matrix.length === 16) curTransform = parseFloat(matrix[12]);
74    // Normal Browsers
75    else curTransform = parseFloat(matrix[4]);
76  }
77  if (axis === 'y') {
78    // Latest Chrome and webkits Fix
79    if (window.WebKitCSSMatrix) curTransform = transformMatrix.m42;
80    // Crazy IE10 Matrix
81    else if (matrix.length === 16) curTransform = parseFloat(matrix[13]);
82    // Normal Browsers
83    else curTransform = parseFloat(matrix[5]);
84  }
85  return curTransform || 0;
86}
87function isObject(o) {
88  return typeof o === 'object' && o !== null && o.constructor && Object.prototype.toString.call(o).slice(8, -1) === 'Object';
89}
90function isNode(node) {
91  // eslint-disable-next-line
92  if (typeof window !== 'undefined' && typeof window.HTMLElement !== 'undefined') {
93    return node instanceof HTMLElement;
94  }
95  return node && (node.nodeType === 1 || node.nodeType === 11);
96}
97function extend() {
98  const to = Object(arguments.length <= 0 ? undefined : arguments[0]);
99  const noExtend = ['__proto__', 'constructor', 'prototype'];
100  for (let i = 1; i < arguments.length; i += 1) {
101    const nextSource = i < 0 || arguments.length <= i ? undefined : arguments[i];
102    if (nextSource !== undefined && nextSource !== null && !isNode(nextSource)) {
103      const keysArray = Object.keys(Object(nextSource)).filter(key => noExtend.indexOf(key) < 0);
104      for (let nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex += 1) {
105        const nextKey = keysArray[nextIndex];
106        const desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
107        if (desc !== undefined && desc.enumerable) {
108          if (isObject(to[nextKey]) && isObject(nextSource[nextKey])) {
109            if (nextSource[nextKey].__swiper__) {
110              to[nextKey] = nextSource[nextKey];
111            } else {
112              extend(to[nextKey], nextSource[nextKey]);
113            }
114          } else if (!isObject(to[nextKey]) && isObject(nextSource[nextKey])) {
115            to[nextKey] = {};
116            if (nextSource[nextKey].__swiper__) {
117              to[nextKey] = nextSource[nextKey];
118            } else {
119              extend(to[nextKey], nextSource[nextKey]);
120            }
121          } else {
122            to[nextKey] = nextSource[nextKey];
123          }
124        }
125      }
126    }
127  }
128  return to;
129}
130function setCSSProperty(el, varName, varValue) {
131  el.style.setProperty(varName, varValue);
132}
133function animateCSSModeScroll(_ref) {
134  let {
135    swiper,
136    targetPosition,
137    side
138  } = _ref;
139  const window = getWindow();
140  const startPosition = -swiper.translate;
141  let startTime = null;
142  let time;
143  const duration = swiper.params.speed;
144  swiper.wrapperEl.style.scrollSnapType = 'none';
145  window.cancelAnimationFrame(swiper.cssModeFrameID);
146  const dir = targetPosition > startPosition ? 'next' : 'prev';
147  const isOutOfBound = (current, target) => {
148    return dir === 'next' && current >= target || dir === 'prev' && current <= target;
149  };
150  const animate = () => {
151    time = new Date().getTime();
152    if (startTime === null) {
153      startTime = time;
154    }
155    const progress = Math.max(Math.min((time - startTime) / duration, 1), 0);
156    const easeProgress = 0.5 - Math.cos(progress * Math.PI) / 2;
vendor: 4,799 bytes, lines 157-300
157    let currentPosition = startPosition + easeProgress * (targetPosition - startPosition);
158    if (isOutOfBound(currentPosition, targetPosition)) {
159      currentPosition = targetPosition;
160    }
161    swiper.wrapperEl.scrollTo({
162      [side]: currentPosition
163    });
164    if (isOutOfBound(currentPosition, targetPosition)) {
165      swiper.wrapperEl.style.overflow = 'hidden';
166      swiper.wrapperEl.style.scrollSnapType = '';
167      setTimeout(() => {
168        swiper.wrapperEl.style.overflow = '';
169        swiper.wrapperEl.scrollTo({
170          [side]: currentPosition
171        });
172      });
173      window.cancelAnimationFrame(swiper.cssModeFrameID);
174      return;
175    }
176    swiper.cssModeFrameID = window.requestAnimationFrame(animate);
177  };
178  animate();
179}
180function getSlideTransformEl(slideEl) {
181  return slideEl.querySelector('.swiper-slide-transform') || slideEl.shadowRoot && slideEl.shadowRoot.querySelector('.swiper-slide-transform') || slideEl;
182}
183function elementChildren(element, selector) {
184  if (selector === void 0) {
185    selector = '';
186  }
187  return [...element.children].filter(el => el.matches(selector));
188}
189function showWarning(text) {
190  try {
191    console.warn(text);
192    return;
193  } catch (err) {
194    // err
195  }
196}
197function createElement(tag, classes) {
198  if (classes === void 0) {
199    classes = [];
200  }
201  const el = document.createElement(tag);
202  el.classList.add(...(Array.isArray(classes) ? classes : classesToTokens(classes)));
203  return el;
204}
205function elementOffset(el) {
206  const window = getWindow();
207  const document = getDocument();
208  const box = el.getBoundingClientRect();
209  const body = document.body;
210  const clientTop = el.clientTop || body.clientTop || 0;
211  const clientLeft = el.clientLeft || body.clientLeft || 0;
212  const scrollTop = el === window ? window.scrollY : el.scrollTop;
213  const scrollLeft = el === window ? window.scrollX : el.scrollLeft;
214  return {
215    top: box.top + scrollTop - clientTop,
216    left: box.left + scrollLeft - clientLeft
217  };
218}
219function elementPrevAll(el, selector) {
220  const prevEls = [];
221  while (el.previousElementSibling) {
222    const prev = el.previousElementSibling; // eslint-disable-line
223    if (selector) {
224      if (prev.matches(selector)) prevEls.push(prev);
225    } else prevEls.push(prev);
226    el = prev;
227  }
228  return prevEls;
229}
230function elementNextAll(el, selector) {
231  const nextEls = [];
232  while (el.nextElementSibling) {
233    const next = el.nextElementSibling; // eslint-disable-line
234    if (selector) {
235      if (next.matches(selector)) nextEls.push(next);
236    } else nextEls.push(next);
237    el = next;
238  }
239  return nextEls;
240}
241function elementStyle(el, prop) {
242  const window = getWindow();
243  return window.getComputedStyle(el, null).getPropertyValue(prop);
244}
245function elementIndex(el) {
246  let child = el;
247  let i;
248  if (child) {
249    i = 0;
250    // eslint-disable-next-line
251    while ((child = child.previousSibling) !== null) {
252      if (child.nodeType === 1) i += 1;
253    }
254    return i;
255  }
256  return undefined;
257}
258function elementParents(el, selector) {
259  const parents = []; // eslint-disable-line
260  let parent = el.parentElement; // eslint-disable-line
261  while (parent) {
262    if (selector) {
263      if (parent.matches(selector)) parents.push(parent);
264    } else {
265      parents.push(parent);
266    }
267    parent = parent.parentElement;
268  }
269  return parents;
270}
271function elementTransitionEnd(el, callback) {
272  function fireCallBack(e) {
273    if (e.target !== el) return;
274    callback.call(el, e);
275    el.removeEventListener('transitionend', fireCallBack);
276  }
277  if (callback) {
278    el.addEventListener('transitionend', fireCallBack);
279  }
280}
281function elementOuterSize(el, size, includeMargins) {
282  const window = getWindow();
283  if (includeMargins) {
284    return el[size === 'width' ? 'offsetWidth' : 'offsetHeight'] + parseFloat(window.getComputedStyle(el, null).getPropertyValue(size === 'width' ? 'margin-right' : 'margin-top')) + parseFloat(window.getComputedStyle(el, null).getPropertyValue(size === 'width' ? 'margin-left' : 'margin-bottom'));
285  }
286  return el.offsetWidth;
287}
288function makeElementsArray(el) {
289  return (Array.isArray(el) ? el : [el]).filter(e => !!e);
290}
291function getRotateFix(swiper) {
292  return v => {
293    if (Math.abs(v) > 0 && swiper.browser && swiper.browser.need3dFix && Math.abs(v) % 90 === 0) {
294      return v + 0.001;
295    }
296    return v;
297  };
298}
299
300export { elementParents as a, elementOffset as b, createElement as c, now as d, elementChildren as e, elementOuterSize as f, getSlideTransformEl as g, elementIndex as h, classesToTokens as i, getTranslate as j, elementTransitionEnd as k, isObject as l, makeElementsArray as m, nextTick as n, getRotateFix as o, elementStyle as p, elementNextAll as q, elementPrevAll as r, setCSSProperty as s, animateCSSModeScroll as t, showWarning as u, extend as v, deleteProps as w };

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.