var _____WB$wombat$assign$function_____=function(name){return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name))||self[name];};if(!self.__WB_pmw){self.__WB_pmw=function(obj){this.__WB_source=obj;return this;}}{
let window = _____WB$wombat$assign$function_____("window");
let self = _____WB$wombat$assign$function_____("self");
let document = _____WB$wombat$assign$function_____("document");
let location = _____WB$wombat$assign$function_____("location");
let top = _____WB$wombat$assign$function_____("top");
let parent = _____WB$wombat$assign$function_____("parent");
let frames = _____WB$wombat$assign$function_____("frames");
let opens = _____WB$wombat$assign$function_____("opens");
( function () {
	window.addEventListener( 'message', function ( event ) {
		var allowed_origins = [ 'https://videopress.com', 'https://video.wordpress.com' ];
		if ( -1 === allowed_origins.indexOf( event.origin ) ) {
			return;
		}

		if ( event.data.event !== 'videopress_token_request' ) {
			return;
		}

		if ( ! window.videopressAjax ) {
			return;
		}

		var fetchData = {
			action: 'videopress-get-playback-jwt',
			guid: event.data.guid,
			post_id: window.videopressAjax.post_id || 0,
		};

		fetch( window.videopressAjax.ajaxUrl, {
			method: 'POST',
			credentials: 'same-origin',
			body: new URLSearchParams( fetchData ),
		} )
			.then( function ( response ) {
				if ( response.ok ) {
					return response.json();
				}
				throw Error( 'Response is not ok' );
			} )
			.then( function ( jsonResponse ) {
				if ( !! jsonResponse.success && jsonResponse.data ) {
					event.source.postMessage(
						{
							event: 'videopress_token_received',
							guid: fetchData.guid,
							jwt: jsonResponse.data.jwt,
						},
						'*'
					);
				} else {
					event.source.postMessage(
						{
							event: 'videopress_token_error',
							guid: fetchData.guid,
						},
						'*'
					);
				}
			} );
	} );
} )();

}