ThirstyAffiliates Affiliate Link Manager - Version 3.9

Version Description

  • Bug Fix: Gutenberg Input affiliate link as shortcode should show the error to admin only
  • Bug Fix: Convert to blocks converts images on posts as ThirstyAffiliates Image block
  • Bug Fix: UTC-2 and UTC+11 Timezone produces Fatal Error when activating the plugin
  • Bug Fix: TA button style for block editor changes in WP 5.2.1
Download this release

Release Info

Developer jkohlbach
Plugin Icon 128x128 ThirstyAffiliates Affiliate Link Manager
Version 3.9
Comparing to
See all releases

Code changes from version 3.8 to 3.9

Helpers/Helper_Functions.php CHANGED
@@ -188,7 +188,7 @@ class Helper_Functions {
188
189
foreach ( timezone_abbreviations_list() as $abbr )
190
foreach ( $abbr as $city )
191
- if ( $city[ 'dst' ] == $is_dst && $city[ 'offset' ] == $utc_offset )
192
return $city[ 'timezone_id' ];
193
194
// fallback to UTC
188
189
foreach ( timezone_abbreviations_list() as $abbr )
190
foreach ( $abbr as $city )
191
+ if ( $city[ 'dst' ] == $is_dst && $city[ 'offset' ] == $utc_offset && isset( $city[ 'timezone_id' ] ) )
192
return $city[ 'timezone_id' ];
193
194
// fallback to UTC
Helpers/Plugin_Constants.php CHANGED
@@ -27,7 +27,7 @@ class Plugin_Constants {
27
// Plugin configuration constants
28
const TOKEN = 'ta';
29
const INSTALLED_VERSION = 'ta_installed_version';
30
- const VERSION = '3.8';
31
const TEXT_DOMAIN = 'thirstyaffiliates';
32
const THEME_TEMPLATE_PATH = 'thirstyaffiliates';
33
const META_DATA_PREFIX = '_ta_';
27
// Plugin configuration constants
28
const TOKEN = 'ta';
29
const INSTALLED_VERSION = 'ta_installed_version';
30
+ const VERSION = '3.9';
31
const TEXT_DOMAIN = 'thirstyaffiliates';
32
const THEME_TEMPLATE_PATH = 'thirstyaffiliates';
33
const META_DATA_PREFIX = '_ta_';
Models/Shortcodes.php CHANGED
@@ -260,8 +260,10 @@ class Shortcodes implements Model_Interface {
260
$output .= ' data-shortcode="true">' . do_shortcode( $content ) . '</a>';
261
262
263
- } else
264
$output .= '<span style="color: #0000ff;">' . __( 'SHORTCODE ERROR: ThirstyAffiliates did not detect a valid link id, please check your short code!' , 'thirstyaffiliates' ) . '</span>';
265
266
return $output;
267
}
260
$output .= ' data-shortcode="true">' . do_shortcode( $content ) . '</a>';
261
262
263
+ } elseif ( current_user_can( 'edit_published_posts' ) )
264
$output .= '<span style="color: #0000ff;">' . __( 'SHORTCODE ERROR: ThirstyAffiliates did not detect a valid link id, please check your short code!' , 'thirstyaffiliates' ) . '</span>';
265
+ else
266
+ $output = $content;
267
268
return $output;
269
}
js/app/gutenberg_support/dist/gutenberg-support.js CHANGED
@@ -3,5 +3,5 @@
3
Licensed under the MIT License (MIT), see
4
http://jedwatson.github.io/classnames
5
*/
6
- !function(){"use strict";function n(){for(var e=[],t=0;t<arguments.length;t++){var i=arguments[t];if(i){var o=typeof i;if("string"===o||"number"===o)e.push(i);else if(Array.isArray(i)&&i.length){var a=n.apply(null,i);a&&e.push(a)}else if("object"===o)for(var l in i)r.call(i,l)&&i[l]&&e.push(l)}}return e.join(" ")}var r={}.hasOwnProperty;void 0!==e&&e.exports?(n.default=n,e.exports=n):(i=[],void 0!==(o=function(){return n}.apply(t,i))&&(e.exports=o))}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),o=n(8),r=n(18);n.n(r);Object(i.a)(),Object(o.a)()},function(e,t,n){"use strict";function i(){[o].forEach(function(e){if(e){var t=e.name,n=e.settings;r(t,n)}})}t.a=i;var o=n(3),r=wp.blocks.registerBlockType},function(e,t,n){"use strict";function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.defineProperty(t,"__esModule",{value:!0}),n.d(t,"name",function(){return v}),n.d(t,"settings",function(){return k});var o=n(0),r=n.n(o),a=n(4),l=wp.element.Fragment,s=wp.i18n.__,u=wp.blocks,c=u.createBlock,p=u.getBlockAttributes,f=u.getPhrasingContentSchema,d=wp.editor.RichText,h=wp.components,m=h.Path,g=h.SVG,v="ta/image",w={url:{type:"string",source:"attribute",selector:"img",attribute:"src"},alt:{type:"string",source:"attribute",selector:"img",attribute:"alt",default:""},caption:{type:"string",source:"html",selector:"figcaption"},id:{type:"number"},align:{type:"string"},width:{type:"number"},height:{type:"number"},linkid:{type:"number"},href:{type:"string",source:"attribute",selector:"ta",attribute:"href"},affiliateLink:{type:"object"}},b={img:{attributes:["src","alt"],classes:["alignleft","aligncenter","alignright","alignnone",/^wp-image-\d+#x2F;]}},y={figure:{require:["ta","img"],children:{ta:{attributes:["href","linkid"],children:b},figcaption:{children:f()}}}},k={title:s("ThirstyAffiliates Image"),description:s("Insert an image with an affiliate link to make a visual statement."),icon:wp.element.createElement(g,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement(m,{d:"M0,0h24v24H0V0z",fill:"none"}),wp.element.createElement(m,{d:"m19 5v14h-14v-14h14m0-2h-14c-1.1 0-2 0.9-2 2v14c0 1.1 0.9 2 2 2h14c1.1 0 2-0.9 2-2v-14c0-1.1-0.9-2-2-2z"}),wp.element.createElement(m,{d:"m14.14 11.86l-3 3.87-2.14-2.59-3 3.86h12l-3.86-5.14z"})),category:"common",keywords:["img",s("photo"),s("affiliate")],attributes:w,transforms:{from:[{type:"raw",isMatch:function(e){return"FIGURE"===e.nodeName&&!!e.querySelector("img")},schema:y,transform:function(e){var t=e.className+" "+e.querySelector("img").className,n=/(?:^|\s)align(left|center|right)(?:$|\s)/.exec(t),i=n?n[1]:void 0,o=/(?:^|\s)wp-image-(\d+)(?:$|\s)/.exec(t),r=o?Number(o[1]):void 0,a=e.querySelector("a"),l=a&&a.href?"custom":void 0,s=a&&a.linkid?a.linkid:void 0,u=a&&a.href?a.href:void 0,f=a&&a.rel?a.rel:void 0,d=a&&a.className?a.className:void 0,h=p("ta/image",e.outerHTML,{align:i,id:r,linkDestination:l,linkid:s,href:u,rel:f,linkClass:d});return c("ta/image",h)}},{type:"files",isMatch:function(e){return 1===e.length&&0===e[0].type.indexOf("image/")},transform:function(e){var t=e[0];return c("ta/image",{url:createBlobURL(t)})}},{type:"shortcode",tag:"caption",attributes:{url:{type:"string",source:"attribute",attribute:"src",selector:"img"},alt:{type:"string",source:"attribute",attribute:"alt",selector:"img"},caption:{shortcode:function(e,t){var n=t.shortcode,i=document.implementation.createHTMLDocument(""),o=i.body;return o.innerHTML=n.content,o.removeChild(o.firstElementChild),o.innerHTML.trim()}},id:{type:"number",shortcode:function(e){var t=e.named.id;if(t)return parseInt(t.replace("attachment_",""),10)}},align:{type:"string",shortcode:function(e){var t=e.named.align;return(void 0===t?"alignnone":t).replace("align","")}},linkid:{type:"string",source:"attribute",selector:"wp-block-ta-image > ta",attribute:"linkid"},href:{type:"string",source:"attribute",selector:"ta",attribute:"href"}}}]},getEditWrapperProps:function(e){var t=e.align,n=e.width;if("left"===t||"center"===t||"right"===t||"wide"===t||"full"===t)return{"data-align":t,"data-resized":!!n}},edit:a.a,save:function(e){var t,n=e.attributes,o=n.url,a=n.alt,s=n.caption,u=n.align,c=n.width,p=n.height,f=n.id,h=n.linkid,m=n.href,g=r()((t={},i(t,"align"+u,u),i(t,"is-resized",c||p),t)),v=wp.element.createElement("img",{src:o,alt:a,className:f?"wp-image-"+f:null,width:c,height:p}),w=wp.element.createElement(l,null,wp.element.createElement("ta",{linkid:h,href:m},v),wp.element.createElement(d.Content,{tagName:"figcaption",value:s}));return"left"===u||"right"===u||"center"===u?wp.element.createElement("div",{className:"wp-block-image"},wp.element.createElement("figure",{className:g},w)):wp.element.createElement("figure",{className:"wp-block-image "+g},w)}}},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(0),l=n.n(a),s=n(5),u=n(6),c=n(7),p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},f=function(){function e(e,t){var n=[],i=!0,o=!1,r=void 0;try{for(var a,l=e[Symbol.iterator]();!(i=(a=l.next()).done)&&(n.push(a.value),!t||n.length!==t);i=!0);}catch(e){o=!0,r=e}finally{try{!i&&l.return&&l.return()}finally{if(o)throw r}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),d=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),h=lodash,m=h.get,g=h.isEmpty,v=h.map,w=h.last,b=h.pick,y=h.compact,k=wp.url.getPath,S=wp.i18n,E=S.__,_=S.sprintf,L=wp.element,O=L.Component,C=L.Fragment,I=L.createRef,T=wp.blob,R=T.getBlobByURL,P=T.revokeBlobURL,x=T.isBlobURL,A=wp.components,j=A.Placeholder,N=A.Button,F=A.ButtonGroup,W=A.IconButton,D=A.PanelBody,V=A.ResizableBox,H=A.SelectControl,z=A.Spinner,M=A.TextControl,B=A.TextareaControl,U=A.Toolbar,K=A.withNotices,q=(A.ToggleControl,A.Popover,wp.data.withSelect),G=wp.editor,$=G.RichText,Q=G.BlockControls,Z=G.InspectorControls,X=(G.MediaUpload,G.MediaUploadCheck,G.MediaPlaceholder,G.BlockAlignmentToolbar),Y=G.mediaUpload,J=wp.viewport.withViewportMatch,ee=wp.compose.compose,te=["image"],ne=function(e){var t=b(e,["alt","id","link","caption"]);return t.url=m(e,["sizes","large","url"])||m(e,["media_details","sizes","large","source_url"])||e.url,t},ie=function(e,t){return!e&&x(t)},oe=function(e){function t(e){var n=e.attributes;i(this,t);var r=o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return r.updateAlt=r.updateAlt.bind(r),r.updateAlignment=r.updateAlignment.bind(r),r.onFocusCaption=r.onFocusCaption.bind(r),r.onImageClick=r.onImageClick.bind(r),r.onSelectImage=r.onSelectImage.bind(r),r.updateImageURL=r.updateImageURL.bind(r),r.updateWidth=r.updateWidth.bind(r),r.updateHeight=r.updateHeight.bind(r),r.updateDimensions=r.updateDimensions.bind(r),r.getFilename=r.getFilename.bind(r),r.toggleIsEditing=r.toggleIsEditing.bind(r),r.onImageError=r.onImageError.bind(r),r.onChangeInputValue=r.onChangeInputValue.bind(r),r.autocompleteRef=I(),r.resetInvalidLink=r.resetInvalidLink.bind(r),r.updateImageSelection=r.updateImageSelection.bind(r),r.onSelectAffiliateImage=r.onSelectAffiliateImage.bind(r),r.editAFfiliateImage=r.editAFfiliateImage.bind(r),r.state={captionFocused:!1,isEditing:!n.url,inputValue:"",linkid:0,post:null,showSuggestions:!1,imageSelection:[],affiliateLink:null},r}return r(t,e),d(t,[{key:"componentDidMount",value:function(){var e=this,t=this.props,n=t.attributes,i=t.setAttributes,o=t.noticeOperations,r=n.id,a=n.url,l=void 0===a?"":a;if(ie(r,l)){var s=R(l);s&&Y({filesList:[s],onFileChange:function(e){var t=f(e,1),n=t[0];i(ne(n))},allowedTypes:te,onError:function(t){o.createErrorNotice(t),e.setState({isEditing:!0})}})}}},{key:"componentDidUpdate",value:function(e){var t=e.attributes,n=t.id,i=t.url,o=void 0===i?"":i,r=this.props.attributes,a=r.id,l=r.url,s=void 0===l?"":l;ie(n,o)&&!ie(a,s)&&P(s),!this.props.isSelected&&e.isSelected&&this.state.captionFocused&&this.setState({captionFocused:!1})}},{key:"onSelectImage",value:function(e){if(!e||!e.url)return void this.props.setAttributes({url:void 0,alt:void 0,id:void 0,caption:void 0});var t=this.state.affiliateLink;this.setState({isEditing:!1}),this.props.setAttributes(p({},ne(e),{linkid:t.id,href:t.link,affiliateLink:t,width:void 0,height:void 0}))}},{key:"onImageError",value:function(e){var t=Object(s.a)({attributes:{url:e}});void 0!==t&&this.props.onReplace(t)}},{key:"onFocusCaption",value:function(){this.state.captionFocused||this.setState({captionFocused:!0})}},{key:"onImageClick",value:function(){this.state.captionFocused&&this.setState({captionFocused:!1})}},{key:"updateAlt",value:function(e){this.props.setAttributes({alt:e})}},{key:"updateAlignment",value:function(e){var t=-1!==["wide","full"].indexOf(e)?{width:void 0,height:void 0}:{};this.props.setAttributes(p({},t,{align:e}))}},{key:"updateImageURL",value:function(e){this.props.setAttributes({url:e,width:void 0,height:void 0})}},{key:"updateWidth",value:function(e){this.props.setAttributes({width:parseInt(e,10)})}},{key:"updateHeight",value:function(e){this.props.setAttributes({height:parseInt(e,10)})}},{key:"updateDimensions",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return function(){e.props.setAttributes({width:t,height:n})}}},{key:"getFilename",value:function(e){var t=k(e);if(t)return w(t.split("/"))}},{key:"getLinkDestinationOptions",value:function(){return[{value:"none",label:E("None")},{value:"media",label:E("Media File")},{value:"attachment",label:E("Attachment Page")},{value:"custom",label:E("Custom URL")}]}},{key:"toggleIsEditing",value:function(){this.setState({isEditing:!this.state.isEditing})}},{key:"getImageSizeOptions",value:function(){var e=this.props,t=e.imageSizes,n=e.image;return y(v(t,function(e){var t=e.name,i=e.slug,o=m(n,["media_details","sizes",i,"source_url"]);return o?{value:o,label:t}:null}))}},{key:"onChangeInputValue",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=t?t.id:0;this.setState({inputValue:e,linkid:n,post:t})}},{key:"resetInvalidLink",value:function(){this.setState({invalidLink:!1})}},{key:"updateImageSelection",value:function(e,t){this.setState({imageSelection:e,affiliateLink:t})}},{key:"onSelectAffiliateImage",value:function(e){var t=this;wp.apiFetch({path:wp.url.addQueryArgs("wp/v2/media/"+e.id,{context:"edit",_locale:"user"})}).then(function(e){e.url=e.source_url,t.onSelectImage(e)})}},{key:"editAFfiliateImage",value:function(){var e=this.props.attributes,t=e.affiliateLink;this.setState({isEditing:!0,imageSelection:t.images,affiliateLink:t})}},{key:"render",value:function(){var e=this,t=this.state,n=t.isEditing,i=t.imageSelection,o=t.affiliateLink,r=this.props,a=r.attributes,s=r.setAttributes,p=r.isLargeViewport,f=r.isSelected,d=r.className,h=r.maxWidth,m=r.toggleSelection,v=r.isRTL,w=a.url,b=a.alt,y=a.caption,k=a.align,S=(a.linkDestination,a.width),L=a.height,O=a.linkid,I=a.href,T=wp.element.createElement(U,null,wp.element.createElement(W,{className:"ta-edit-image-button components-icon-button components-toolbar__control",label:E("Edit ThirstyAffiliates Image"),icon:"edit",onClick:this.editAFfiliateImage})),R=wp.element.createElement(Q,null,wp.element.createElement(X,{value:k,onChange:this.updateAlignment}),T);if(n)return wp.element.createElement(C,null,R,wp.element.createElement(j,{icon:"format-image",label:E("ThirstyAffiliates Image"),instructions:E("Search for an affiliate link and select image to insert.")},wp.element.createElement(c.a,{updateImageSelection:this.updateImageSelection}),!!i.length&&wp.element.createElement("div",{className:"ta-image-sel-wrap"},wp.element.createElement("h3",null,o.title+" "+E("attached images:")),wp.element.createElement("div",{className:"ta-image-selection"},i.map(function(t,n){return wp.element.createElement("button",{onClick:function(){return e.onSelectAffiliateImage(t)}},wp.element.createElement("img",{src:t.src}))})))));var P=l()(d,{"wp-block-image":!0,"is-transient":x(w),"is-resized":!!S||!!L,"is-focused":f}),A=-1===["wide","full"].indexOf(k)&&p,K=this.getImageSizeOptions(),q=function(t,n){return wp.element.createElement(Z,null,wp.element.createElement(D,{title:E("Image Settings")},wp.element.createElement(B,{label:E("Alt Text (Alternative Text)"),value:b,onChange:e.updateAlt,help:E("Alternative text describes your image to people who can’t see it. Add a short description with its key details.")}),!g(K)&&wp.element.createElement(H,{label:E("Image Size"),value:w,options:K,onChange:e.updateImageURL}),A&&wp.element.createElement("div",{className:"block-library-image__dimensions"},wp.element.createElement("p",{className:"block-library-image__dimensions__row"},E("Image Dimensions")),wp.element.createElement("div",{className:"block-library-image__dimensions__row"},wp.element.createElement(M,{type:"number",className:"block-library-image__dimensions__width",label:E("Width"),value:void 0!==S?S:"",placeholder:t,min:1,onChange:e.updateWidth}),wp.element.createElement(M,{type:"number",className:"block-library-image__dimensions__height",label:E("Height"),value:void 0!==L?L:"",placeholder:n,min:1,onChange:e.updateHeight})),wp.element.createElement("div",{className:"block-library-image__dimensions__row"},wp.element.createElement(F,{"aria-label":E("Image Size")},[25,50,75,100].map(function(i){var o=Math.round(t*(i/100)),r=Math.round(n*(i/100)),a=S===o&&L===r;return wp.element.createElement(N,{key:i,isSmall:!0,isPrimary:a,"aria-pressed":a,onClick:e.updateDimensions(o,r)},i,"%")})),wp.element.createElement(N,{isSmall:!0,onClick:e.updateDimensions()},E("Reset"))))))};return wp.element.createElement(C,null,R,wp.element.createElement("figure",{className:P},wp.element.createElement(u.a,{src:w,dirtynessTrigger:k},function(t){var n=t.imageWidthWithinContainer,i=t.imageHeightWithinContainer,o=t.imageWidth,r=t.imageHeight,a=e.getFilename(w),l=void 0;l=b||(a?_(E("This image has an empty alt attribute; its file name is %s"),a):E("This image has an empty alt attribute"));var u=wp.element.createElement(C,null,wp.element.createElement("ta",{linkid:O,href:I},wp.element.createElement("img",{src:w,alt:l,onClick:e.onImageClick,onError:function(){return e.onImageError(w)}})),x(w)&&wp.element.createElement(z,null));if(!A||!n)return wp.element.createElement(C,null,q(o,r),wp.element.createElement("div",{style:{width:S,height:L}},u));var c=S||n,p=L||i,f=o/r,d=o<r?20:20*f,g=r<o?20:20/f,y=2.5*h,T=!1,R=!1;return"center"===k?(T=!0,R=!0):v?"left"===k?T=!0:R=!0:"right"===k?R=!0:T=!0,wp.element.createElement(C,null,q(o,r),wp.element.createElement(V,{size:S&&L?{width:S,height:L}:void 0,minWidth:d,maxWidth:y,minHeight:g,maxHeight:y/f,lockAspectRatio:!0,enable:{top:!1,right:T,bottom:!0,left:R},onResizeStart:function(){m(!1)},onResizeStop:function(e,t,n,i){s({width:parseInt(c+i.width,10),height:parseInt(p+i.height,10)}),m(!0)}},u))}),(!$.isEmpty(y)||f)&&wp.element.createElement($,{tagName:"figcaption",placeholder:E("Write caption…"),value:y,unstableOnFocus:this.onFocusCaption,onChange:function(e){return s({caption:e})},isSelected:this.state.captionFocused,inlineToolbar:!0})))}}]),t}(O);t.a=ee([q(function(e,t){var n=e("core"),i=n.getMedia,o=e("core/editor"),r=o.getEditorSettings,a=t.attributes.id,l=r(),s=l.maxWidth,u=l.isRTL,c=l.imageSizes;return{image:a?i(a):null,maxWidth:s,isRTL:u,imageSizes:c}}),J({isLargeViewport:"medium"}),K])(oe)},function(e,t,n){"use strict";n.d(t,"a",function(){return l});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},o=lodash,r=o.includes,a=(wp.element.renderToString,wp.blocks.createBlock),l=function(e,t){var n=e.preview,o=e.name,r=e.attributes.url;if(r){var l=findBlock(r);if("core-embed/wordpress"!==o&&DEFAULT_EMBED_BLOCK!==l&&o!==l)return a(l,{url:r});if(n){var u=n.html;if(s(u)&&"core-embed/wordpress"!==o)return a("core-embed/wordpress",i({url:r},t))}}},s=function(e){return r(e,'class="wp-embedded-content" data-secret')}},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=lodash,s=l.noop,u=wp.compose.withGlobalEvents,c=wp.element.Component,p=function(e){function t(){i(this,t);var e=o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.state={width:void 0,height:void 0},e.bindContainer=e.bindContainer.bind(e),e.calculateSize=e.calculateSize.bind(e),e}return r(t,e),a(t,[{key:"bindContainer",value:function(e){this.container=e}},{key:"componentDidUpdate",value:function(e){this.props.src!==e.src&&(this.setState({width:void 0,height:void 0}),this.fetchImageSize()),this.props.dirtynessTrigger!==e.dirtynessTrigger&&this.calculateSize()}},{key:"componentDidMount",value:function(){this.fetchImageSize()}},{key:"componentWillUnmount",value:function(){this.image&&(this.image.onload=s)}},{key:"fetchImageSize",value:function(){this.image=new window.Image,this.image.onload=this.calculateSize,this.image.src=this.props.src}},{key:"calculateSize",value:function(){var e=this.container.clientWidth,t=this.image.width>e,n=this.image.height/this.image.width,i=t?e:this.image.width,o=t?e*n:this.image.height;this.setState({width:i,height:o})}},{key:"render",value:function(){var e={imageWidth:this.image&&this.image.width,imageHeight:this.image&&this.image.height,containerWidth:this.container&&this.container.clientWidth,containerHeight:this.container&&this.container.clientHeight,imageWidthWithinContainer:this.state.width,imageHeightWithinContainer:this.state.height};return wp.element.createElement("div",{ref:this.bindContainer},this.props.children(e))}}]),t}(c);t.a=u({resize:"calculateSize"})(p)},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(0),l=n.n(a),s=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),u=wp.i18n.__,c=wp.element,p=c.Component,f=c.createRef,d=wp.components,h=d.Spinner,m=d.withSpokenMessages,g=d.Popover,v=d.TextControl,w=wp.compose.withInstanceId,b=function(e){function t(e){var n=e.autocompleteRef;i(this,t);var r=o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return r.autocompleteRef=n||f(),r.inputRef=f(),r.searchAffiliateLinks=r.searchAffiliateLinks.bind(r),r.suggestionNodes=[],r.state={posts:[],showSuggestions:!1,selectedSuggestion:null,loading:!1},r}return r(t,e),s(t,[{key:"componentDidUpdate",value:function(){var e=this,t=this.state,n=t.showSuggestions,i=t.selectedSuggestion;n&&null!==i&&!this.scrollingIntoView&&(this.scrollingIntoView=!0,scrollIntoView(this.suggestionNodes[i],this.autocompleteRef.current,{onlyScrollIfNeeded:!0}),setTimeout(function(){e.scrollingIntoView=!1},100))}},{key:"componentWillUnmount",value:function(){delete this.suggestionsRequest}},{key:"bindSuggestionNode",value:function(e){var t=this;return function(n){t.suggestionNodes[e]=n}}},{key:"searchAffiliateLinks",value:function(e){var t=this;if(e.length<2)return void this.setState({showSuggestions:!1,selectedSuggestion:null,loading:!1});this.setState({showSuggestions:!0,selectedSuggestion:null,loading:!0});var n=new FormData;n.append("action","search_affiliate_links_query"),n.append("keyword",e),n.append("paged",1),n.append("gutenberg",!0),n.append("with_images",!0);var i=fetch(ajaxurl,{method:"POST",body:n});i.then(function(e){return e.json()}).then(function(e){if(e.affiliate_links){var n=e.affiliate_links;t.suggestionsRequest===i&&(t.setState({posts:n,loading:!1}),n.length?t.props.debouncedSpeak(sprintf(_n("%d result found, use up and down arrow keys to navigate.","%d results found, use up and down arrow keys to navigate.",n.length),n.length),"assertive"):t.props.debouncedSpeak(u("No results."),"assertive"))}}).catch(function(){t.suggestionsRequest===i&&t.setState({loading:!1})}),this.suggestionsRequest=i}},{key:"selectLink",value:function(e){this.setState({selectedSuggestion:e,showSuggestions:!1}),this.props.updateImageSelection(e.images,e)}},{key:"handleOnClick",value:function(e){this.selectLink(e)}},{key:"render",value:function(){var e=this,t=this.props,n=(t.value,t.autoFocus,t.instanceId),i=this.state,o=i.showSuggestions,r=i.posts,a=i.selectedSuggestion,s=i.loading;return wp.element.createElement("div",{class:"edit-search-affiliate-links"},wp.element.createElement("form",{className:"editor-format-toolbar__link-container-content ta-link-search-popover",onSubmit:this.displayAffiliateImages},wp.element.createElement(v,{type:"text",className:"ta-search-affiliate-links",placeholder:u("Type to search affiliate links"),onChange:this.searchAffiliateLinks,autocomplete:"off"}),s&&wp.element.createElement(h,null),o&&!!r.length&&wp.element.createElement(g,{position:"bottom",focusOnMount:!1},wp.element.createElement("div",{class:"affilate-links-suggestions"},r.map(function(t,i){return wp.element.createElement("button",{key:t.id,role:"option",tabIndex:"-1",id:"editor-url-input-suggestion-"+n+"-"+i,ref:e.bindSuggestionNode(i),className:l()("editor-url-input__suggestion",{"is-selected":i===a}),onClick:function(){return e.handleOnClick(t)},"aria-selected":i===a},t.title||u("(no title)"))})))))}}]),t}(p);t.a=m(w(b))},function(e,t,n){"use strict";function i(e,t){var n={};for(var i in e)t.indexOf(i)>=0||Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i]);return n}function o(){[r.a].forEach(function(e){var t=e.name,n=i(e,["name"]);return a(t,n)})}t.a=o;var r=n(9),a=wp.richText.registerFormatType},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}n.d(t,"a",function(){return L});var a=n(10),l=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=wp.i18n.__,u=wp.element,c=u.Component,p=u.Fragment,f=wp.components.withSpokenMessages,d=wp.richText,h=d.getTextContent,m=d.applyFormat,g=d.removeFormat,v=d.slice,w=wp.url.isURL,b=wp.editor,y=b.RichTextToolbarButton,k=b.RichTextShortcut,S=wp.components,E=S.Path,_=S.SVG,L={name:"ta/link",title:s("Affiliate Link"),tagName:"ta",className:null,attributes:{url:"href",target:"target"},edit:f(function(e){function t(){i(this,t);var e=o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.addLink=e.addLink.bind(e),e.stopAddingLink=e.stopAddingLink.bind(e),e.onRemoveFormat=e.onRemoveFormat.bind(e),e.state={addingLink:!1},e}return r(t,e),l(t,[{key:"addLink",value:function(){var e=this.props,t=e.value,n=e.onChange,i=h(v(t));i&&w(i)?n(m(t,{type:"ta/link",attributes:{url:i}})):this.setState({addingLink:!0})}},{key:"stopAddingLink",value:function(){this.setState({addingLink:!1})}},{key:"onRemoveFormat",value:function(){var e=this.props,t=e.value,n=e.onChange,i=e.speak;n(g(t,"ta/link")),i(s("Affiliate Link removed."),"assertive")}},{key:"render",value:function(){var e=this.props,t=e.isActive,n=e.activeAttributes,i=e.value,o=e.onChange;return wp.element.createElement(p,null,wp.element.createElement(k,{type:"access",character:"s",onUse:this.onRemoveFormat}),wp.element.createElement(k,{type:"primary",character:"l",onUse:this.addLink}),wp.element.createElement(k,{type:"primaryShift",character:"l",onUse:this.onRemoveFormat}),t&&wp.element.createElement(y,{icon:"editor-unlink",title:s("Remove Affiliate Link"),className:"ta-unlink-button",onClick:this.onRemoveFormat,isActive:t,shortcutType:"primaryShift",shortcutCharacter:"l"}),!t&&wp.element.createElement(y,{icon:wp.element.createElement(_,{xmlns:"http://www.w3.org/2000/svg",width:"16.688",height:"9.875",viewBox:"0 0 16.688 9.875"},wp.element.createElement(E,{id:"TA.svg",fill:"black",class:"cls-1",d:"M2.115,15.12H4.847L6.836,7.7H9.777l0.63-2.381H1.821L1.177,7.7H4.118Zm4.758,0H9.829l1.177-1.751h3.782l0.238,1.751h2.858L16.357,5.245H13.7Zm5.5-3.866,1.835-2.816,0.35,2.816H12.378Z",transform:"translate(-1.188 -5.25)"})),title:s("Affiliate Link"),className:"ta-link-button",onClick:this.addLink,shortcutType:"primary",shortcutCharacter:"l"}),wp.element.createElement(a.a,{addingLink:this.state.addingLink,stopAddingLink:this.stopAddingLink,isActive:t,activeAttributes:n,value:i,onChange:o}))}}]),t}(c))}},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function a(e){var t=e.url,n=e.linkid;e.text;return{type:"ta/link",attributes:{url:t,linkid:n.toString()}}}function l(e,t){return e.addingLink||t.editLink}var s=n(0),u=n.n(s),c=n(11),p=n(12),f=n(13),d=n(14),h=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),m=wp.i18n.__,g=wp.element,v=g.Component,w=g.createRef,b=wp.components,y=b.ExternalLink,k=(b.ToggleControl,b.IconButton),S=b.withSpokenMessages,E=wp.keycodes,_=E.LEFT,L=E.RIGHT,O=E.UP,C=E.DOWN,I=E.BACKSPACE,T=E.ENTER,R=wp.url,P=R.prependHTTP,x=R.safeDecodeURI,A=R.filterURLForDisplay,j=wp.richText,N=j.create,F=j.insert,W=j.isCollapsed,D=j.applyFormat,V=j.getTextContent,H=j.slice,z=function(e){return e.stopPropagation()},M=function(e){var t=e.value,n=e.onChangeInputValue,i=e.onKeyDown,o=e.submitLink,r=e.invalidLink,a=e.resetInvalidLink,l=e.autocompleteRef;return wp.element.createElement("form",{className:"editor-format-toolbar__link-container-content ta-link-search-popover",onKeyPress:z,onKeyDown:i,onSubmit:o},wp.element.createElement(d.a,{value:t,onChange:n,autocompleteRef:l,invalidLink:r,resetInvalidLink:a}),wp.element.createElement(k,{icon:"editor-break",label:m("Apply"),type:"submit"}))},B=function(e){var t=e.url,n=P(t),i=u()("editor-format-toolbar__link-container-value",{"has-invalid-link":!Object(p.a)(n)});return t?wp.element.createElement(y,{className:i,href:t},A(x(t))):wp.element.createElement("span",{className:i})},U=function(e){var t=e.url,n=e.editLink;return wp.element.createElement("div",{className:"editor-format-toolbar__link-container-content",onKeyPress:z},wp.element.createElement(B,{url:t}),wp.element.createElement(k,{icon:"edit",label:m("Edit"),onClick:n}))},K=function(e){function t(){i(this,t);var e=o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.editLink=e.editLink.bind(e),e.submitLink=e.submitLink.bind(e),e.onKeyDown=e.onKeyDown.bind(e),e.onChangeInputValue=e.onChangeInputValue.bind(e),e.onClickOutside=e.onClickOutside.bind(e),e.resetState=e.resetState.bind(e),e.autocompleteRef=w(),e.resetInvalidLink=e.resetInvalidLink.bind(e),e.state={inputValue:"",linkid:0,post:null,invalidLink:!1},e}return r(t,e),h(t,[{key:"onKeyDown",value:function(e){[_,C,L,O,I,T].indexOf(e.keyCode)>-1&&e.stopPropagation()}},{key:"onChangeInputValue",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=t?t.id:0;this.setState({inputValue:e,linkid:n,post:t})}},{key:"editLink",value:function(e){this.setState({editLink:!0}),e.preventDefault()}},{key:"submitLink",value:function(e){var t=this.props,n=t.isActive,i=t.value,o=t.onChange,r=t.speak,l=this.state,s=l.inputValue,u=l.linkid,c=l.post,f=P(s),d=V(H(i)),h=a({url:f,linkid:u,text:d});if(e.preventDefault(),!u||!c)return void this.setState({invalidLink:!0});if(W(i)&&!n){var g=D(N({text:c.title}),h,0,f.length);o(F(i,g))}else o(D(i,h));this.resetState(),Object(p.a)(f)?n?r(m("Link edited."),"assertive"):r(m("Link inserted"),"assertive"):r(m("Warning: the link has been inserted but may have errors. Please test it."),"assertive")}},{key:"onClickOutside",value:function(e){var t=this.autocompleteRef.current;t&&t.contains(e.target)||this.resetState()}},{key:"resetState",value:function(){this.props.stopAddingLink(),this.setState({inputValue:"",editLink:!1}),this.resetInvalidLink()}},{key:"resetInvalidLink",value:function(){this.setState({invalidLink:!1})}},{key:"render",value:function(){var e=this.props,t=e.isActive,n=e.activeAttributes,i=n.url,o=(n.linkid,e.addingLink),r=e.value;e.onChange;if(!t&&!o)return null;var a=this.state,s=a.inputValue,u=a.invalidLink,p=l(this.props,this.state);return wp.element.createElement(c.a,{key:""+r.start+r.end},wp.element.createElement(f.a,{onClickOutside:this.onClickOutside,onClose:this.resetState,focusOnMount:!!p&&"firstElement",invalidLink:u},p?wp.element.createElement(M,{value:s,onChangeInputValue:this.onChangeInputValue,onKeyDown:this.onKeyDown,submitLink:this.submitLink,autocompleteRef:this.autocompleteRef,updateLinkId:this.updateLinkId,invalidLink:u,resetInvalidLink:this.resetInvalidLink}):wp.element.createElement(U,{url:i,editLink:this.editLink})))}}]),t}(v);t.a=S(K)},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function a(){var e=window.getSelection();if(0===e.rangeCount)return{};var t=p(e.getRangeAt(0)),n=t.top+t.height,i=t.left+t.width/2,o=c(e.anchorNode);if(o){var r=o.getBoundingClientRect();n-=r.top,i-=r.left}return{top:n,left:i}}var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=wp.element.Component,u=wp.dom,c=u.getOffsetParent,p=u.getRectangleFromRange,f=function(e){function t(){i(this,t);var e=o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.state={style:a()},e}return r(t,e),l(t,[{key:"render",value:function(){var e=this.props.children,t=this.state.style;return wp.element.createElement("div",{className:"editor-format-toolbar__selection-position",style:t},e)}}]),t}(s);t.a=f},function(e,t,n){"use strict";function i(e){if(!e)return!1;var t=e.trim();if(!t)return!1;if(/^\S+:/.test(t)){var n=l(t);if(!s(n))return!1;if(r(n,"http")&&!/^https?:\/\/[^\/\s]/i.test(t))return!1;var i=u(t);if(!c(i))return!1;var o=p(t);if(o&&!f(o))return!1;var a=d(t);if(a&&!h(a))return!1;var v=m(t);if(v&&!g(v))return!1}return!(r(t,"#")&&!g(t))}t.a=i;var o=lodash,r=o.startsWith,a=wp.url,l=a.getProtocol,s=a.isValidProtocol,u=a.getAuthority,c=a.isValidAuthority,p=a.getPath,f=a.isValidPath,d=a.getQueryString,h=a.isValidQueryString,m=a.getFragment,g=a.isValidFragment},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=wp.i18n.__,s=wp.element.Component,u=wp.components,c=u.Popover,p=u.IconButton,f=function(e){function t(){i(this,t);var e=o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.toggleSettingsVisibility=e.toggleSettingsVisibility.bind(e),e.state={isSettingsExpanded:!1},e}return r(t,e),a(t,[{key:"toggleSettingsVisibility",value:function(){this.setState({isSettingsExpanded:!this.state.isSettingsExpanded})}},{key:"render",value:function(){var e=this.props,t=e.children,n=e.renderSettings,i=e.onClose,o=e.onClickOutside,r=e.invalidLink,a=e.position,s=void 0===a?"bottom center":a,u=e.focusOnMount,f=void 0===u?"firstElement":u,d=this.state.isSettingsExpanded,h=!!n&&d;return wp.element.createElement(c,{className:"ta-url-popover editor-url-popover",focusOnMount:f,position:s,onClose:i,onClickOutside:o},wp.element.createElement("div",{className:"editor-url-popover__row"},t,!!n&&wp.element.createElement(p,{className:"editor-url-popover__settings-toggle",icon:"ellipsis",label:l("Link Settings"),onClick:this.toggleSettingsVisibility,"aria-expanded":d})),h&&wp.element.createElement("div",{className:"editor-url-popover__row editor-url-popover__settings"},n()),r&&wp.element.createElement("div",{class:"ta-invalid-link"},l("Invalid affiliate link")))}}]),t}(s);t.a=f},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(0),l=n.n(a),s=n(15),u=n.n(s),c=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),p=wp.i18n.__,f=lodash,d=f.throttle,h=wp.element,m=h.Component,g=h.createRef,v=wp.keycodes,w=v.UP,b=v.DOWN,y=v.ENTER,k=v.TAB,S=wp.components,E=S.Spinner,_=S.withSpokenMessages,L=S.Popover,O=wp.compose.withInstanceId,C=function(e){return e.stopPropagation()},I=function(e){function t(e){var n=e.autocompleteRef;i(this,t);var r=o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return r.onChange=r.onChange.bind(r),r.onKeyDown=r.onKeyDown.bind(r),r.autocompleteRef=n||g(),r.inputRef=g(),r.updateSuggestions=d(r.updateSuggestions.bind(r),200),r.suggestionNodes=[],r.state={posts:[],showSuggestions:!1,selectedSuggestion:null},r}return r(t,e),c(t,[{key:"componentDidUpdate",value:function(){var e=this,t=this.state,n=t.showSuggestions,i=t.selectedSuggestion;n&&null!==i&&!this.scrollingIntoView&&(this.scrollingIntoView=!0,u()(this.suggestionNodes[i],this.autocompleteRef.current,{onlyScrollIfNeeded:!0}),setTimeout(function(){e.scrollingIntoView=!1},100))}},{key:"componentWillUnmount",value:function(){delete this.suggestionsRequest}},{key:"bindSuggestionNode",value:function(e){var t=this;return function(n){t.suggestionNodes[e]=n}}},{key:"updateSuggestions",value:function(e){var t=this;if(e.length<2||/^https?:/.test(e))return void this.setState({showSuggestions:!1,selectedSuggestion:null,loading:!1});this.setState({showSuggestions:!0,selectedSuggestion:null,loading:!0});var n=new FormData;n.append("action","search_affiliate_links_query"),n.append("keyword",e),n.append("paged",1),n.append("gutenberg",!0);var i=fetch(ajaxurl,{method:"POST",body:n});i.then(function(e){return e.json()}).then(function(e){if(e.affiliate_links){var n=e.affiliate_links;t.suggestionsRequest===i&&(t.setState({posts:n,loading:!1}),n.length?t.props.debouncedSpeak(sprintf(_n("%d result found, use up and down arrow keys to navigate.","%d results found, use up and down arrow keys to navigate.",n.length),n.length),"assertive"):t.props.debouncedSpeak(p("No results."),"assertive"))}}).catch(function(){t.suggestionsRequest===i&&t.setState({loading:!1})}),this.suggestionsRequest=i}},{key:"onChange",value:function(e){this.props.resetInvalidLink();var t=e.target.value;this.props.onChange(t),this.updateSuggestions(t)}},{key:"onKeyDown",value:function(e){var t=this.state,n=t.showSuggestions,i=t.selectedSuggestion,o=t.posts,r=t.loading;if(n&&o.length&&!r){var a=this.state.posts[this.state.selectedSuggestion];switch(e.keyCode){case w:e.stopPropagation(),e.preventDefault();var l=i?i-1:o.length-1;this.setState({selectedSuggestion:l});break;case b:e.stopPropagation(),e.preventDefault();var s=null===i||i===o.length-1?0:i+1;this.setState({selectedSuggestion:s});break;case k:null!==this.state.selectedSuggestion&&(this.selectLink(a),this.props.speak(p("Link selected")));break;case y:null!==this.state.selectedSuggestion&&(e.stopPropagation(),this.selectLink(a))}}else switch(e.keyCode){case w:0!==e.target.selectionStart&&(e.stopPropagation(),e.preventDefault(),e.target.setSelectionRange(0,0));break;case b:this.props.value.length!==e.target.selectionStart&&(e.stopPropagation(),e.preventDefault(),e.target.setSelectionRange(this.props.value.length,this.props.value.length))}}},{key:"selectLink",value:function(e){this.props.onChange(e.link,e),this.setState({selectedSuggestion:null,showSuggestions:!1})}},{key:"handleOnClick",value:function(e){this.selectLink(e),this.inputRef.current.focus()}},{key:"render",value:function(){var e=this,t=this.props,n=t.value,i=void 0===n?"":n,o=t.autoFocus,r=void 0===o||o,a=t.instanceId,s=t.invalidLink,u=this.state,c=u.showSuggestions,f=u.posts,d=u.selectedSuggestion,h=u.loading;return wp.element.createElement("div",{className:"editor-url-input"},wp.element.createElement("input",{autoFocus:r,type:"text","aria-label":p("URL"),required:!0,value:i,onChange:this.onChange,onInput:C,placeholder:p("Paste URL or type to search"),onKeyDown:this.onKeyDown,role:"combobox","aria-expanded":c,"aria-autocomplete":"list","aria-owns":"editor-url-input-suggestions-"+a,"aria-activedescendant":null!==d?"editor-url-input-suggestion-"+a+"-"+d:void 0,ref:this.inputRef}),h&&wp.element.createElement(E,null),c&&!!f.length&&!s&&wp.element.createElement(L,{position:"bottom",noArrow:!0,focusOnMount:!1},wp.element.createElement("div",{className:"editor-url-input__suggestions",id:"editor-url-input-suggestions-"+a,ref:this.autocompleteRef,role:"listbox"},f.map(function(t,n){return wp.element.createElement("button",{key:t.id,role:"option",tabIndex:"-1",id:"editor-url-input-suggestion-"+a+"-"+n,ref:e.bindSuggestionNode(n),className:l()("editor-url-input__suggestion",{"is-selected":n===d}),onClick:function(){return e.handleOnClick(t)},"aria-selected":n===d},t.title||p("(no title)"))}))))}}]),t}(m);t.a=_(O(I))},function(e,t,n){"use strict";e.exports=n(16)},function(e,t,n){"use strict";function i(e,t,n){n=n||{},9===t.nodeType&&(t=o.getWindow(t));var i=n.allowHorizontalScroll,r=n.onlyScrollIfNeeded,a=n.alignWithTop,l=n.alignWithLeft,s=n.offsetTop||0,u=n.offsetLeft||0,c=n.offsetBottom||0,p=n.offsetRight||0;i=void 0===i||i;var f=o.isWindow(t),d=o.offset(e),h=o.outerHeight(e),m=o.outerWidth(e),g=void 0,v=void 0,w=void 0,b=void 0,y=void 0,k=void 0,S=void 0,E=void 0,_=void 0,L=void 0;f?(S=t,L=o.height(S),_=o.width(S),E={left:o.scrollLeft(S),top:o.scrollTop(S)},y={left:d.left-E.left-u,top:d.top-E.top-s},k={left:d.left+m-(E.left+_)+p,top:d.top+h-(E.top+L)+c},b=E):(g=o.offset(t),v=t.clientHeight,w=t.clientWidth,b={left:t.scrollLeft,top:t.scrollTop},y={left:d.left-(g.left+(parseFloat(o.css(t,"borderLeftWidth"))||0))-u,top:d.top-(g.top+(parseFloat(o.css(t,"borderTopWidth"))||0))-s},k={left:d.left+m-(g.left+w+(parseFloat(o.css(t,"borderRightWidth"))||0))+p,top:d.top+h-(g.top+v+(parseFloat(o.css(t,"borderBottomWidth"))||0))+c}),y.top<0||k.top>0?!0===a?o.scrollTop(t,b.top+y.top):!1===a?o.scrollTop(t,b.top+k.top):y.top<0?o.scrollTop(t,b.top+y.top):o.scrollTop(t,b.top+k.top):r||(a=void 0===a||!!a,a?o.scrollTop(t,b.top+y.top):o.scrollTop(t,b.top+k.top)),i&&(y.left<0||k.left>0?!0===l?o.scrollLeft(t,b.left+y.left):!1===l?o.scrollLeft(t,b.left+k.left):y.left<0?o.scrollLeft(t,b.left+y.left):o.scrollLeft(t,b.left+k.left):r||(l=void 0===l||!!l,l?o.scrollLeft(t,b.left+y.left):o.scrollLeft(t,b.left+k.left)))}var o=n(17);e.exports=i},function(e,t,n){"use strict";function i(e){var t=void 0,n=void 0,i=void 0,o=e.ownerDocument,r=o.body,a=o&&o.documentElement;return t=e.getBoundingClientRect(),n=t.left,i=t.top,n-=a.clientLeft||r.clientLeft||0,i-=a.clientTop||r.clientTop||0,{left:n,top:i}}function o(e,t){var n=e["page"+(t?"Y":"X")+"Offset"],i="scroll"+(t?"Top":"Left");if("number"!=typeof n){var o=e.document;n=o.documentElement[i],"number"!=typeof n&&(n=o.body[i])}return n}function r(e){return o(e)}function a(e){return o(e,!0)}function l(e){var t=i(e),n=e.ownerDocument,o=n.defaultView||n.parentWindow;return t.left+=r(o),t.top+=a(o),t}function s(e,t,n){var i="",o=e.ownerDocument,r=n||o.defaultView.getComputedStyle(e,null);return r&&(i=r.getPropertyValue(t)||r[t]),i}function u(e,t){var n=e[_]&&e[_][t];if(S.test(n)&&!E.test(t)){var i=e.style,o=i[O],r=e[L][O];e[L][O]=e[_][O],i[O]="fontSize"===t?"1em":n||0,n=i.pixelLeft+C,i[O]=o,e[L][O]=r}return""===n?"auto":n}function c(e,t){for(var n=0;n<e.length;n++)t(e[n])}function p(e){return"border-box"===I(e,"boxSizing")}function f(e,t,n){var i={},o=e.style,r=void 0;for(r in t)t.hasOwnProperty(r)&&(i[r]=o[r],o[r]=t[r]);n.call(e);for(r in t)t.hasOwnProperty(r)&&(o[r]=i[r])}function d(e,t,n){var i=0,o=void 0,r=void 0,a=void 0;for(r=0;r<t.length;r++)if(o=t[r])for(a=0;a<n.length;a++){var l=void 0;l="border"===o?o+n[a]+"Width":o+n[a],i+=parseFloat(I(e,l))||0}return i}function h(e){return null!=e&&e==e.window}function m(e,t,n){if(h(e))return"width"===t?A.viewportWidth(e):A.viewportHeight(e);if(9===e.nodeType)return"width"===t?A.docWidth(e):A.docHeight(e);var i="width"===t?["Left","Right"]:["Top","Bottom"],o="width"===t?e.offsetWidth:e.offsetHeight,r=I(e),a=p(e,r),l=0;(null==o||o<=0)&&(o=void 0,l=I(e,t),(null==l||Number(l)<0)&&(l=e.style[t]||0),l=parseFloat(l)||0),void 0===n&&(n=a?x:R);var s=void 0!==o||a,u=o||l;if(n===R)return s?u-d(e,["border","padding"],i,r):l;if(s){var c=n===P?-d(e,["border"],i,r):d(e,["margin"],i,r);return u+(n===x?0:c)}return l+d(e,T.slice(n),i,r)}function g(e){var t=void 0,n=arguments;return 0!==e.offsetWidth?t=m.apply(void 0,n):f(e,j,function(){t=m.apply(void 0,n)}),t}function v(e,t,n){var i=n;{if("object"!==(void 0===t?"undefined":y(t)))return void 0!==i?("number"==typeof i&&(i+="px"),void(e.style[t]=i)):I(e,t);for(var o in t)t.hasOwnProperty(o)&&v(e,o,t[o])}}function w(e,t){"static"===v(e,"position")&&(e.style.position="relative");var n=l(e),i={},o=void 0,r=void 0;for(r in t)t.hasOwnProperty(r)&&(o=parseFloat(v(e,r))||0,i[r]=o+t[r]-n[r]);v(e,i)}var b=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},k=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,S=new RegExp("^("+k+")(?!px)[a-z%]+quot;,"i"),E=/^(top|right|bottom|left)#x2F;,_="currentStyle",L="runtimeStyle",O="left",C="px",I=void 0;"undefined"!=typeof window&&(I=window.getComputedStyle?s:u);var T=["margin","border","padding"],R=-1,P=2,x=1,A={};c(["Width","Height"],function(e){A["doc"+e]=function(t){var n=t.document;return Math.max(n.documentElement["scroll"+e],n.body["scroll"+e],A["viewport"+e](n))},A["viewport"+e]=function(t){var n="client"+e,i=t.document,o=i.body,r=i.documentElement,a=r[n];return"CSS1Compat"===i.compatMode&&a||o&&o[n]||a}});var j={position:"absolute",visibility:"hidden",display:"block"};c(["width","height"],function(e){var t=e.charAt(0).toUpperCase()+e.slice(1);A["outer"+t]=function(t,n){return t&&g(t,e,n?0:x)};var n="width"===e?["Left","Right"]:["Top","Bottom"];A[e]=function(t,i){if(void 0===i)return t&&g(t,e,R);if(t){var o=I(t);return p(t)&&(i+=d(t,["padding","border"],n,o)),v(t,e,i)}}}),e.exports=b({getWindow:function(e){var t=e.ownerDocument||e;return t.defaultView||t.parentWindow},offset:function(e,t){if(void 0===t)return l(e);w(e,t)},isWindow:h,each:c,css:v,clone:function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);if(e.overflow)for(var n in e)e.hasOwnProperty(n)&&(t.overflow[n]=e.overflow[n]);return t},scrollLeft:function(e,t){if(h(e)){if(void 0===t)return r(e);window.scrollTo(t,a(e))}else{if(void 0===t)return e.scrollLeft;e.scrollLeft=t}},scrollTop:function(e,t){if(h(e)){if(void 0===t)return a(e);window.scrollTo(r(e),t)}else{if(void 0===t)return e.scrollTop;e.scrollTop=t}},viewportWidth:0,viewportHeight:0},A)},function(e,t){}]);
7
//# sourceMappingURL=gutenberg-support.js.map
3
Licensed under the MIT License (MIT), see
4
http://jedwatson.github.io/classnames
5
*/
6
+ !function(){"use strict";function n(){for(var e=[],t=0;t<arguments.length;t++){var i=arguments[t];if(i){var o=typeof i;if("string"===o||"number"===o)e.push(i);else if(Array.isArray(i)&&i.length){var a=n.apply(null,i);a&&e.push(a)}else if("object"===o)for(var l in i)r.call(i,l)&&i[l]&&e.push(l)}}return e.join(" ")}var r={}.hasOwnProperty;void 0!==e&&e.exports?(n.default=n,e.exports=n):(i=[],void 0!==(o=function(){return n}.apply(t,i))&&(e.exports=o))}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),o=n(8),r=n(17);n.n(r);Object(i.a)(),Object(o.a)()},function(e,t,n){"use strict";function i(){[o].forEach(function(e){if(e){var t=e.name,n=e.settings;r(t,n)}})}t.a=i;var o=n(3),r=wp.blocks.registerBlockType},function(e,t,n){"use strict";function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.defineProperty(t,"__esModule",{value:!0}),n.d(t,"name",function(){return g}),n.d(t,"settings",function(){return w});var o=n(0),r=n.n(o),a=n(4),l=wp.element.Fragment,s=wp.i18n.__,u=wp.blocks,c=(u.createBlock,u.getBlockAttributes,u.getPhrasingContentSchema),p=wp.editor.RichText,d=wp.components,f=d.Path,h=d.SVG,g="ta/image",m={url:{type:"string",source:"attribute",selector:"img",attribute:"src"},alt:{type:"string",source:"attribute",selector:"img",attribute:"alt",default:""},caption:{type:"string",source:"html",selector:"figcaption"},id:{type:"number"},align:{type:"string"},width:{type:"number"},height:{type:"number"},linkid:{type:"number"},href:{type:"string",source:"attribute",selector:"ta",attribute:"href"},affiliateLink:{type:"object"}},v={img:{attributes:["src","alt"],classes:["alignleft","aligncenter","alignright","alignnone",/^wp-image-\d+#x2F;]}},w=(c(),{title:s("ThirstyAffiliates Image"),description:s("Insert an image with an affiliate link to make a visual statement."),icon:wp.element.createElement(h,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement(f,{d:"M0,0h24v24H0V0z",fill:"none"}),wp.element.createElement(f,{d:"m19 5v14h-14v-14h14m0-2h-14c-1.1 0-2 0.9-2 2v14c0 1.1 0.9 2 2 2h14c1.1 0 2-0.9 2-2v-14c0-1.1-0.9-2-2-2z"}),wp.element.createElement(f,{d:"m14.14 11.86l-3 3.87-2.14-2.59-3 3.86h12l-3.86-5.14z"})),category:"common",keywords:["img",s("photo"),s("affiliate")],attributes:m,getEditWrapperProps:function(e){var t=e.align,n=e.width;if("left"===t||"center"===t||"right"===t||"wide"===t||"full"===t)return{"data-align":t,"data-resized":!!n}},edit:a.a,save:function(e){var t,n=e.attributes,o=n.url,a=n.alt,s=n.caption,u=n.align,c=n.width,d=n.height,f=n.id,h=n.linkid,g=n.href,m=r()((t={},i(t,"align"+u,u),i(t,"is-resized",c||d),t)),v=wp.element.createElement("img",{src:o,alt:a,className:f?"wp-image-"+f:null,width:c,height:d}),w=wp.element.createElement(l,null,wp.element.createElement("ta",{linkid:h,href:g},v),wp.element.createElement(p.Content,{tagName:"figcaption",value:s}));return"left"===u||"right"===u||"center"===u?wp.element.createElement("div",{className:"wp-block-image"},wp.element.createElement("figure",{className:m},w)):wp.element.createElement("figure",{className:"wp-block-image "+m},w)}})},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(0),l=n.n(a),s=n(5),u=n(6),c=n(7),p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},d=function(){function e(e,t){var n=[],i=!0,o=!1,r=void 0;try{for(var a,l=e[Symbol.iterator]();!(i=(a=l.next()).done)&&(n.push(a.value),!t||n.length!==t);i=!0);}catch(e){o=!0,r=e}finally{try{!i&&l.return&&l.return()}finally{if(o)throw r}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),f=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),h=lodash,g=h.get,m=h.isEmpty,v=h.map,w=h.last,b=h.pick,y=h.compact,k=wp.url.getPath,S=wp.i18n,E=S.__,_=S.sprintf,L=wp.element,O=L.Component,C=L.Fragment,I=L.createRef,T=wp.blob,R=T.getBlobByURL,P=T.revokeBlobURL,A=T.isBlobURL,x=wp.components,j=x.Placeholder,N=x.Button,F=x.ButtonGroup,W=x.IconButton,D=x.PanelBody,V=x.ResizableBox,z=x.SelectControl,B=x.Spinner,H=x.TextControl,U=x.TextareaControl,M=x.Toolbar,K=x.withNotices,q=(x.ToggleControl,x.Popover,wp.data.withSelect),G=wp.editor,Q=G.RichText,Z=G.BlockControls,$=G.InspectorControls,X=(G.MediaUpload,G.MediaUploadCheck,G.MediaPlaceholder,G.BlockAlignmentToolbar),Y=G.mediaUpload,J=wp.viewport.withViewportMatch,ee=wp.compose.compose,te=["image"],ne=function(e){var t=b(e,["alt","id","link","caption"]);return t.url=g(e,["sizes","large","url"])||g(e,["media_details","sizes","large","source_url"])||e.url,t},ie=function(e,t){return!e&&A(t)},oe=function(e){function t(e){var n=e.attributes;i(this,t);var r=o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return r.updateAlt=r.updateAlt.bind(r),r.updateAlignment=r.updateAlignment.bind(r),r.onFocusCaption=r.onFocusCaption.bind(r),r.onImageClick=r.onImageClick.bind(r),r.onSelectImage=r.onSelectImage.bind(r),r.updateImageURL=r.updateImageURL.bind(r),r.updateWidth=r.updateWidth.bind(r),r.updateHeight=r.updateHeight.bind(r),r.updateDimensions=r.updateDimensions.bind(r),r.getFilename=r.getFilename.bind(r),r.toggleIsEditing=r.toggleIsEditing.bind(r),r.onImageError=r.onImageError.bind(r),r.onChangeInputValue=r.onChangeInputValue.bind(r),r.autocompleteRef=I(),r.resetInvalidLink=r.resetInvalidLink.bind(r),r.updateImageSelection=r.updateImageSelection.bind(r),r.onSelectAffiliateImage=r.onSelectAffiliateImage.bind(r),r.editAFfiliateImage=r.editAFfiliateImage.bind(r),r.state={captionFocused:!1,isEditing:!n.url,inputValue:"",linkid:0,post:null,showSuggestions:!1,imageSelection:[],affiliateLink:null},r}return r(t,e),f(t,[{key:"componentDidMount",value:function(){var e=this,t=this.props,n=t.attributes,i=t.setAttributes,o=t.noticeOperations,r=n.id,a=n.url,l=void 0===a?"":a;if(ie(r,l)){var s=R(l);s&&Y({filesList:[s],onFileChange:function(e){var t=d(e,1),n=t[0];i(ne(n))},allowedTypes:te,onError:function(t){o.createErrorNotice(t),e.setState({isEditing:!0})}})}}},{key:"componentDidUpdate",value:function(e){var t=e.attributes,n=t.id,i=t.url,o=void 0===i?"":i,r=this.props.attributes,a=r.id,l=r.url,s=void 0===l?"":l;ie(n,o)&&!ie(a,s)&&P(s),!this.props.isSelected&&e.isSelected&&this.state.captionFocused&&this.setState({captionFocused:!1})}},{key:"onSelectImage",value:function(e){if(!e||!e.url)return void this.props.setAttributes({url:void 0,alt:void 0,id:void 0,caption:void 0});var t=this.state.affiliateLink;this.setState({isEditing:!1}),this.props.setAttributes(p({},ne(e),{linkid:t.id,href:t.link,affiliateLink:t,width:void 0,height:void 0}))}},{key:"onImageError",value:function(e){var t=Object(s.a)({attributes:{url:e}});void 0!==t&&this.props.onReplace(t)}},{key:"onFocusCaption",value:function(){this.state.captionFocused||this.setState({captionFocused:!0})}},{key:"onImageClick",value:function(){this.state.captionFocused&&this.setState({captionFocused:!1})}},{key:"updateAlt",value:function(e){this.props.setAttributes({alt:e})}},{key:"updateAlignment",value:function(e){var t=-1!==["wide","full"].indexOf(e)?{width:void 0,height:void 0}:{};this.props.setAttributes(p({},t,{align:e}))}},{key:"updateImageURL",value:function(e){this.props.setAttributes({url:e,width:void 0,height:void 0})}},{key:"updateWidth",value:function(e){this.props.setAttributes({width:parseInt(e,10)})}},{key:"updateHeight",value:function(e){this.props.setAttributes({height:parseInt(e,10)})}},{key:"updateDimensions",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return function(){e.props.setAttributes({width:t,height:n})}}},{key:"getFilename",value:function(e){var t=k(e);if(t)return w(t.split("/"))}},{key:"getLinkDestinationOptions",value:function(){return[{value:"none",label:E("None")},{value:"media",label:E("Media File")},{value:"attachment",label:E("Attachment Page")},{value:"custom",label:E("Custom URL")}]}},{key:"toggleIsEditing",value:function(){this.setState({isEditing:!this.state.isEditing})}},{key:"getImageSizeOptions",value:function(){var e=this.props,t=e.imageSizes,n=e.image;return y(v(t,function(e){var t=e.name,i=e.slug,o=g(n,["media_details","sizes",i,"source_url"]);return o?{value:o,label:t}:null}))}},{key:"onChangeInputValue",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=t?t.id:0;this.setState({inputValue:e,linkid:n,post:t})}},{key:"resetInvalidLink",value:function(){this.setState({invalidLink:!1})}},{key:"updateImageSelection",value:function(e,t){this.setState({imageSelection:e,affiliateLink:t})}},{key:"onSelectAffiliateImage",value:function(e){var t=this;wp.apiFetch({path:wp.url.addQueryArgs("wp/v2/media/"+e.id,{context:"edit",_locale:"user"})}).then(function(e){e.url=e.source_url,t.onSelectImage(e)})}},{key:"editAFfiliateImage",value:function(){var e=this.props.attributes,t=e.affiliateLink;this.setState({isEditing:!0,imageSelection:t.images,affiliateLink:t})}},{key:"render",value:function(){var e=this,t=this.state,n=t.isEditing,i=t.imageSelection,o=t.affiliateLink,r=this.props,a=r.attributes,s=r.setAttributes,p=r.isLargeViewport,d=r.isSelected,f=r.className,h=r.maxWidth,g=r.toggleSelection,v=r.isRTL,w=a.url,b=a.alt,y=a.caption,k=a.align,S=(a.linkDestination,a.width),L=a.height,O=a.linkid,I=a.href,T=wp.element.createElement(M,null,wp.element.createElement(W,{className:"ta-edit-image-button components-icon-button components-toolbar__control",label:E("Edit ThirstyAffiliates Image"),icon:"edit",onClick:this.editAFfiliateImage})),R=wp.element.createElement(Z,null,wp.element.createElement(X,{value:k,onChange:this.updateAlignment}),T);if(n)return wp.element.createElement(C,null,R,wp.element.createElement(j,{icon:"format-image",label:E("ThirstyAffiliates Image"),instructions:E("Search for an affiliate link and select image to insert.")},wp.element.createElement(c.a,{updateImageSelection:this.updateImageSelection}),!!i.length&&wp.element.createElement("div",{className:"ta-image-sel-wrap"},wp.element.createElement("h3",null,o.title+" "+E("attached images:")),wp.element.createElement("div",{className:"ta-image-selection"},i.map(function(t,n){return wp.element.createElement("button",{onClick:function(){return e.onSelectAffiliateImage(t)}},wp.element.createElement("img",{src:t.src}))})))));var P=l()(f,{"wp-block-image":!0,"is-transient":A(w),"is-resized":!!S||!!L,"is-focused":d}),x=-1===["wide","full"].indexOf(k)&&p,K=this.getImageSizeOptions(),q=function(t,n){return wp.element.createElement($,null,wp.element.createElement(D,{title:E("Image Settings")},wp.element.createElement(U,{label:E("Alt Text (Alternative Text)"),value:b,onChange:e.updateAlt,help:E("Alternative text describes your image to people who can’t see it. Add a short description with its key details.")}),!m(K)&&wp.element.createElement(z,{label:E("Image Size"),value:w,options:K,onChange:e.updateImageURL}),x&&wp.element.createElement("div",{className:"block-library-image__dimensions"},wp.element.createElement("p",{className:"block-library-image__dimensions__row"},E("Image Dimensions")),wp.element.createElement("div",{className:"block-library-image__dimensions__row"},wp.element.createElement(H,{type:"number",className:"block-library-image__dimensions__width",label:E("Width"),value:void 0!==S?S:"",placeholder:t,min:1,onChange:e.updateWidth}),wp.element.createElement(H,{type:"number",className:"block-library-image__dimensions__height",label:E("Height"),value:void 0!==L?L:"",placeholder:n,min:1,onChange:e.updateHeight})),wp.element.createElement("div",{className:"block-library-image__dimensions__row"},wp.element.createElement(F,{"aria-label":E("Image Size")},[25,50,75,100].map(function(i){var o=Math.round(t*(i/100)),r=Math.round(n*(i/100)),a=S===o&&L===r;return wp.element.createElement(N,{key:i,isSmall:!0,isPrimary:a,"aria-pressed":a,onClick:e.updateDimensions(o,r)},i,"%")})),wp.element.createElement(N,{isSmall:!0,onClick:e.updateDimensions()},E("Reset"))))))};return wp.element.createElement(C,null,R,wp.element.createElement("figure",{className:P},wp.element.createElement(u.a,{src:w,dirtynessTrigger:k},function(t){var n=t.imageWidthWithinContainer,i=t.imageHeightWithinContainer,o=t.imageWidth,r=t.imageHeight,a=e.getFilename(w),l=void 0;l=b||(a?_(E("This image has an empty alt attribute; its file name is %s"),a):E("This image has an empty alt attribute"));var u=wp.element.createElement(C,null,wp.element.createElement("ta",{linkid:O,href:I},wp.element.createElement("img",{src:w,alt:l,onClick:e.onImageClick,onError:function(){return e.onImageError(w)}})),A(w)&&wp.element.createElement(B,null));if(!x||!n)return wp.element.createElement(C,null,q(o,r),wp.element.createElement("div",{style:{width:S,height:L}},u));var c=S||n,p=L||i,d=o/r,f=o<r?20:20*d,m=r<o?20:20/d,y=2.5*h,T=!1,R=!1;return"center"===k?(T=!0,R=!0):v?"left"===k?T=!0:R=!0:"right"===k?R=!0:T=!0,wp.element.createElement(C,null,q(o,r),wp.element.createElement(V,{size:S&&L?{width:S,height:L}:void 0,minWidth:f,maxWidth:y,minHeight:m,maxHeight:y/d,lockAspectRatio:!0,enable:{top:!1,right:T,bottom:!0,left:R},onResizeStart:function(){g(!1)},onResizeStop:function(e,t,n,i){s({width:parseInt(c+i.width,10),height:parseInt(p+i.height,10)}),g(!0)}},u))}),(!Q.isEmpty(y)||d)&&wp.element.createElement(Q,{tagName:"figcaption",placeholder:E("Write caption…"),value:y,unstableOnFocus:this.onFocusCaption,onChange:function(e){return s({caption:e})},isSelected:this.state.captionFocused,inlineToolbar:!0})))}}]),t}(O);t.a=ee([q(function(e,t){var n=e("core"),i=n.getMedia,o=e("core/editor"),r=o.getEditorSettings,a=t.attributes.id,l=r(),s=l.maxWidth,u=l.isRTL,c=l.imageSizes;return{image:a?i(a):null,maxWidth:s,isRTL:u,imageSizes:c}}),J({isLargeViewport:"medium"}),K])(oe)},function(e,t,n){"use strict";n.d(t,"a",function(){return l});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},o=lodash,r=o.includes,a=(wp.element.renderToString,wp.blocks.createBlock),l=function(e,t){var n=e.preview,o=e.name,r=e.attributes.url;if(r){var l=findBlock(r);if("core-embed/wordpress"!==o&&DEFAULT_EMBED_BLOCK!==l&&o!==l)return a(l,{url:r});if(n){var u=n.html;if(s(u)&&"core-embed/wordpress"!==o)return a("core-embed/wordpress",i({url:r},t))}}},s=function(e){return r(e,'class="wp-embedded-content" data-secret')}},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=lodash,s=l.noop,u=wp.compose.withGlobalEvents,c=wp.element.Component,p=function(e){function t(){i(this,t);var e=o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.state={width:void 0,height:void 0},e.bindContainer=e.bindContainer.bind(e),e.calculateSize=e.calculateSize.bind(e),e}return r(t,e),a(t,[{key:"bindContainer",value:function(e){this.container=e}},{key:"componentDidUpdate",value:function(e){this.props.src!==e.src&&(this.setState({width:void 0,height:void 0}),this.fetchImageSize()),this.props.dirtynessTrigger!==e.dirtynessTrigger&&this.calculateSize()}},{key:"componentDidMount",value:function(){this.fetchImageSize()}},{key:"componentWillUnmount",value:function(){this.image&&(this.image.onload=s)}},{key:"fetchImageSize",value:function(){this.image=new window.Image,this.image.onload=this.calculateSize,this.image.src=this.props.src}},{key:"calculateSize",value:function(){var e=this.container.clientWidth,t=this.image.width>e,n=this.image.height/this.image.width,i=t?e:this.image.width,o=t?e*n:this.image.height;this.setState({width:i,height:o})}},{key:"render",value:function(){var e={imageWidth:this.image&&this.image.width,imageHeight:this.image&&this.image.height,containerWidth:this.container&&this.container.clientWidth,containerHeight:this.container&&this.container.clientHeight,imageWidthWithinContainer:this.state.width,imageHeightWithinContainer:this.state.height};return wp.element.createElement("div",{ref:this.bindContainer},this.props.children(e))}}]),t}(c);t.a=u({resize:"calculateSize"})(p)},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(0),l=n.n(a),s=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),u=wp.i18n.__,c=wp.element,p=c.Component,d=c.createRef,f=wp.components,h=f.Spinner,g=f.withSpokenMessages,m=f.Popover,v=f.TextControl,w=wp.compose.withInstanceId,b=function(e){function t(e){var n=e.autocompleteRef;i(this,t);var r=o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return r.autocompleteRef=n||d(),r.inputRef=d(),r.searchAffiliateLinks=r.searchAffiliateLinks.bind(r),r.suggestionNodes=[],r.state={posts:[],showSuggestions:!1,selectedSuggestion:null,loading:!1},r}return r(t,e),s(t,[{key:"componentDidUpdate",value:function(){var e=this,t=this.state,n=t.showSuggestions,i=t.selectedSuggestion;n&&null!==i&&!this.scrollingIntoView&&(this.scrollingIntoView=!0,scrollIntoView(this.suggestionNodes[i],this.autocompleteRef.current,{onlyScrollIfNeeded:!0}),setTimeout(function(){e.scrollingIntoView=!1},100))}},{key:"componentWillUnmount",value:function(){delete this.suggestionsRequest}},{key:"bindSuggestionNode",value:function(e){var t=this;return function(n){t.suggestionNodes[e]=n}}},{key:"searchAffiliateLinks",value:function(e){var t=this;if(e.length<2)return void this.setState({showSuggestions:!1,selectedSuggestion:null,loading:!1});this.setState({showSuggestions:!0,selectedSuggestion:null,loading:!0});var n=new FormData;n.append("action","search_affiliate_links_query"),n.append("keyword",e),n.append("paged",1),n.append("gutenberg",!0),n.append("with_images",!0);var i=fetch(ajaxurl,{method:"POST",body:n});i.then(function(e){return e.json()}).then(function(e){if(e.affiliate_links){var n=e.affiliate_links;t.suggestionsRequest===i&&(t.setState({posts:n,loading:!1}),n.length?t.props.debouncedSpeak(sprintf(_n("%d result found, use up and down arrow keys to navigate.","%d results found, use up and down arrow keys to navigate.",n.length),n.length),"assertive"):t.props.debouncedSpeak(u("No results."),"assertive"))}}).catch(function(){t.suggestionsRequest===i&&t.setState({loading:!1})}),this.suggestionsRequest=i}},{key:"selectLink",value:function(e){this.setState({selectedSuggestion:e,showSuggestions:!1}),this.props.updateImageSelection(e.images,e)}},{key:"handleOnClick",value:function(e){this.selectLink(e)}},{key:"render",value:function(){var e=this,t=this.props,n=(t.value,t.autoFocus,t.instanceId),i=this.state,o=i.showSuggestions,r=i.posts,a=i.selectedSuggestion,s=i.loading;return wp.element.createElement("div",{class:"edit-search-affiliate-links"},wp.element.createElement("form",{className:"editor-format-toolbar__link-container-content block-editor-format-toolbar__link-container-content ta-link-search-popover",onSubmit:this.displayAffiliateImages},wp.element.createElement(v,{type:"text",className:"ta-search-affiliate-links",placeholder:u("Type to search affiliate links"),onChange:this.searchAffiliateLinks,autocomplete:"off"}),s&&wp.element.createElement(h,null),o&&!!r.length&&wp.element.createElement(m,{position:"bottom",focusOnMount:!1},wp.element.createElement("div",{class:"affilate-links-suggestions"},r.map(function(t,i){return wp.element.createElement("button",{key:t.id,role:"option",tabIndex:"-1",id:"editor-url-input-suggestion-"+n+"-"+i,ref:e.bindSuggestionNode(i),className:l()("editor-url-input__suggestion block-editor-url-input__suggestion",{"is-selected":i===a}),onClick:function(){return e.handleOnClick(t)},"aria-selected":i===a},t.title||u("(no title)"))})))))}}]),t}(p);t.a=g(w(b))},function(e,t,n){"use strict";function i(e,t){var n={};for(var i in e)t.indexOf(i)>=0||Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i]);return n}function o(){[r.a].forEach(function(e){var t=e.name,n=i(e,["name"]);return a(t,n)})}t.a=o;var r=n(9),a=wp.richText.registerFormatType},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}n.d(t,"a",function(){return O});var a=n(10),l=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=wp.i18n.__,u=wp.element,c=u.Component,p=u.Fragment,d=wp.components.withSpokenMessages,f=wp.richText,h=f.getTextContent,g=f.applyFormat,m=f.removeFormat,v=f.slice,w=wp.url.isURL,b=wp.editor,y=b.RichTextToolbarButton,k=b.RichTextShortcut,S=wp.components,E=S.Path,_=S.SVG,L=wp.dom.getRectangleFromRange,O={name:"ta/link",title:s("Affiliate Link"),tagName:"ta",className:null,attributes:{url:"href",target:"target"},edit:d(function(e){function t(){i(this,t);var e=o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.addLink=e.addLink.bind(e),e.stopAddingLink=e.stopAddingLink.bind(e),e.onRemoveFormat=e.onRemoveFormat.bind(e),e.state={addingLink:!1},e}return r(t,e),l(t,[{key:"addLink",value:function(){var e=this.props,t=e.value,n=e.onChange,i=h(v(t));i&&w(i)?n(g(t,{type:"ta/link",attributes:{url:i}})):this.setState({addingLink:!0})}},{key:"stopAddingLink",value:function(){this.setState({addingLink:!1})}},{key:"onRemoveFormat",value:function(){var e=this.props,t=e.value,n=e.onChange,i=e.speak;n(m(t,"ta/link")),i(s("Affiliate Link removed."),"assertive")}},{key:"getAnchorRect",value:function(){var e=window.getSelection(),t=e.rangeCount>0?e.getRangeAt(0):null;if(t){var n=null;if(this.state.addingLink)n=L(t);else{var i=t.startContainer;for(i=i.nextElementSibling||i;i.nodeType!==window.Node.ELEMENT_NODE;)i=i.parentNode;var o=i.closest("ta");o&&(n=o.getBoundingClientRect())}return n}}},{key:"render",value:function(){var e=this.props,t=e.isActive,n=e.activeAttributes,i=e.value,o=e.onChange,r=this.getAnchorRect();return wp.element.createElement(p,null,wp.element.createElement(k,{type:"access",character:"s",onUse:this.onRemoveFormat}),wp.element.createElement(k,{type:"primary",character:"l",onUse:this.addLink}),wp.element.createElement(k,{type:"primaryShift",character:"l",onUse:this.onRemoveFormat}),t&&wp.element.createElement(y,{icon:"editor-unlink",title:s("Remove Affiliate Link"),className:"ta-unlink-button",onClick:this.onRemoveFormat,isActive:t,shortcutType:"primaryShift",shortcutCharacter:"l"}),!t&&wp.element.createElement(y,{icon:wp.element.createElement(_,{xmlns:"http://www.w3.org/2000/svg",width:"16.688",height:"9.875",viewBox:"0 0 16.688 9.875"},wp.element.createElement(E,{id:"TA.svg",fill:"black",class:"cls-1",d:"M2.115,15.12H4.847L6.836,7.7H9.777l0.63-2.381H1.821L1.177,7.7H4.118Zm4.758,0H9.829l1.177-1.751h3.782l0.238,1.751h2.858L16.357,5.245H13.7Zm5.5-3.866,1.835-2.816,0.35,2.816H12.378Z",transform:"translate(-1.188 -5.25)"})),title:s("Affiliate Link"),className:"ta-link-button",onClick:this.addLink,shortcutType:"primary",shortcutCharacter:"l"}),wp.element.createElement(a.a,{addingLink:this.state.addingLink,stopAddingLink:this.stopAddingLink,isActive:t,activeAttributes:n,anchorRect:r,value:i,onChange:o}))}}]),t}(c))}},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function a(e){var t=e.url,n=e.linkid;e.text;return{type:"ta/link",attributes:{url:t,linkid:n.toString()}}}function l(e,t){return e.addingLink||t.editLink}var s=n(0),u=n.n(s),c=n(11),p=n(12),d=n(13),f=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),h=wp.i18n.__,g=wp.element,m=g.Component,v=g.createRef,w=wp.components,b=w.ExternalLink,y=(w.ToggleControl,w.IconButton),k=w.withSpokenMessages,S=wp.keycodes,E=S.LEFT,_=S.RIGHT,L=S.UP,O=S.DOWN,C=S.BACKSPACE,I=S.ENTER,T=wp.url,R=T.prependHTTP,P=T.safeDecodeURI,A=T.filterURLForDisplay,x=wp.richText,j=x.create,N=x.insert,F=x.isCollapsed,W=x.applyFormat,D=x.getTextContent,V=x.slice,z=function(e){return e.stopPropagation()},B=function(e){var t=e.value,n=e.onChangeInputValue,i=e.onKeyDown,o=e.submitLink,r=e.invalidLink,a=e.resetInvalidLink,l=e.autocompleteRef;return wp.element.createElement("form",{className:"editor-format-toolbar__link-container-content block-editor-format-toolbar__link-container-content ta-link-search-popover",onKeyPress:z,onKeyDown:i,onSubmit:o},wp.element.createElement(d.a,{value:t,onChange:n,autocompleteRef:l,invalidLink:r,resetInvalidLink:a}),wp.element.createElement(y,{icon:"editor-break",label:h("Apply"),type:"submit"}))},H=function(e){var t=e.url,n=R(t),i=u()("editor-format-toolbar__link-container-value block-editor-format-toolbar__link-container-value",{"has-invalid-link":!Object(c.a)(n)});return t?wp.element.createElement(b,{className:i,href:t},A(P(t))):wp.element.createElement("span",{className:i})},U=function(e){var t=e.url,n=e.editLink;return wp.element.createElement("div",{className:"editor-format-toolbar__link-container-content block-editor-format-toolbar__link-container-content",onKeyPress:z},wp.element.createElement(H,{url:t}),wp.element.createElement(y,{icon:"edit",label:h("Edit"),onClick:n}))},M=function(e){function t(){i(this,t);var e=o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.editLink=e.editLink.bind(e),e.submitLink=e.submitLink.bind(e),e.onKeyDown=e.onKeyDown.bind(e),e.onChangeInputValue=e.onChangeInputValue.bind(e),e.onClickOutside=e.onClickOutside.bind(e),e.resetState=e.resetState.bind(e),e.autocompleteRef=v(),e.resetInvalidLink=e.resetInvalidLink.bind(e),e.state={inputValue:"",linkid:0,post:null,invalidLink:!1},e}return r(t,e),f(t,[{key:"onKeyDown",value:function(e){[E,O,_,L,C,I].indexOf(e.keyCode)>-1&&e.stopPropagation()}},{key:"onChangeInputValue",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=t?t.id:0;this.setState({inputValue:e,linkid:n,post:t})}},{key:"editLink",value:function(e){this.setState({editLink:!0}),e.preventDefault()}},{key:"submitLink",value:function(e){var t=this.props,n=t.isActive,i=t.value,o=t.onChange,r=t.speak,l=this.state,s=l.inputValue,u=l.linkid,p=l.post,d=R(s),f=D(V(i)),g=a({url:d,linkid:u,text:f});if(e.preventDefault(),!u||!p)return void this.setState({invalidLink:!0});if(F(i)&&!n){var m=W(j({text:p.title}),g,0,d.length);o(N(i,m))}else o(W(i,g));this.resetState(),Object(c.a)(d)?n?r(h("Link edited."),"assertive"):r(h("Link inserted"),"assertive"):r(h("Warning: the link has been inserted but may have errors. Please test it."),"assertive")}},{key:"onClickOutside",value:function(e){var t=this.autocompleteRef.current;t&&t.contains(e.target)||this.resetState()}},{key:"resetState",value:function(){this.props.stopAddingLink(),this.setState({inputValue:"",editLink:!1}),this.resetInvalidLink()}},{key:"resetInvalidLink",value:function(){this.setState({invalidLink:!1})}},{key:"render",value:function(){var e=this.props,t=e.isActive,n=e.activeAttributes,i=n.url,o=(n.linkid,e.addingLink),r=e.anchorRect;e.value,e.onChange;if(!t&&!o)return null;var a=this.state,s=a.inputValue,u=a.invalidLink,c=l(this.props,this.state);return wp.element.createElement(p.a,{onClickOutside:this.onClickOutside,onClose:this.resetState,focusOnMount:!!c&&"firstElement",invalidLink:u,anchorRect:r},c?wp.element.createElement(B,{value:s,onChangeInputValue:this.onChangeInputValue,onKeyDown:this.onKeyDown,submitLink:this.submitLink,autocompleteRef:this.autocompleteRef,updateLinkId:this.updateLinkId,invalidLink:u,resetInvalidLink:this.resetInvalidLink}):wp.element.createElement(U,{url:i,editLink:this.editLink}))}}]),t}(m);t.a=k(M)},function(e,t,n){"use strict";function i(e){if(!e)return!1;var t=e.trim();if(!t)return!1;if(/^\S+:/.test(t)){var n=l(t);if(!s(n))return!1;if(r(n,"http")&&!/^https?:\/\/[^\/\s]/i.test(t))return!1;var i=u(t);if(!c(i))return!1;var o=p(t);if(o&&!d(o))return!1;var a=f(t);if(a&&!h(a))return!1;var v=g(t);if(v&&!m(v))return!1}return!(r(t,"#")&&!m(t))}t.a=i;var o=lodash,r=o.startsWith,a=wp.url,l=a.getProtocol,s=a.isValidProtocol,u=a.getAuthority,c=a.isValidAuthority,p=a.getPath,d=a.isValidPath,f=a.getQueryString,h=a.isValidQueryString,g=a.getFragment,m=a.isValidFragment},function(e,t,n){"use strict";function i(e,t){var n={};for(var i in e)t.indexOf(i)>=0||Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i]);return n}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),u=wp.i18n.__,c=wp.element.Component,p=wp.components,d=p.Popover,f=p.IconButton,h=function(e){function t(){o(this,t);var e=r(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.toggleSettingsVisibility=e.toggleSettingsVisibility.bind(e),e.state={isSettingsExpanded:!1},e}return a(t,e),s(t,[{key:"toggleSettingsVisibility",value:function(){this.setState({isSettingsExpanded:!this.state.isSettingsExpanded})}},{key:"render",value:function(){var e=this.props,t=e.children,n=e.renderSettings,o=e.invalidLink,r=e.position,a=void 0===r?"bottom center":r,s=e.focusOnMount,c=void 0===s?"firstElement":s,p=i(e,["children","renderSettings","invalidLink","position","focusOnMount"]),h=this.state.isSettingsExpanded,g=!!n&&h;return wp.element.createElement(d,l({className:"ta-url-popover editor-url-popover block-editor-url-popover",focusOnMount:c,position:a},p),wp.element.createElement("div",{className:"editor-url-popover__row"},t,!!n&&wp.element.createElement(f,{className:"editor-url-popover__settings-toggle",icon:"ellipsis",label:u("Link Settings"),onClick:this.toggleSettingsVisibility,"aria-expanded":h})),g&&wp.element.createElement("div",{className:"editor-url-popover__row editor-url-popover__settings"},n()),o&&wp.element.createElement("div",{class:"ta-invalid-link"},u("Invalid affiliate link")))}}]),t}(c);t.a=h},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(0),l=n.n(a),s=n(14),u=n.n(s),c=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),p=wp.i18n.__,d=lodash,f=d.throttle,h=wp.element,g=h.Component,m=h.createRef,v=wp.keycodes,w=v.UP,b=v.DOWN,y=v.ENTER,k=v.TAB,S=wp.components,E=S.Spinner,_=S.withSpokenMessages,L=S.Popover,O=wp.compose.withInstanceId,C=function(e){return e.stopPropagation()},I=function(e){function t(e){var n=e.autocompleteRef;i(this,t);var r=o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return r.onChange=r.onChange.bind(r),r.onKeyDown=r.onKeyDown.bind(r),r.autocompleteRef=n||m(),r.inputRef=m(),r.updateSuggestions=f(r.updateSuggestions.bind(r),200),r.suggestionNodes=[],r.state={posts:[],showSuggestions:!1,selectedSuggestion:null},r}return r(t,e),c(t,[{key:"componentDidUpdate",value:function(){var e=this,t=this.state,n=t.showSuggestions,i=t.selectedSuggestion;n&&null!==i&&!this.scrollingIntoView&&(this.scrollingIntoView=!0,u()(this.suggestionNodes[i],this.autocompleteRef.current,{onlyScrollIfNeeded:!0}),setTimeout(function(){e.scrollingIntoView=!1},100))}},{key:"componentWillUnmount",value:function(){delete this.suggestionsRequest}},{key:"bindSuggestionNode",value:function(e){var t=this;return function(n){t.suggestionNodes[e]=n}}},{key:"updateSuggestions",value:function(e){var t=this;if(e.length<2||/^https?:/.test(e))return void this.setState({showSuggestions:!1,selectedSuggestion:null,loading:!1});this.setState({showSuggestions:!0,selectedSuggestion:null,loading:!0});var n=new FormData;n.append("action","search_affiliate_links_query"),n.append("keyword",e),n.append("paged",1),n.append("gutenberg",!0);var i=fetch(ajaxurl,{method:"POST",body:n});i.then(function(e){return e.json()}).then(function(e){if(e.affiliate_links){var n=e.affiliate_links;t.suggestionsRequest===i&&(t.setState({posts:n,loading:!1}),n.length?t.props.debouncedSpeak(sprintf(_n("%d result found, use up and down arrow keys to navigate.","%d results found, use up and down arrow keys to navigate.",n.length),n.length),"assertive"):t.props.debouncedSpeak(p("No results."),"assertive"))}}).catch(function(){t.suggestionsRequest===i&&t.setState({loading:!1})}),this.suggestionsRequest=i}},{key:"onChange",value:function(e){this.props.resetInvalidLink();var t=e.target.value;this.props.onChange(t),this.updateSuggestions(t)}},{key:"onKeyDown",value:function(e){var t=this.state,n=t.showSuggestions,i=t.selectedSuggestion,o=t.posts,r=t.loading;if(n&&o.length&&!r){var a=this.state.posts[this.state.selectedSuggestion];switch(e.keyCode){case w:e.stopPropagation(),e.preventDefault();var l=i?i-1:o.length-1;this.setState({selectedSuggestion:l});break;case b:e.stopPropagation(),e.preventDefault();var s=null===i||i===o.length-1?0:i+1;this.setState({selectedSuggestion:s});break;case k:null!==this.state.selectedSuggestion&&(this.selectLink(a),this.props.speak(p("Link selected")));break;case y:null!==this.state.selectedSuggestion&&(e.stopPropagation(),this.selectLink(a))}}else switch(e.keyCode){case w:0!==e.target.selectionStart&&(e.stopPropagation(),e.preventDefault(),e.target.setSelectionRange(0,0));break;case b:this.props.value.length!==e.target.selectionStart&&(e.stopPropagation(),e.preventDefault(),e.target.setSelectionRange(this.props.value.length,this.props.value.length))}}},{key:"selectLink",value:function(e){this.props.onChange(e.link,e),this.setState({selectedSuggestion:null,showSuggestions:!1})}},{key:"handleOnClick",value:function(e){this.selectLink(e),this.inputRef.current.focus()}},{key:"render",value:function(){var e=this,t=this.props,n=t.value,i=void 0===n?"":n,o=t.autoFocus,r=void 0===o||o,a=t.instanceId,s=t.invalidLink,u=this.state,c=u.showSuggestions,d=u.posts,f=u.selectedSuggestion,h=u.loading;return wp.element.createElement("div",{className:"editor-url-input block-editor-url-input"},wp.element.createElement("input",{autoFocus:r,type:"text","aria-label":p("URL"),required:!0,value:i,onChange:this.onChange,onInput:C,placeholder:p("Paste URL or type to search"),onKeyDown:this.onKeyDown,role:"combobox","aria-expanded":c,"aria-autocomplete":"list","aria-owns":"editor-url-input-suggestions-"+a,"aria-activedescendant":null!==f?"editor-url-input-suggestion-"+a+"-"+f:void 0,ref:this.inputRef}),h&&wp.element.createElement(E,null),c&&!!d.length&&!s&&wp.element.createElement(L,{position:"bottom",noArrow:!0,focusOnMount:!1},wp.element.createElement("div",{className:"editor-url-input__suggestions block-editor-url-input__suggestions",id:"editor-url-input-suggestions-"+a,ref:this.autocompleteRef,role:"listbox"},d.map(function(t,n){return wp.element.createElement("button",{key:t.id,role:"option",tabIndex:"-1",id:"block-editor-url-input-suggestion-"+a+"-"+n,ref:e.bindSuggestionNode(n),className:l()("editor-url-input__suggestion block-editor-url-input__suggestion",{"is-selected":n===f}),onClick:function(){return e.handleOnClick(t)},"aria-selected":n===f},t.title||p("(no title)"))}))))}}]),t}(g);t.a=_(O(I))},function(e,t,n){"use strict";e.exports=n(15)},function(e,t,n){"use strict";function i(e,t,n){n=n||{},9===t.nodeType&&(t=o.getWindow(t));var i=n.allowHorizontalScroll,r=n.onlyScrollIfNeeded,a=n.alignWithTop,l=n.alignWithLeft,s=n.offsetTop||0,u=n.offsetLeft||0,c=n.offsetBottom||0,p=n.offsetRight||0;i=void 0===i||i;var d=o.isWindow(t),f=o.offset(e),h=o.outerHeight(e),g=o.outerWidth(e),m=void 0,v=void 0,w=void 0,b=void 0,y=void 0,k=void 0,S=void 0,E=void 0,_=void 0,L=void 0;d?(S=t,L=o.height(S),_=o.width(S),E={left:o.scrollLeft(S),top:o.scrollTop(S)},y={left:f.left-E.left-u,top:f.top-E.top-s},k={left:f.left+g-(E.left+_)+p,top:f.top+h-(E.top+L)+c},b=E):(m=o.offset(t),v=t.clientHeight,w=t.clientWidth,b={left:t.scrollLeft,top:t.scrollTop},y={left:f.left-(m.left+(parseFloat(o.css(t,"borderLeftWidth"))||0))-u,top:f.top-(m.top+(parseFloat(o.css(t,"borderTopWidth"))||0))-s},k={left:f.left+g-(m.left+w+(parseFloat(o.css(t,"borderRightWidth"))||0))+p,top:f.top+h-(m.top+v+(parseFloat(o.css(t,"borderBottomWidth"))||0))+c}),y.top<0||k.top>0?!0===a?o.scrollTop(t,b.top+y.top):!1===a?o.scrollTop(t,b.top+k.top):y.top<0?o.scrollTop(t,b.top+y.top):o.scrollTop(t,b.top+k.top):r||(a=void 0===a||!!a,a?o.scrollTop(t,b.top+y.top):o.scrollTop(t,b.top+k.top)),i&&(y.left<0||k.left>0?!0===l?o.scrollLeft(t,b.left+y.left):!1===l?o.scrollLeft(t,b.left+k.left):y.left<0?o.scrollLeft(t,b.left+y.left):o.scrollLeft(t,b.left+k.left):r||(l=void 0===l||!!l,l?o.scrollLeft(t,b.left+y.left):o.scrollLeft(t,b.left+k.left)))}var o=n(16);e.exports=i},function(e,t,n){"use strict";function i(e){var t=void 0,n=void 0,i=void 0,o=e.ownerDocument,r=o.body,a=o&&o.documentElement;return t=e.getBoundingClientRect(),n=t.left,i=t.top,n-=a.clientLeft||r.clientLeft||0,i-=a.clientTop||r.clientTop||0,{left:n,top:i}}function o(e,t){var n=e["page"+(t?"Y":"X")+"Offset"],i="scroll"+(t?"Top":"Left");if("number"!=typeof n){var o=e.document;n=o.documentElement[i],"number"!=typeof n&&(n=o.body[i])}return n}function r(e){return o(e)}function a(e){return o(e,!0)}function l(e){var t=i(e),n=e.ownerDocument,o=n.defaultView||n.parentWindow;return t.left+=r(o),t.top+=a(o),t}function s(e,t,n){var i="",o=e.ownerDocument,r=n||o.defaultView.getComputedStyle(e,null);return r&&(i=r.getPropertyValue(t)||r[t]),i}function u(e,t){var n=e[_]&&e[_][t];if(S.test(n)&&!E.test(t)){var i=e.style,o=i[O],r=e[L][O];e[L][O]=e[_][O],i[O]="fontSize"===t?"1em":n||0,n=i.pixelLeft+C,i[O]=o,e[L][O]=r}return""===n?"auto":n}function c(e,t){for(var n=0;n<e.length;n++)t(e[n])}function p(e){return"border-box"===I(e,"boxSizing")}function d(e,t,n){var i={},o=e.style,r=void 0;for(r in t)t.hasOwnProperty(r)&&(i[r]=o[r],o[r]=t[r]);n.call(e);for(r in t)t.hasOwnProperty(r)&&(o[r]=i[r])}function f(e,t,n){var i=0,o=void 0,r=void 0,a=void 0;for(r=0;r<t.length;r++)if(o=t[r])for(a=0;a<n.length;a++){var l=void 0;l="border"===o?o+n[a]+"Width":o+n[a],i+=parseFloat(I(e,l))||0}return i}function h(e){return null!=e&&e==e.window}function g(e,t,n){if(h(e))return"width"===t?x.viewportWidth(e):x.viewportHeight(e);if(9===e.nodeType)return"width"===t?x.docWidth(e):x.docHeight(e);var i="width"===t?["Left","Right"]:["Top","Bottom"],o="width"===t?e.offsetWidth:e.offsetHeight,r=I(e),a=p(e,r),l=0;(null==o||o<=0)&&(o=void 0,l=I(e,t),(null==l||Number(l)<0)&&(l=e.style[t]||0),l=parseFloat(l)||0),void 0===n&&(n=a?A:R);var s=void 0!==o||a,u=o||l;if(n===R)return s?u-f(e,["border","padding"],i,r):l;if(s){var c=n===P?-f(e,["border"],i,r):f(e,["margin"],i,r);return u+(n===A?0:c)}return l+f(e,T.slice(n),i,r)}function m(e){var t=void 0,n=arguments;return 0!==e.offsetWidth?t=g.apply(void 0,n):d(e,j,function(){t=g.apply(void 0,n)}),t}function v(e,t,n){var i=n;{if("object"!==(void 0===t?"undefined":y(t)))return void 0!==i?("number"==typeof i&&(i+="px"),void(e.style[t]=i)):I(e,t);for(var o in t)t.hasOwnProperty(o)&&v(e,o,t[o])}}function w(e,t){"static"===v(e,"position")&&(e.style.position="relative");var n=l(e),i={},o=void 0,r=void 0;for(r in t)t.hasOwnProperty(r)&&(o=parseFloat(v(e,r))||0,i[r]=o+t[r]-n[r]);v(e,i)}var b=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},k=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,S=new RegExp("^("+k+")(?!px)[a-z%]+quot;,"i"),E=/^(top|right|bottom|left)#x2F;,_="currentStyle",L="runtimeStyle",O="left",C="px",I=void 0;"undefined"!=typeof window&&(I=window.getComputedStyle?s:u);var T=["margin","border","padding"],R=-1,P=2,A=1,x={};c(["Width","Height"],function(e){x["doc"+e]=function(t){var n=t.document;return Math.max(n.documentElement["scroll"+e],n.body["scroll"+e],x["viewport"+e](n))},x["viewport"+e]=function(t){var n="client"+e,i=t.document,o=i.body,r=i.documentElement,a=r[n];return"CSS1Compat"===i.compatMode&&a||o&&o[n]||a}});var j={position:"absolute",visibility:"hidden",display:"block"};c(["width","height"],function(e){var t=e.charAt(0).toUpperCase()+e.slice(1);x["outer"+t]=function(t,n){return t&&m(t,e,n?0:A)};var n="width"===e?["Left","Right"]:["Top","Bottom"];x[e]=function(t,i){if(void 0===i)return t&&m(t,e,R);if(t){var o=I(t);return p(t)&&(i+=f(t,["padding","border"],n,o)),v(t,e,i)}}}),e.exports=b({getWindow:function(e){var t=e.ownerDocument||e;return t.defaultView||t.parentWindow},offset:function(e,t){if(void 0===t)return l(e);w(e,t)},isWindow:h,each:c,css:v,clone:function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);if(e.overflow)for(var n in e)e.hasOwnProperty(n)&&(t.overflow[n]=e.overflow[n]);return t},scrollLeft:function(e,t){if(h(e)){if(void 0===t)return r(e);window.scrollTo(t,a(e))}else{if(void 0===t)return e.scrollLeft;e.scrollLeft=t}},scrollTop:function(e,t){if(h(e)){if(void 0===t)return a(e);window.scrollTo(r(e),t)}else{if(void 0===t)return e.scrollTop;e.scrollTop=t}},viewportWidth:0,viewportHeight:0},x)},function(e,t){}]);
7
//# sourceMappingURL=gutenberg-support.js.map
js/app/gutenberg_support/dist/gutenberg-support.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack:///gutenberg-support.js","webpack:///webpack/bootstrap c9935c87e3e022ad59ba","webpack:///./node_modules/classnames/index.js","webpack:///./src/index.js","webpack:///./src/blocks/index.js","webpack:///./src/blocks/ta-image/index.js","webpack:///./src/blocks/ta-image/edit.js","webpack:///./src/blocks/ta-image/util.js","webpack:///./src/blocks/ta-image/image-size.js","webpack:///./src/blocks/ta-image/search-input.js","webpack:///./src/formats/index.js","webpack:///./src/formats/ta-link/index.js","webpack:///./src/formats/ta-link/inline.js","webpack:///./src/formats/ta-link/positioned-at-selection.js","webpack:///./src/formats/ta-link/utils.js","webpack:///./src/formats/ta-link/url-popover.js","webpack:///./src/formats/ta-link/url-input.js","webpack:///./node_modules/dom-scroll-into-view/lib/index.js","webpack:///./node_modules/dom-scroll-into-view/lib/dom-scroll-into-view.js","webpack:///./node_modules/dom-scroll-into-view/lib/util.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","__WEBPACK_AMD_DEFINE_ARRAY__","__WEBPACK_AMD_DEFINE_RESULT__","classNames","classes","arguments","length","arg","argType","push","Array","isArray","inner","apply","key","hasOwn","join","default","undefined","__webpack_exports__","value","__WEBPACK_IMPORTED_MODULE_0__blocks__","__WEBPACK_IMPORTED_MODULE_1__formats__","__WEBPACK_IMPORTED_MODULE_2__assets_styles_index_scss__","registerBlocks","registerFormats","taimage","forEach","block","settings","registerBlockType","__WEBPACK_IMPORTED_MODULE_0__ta_image__","wp","blocks","_defineProperty","obj","writable","__WEBPACK_IMPORTED_MODULE_0_classnames__","__WEBPACK_IMPORTED_MODULE_0_classnames___default","__WEBPACK_IMPORTED_MODULE_1__edit__","Fragment","element","__","i18n","_wp$blocks","createBlock","getBlockAttributes","getPhrasingContentSchema","RichText","editor","_wp$components","components","Path","SVG","blockAttributes","url","type","source","selector","attribute","alt","caption","id","align","width","height","linkid","href","affiliateLink","imageSchema","img","attributes","schema","figure","require","children","ta","figcaption","title","description","icon","createElement","viewBox","xmlns","fill","category","keywords","transforms","from","isMatch","node","nodeName","querySelector","transform","className","alignMatches","exec","idMatches","Number","anchorElement","linkDestination","rel","linkClass","outerHTML","files","indexOf","file","createBlobURL","tag","shortcode","_ref","_document$implementat2","document","implementation","createHTMLDocument","body","innerHTML","content","removeChild","firstElementChild","trim","_ref2","named","parseInt","replace","_ref3","_ref3$named$align","getEditWrapperProps","data-align","data-resized","edit","save","_ref4","_classnames","classnames","image","src","Content","tagName","_classCallCheck","instance","Constructor","TypeError","_possibleConstructorReturn","self","ReferenceError","_inherits","subClass","superClass","create","constructor","setPrototypeOf","__proto__","__WEBPACK_IMPORTED_MODULE_1__util__","__WEBPACK_IMPORTED_MODULE_2__image_size__","__WEBPACK_IMPORTED_MODULE_3__search_input__","_extends","assign","target","_slicedToArray","sliceIterator","arr","_arr","_n","_d","_e","_s","_i","Symbol","iterator","next","done","err","_createClass","defineProperties","props","descriptor","protoProps","staticProps","_lodash","lodash","isEmpty","map","last","pick","compact","getPath","_wp$i18n","sprintf","_wp$element","Component","createRef","_wp$blob","blob","getBlobByURL","revokeBlobURL","isBlobURL","Placeholder","Button","ButtonGroup","IconButton","PanelBody","ResizableBox","SelectControl","Spinner","TextControl","TextareaControl","Toolbar","withNotices","withSelect","ToggleControl","Popover","data","_wp$editor","BlockControls","InspectorControls","BlockAlignmentToolbar","MediaUpload","MediaUploadCheck","MediaPlaceholder","mediaUpload","withViewportMatch","viewport","compose","ALLOWED_MEDIA_TYPES","pickRelevantMediaFiles","imageProps","isTemporaryImage","ImageEdit","_Component","this","_this","getPrototypeOf","updateAlt","bind","updateAlignment","onFocusCaption","onImageClick","onSelectImage","updateImageURL","updateWidth","updateHeight","updateDimensions","getFilename","toggleIsEditing","onImageError","onChangeInputValue","autocompleteRef","resetInvalidLink","updateImageSelection","onSelectAffiliateImage","editAFfiliateImage","state","captionFocused","isEditing","inputValue","post","showSuggestions","imageSelection","_this2","_props","setAttributes","noticeOperations","_attributes$url","filesList","onFileChange","allowedTypes","onError","message","createErrorNotice","setState","prevProps","_prevProps$attributes","prevID","_prevProps$attributes2","prevURL","_props$attributes","_props$attributes$url","isSelected","media","link","embedBlock","createUpgradedEmbedBlock","onReplace","newAlt","nextAlign","extraUpdatedAttributes","_this3","path","split","label","_props2","imageSizes","slug","sizeUrl","invalidLink","_this4","apiFetch","addQueryArgs","context","_locale","then","source_url","images","_this5","_state","_props3","isLargeViewport","maxWidth","toggleSelection","isRTL","toolbarEditButton","onClick","controls","onChange","instructions","index","wp-block-image","is-transient","is-resized","is-focused","isResizable","imageSizeOptions","getImageSizeOptions","getInspectorControls","imageWidth","imageHeight","help","options","placeholder","min","aria-label","scale","scaledWidth","Math","round","scaledHeight","isCurrent","isSmall","isPrimary","aria-pressed","dirtynessTrigger","sizes","imageWidthWithinContainer","imageHeightWithinContainer","filename","defaultedAlt","style","currentWidth","currentHeight","ratio","minWidth","minHeight","maxWidthBuffer","showRightHandle","showLeftHandle","size","maxHeight","lockAspectRatio","enable","top","right","bottom","left","onResizeStart","onResizeStop","event","direction","elt","delta","unstableOnFocus","inlineToolbar","select","_select","getMedia","_select2","getEditorSettings","_getEditorSettings","includes","renderToString","attributesFromPreview","preview","matchingBlock","findBlock","DEFAULT_EMBED_BLOCK","html","isFromWordPress","noop","withGlobalEvents","ImageSize","bindContainer","calculateSize","ref","container","fetchImageSize","onload","window","Image","clientWidth","exceedMaxWidth","containerWidth","containerHeight","clientHeight","resize","withSpokenMessages","withInstanceId","ThirstyURLInput","inputRef","searchAffiliateLinks","suggestionNodes","posts","selectedSuggestion","loading","scrollingIntoView","scrollIntoView","current","onlyScrollIfNeeded","setTimeout","suggestionsRequest","formData","FormData","append","request","fetch","ajaxurl","method","response","json","affiliate_links","debouncedSpeak","catch","selectLink","instanceId","autoFocus","_state2","class","onSubmit","displayAffiliateImages","autocomplete","position","focusOnMount","role","tabIndex","bindSuggestionNode","is-selected","handleOnClick","aria-selected","_objectWithoutProperties","keys","taLink","registerFormatType","__WEBPACK_IMPORTED_MODULE_0__ta_link__","richText","__WEBPACK_IMPORTED_MODULE_0__inline__","_wp$richText","getTextContent","applyFormat","removeFormat","slice","isURL","RichTextToolbarButton","RichTextShortcut","LinkEdit","addLink","stopAddingLink","onRemoveFormat","addingLink","text","speak","isActive","activeAttributes","character","onUse","shortcutType","shortcutCharacter","createLinkFormat","toString","isShowingInput","editLink","__WEBPACK_IMPORTED_MODULE_1__positioned_at_selection__","__WEBPACK_IMPORTED_MODULE_2__utils__","__WEBPACK_IMPORTED_MODULE_3__url_popover__","__WEBPACK_IMPORTED_MODULE_4__url_input__","ExternalLink","_wp$keycodes","keycodes","LEFT","RIGHT","UP","DOWN","BACKSPACE","ENTER","_wp$url","prependHTTP","safeDecodeURI","filterURLForDisplay","insert","isCollapsed","stopKeyPropagation","stopPropagation","LinkEditor","onKeyDown","submitLink","onKeyPress","LinkViewerUrl","prependedURL","linkClassName","has-invalid-link","isValidHref","LinkViewer","InlineAffiliateLinkUI","onClickOutside","resetState","keyCode","preventDefault","selectedText","format","toInsert","autocompleteElement","contains","_props2$activeAttribu","showInput","start","end","onClose","updateLinkId","getCurrentCaretPositionStyle","selection","getSelection","rangeCount","rect","getRectangleFromRange","getRangeAt","offsetParent","getOffsetParent","anchorNode","parentRect","getBoundingClientRect","_wp$dom","dom","ThirstyPositionedAtSelection","trimmedHref","test","protocol","getProtocol","isValidProtocol","startsWith","authority","getAuthority","isValidAuthority","isValidPath","queryString","getQueryString","isValidQueryString","fragment","getFragment","isValidFragment","ThirstyURLPopover","toggleSettingsVisibility","isSettingsExpanded","renderSettings","_props$position","_props$focusOnMount","showSettings","aria-expanded","__WEBPACK_IMPORTED_MODULE_1_dom_scroll_into_view__","__WEBPACK_IMPORTED_MODULE_1_dom_scroll_into_view___default","throttle","TAB","stopEventPropagation","updateSuggestions","previousIndex","nextIndex","selectionStart","setSelectionRange","focus","_props$value","_props$autoFocus","_state3","required","onInput","aria-autocomplete","aria-owns","aria-activedescendant","noArrow","elem","config","nodeType","util","getWindow","allowHorizontalScroll","alignWithTop","alignWithLeft","offsetTop","offsetLeft","offsetBottom","offsetRight","isWin","isWindow","elemOffset","offset","eh","outerHeight","ew","outerWidth","containerOffset","ch","cw","containerScroll","diffTop","diffBottom","win","winScroll","ww","wh","scrollLeft","scrollTop","parseFloat","css","getClientPosition","box","x","y","doc","ownerDocument","docElem","documentElement","clientLeft","clientTop","getScroll","w","ret","getScrollLeft","getScrollTop","getOffset","el","pos","defaultView","parentWindow","_getComputedStyle","computedStyle_","val","computedStyle","getComputedStyle","getPropertyValue","_getComputedStyleIE","CURRENT_STYLE","_RE_NUM_NO_PX","RE_POS","rsLeft","RUNTIME_STYLE","pixelLeft","PX","each","fn","isBorderBoxFn","getComputedStyleX","swap","callback","old","getPBMWidth","which","prop","j","cssProp","getWH","extra","domUtils","viewportWidth","viewportHeight","docWidth","docHeight","borderBoxValue","offsetWidth","offsetHeight","isBorderBox","cssBoxValue","BORDER_INDEX","CONTENT_INDEX","borderBoxValueOrIsBorderBox","padding","PADDING_INDEX","BOX_MODELS","getWHIgnoreDisplay","args","cssShow","v","_typeof","setOffset","RE_NUM","RegExp","refWin","max","documentElementProp","compatMode","visibility","display","first","charAt","toUpperCase","includeMargin","clone","overflow","scrollTo"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAI,EAAAJ,EACAK,GAAA,EACAH,WAUA,OANAJ,GAAAE,GAAAM,KAAAH,EAAAD,QAAAC,IAAAD,QAAA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c,aAAAd,EAAAe,cAEAtC,OAAA,SAAAmC,EAAAvmB,GACA,YAAAA,EAGA,MAAAsmB,GAAAC,EAFAqD,GAAArD,EAAAvmB,IAMAkkB,WACAuD,OACAnC,MACAmF,MAAA,SAAA1pB,GACA,GAAAolB,KACA,QAAA5oB,KAAAwD,GACAA,EAAArC,eAAAnB,KACA4oB,EAAA5oB,GAAAwD,EAAAxD,GAIA,IADAwD,EAAA2pB,SAEA,OAAAntB,KAAAwD,GACAA,EAAArC,eAAAnB,KACA4oB,EAAAuE,SAAAntB,GAAAwD,EAAA2pB,SAAAntB,GAIA,OAAA4oB,IAEAhB,WAAA,SAAAe,EAAAwD,GACA,GAAAxF,EAAAgC,GAAA,CACA,OAAApmB,KAAA4pB,EACA,MAAAtD,GAAAF,EAEA1O,QAAAmT,SAAAjB,EAAArD,EAAAH,QACK,CACL,OAAApmB,KAAA4pB,EACA,MAAAxD,GAAAf,UAEAe,GAAAf,WAAAuE,IAGAtE,UAAA,SAAAc,EAAAwD,GACA,GAAAxF,EAAAgC,GAAA,CACA,OAAApmB,KAAA4pB,EACA,MAAArD,GAAAH,EAEA1O,QAAAmT,SAAAvE,EAAAF,GAAAwD,OACK,CACL,OAAA5pB,KAAA4pB,EACA,MAAAxD,GAAAd,SAEAc,GAAAd,UAAAsE,IAIAlB,cAAA,EACAC,eAAA,GACCF,InB6wGK,SAAUjrB,EAAQD","file":"gutenberg-support.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 1);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!\n Copyright (c) 2017 Jed Watson.\n Licensed under the MIT License (MIT), see\n http://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = [];\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (!arg) continue;\n\n\t\t\tvar argType = typeof arg;\n\n\t\t\tif (argType === 'string' || argType === 'number') {\n\t\t\t\tclasses.push(arg);\n\t\t\t} else if (Array.isArray(arg) && arg.length) {\n\t\t\t\tvar inner = classNames.apply(null, arg);\n\t\t\t\tif (inner) {\n\t\t\t\t\tclasses.push(inner);\n\t\t\t\t}\n\t\t\t} else if (argType === 'object') {\n\t\t\t\tfor (var key in arg) {\n\t\t\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\t\t\tclasses.push(key);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn classes.join(' ');\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (true) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {\n\t\t\treturn classNames;\n\t\t}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n\n\n/***/ }),\n/* 1 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nObject.defineProperty(__webpack_exports__, \"__esModule\", { value: true });\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__blocks__ = __webpack_require__(2);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__formats__ = __webpack_require__(8);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__assets_styles_index_scss__ = __webpack_require__(18);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__assets_styles_index_scss___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2__assets_styles_index_scss__);\n\n\n\n\n\nObject(__WEBPACK_IMPORTED_MODULE_0__blocks__[\"a\" /* default */])();\nObject(__WEBPACK_IMPORTED_MODULE_1__formats__[\"a\" /* default */])();\n\n/***/ }),\n/* 2 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export (immutable) */ __webpack_exports__[\"a\"] = registerBlocks;\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ta_image__ = __webpack_require__(3);\n\n\nvar registerBlockType = wp.blocks.registerBlockType;\n\n/**\r\n * Register gutenberg blocks.\r\n * \r\n * @since 3.6\r\n */\n\nfunction registerBlocks() {\n\n [__WEBPACK_IMPORTED_MODULE_0__ta_image__].forEach(function (block) {\n if (!block) return;\n\n var name = block.name,\n settings = block.settings;\n\n registerBlockType(name, settings);\n });\n}\n\n/***/ }),\n/* 3 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nObject.defineProperty(__webpack_exports__, \"__esModule\", { value: true });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"name\", function() { return name; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"settings\", function() { return settings; });\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_classnames__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_classnames___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_classnames__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__edit__ = __webpack_require__(4);\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n\n\nvar Fragment = wp.element.Fragment;\nvar __ = wp.i18n.__;\nvar _wp$blocks = wp.blocks,\n createBlock = _wp$blocks.createBlock,\n getBlockAttributes = _wp$blocks.getBlockAttributes,\n getPhrasingContentSchema = _wp$blocks.getPhrasingContentSchema;\nvar RichText = wp.editor.RichText;\nvar _wp$components = wp.components,\n Path = _wp$components.Path,\n SVG = _wp$components.SVG;\n\n\n\n\nvar name = 'ta/image';\n\nvar blockAttributes = {\n\turl: {\n\t\ttype: 'string',\n\t\tsource: 'attribute',\n\t\tselector: 'img',\n\t\tattribute: 'src'\n\t},\n\talt: {\n\t\ttype: 'string',\n\t\tsource: 'attribute',\n\t\tselector: 'img',\n\t\tattribute: 'alt',\n\t\tdefault: ''\n\t},\n\tcaption: {\n\t\ttype: 'string',\n\t\tsource: 'html',\n\t\tselector: 'figcaption'\n\t},\n\tid: {\n\t\ttype: 'number'\n\t},\n\talign: {\n\t\ttype: 'string'\n\t},\n\twidth: {\n\t\ttype: 'number'\n\t},\n\theight: {\n\t\ttype: 'number'\n\t},\n\tlinkid: {\n\t\ttype: 'number'\n\t},\n\thref: {\n\t\ttype: 'string',\n\t\tsource: 'attribute',\n\t\tselector: 'ta',\n\t\tattribute: 'href'\n\t},\n\taffiliateLink: {\n\t\ttype: 'object'\n\t}\n};\n\nvar imageSchema = {\n\timg: {\n\t\tattributes: ['src', 'alt'],\n\t\tclasses: ['alignleft', 'aligncenter', 'alignright', 'alignnone', /^wp-image-\\d+#x2F;]\n\t}\n};\n\nvar schema = {\n\tfigure: {\n\t\trequire: ['ta', 'img'],\n\t\tchildren: {\n\t\t\tta: {\n\t\t\t\tattributes: ['href', 'linkid'],\n\t\t\t\tchildren: imageSchema\n\t\t\t},\n\t\t\tfigcaption: {\n\t\t\t\tchildren: getPhrasingContentSchema()\n\t\t\t}\n\t\t}\n\t}\n};\n\nfunction getFirstAnchorAttributeFormHTML(html, attributeName) {\n\tvar _document$implementat = document.implementation.createHTMLDocument(''),\n\t body = _document$implementat.body;\n\n\tbody.innerHTML = html;\n\n\tvar firstElementChild = body.firstElementChild;\n\n\n\tif (firstElementChild && firstElementChild.nodeName === 'A') {\n\t\treturn firstElementChild.getAttribute(attributeName) || undefined;\n\t}\n}\n\nvar settings = {\n\ttitle: __('ThirstyAffiliates Image'),\n\n\tdescription: __('Insert an image with an affiliate link to make a visual statement.'),\n\n\ticon: wp.element.createElement(\n\t\tSVG,\n\t\t{ viewBox: \"0 0 24 24\", xmlns: \"http://www.w3.org/2000/svg\" },\n\t\twp.element.createElement(Path, { d: \"M0,0h24v24H0V0z\", fill: \"none\" }),\n\t\twp.element.createElement(Path, { d: \"m19 5v14h-14v-14h14m0-2h-14c-1.1 0-2 0.9-2 2v14c0 1.1 0.9 2 2 2h14c1.1 0 2-0.9 2-2v-14c0-1.1-0.9-2-2-2z\" }),\n\t\twp.element.createElement(Path, { d: \"m14.14 11.86l-3 3.87-2.14-2.59-3 3.86h12l-3.86-5.14z\" })\n\t),\n\n\tcategory: 'common',\n\n\tkeywords: ['img', // \"img\" is not translated as it is intended to reflect the HTML <img> tag.\n\t__('photo'), __('affiliate')],\n\n\tattributes: blockAttributes,\n\n\ttransforms: {\n\t\tfrom: [{\n\t\t\ttype: 'raw',\n\t\t\tisMatch: function isMatch(node) {\n\t\t\t\treturn node.nodeName === 'FIGURE' && !!node.querySelector('img');\n\t\t\t},\n\t\t\tschema: schema,\n\t\t\ttransform: function transform(node) {\n\n\t\t\t\t// Search both figure and image classes. Alignment could be\n\t\t\t\t// set on either. ID is set on the image.\n\t\t\t\tvar className = node.className + ' ' + node.querySelector('img').className;\n\t\t\t\tvar alignMatches = /(?:^|\\s)align(left|center|right)(?:$|\\s)/.exec(className);\n\t\t\t\tvar align = alignMatches ? alignMatches[1] : undefined;\n\t\t\t\tvar idMatches = /(?:^|\\s)wp-image-(\\d+)(?:$|\\s)/.exec(className);\n\t\t\t\tvar id = idMatches ? Number(idMatches[1]) : undefined;\n\t\t\t\tvar anchorElement = node.querySelector('a');\n\t\t\t\tvar linkDestination = anchorElement && anchorElement.href ? 'custom' : undefined;\n\t\t\t\tvar linkid = anchorElement && anchorElement.linkid ? anchorElement.linkid : undefined;\n\t\t\t\tvar href = anchorElement && anchorElement.href ? anchorElement.href : undefined;\n\t\t\t\tvar rel = anchorElement && anchorElement.rel ? anchorElement.rel : undefined;\n\t\t\t\tvar linkClass = anchorElement && anchorElement.className ? anchorElement.className : undefined;\n\t\t\t\tvar attributes = getBlockAttributes('ta/image', node.outerHTML, { align: align, id: id, linkDestination: linkDestination, linkid: linkid, href: href, rel: rel, linkClass: linkClass });\n\t\t\t\treturn createBlock('ta/image', attributes);\n\t\t\t}\n\t\t}, {\n\t\t\ttype: 'files',\n\t\t\tisMatch: function isMatch(files) {\n\t\t\t\treturn files.length === 1 && files[0].type.indexOf('image/') === 0;\n\t\t\t},\n\t\t\ttransform: function transform(files) {\n\t\t\t\tvar file = files[0];\n\t\t\t\t// We don't need to upload the media directly here\n\t\t\t\t// It's already done as part of the `componentDidMount`\n\t\t\t\t// int the image block\n\t\t\t\tvar block = createBlock('ta/image', {\n\t\t\t\t\turl: createBlobURL(file)\n\t\t\t\t});\n\n\t\t\t\treturn block;\n\t\t\t}\n\t\t}, {\n\t\t\ttype: 'shortcode',\n\t\t\ttag: 'caption',\n\t\t\tattributes: {\n\t\t\t\turl: {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tsource: 'attribute',\n\t\t\t\t\tattribute: 'src',\n\t\t\t\t\tselector: 'img'\n\t\t\t\t},\n\t\t\t\talt: {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tsource: 'attribute',\n\t\t\t\t\tattribute: 'alt',\n\t\t\t\t\tselector: 'img'\n\t\t\t\t},\n\t\t\t\tcaption: {\n\t\t\t\t\tshortcode: function shortcode(attributes, _ref) {\n\t\t\t\t\t\tvar _shortcode = _ref.shortcode;\n\n\t\t\t\t\t\tvar _document$implementat2 = document.implementation.createHTMLDocument(''),\n\t\t\t\t\t\t body = _document$implementat2.body;\n\n\t\t\t\t\t\tbody.innerHTML = _shortcode.content;\n\t\t\t\t\t\tbody.removeChild(body.firstElementChild);\n\n\t\t\t\t\t\treturn body.innerHTML.trim();\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tid: {\n\t\t\t\t\ttype: 'number',\n\t\t\t\t\tshortcode: function shortcode(_ref2) {\n\t\t\t\t\t\tvar id = _ref2.named.id;\n\n\t\t\t\t\t\tif (!id) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn parseInt(id.replace('attachment_', ''), 10);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\talign: {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tshortcode: function shortcode(_ref3) {\n\t\t\t\t\t\tvar _ref3$named$align = _ref3.named.align,\n\t\t\t\t\t\t align = _ref3$named$align === undefined ? 'alignnone' : _ref3$named$align;\n\n\t\t\t\t\t\treturn align.replace('align', '');\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tlinkid: {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tsource: 'attribute',\n\t\t\t\t\tselector: 'wp-block-ta-image > ta',\n\t\t\t\t\tattribute: 'linkid'\n\t\t\t\t},\n\t\t\t\thref: {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tsource: 'attribute',\n\t\t\t\t\tselector: 'ta',\n\t\t\t\t\tattribute: 'href'\n\t\t\t\t}\n\t\t\t}\n\t\t}]\n\t},\n\n\tgetEditWrapperProps: function getEditWrapperProps(attributes) {\n\t\tvar align = attributes.align,\n\t\t width = attributes.width;\n\n\t\tif ('left' === align || 'center' === align || 'right' === align || 'wide' === align || 'full' === align) {\n\t\t\treturn { 'data-align': align, 'data-resized': !!width };\n\t\t}\n\t},\n\n\n\tedit: __WEBPACK_IMPORTED_MODULE_1__edit__[\"a\" /* default */],\n\n\tsave: function save(_ref4) {\n\t\tvar _classnames;\n\n\t\tvar attributes = _ref4.attributes;\n\t\tvar url = attributes.url,\n\t\t alt = attributes.alt,\n\t\t caption = attributes.caption,\n\t\t align = attributes.align,\n\t\t width = attributes.width,\n\t\t height = attributes.height,\n\t\t id = attributes.id,\n\t\t linkid = attributes.linkid,\n\t\t href = attributes.href;\n\n\n\t\tvar classes = __WEBPACK_IMPORTED_MODULE_0_classnames___default()((_classnames = {}, _defineProperty(_classnames, \"align\" + align, align), _defineProperty(_classnames, 'is-resized', width || height), _classnames));\n\n\t\tvar image = wp.element.createElement(\"img\", {\n\t\t\tsrc: url,\n\t\t\talt: alt,\n\t\t\tclassName: id ? \"wp-image-\" + id : null,\n\t\t\twidth: width,\n\t\t\theight: height\n\t\t});\n\n\t\tvar figure = wp.element.createElement(\n\t\t\tFragment,\n\t\t\tnull,\n\t\t\twp.element.createElement(\n\t\t\t\t\"ta\",\n\t\t\t\t{ linkid: linkid, href: href },\n\t\t\t\timage\n\t\t\t),\n\t\t\twp.element.createElement(RichText.Content, { tagName: \"figcaption\", value: caption })\n\t\t);\n\n\t\tif ('left' === align || 'right' === align || 'center' === align) {\n\t\t\treturn wp.element.createElement(\n\t\t\t\t\"div\",\n\t\t\t\t{ className: \"wp-block-image\" },\n\t\t\t\twp.element.createElement(\n\t\t\t\t\t\"figure\",\n\t\t\t\t\t{ className: classes },\n\t\t\t\t\tfigure\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\n\t\treturn wp.element.createElement(\n\t\t\t\"figure\",\n\t\t\t{ className: \"wp-block-image \" + classes },\n\t\t\tfigure\n\t\t);\n\t}\n};\n\n\n/***/ }),\n/* 4 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* unused harmony export pickRelevantMediaFiles */\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_classnames__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_classnames___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_classnames__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util__ = __webpack_require__(5);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__image_size__ = __webpack_require__(6);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__search_input__ = __webpack_require__(7);\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n\n\nvar _lodash = lodash,\n get = _lodash.get,\n isEmpty = _lodash.isEmpty,\n map = _lodash.map,\n last = _lodash.last,\n pick = _lodash.pick,\n compact = _lodash.compact;\nvar getPath = wp.url.getPath;\nvar _wp$i18n = wp.i18n,\n __ = _wp$i18n.__,\n sprintf = _wp$i18n.sprintf;\nvar _wp$element = wp.element,\n Component = _wp$element.Component,\n Fragment = _wp$element.Fragment,\n createRef = _wp$element.createRef;\nvar _wp$blob = wp.blob,\n getBlobByURL = _wp$blob.getBlobByURL,\n revokeBlobURL = _wp$blob.revokeBlobURL,\n isBlobURL = _wp$blob.isBlobURL;\nvar _wp$components = wp.components,\n Placeholder = _wp$components.Placeholder,\n Button = _wp$components.Button,\n ButtonGroup = _wp$components.ButtonGroup,\n IconButton = _wp$components.IconButton,\n PanelBody = _wp$components.PanelBody,\n ResizableBox = _wp$components.ResizableBox,\n SelectControl = _wp$components.SelectControl,\n Spinner = _wp$components.Spinner,\n TextControl = _wp$components.TextControl,\n TextareaControl = _wp$components.TextareaControl,\n Toolbar = _wp$components.Toolbar,\n withNotices = _wp$components.withNotices,\n ToggleControl = _wp$components.ToggleControl,\n Popover = _wp$components.Popover;\nvar withSelect = wp.data.withSelect;\nvar _wp$editor = wp.editor,\n RichText = _wp$editor.RichText,\n BlockControls = _wp$editor.BlockControls,\n InspectorControls = _wp$editor.InspectorControls,\n MediaUpload = _wp$editor.MediaUpload,\n MediaUploadCheck = _wp$editor.MediaUploadCheck,\n MediaPlaceholder = _wp$editor.MediaPlaceholder,\n BlockAlignmentToolbar = _wp$editor.BlockAlignmentToolbar,\n mediaUpload = _wp$editor.mediaUpload;\nvar withViewportMatch = wp.viewport.withViewportMatch;\nvar compose = wp.compose.compose;\n\n\n\n\n\n\n/**\r\n * Module constants\r\n */\nvar MIN_SIZE = 20;\nvar LINK_DESTINATION_NONE = 'none';\nvar LINK_DESTINATION_MEDIA = 'media';\nvar LINK_DESTINATION_ATTACHMENT = 'attachment';\nvar LINK_DESTINATION_CUSTOM = 'custom';\nvar NEW_TAB_REL = 'noreferrer noopener';\nvar ALLOWED_MEDIA_TYPES = ['image'];\n\nvar pickRelevantMediaFiles = function pickRelevantMediaFiles(image) {\n\tvar imageProps = pick(image, ['alt', 'id', 'link', 'caption']);\n\timageProps.url = get(image, ['sizes', 'large', 'url']) || get(image, ['media_details', 'sizes', 'large', 'source_url']) || image.url;\n\treturn imageProps;\n};\n\n/**\r\n * Is the URL a temporary blob URL? A blob URL is one that is used temporarily\r\n * while the image is being uploaded and will not have an id yet allocated.\r\n *\r\n * @param {number=} id The id of the image.\r\n * @param {string=} url The url of the image.\r\n *\r\n * @return {boolean} Is the URL a Blob URL\r\n */\nvar isTemporaryImage = function isTemporaryImage(id, url) {\n\treturn !id && isBlobURL(url);\n};\n\n/**\r\n * Is the url for the image hosted externally. An externally hosted image has no id\r\n * and is not a blob url.\r\n *\r\n * @param {number=} id The id of the image.\r\n * @param {string=} url The url of the image.\r\n *\r\n * @return {boolean} Is the url an externally hosted url?\r\n */\nvar isExternalImage = function isExternalImage(id, url) {\n\treturn url && !id && !isBlobURL(url);\n};\n\nvar ImageEdit = function (_Component) {\n\t_inherits(ImageEdit, _Component);\n\n\tfunction ImageEdit(_ref) {\n\t\tvar attributes = _ref.attributes;\n\n\t\t_classCallCheck(this, ImageEdit);\n\n\t\tvar _this = _possibleConstructorReturn(this, (ImageEdit.__proto__ || Object.getPrototypeOf(ImageEdit)).apply(this, arguments));\n\n\t\t_this.updateAlt = _this.updateAlt.bind(_this);\n\t\t_this.updateAlignment = _this.updateAlignment.bind(_this);\n\t\t_this.onFocusCaption = _this.onFocusCaption.bind(_this);\n\t\t_this.onImageClick = _this.onImageClick.bind(_this);\n\t\t_this.onSelectImage = _this.onSelectImage.bind(_this);\n\t\t_this.updateImageURL = _this.updateImageURL.bind(_this);\n\t\t_this.updateWidth = _this.updateWidth.bind(_this);\n\t\t_this.updateHeight = _this.updateHeight.bind(_this);\n\t\t_this.updateDimensions = _this.updateDimensions.bind(_this);\n\t\t_this.getFilename = _this.getFilename.bind(_this);\n\t\t_this.toggleIsEditing = _this.toggleIsEditing.bind(_this);\n\t\t_this.onImageError = _this.onImageError.bind(_this);\n\t\t_this.onChangeInputValue = _this.onChangeInputValue.bind(_this);\n\t\t_this.autocompleteRef = createRef();\n\t\t_this.resetInvalidLink = _this.resetInvalidLink.bind(_this);\n\t\t_this.updateImageSelection = _this.updateImageSelection.bind(_this);\n\t\t_this.onSelectAffiliateImage = _this.onSelectAffiliateImage.bind(_this);\n\t\t_this.editAFfiliateImage = _this.editAFfiliateImage.bind(_this);\n\n\t\t_this.state = {\n\t\t\tcaptionFocused: false,\n\t\t\tisEditing: !attributes.url,\n\t\t\tinputValue: '',\n\t\t\tlinkid: 0,\n\t\t\tpost: null,\n\t\t\tshowSuggestions: false,\n\t\t\timageSelection: [],\n\t\t\taffiliateLink: null\n\t\t};\n\t\treturn _this;\n\t}\n\n\t_createClass(ImageEdit, [{\n\t\tkey: \"componentDidMount\",\n\t\tvalue: function componentDidMount() {\n\t\t\tvar _this2 = this;\n\n\t\t\tvar _props = this.props,\n\t\t\t attributes = _props.attributes,\n\t\t\t setAttributes = _props.setAttributes,\n\t\t\t noticeOperations = _props.noticeOperations;\n\t\t\tvar id = attributes.id,\n\t\t\t _attributes$url = attributes.url,\n\t\t\t url = _attributes$url === undefined ? '' : _attributes$url;\n\n\n\t\t\tif (isTemporaryImage(id, url)) {\n\t\t\t\tvar file = getBlobByURL(url);\n\n\t\t\t\tif (file) {\n\t\t\t\t\tmediaUpload({\n\t\t\t\t\t\tfilesList: [file],\n\t\t\t\t\t\tonFileChange: function onFileChange(_ref2) {\n\t\t\t\t\t\t\tvar _ref3 = _slicedToArray(_ref2, 1),\n\t\t\t\t\t\t\t image = _ref3[0];\n\n\t\t\t\t\t\t\tsetAttributes(pickRelevantMediaFiles(image));\n\t\t\t\t\t\t},\n\t\t\t\t\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\n\t\t\t\t\t\tonError: function onError(message) {\n\t\t\t\t\t\t\tnoticeOperations.createErrorNotice(message);\n\t\t\t\t\t\t\t_this2.setState({ isEditing: true });\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"componentDidUpdate\",\n\t\tvalue: function componentDidUpdate(prevProps) {\n\t\t\tvar _prevProps$attributes = prevProps.attributes,\n\t\t\t prevID = _prevProps$attributes.id,\n\t\t\t _prevProps$attributes2 = _prevProps$attributes.url,\n\t\t\t prevURL = _prevProps$attributes2 === undefined ? '' : _prevProps$attributes2;\n\t\t\tvar _props$attributes = this.props.attributes,\n\t\t\t id = _props$attributes.id,\n\t\t\t _props$attributes$url = _props$attributes.url,\n\t\t\t url = _props$attributes$url === undefined ? '' : _props$attributes$url;\n\n\n\t\t\tif (isTemporaryImage(prevID, prevURL) && !isTemporaryImage(id, url)) {\n\t\t\t\trevokeBlobURL(url);\n\t\t\t}\n\n\t\t\tif (!this.props.isSelected && prevProps.isSelected && this.state.captionFocused) {\n\t\t\t\tthis.setState({\n\t\t\t\t\tcaptionFocused: false\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"onSelectImage\",\n\t\tvalue: function onSelectImage(media) {\n\n\t\t\tif (!media || !media.url) {\n\t\t\t\tthis.props.setAttributes({\n\t\t\t\t\turl: undefined,\n\t\t\t\t\talt: undefined,\n\t\t\t\t\tid: undefined,\n\t\t\t\t\tcaption: undefined\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar affiliateLink = this.state.affiliateLink;\n\n\n\t\t\tthis.setState({\n\t\t\t\tisEditing: false\n\t\t\t});\n\n\t\t\tthis.props.setAttributes(_extends({}, pickRelevantMediaFiles(media), {\n\t\t\t\tlinkid: affiliateLink.id,\n\t\t\t\thref: affiliateLink.link,\n\t\t\t\taffiliateLink: affiliateLink,\n\t\t\t\twidth: undefined,\n\t\t\t\theight: undefined\n\t\t\t}));\n\t\t}\n\t}, {\n\t\tkey: \"onImageError\",\n\t\tvalue: function onImageError(url) {\n\t\t\t// Check if there's an embed block that handles this URL.\n\t\t\tvar embedBlock = Object(__WEBPACK_IMPORTED_MODULE_1__util__[\"a\" /* createUpgradedEmbedBlock */])({ attributes: { url: url } });\n\t\t\tif (undefined !== embedBlock) {\n\t\t\t\tthis.props.onReplace(embedBlock);\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"onFocusCaption\",\n\t\tvalue: function onFocusCaption() {\n\t\t\tif (!this.state.captionFocused) {\n\t\t\t\tthis.setState({\n\t\t\t\t\tcaptionFocused: true\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"onImageClick\",\n\t\tvalue: function onImageClick() {\n\t\t\tif (this.state.captionFocused) {\n\t\t\t\tthis.setState({\n\t\t\t\t\tcaptionFocused: false\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"updateAlt\",\n\t\tvalue: function updateAlt(newAlt) {\n\t\t\tthis.props.setAttributes({ alt: newAlt });\n\t\t}\n\t}, {\n\t\tkey: \"updateAlignment\",\n\t\tvalue: function updateAlignment(nextAlign) {\n\t\t\tvar extraUpdatedAttributes = ['wide', 'full'].indexOf(nextAlign) !== -1 ? { width: undefined, height: undefined } : {};\n\t\t\tthis.props.setAttributes(_extends({}, extraUpdatedAttributes, { align: nextAlign }));\n\t\t}\n\t}, {\n\t\tkey: \"updateImageURL\",\n\t\tvalue: function updateImageURL(url) {\n\t\t\tthis.props.setAttributes({ url: url, width: undefined, height: undefined });\n\t\t}\n\t}, {\n\t\tkey: \"updateWidth\",\n\t\tvalue: function updateWidth(width) {\n\t\t\tthis.props.setAttributes({ width: parseInt(width, 10) });\n\t\t}\n\t}, {\n\t\tkey: \"updateHeight\",\n\t\tvalue: function updateHeight(height) {\n\t\t\tthis.props.setAttributes({ height: parseInt(height, 10) });\n\t\t}\n\t}, {\n\t\tkey: \"updateDimensions\",\n\t\tvalue: function updateDimensions() {\n\t\t\tvar _this3 = this;\n\n\t\t\tvar width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;\n\t\t\tvar height = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;\n\n\t\t\treturn function () {\n\t\t\t\t_this3.props.setAttributes({ width: width, height: height });\n\t\t\t};\n\t\t}\n\t}, {\n\t\tkey: \"getFilename\",\n\t\tvalue: function getFilename(url) {\n\t\t\tvar path = getPath(url);\n\t\t\tif (path) {\n\t\t\t\treturn last(path.split('/'));\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"getLinkDestinationOptions\",\n\t\tvalue: function getLinkDestinationOptions() {\n\t\t\treturn [{ value: LINK_DESTINATION_NONE, label: __('None') }, { value: LINK_DESTINATION_MEDIA, label: __('Media File') }, { value: LINK_DESTINATION_ATTACHMENT, label: __('Attachment Page') }, { value: LINK_DESTINATION_CUSTOM, label: __('Custom URL') }];\n\t\t}\n\t}, {\n\t\tkey: \"toggleIsEditing\",\n\t\tvalue: function toggleIsEditing() {\n\t\t\tthis.setState({\n\t\t\t\tisEditing: !this.state.isEditing\n\t\t\t});\n\t\t}\n\t}, {\n\t\tkey: \"getImageSizeOptions\",\n\t\tvalue: function getImageSizeOptions() {\n\t\t\tvar _props2 = this.props,\n\t\t\t imageSizes = _props2.imageSizes,\n\t\t\t image = _props2.image;\n\n\t\t\treturn compact(map(imageSizes, function (_ref4) {\n\t\t\t\tvar name = _ref4.name,\n\t\t\t\t slug = _ref4.slug;\n\n\t\t\t\tvar sizeUrl = get(image, ['media_details', 'sizes', slug, 'source_url']);\n\t\t\t\tif (!sizeUrl) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tvalue: sizeUrl,\n\t\t\t\t\tlabel: name\n\t\t\t\t};\n\t\t\t}));\n\t\t}\n\t}, {\n\t\tkey: \"onChangeInputValue\",\n\t\tvalue: function onChangeInputValue(inputValue) {\n\t\t\tvar post = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n\n\t\t\tvar linkid = post ? post.id : 0;\n\t\t\tthis.setState({ inputValue: inputValue, linkid: linkid, post: post });\n\t\t}\n\t}, {\n\t\tkey: \"resetInvalidLink\",\n\t\tvalue: function resetInvalidLink() {\n\t\t\tthis.setState({ invalidLink: false });\n\t\t}\n\t}, {\n\t\tkey: \"updateImageSelection\",\n\t\tvalue: function updateImageSelection(imageSelection, affiliateLink) {\n\t\t\tthis.setState({\n\t\t\t\timageSelection: imageSelection,\n\t\t\t\taffiliateLink: affiliateLink\n\t\t\t});\n\t\t}\n\t}, {\n\t\tkey: \"onSelectAffiliateImage\",\n\t\tvalue: function onSelectAffiliateImage(image) {\n\t\t\tvar _this4 = this;\n\n\t\t\tvar request = wp.apiFetch({\n\t\t\t\tpath: wp.url.addQueryArgs('wp/v2/media/' + image.id, {\n\t\t\t\t\tcontext: 'edit',\n\t\t\t\t\t_locale: 'user'\n\t\t\t\t})\n\t\t\t});\n\n\t\t\trequest.then(function (media) {\n\t\t\t\tmedia.url = media.source_url;\n\t\t\t\t_this4.onSelectImage(media);\n\t\t\t});\n\t\t}\n\t}, {\n\t\tkey: \"editAFfiliateImage\",\n\t\tvalue: function editAFfiliateImage() {\n\t\t\tvar attributes = this.props.attributes;\n\t\t\tvar affiliateLink = attributes.affiliateLink;\n\n\n\t\t\tthis.setState({\n\t\t\t\tisEditing: true,\n\t\t\t\timageSelection: affiliateLink.images,\n\t\t\t\taffiliateLink: affiliateLink\n\t\t\t});\n\t\t}\n\t}, {\n\t\tkey: \"render\",\n\t\tvalue: function render() {\n\t\t\tvar _this5 = this;\n\n\t\t\tvar _state = this.state,\n\t\t\t isEditing = _state.isEditing,\n\t\t\t imageSelection = _state.imageSelection,\n\t\t\t affiliateLink = _state.affiliateLink;\n\t\t\tvar _props3 = this.props,\n\t\t\t attributes = _props3.attributes,\n\t\t\t setAttributes = _props3.setAttributes,\n\t\t\t isLargeViewport = _props3.isLargeViewport,\n\t\t\t isSelected = _props3.isSelected,\n\t\t\t className = _props3.className,\n\t\t\t maxWidth = _props3.maxWidth,\n\t\t\t toggleSelection = _props3.toggleSelection,\n\t\t\t isRTL = _props3.isRTL;\n\t\t\tvar url = attributes.url,\n\t\t\t alt = attributes.alt,\n\t\t\t caption = attributes.caption,\n\t\t\t align = attributes.align,\n\t\t\t linkDestination = attributes.linkDestination,\n\t\t\t width = attributes.width,\n\t\t\t height = attributes.height,\n\t\t\t linkid = attributes.linkid,\n\t\t\t href = attributes.href;\n\n\t\t\tvar toolbarEditButton = wp.element.createElement(\n\t\t\t\tToolbar,\n\t\t\t\tnull,\n\t\t\t\twp.element.createElement(IconButton, {\n\t\t\t\t\tclassName: \"ta-edit-image-button components-icon-button components-toolbar__control\",\n\t\t\t\t\tlabel: __('Edit ThirstyAffiliates Image'),\n\t\t\t\t\ticon: \"edit\",\n\t\t\t\t\tonClick: this.editAFfiliateImage\n\t\t\t\t})\n\t\t\t);\n\n\t\t\tvar controls = wp.element.createElement(\n\t\t\t\tBlockControls,\n\t\t\t\tnull,\n\t\t\t\twp.element.createElement(BlockAlignmentToolbar, {\n\t\t\t\t\tvalue: align,\n\t\t\t\t\tonChange: this.updateAlignment\n\t\t\t\t}),\n\t\t\t\ttoolbarEditButton\n\t\t\t);\n\n\t\t\tif (isEditing) {\n\t\t\t\treturn wp.element.createElement(\n\t\t\t\t\tFragment,\n\t\t\t\t\tnull,\n\t\t\t\t\tcontrols,\n\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\tPlaceholder,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ticon: \"format-image\",\n\t\t\t\t\t\t\tlabel: __(\"ThirstyAffiliates Image\"),\n\t\t\t\t\t\t\tinstructions: __(\"Search for an affiliate link and select image to insert.\")\n\t\t\t\t\t\t},\n\t\t\t\t\t\twp.element.createElement(__WEBPACK_IMPORTED_MODULE_3__search_input__[\"a\" /* default */], {\n\t\t\t\t\t\t\tupdateImageSelection: this.updateImageSelection\n\t\t\t\t\t\t}),\n\t\t\t\t\t\t!!imageSelection.length && wp.element.createElement(\n\t\t\t\t\t\t\t\"div\",\n\t\t\t\t\t\t\t{ className: \"ta-image-sel-wrap\" },\n\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\t\"h3\",\n\t\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t\taffiliateLink.title + \" \" + __('attached images:')\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\t\"div\",\n\t\t\t\t\t\t\t\t{ className: \"ta-image-selection\" },\n\t\t\t\t\t\t\t\timageSelection.map(function (image, index) {\n\t\t\t\t\t\t\t\t\treturn wp.element.createElement(\n\t\t\t\t\t\t\t\t\t\t\"button\",\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tonClick: function onClick() {\n\t\t\t\t\t\t\t\t\t\t\t\treturn _this5.onSelectAffiliateImage(image);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\twp.element.createElement(\"img\", { src: image.src })\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tvar classes = __WEBPACK_IMPORTED_MODULE_0_classnames___default()(className, {\n\t\t\t\t'wp-block-image': true,\n\t\t\t\t'is-transient': isBlobURL(url),\n\t\t\t\t'is-resized': !!width || !!height,\n\t\t\t\t'is-focused': isSelected\n\t\t\t});\n\n\t\t\tvar isResizable = ['wide', 'full'].indexOf(align) === -1 && isLargeViewport;\n\t\t\tvar imageSizeOptions = this.getImageSizeOptions();\n\n\t\t\tvar getInspectorControls = function getInspectorControls(imageWidth, imageHeight) {\n\t\t\t\treturn wp.element.createElement(\n\t\t\t\t\tInspectorControls,\n\t\t\t\t\tnull,\n\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\tPanelBody,\n\t\t\t\t\t\t{ title: __('Image Settings') },\n\t\t\t\t\t\twp.element.createElement(TextareaControl, {\n\t\t\t\t\t\t\tlabel: __('Alt Text (Alternative Text)'),\n\t\t\t\t\t\t\tvalue: alt,\n\t\t\t\t\t\t\tonChange: _this5.updateAlt,\n\t\t\t\t\t\t\thelp: __('Alternative text describes your image to people who can’t see it. Add a short description with its key details.')\n\t\t\t\t\t\t}),\n\t\t\t\t\t\t!isEmpty(imageSizeOptions) && wp.element.createElement(SelectControl, {\n\t\t\t\t\t\t\tlabel: __('Image Size'),\n\t\t\t\t\t\t\tvalue: url,\n\t\t\t\t\t\t\toptions: imageSizeOptions,\n\t\t\t\t\t\t\tonChange: _this5.updateImageURL\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tisResizable && wp.element.createElement(\n\t\t\t\t\t\t\t\"div\",\n\t\t\t\t\t\t\t{ className: \"block-library-image__dimensions\" },\n\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\t\"p\",\n\t\t\t\t\t\t\t\t{ className: \"block-library-image__dimensions__row\" },\n\t\t\t\t\t\t\t\t__('Image Dimensions')\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\t\"div\",\n\t\t\t\t\t\t\t\t{ className: \"block-library-image__dimensions__row\" },\n\t\t\t\t\t\t\t\twp.element.createElement(TextControl, {\n\t\t\t\t\t\t\t\t\ttype: \"number\",\n\t\t\t\t\t\t\t\t\tclassName: \"block-library-image__dimensions__width\",\n\t\t\t\t\t\t\t\t\tlabel: __('Width'),\n\t\t\t\t\t\t\t\t\tvalue: width !== undefined ? width : '',\n\t\t\t\t\t\t\t\t\tplaceholder: imageWidth,\n\t\t\t\t\t\t\t\t\tmin: 1,\n\t\t\t\t\t\t\t\t\tonChange: _this5.updateWidth\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\twp.element.createElement(TextControl, {\n\t\t\t\t\t\t\t\t\ttype: \"number\",\n\t\t\t\t\t\t\t\t\tclassName: \"block-library-image__dimensions__height\",\n\t\t\t\t\t\t\t\t\tlabel: __('Height'),\n\t\t\t\t\t\t\t\t\tvalue: height !== undefined ? height : '',\n\t\t\t\t\t\t\t\t\tplaceholder: imageHeight,\n\t\t\t\t\t\t\t\t\tmin: 1,\n\t\t\t\t\t\t\t\t\tonChange: _this5.updateHeight\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\t\"div\",\n\t\t\t\t\t\t\t\t{ className: \"block-library-image__dimensions__row\" },\n\t\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\t\tButtonGroup,\n\t\t\t\t\t\t\t\t\t{ \"aria-label\": __('Image Size') },\n\t\t\t\t\t\t\t\t\t[25, 50, 75, 100].map(function (scale) {\n\t\t\t\t\t\t\t\t\t\tvar scaledWidth = Math.round(imageWidth * (scale / 100));\n\t\t\t\t\t\t\t\t\t\tvar scaledHeight = Math.round(imageHeight * (scale / 100));\n\n\t\t\t\t\t\t\t\t\t\tvar isCurrent = width === scaledWidth && height === scaledHeight;\n\n\t\t\t\t\t\t\t\t\t\treturn wp.element.createElement(\n\t\t\t\t\t\t\t\t\t\t\tButton,\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tkey: scale,\n\t\t\t\t\t\t\t\t\t\t\t\tisSmall: true,\n\t\t\t\t\t\t\t\t\t\t\t\tisPrimary: isCurrent,\n\t\t\t\t\t\t\t\t\t\t\t\t\"aria-pressed\": isCurrent,\n\t\t\t\t\t\t\t\t\t\t\t\tonClick: _this5.updateDimensions(scaledWidth, scaledHeight)\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\tscale,\n\t\t\t\t\t\t\t\t\t\t\t\"%\"\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\t\tButton,\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tisSmall: true,\n\t\t\t\t\t\t\t\t\t\tonClick: _this5.updateDimensions()\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t__('Reset')\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t};\n\n\t\t\t// Disable reason: Each block can be selected by clicking on it\n\t\t\t/* eslint-disable jsx-a11y/no-static-element-interactions, jsx-a11y/onclick-has-role, jsx-a11y/click-events-have-key-events */\n\t\t\treturn wp.element.createElement(\n\t\t\t\tFragment,\n\t\t\t\tnull,\n\t\t\t\tcontrols,\n\t\t\t\twp.element.createElement(\n\t\t\t\t\t\"figure\",\n\t\t\t\t\t{ className: classes },\n\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t__WEBPACK_IMPORTED_MODULE_2__image_size__[\"a\" /* default */],\n\t\t\t\t\t\t{ src: url, dirtynessTrigger: align },\n\t\t\t\t\t\tfunction (sizes) {\n\t\t\t\t\t\t\tvar imageWidthWithinContainer = sizes.imageWidthWithinContainer,\n\t\t\t\t\t\t\t imageHeightWithinContainer = sizes.imageHeightWithinContainer,\n\t\t\t\t\t\t\t imageWidth = sizes.imageWidth,\n\t\t\t\t\t\t\t imageHeight = sizes.imageHeight;\n\n\n\t\t\t\t\t\t\tvar filename = _this5.getFilename(url);\n\t\t\t\t\t\t\tvar defaultedAlt = void 0;\n\t\t\t\t\t\t\tif (alt) {\n\t\t\t\t\t\t\t\tdefaultedAlt = alt;\n\t\t\t\t\t\t\t} else if (filename) {\n\t\t\t\t\t\t\t\tdefaultedAlt = sprintf(__('This image has an empty alt attribute; its file name is %s'), filename);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tdefaultedAlt = __('This image has an empty alt attribute');\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tvar img =\n\t\t\t\t\t\t\t// Disable reason: Image itself is not meant to be interactive, but\n\t\t\t\t\t\t\t// should direct focus to block.\n\t\t\t\t\t\t\t/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */\n\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\tFragment,\n\t\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\t\t\"ta\",\n\t\t\t\t\t\t\t\t\t{ linkid: linkid, href: href },\n\t\t\t\t\t\t\t\t\twp.element.createElement(\"img\", { src: url, alt: defaultedAlt, onClick: _this5.onImageClick, onError: function onError() {\n\t\t\t\t\t\t\t\t\t\t\treturn _this5.onImageError(url);\n\t\t\t\t\t\t\t\t\t\t} })\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tisBlobURL(url) && wp.element.createElement(Spinner, null)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t/* eslint-enable jsx-a11y/no-noninteractive-element-interactions */\n\t\t\t\t\t\t\t;\n\n\t\t\t\t\t\t\tif (!isResizable || !imageWidthWithinContainer) {\n\t\t\t\t\t\t\t\treturn wp.element.createElement(\n\t\t\t\t\t\t\t\t\tFragment,\n\t\t\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t\t\tgetInspectorControls(imageWidth, imageHeight),\n\t\t\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\t\t\t\"div\",\n\t\t\t\t\t\t\t\t\t\t{ style: { width: width, height: height } },\n\t\t\t\t\t\t\t\t\t\timg\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tvar currentWidth = width || imageWidthWithinContainer;\n\t\t\t\t\t\t\tvar currentHeight = height || imageHeightWithinContainer;\n\n\t\t\t\t\t\t\tvar ratio = imageWidth / imageHeight;\n\t\t\t\t\t\t\tvar minWidth = imageWidth < imageHeight ? MIN_SIZE : MIN_SIZE * ratio;\n\t\t\t\t\t\t\tvar minHeight = imageHeight < imageWidth ? MIN_SIZE : MIN_SIZE / ratio;\n\n\t\t\t\t\t\t\t// With the current implementation of ResizableBox, an image needs an explicit pixel value for the max-width.\n\t\t\t\t\t\t\t// In absence of being able to set the content-width, this max-width is currently dictated by the vanilla editor style.\n\t\t\t\t\t\t\t// The following variable adds a buffer to this vanilla style, so 3rd party themes have some wiggleroom.\n\t\t\t\t\t\t\t// This does, in most cases, allow you to scale the image beyond the width of the main column, though not infinitely.\n\t\t\t\t\t\t\t// @todo It would be good to revisit this once a content-width variable becomes available.\n\t\t\t\t\t\t\tvar maxWidthBuffer = maxWidth * 2.5;\n\n\t\t\t\t\t\t\tvar showRightHandle = false;\n\t\t\t\t\t\t\tvar showLeftHandle = false;\n\n\t\t\t\t\t\t\t/* eslint-disable no-lonely-if */\n\t\t\t\t\t\t\t// See https://github.com/WordPress/gutenberg/issues/7584.\n\t\t\t\t\t\t\tif (align === 'center') {\n\t\t\t\t\t\t\t\t// When the image is centered, show both handles.\n\t\t\t\t\t\t\t\tshowRightHandle = true;\n\t\t\t\t\t\t\t\tshowLeftHandle = true;\n\t\t\t\t\t\t\t} else if (isRTL) {\n\t\t\t\t\t\t\t\t// In RTL mode the image is on the right by default.\n\t\t\t\t\t\t\t\t// Show the right handle and hide the left handle only when it is aligned left.\n\t\t\t\t\t\t\t\t// Otherwise always show the left handle.\n\t\t\t\t\t\t\t\tif (align === 'left') {\n\t\t\t\t\t\t\t\t\tshowRightHandle = true;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tshowLeftHandle = true;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// Show the left handle and hide the right handle only when the image is aligned right.\n\t\t\t\t\t\t\t\t// Otherwise always show the right handle.\n\t\t\t\t\t\t\t\tif (align === 'right') {\n\t\t\t\t\t\t\t\t\tshowLeftHandle = true;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tshowRightHandle = true;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/* eslint-enable no-lonely-if */\n\n\t\t\t\t\t\t\treturn wp.element.createElement(\n\t\t\t\t\t\t\t\tFragment,\n\t\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t\tgetInspectorControls(imageWidth, imageHeight),\n\t\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\t\tResizableBox,\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tsize: width && height ? {\n\t\t\t\t\t\t\t\t\t\t\twidth: width,\n\t\t\t\t\t\t\t\t\t\t\theight: height\n\t\t\t\t\t\t\t\t\t\t} : undefined,\n\t\t\t\t\t\t\t\t\t\tminWidth: minWidth,\n\t\t\t\t\t\t\t\t\t\tmaxWidth: maxWidthBuffer,\n\t\t\t\t\t\t\t\t\t\tminHeight: minHeight,\n\t\t\t\t\t\t\t\t\t\tmaxHeight: maxWidthBuffer / ratio,\n\t\t\t\t\t\t\t\t\t\tlockAspectRatio: true,\n\t\t\t\t\t\t\t\t\t\tenable: {\n\t\t\t\t\t\t\t\t\t\t\ttop: false,\n\t\t\t\t\t\t\t\t\t\t\tright: showRightHandle,\n\t\t\t\t\t\t\t\t\t\t\tbottom: true,\n\t\t\t\t\t\t\t\t\t\t\tleft: showLeftHandle\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tonResizeStart: function onResizeStart() {\n\t\t\t\t\t\t\t\t\t\t\ttoggleSelection(false);\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tonResizeStop: function onResizeStop(event, direction, elt, delta) {\n\t\t\t\t\t\t\t\t\t\t\tsetAttributes({\n\t\t\t\t\t\t\t\t\t\t\t\twidth: parseInt(currentWidth + delta.width, 10),\n\t\t\t\t\t\t\t\t\t\t\t\theight: parseInt(currentHeight + delta.height, 10)\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\ttoggleSelection(true);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\timg\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t),\n\t\t\t\t\t(!RichText.isEmpty(caption) || isSelected) && wp.element.createElement(RichText, {\n\t\t\t\t\t\ttagName: \"figcaption\",\n\t\t\t\t\t\tplaceholder: __('Write caption…'),\n\t\t\t\t\t\tvalue: caption,\n\t\t\t\t\t\tunstableOnFocus: this.onFocusCaption,\n\t\t\t\t\t\tonChange: function onChange(value) {\n\t\t\t\t\t\t\treturn setAttributes({ caption: value });\n\t\t\t\t\t\t},\n\t\t\t\t\t\tisSelected: this.state.captionFocused,\n\t\t\t\t\t\tinlineToolbar: true\n\t\t\t\t\t})\n\t\t\t\t)\n\t\t\t);\n\t\t\t/* eslint-enable jsx-a11y/no-static-element-interactions, jsx-a11y/onclick-has-role, jsx-a11y/click-events-have-key-events */\n\t\t}\n\t}]);\n\n\treturn ImageEdit;\n}(Component);\n\n/* harmony default export */ __webpack_exports__[\"a\"] = (compose([withSelect(function (select, props) {\n\tvar _select = select('core'),\n\t getMedia = _select.getMedia;\n\n\tvar _select2 = select('core/editor'),\n\t getEditorSettings = _select2.getEditorSettings;\n\n\tvar id = props.attributes.id;\n\n\tvar _getEditorSettings = getEditorSettings(),\n\t maxWidth = _getEditorSettings.maxWidth,\n\t isRTL = _getEditorSettings.isRTL,\n\t imageSizes = _getEditorSettings.imageSizes;\n\n\treturn {\n\t\timage: id ? getMedia(id) : null,\n\t\tmaxWidth: maxWidth,\n\t\tisRTL: isRTL,\n\t\timageSizes: imageSizes\n\t};\n}), withViewportMatch({ isLargeViewport: 'medium' }), withNotices])(ImageEdit));\n\n/***/ }),\n/* 5 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return createUpgradedEmbedBlock; });\n/* unused harmony export isFromWordPress */\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar WORDPRESS_EMBED_BLOCK = 'core-embed/wordpress';\n\nvar _lodash = lodash,\n includes = _lodash.includes;\nvar renderToString = wp.element.renderToString;\nvar createBlock = wp.blocks.createBlock;\n\n/***\r\n * Creates a more suitable embed block based on the passed in props\r\n * and attributes generated from an embed block's preview.\r\n *\r\n * We require `attributesFromPreview` to be generated from the latest attributes\r\n * and preview, and because of the way the react lifecycle operates, we can't\r\n * guarantee that the attributes contained in the block's props are the latest\r\n * versions, so we require that these are generated separately.\r\n * See `getAttributesFromPreview` in the generated embed edit component.\r\n *\r\n * @param {Object} props The block's props.\r\n * @param {Object} attributesFromPreview Attributes generated from the block's most up to date preview.\r\n * @return {Object|undefined} A more suitable embed block if one exists.\r\n */\n\nvar createUpgradedEmbedBlock = function createUpgradedEmbedBlock(props, attributesFromPreview) {\n\tvar preview = props.preview,\n\t name = props.name;\n\tvar url = props.attributes.url;\n\n\n\tif (!url) {\n\t\treturn;\n\t}\n\n\tvar matchingBlock = findBlock(url);\n\n\t// WordPress blocks can work on multiple sites, and so don't have patterns,\n\t// so if we're in a WordPress block, assume the user has chosen it for a WordPress URL.\n\tif (WORDPRESS_EMBED_BLOCK !== name && DEFAULT_EMBED_BLOCK !== matchingBlock) {\n\t\t// At this point, we have discovered a more suitable block for this url, so transform it.\n\t\tif (name !== matchingBlock) {\n\t\t\treturn createBlock(matchingBlock, { url: url });\n\t\t}\n\t}\n\n\tif (preview) {\n\t\tvar html = preview.html;\n\n\t\t// We can't match the URL for WordPress embeds, we have to check the HTML instead.\n\n\t\tif (isFromWordPress(html)) {\n\t\t\t// If this is not the WordPress embed block, transform it into one.\n\t\t\tif (WORDPRESS_EMBED_BLOCK !== name) {\n\t\t\t\treturn createBlock(WORDPRESS_EMBED_BLOCK, _extends({\n\t\t\t\t\turl: url\n\t\t\t\t}, attributesFromPreview));\n\t\t\t}\n\t\t}\n\t}\n};\n\nvar isFromWordPress = function isFromWordPress(html) {\n\treturn includes(html, 'class=\"wp-embedded-content\" data-secret');\n};\n\n/***/ }),\n/* 6 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar _lodash = lodash,\n noop = _lodash.noop;\nvar withGlobalEvents = wp.compose.withGlobalEvents;\nvar Component = wp.element.Component;\n\nvar ImageSize = function (_Component) {\n\t_inherits(ImageSize, _Component);\n\n\tfunction ImageSize() {\n\t\t_classCallCheck(this, ImageSize);\n\n\t\tvar _this = _possibleConstructorReturn(this, (ImageSize.__proto__ || Object.getPrototypeOf(ImageSize)).apply(this, arguments));\n\n\t\t_this.state = {\n\t\t\twidth: undefined,\n\t\t\theight: undefined\n\t\t};\n\t\t_this.bindContainer = _this.bindContainer.bind(_this);\n\t\t_this.calculateSize = _this.calculateSize.bind(_this);\n\t\treturn _this;\n\t}\n\n\t_createClass(ImageSize, [{\n\t\tkey: 'bindContainer',\n\t\tvalue: function bindContainer(ref) {\n\t\t\tthis.container = ref;\n\t\t}\n\t}, {\n\t\tkey: 'componentDidUpdate',\n\t\tvalue: function componentDidUpdate(prevProps) {\n\t\t\tif (this.props.src !== prevProps.src) {\n\t\t\t\tthis.setState({\n\t\t\t\t\twidth: undefined,\n\t\t\t\t\theight: undefined\n\t\t\t\t});\n\t\t\t\tthis.fetchImageSize();\n\t\t\t}\n\n\t\t\tif (this.props.dirtynessTrigger !== prevProps.dirtynessTrigger) {\n\t\t\t\tthis.calculateSize();\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: 'componentDidMount',\n\t\tvalue: function componentDidMount() {\n\t\t\tthis.fetchImageSize();\n\t\t}\n\t}, {\n\t\tkey: 'componentWillUnmount',\n\t\tvalue: function componentWillUnmount() {\n\t\t\tif (this.image) {\n\t\t\t\tthis.image.onload = noop;\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: 'fetchImageSize',\n\t\tvalue: function fetchImageSize() {\n\t\t\tthis.image = new window.Image();\n\t\t\tthis.image.onload = this.calculateSize;\n\t\t\tthis.image.src = this.props.src;\n\t\t}\n\t}, {\n\t\tkey: 'calculateSize',\n\t\tvalue: function calculateSize() {\n\t\t\tvar maxWidth = this.container.clientWidth;\n\t\t\tvar exceedMaxWidth = this.image.width > maxWidth;\n\t\t\tvar ratio = this.image.height / this.image.width;\n\t\t\tvar width = exceedMaxWidth ? maxWidth : this.image.width;\n\t\t\tvar height = exceedMaxWidth ? maxWidth * ratio : this.image.height;\n\t\t\tthis.setState({ width: width, height: height });\n\t\t}\n\t}, {\n\t\tkey: 'render',\n\t\tvalue: function render() {\n\t\t\tvar sizes = {\n\t\t\t\timageWidth: this.image && this.image.width,\n\t\t\t\timageHeight: this.image && this.image.height,\n\t\t\t\tcontainerWidth: this.container && this.container.clientWidth,\n\t\t\t\tcontainerHeight: this.container && this.container.clientHeight,\n\t\t\t\timageWidthWithinContainer: this.state.width,\n\t\t\t\timageHeightWithinContainer: this.state.height\n\t\t\t};\n\t\t\treturn wp.element.createElement(\n\t\t\t\t'div',\n\t\t\t\t{ ref: this.bindContainer },\n\t\t\t\tthis.props.children(sizes)\n\t\t\t);\n\t\t}\n\t}]);\n\n\treturn ImageSize;\n}(Component);\n\n/* harmony default export */ __webpack_exports__[\"a\"] = (withGlobalEvents({\n\tresize: 'calculateSize'\n})(ImageSize));\n\n/***/ }),\n/* 7 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_classnames__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_classnames___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_classnames__);\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n\n\nvar __ = wp.i18n.__;\nvar _wp$element = wp.element,\n Component = _wp$element.Component,\n createRef = _wp$element.createRef;\nvar _wp$components = wp.components,\n Spinner = _wp$components.Spinner,\n withSpokenMessages = _wp$components.withSpokenMessages,\n Popover = _wp$components.Popover,\n TextControl = _wp$components.TextControl;\nvar withInstanceId = wp.compose.withInstanceId;\n\nvar ThirstyURLInput = function (_Component) {\n\t_inherits(ThirstyURLInput, _Component);\n\n\t/**\r\n * Component constructor method.\r\n * \r\n * @since 3.6\r\n * \r\n * @param {*} param0 \r\n */\n\tfunction ThirstyURLInput(_ref) {\n\t\tvar autocompleteRef = _ref.autocompleteRef;\n\n\t\t_classCallCheck(this, ThirstyURLInput);\n\n\t\t// this.onChange = this.onChange.bind( this );\n\t\t// this.onKeyDown = this.onKeyDown.bind( this );\n\t\tvar _this = _possibleConstructorReturn(this, (ThirstyURLInput.__proto__ || Object.getPrototypeOf(ThirstyURLInput)).apply(this, arguments));\n\n\t\t_this.autocompleteRef = autocompleteRef || createRef();\n\t\t_this.inputRef = createRef();\n\t\t_this.searchAffiliateLinks = _this.searchAffiliateLinks.bind(_this);\n\t\t// this.updateSuggestions = throttle( this.updateSuggestions.bind( this ), 200 );\n\n\t\t_this.suggestionNodes = [];\n\n\t\t_this.state = {\n\t\t\tposts: [],\n\t\t\tshowSuggestions: false,\n\t\t\tselectedSuggestion: null,\n\t\t\tloading: false\n\t\t};\n\t\treturn _this;\n\t}\n\n\t/**\r\n * Component did update method.\r\n * \r\n * @since 3.6\r\n */\n\n\n\t_createClass(ThirstyURLInput, [{\n\t\tkey: \"componentDidUpdate\",\n\t\tvalue: function componentDidUpdate() {\n\t\t\tvar _this2 = this;\n\n\t\t\tvar _state = this.state,\n\t\t\t showSuggestions = _state.showSuggestions,\n\t\t\t selectedSuggestion = _state.selectedSuggestion;\n\t\t\t// only have to worry about scrolling selected suggestion into view\n\t\t\t// when already expanded\n\n\t\t\tif (showSuggestions && selectedSuggestion !== null && !this.scrollingIntoView) {\n\t\t\t\tthis.scrollingIntoView = true;\n\t\t\t\tscrollIntoView(this.suggestionNodes[selectedSuggestion], this.autocompleteRef.current, {\n\t\t\t\t\tonlyScrollIfNeeded: true\n\t\t\t\t});\n\n\t\t\t\tsetTimeout(function () {\n\t\t\t\t\t_this2.scrollingIntoView = false;\n\t\t\t\t}, 100);\n\t\t\t}\n\t\t}\n\n\t\t/**\r\n * Component unmount method.\r\n * \r\n * @since 3.6\r\n */\n\n\t}, {\n\t\tkey: \"componentWillUnmount\",\n\t\tvalue: function componentWillUnmount() {\n\t\t\tdelete this.suggestionsRequest;\n\t\t}\n\n\t\t/**\r\n * Bind suggestion to node.\r\n * \r\n * @param {*} index \r\n */\n\n\t}, {\n\t\tkey: \"bindSuggestionNode\",\n\t\tvalue: function bindSuggestionNode(index) {\n\t\t\tvar _this3 = this;\n\n\t\t\treturn function (ref) {\n\t\t\t\t_this3.suggestionNodes[index] = ref;\n\t\t\t};\n\t\t}\n\t}, {\n\t\tkey: \"searchAffiliateLinks\",\n\t\tvalue: function searchAffiliateLinks(value) {\n\t\t\tvar _this4 = this;\n\n\t\t\t// Show the suggestions after typing at least 2 characters=\n\t\t\tif (value.length < 2) {\n\t\t\t\tthis.setState({\n\t\t\t\t\tshowSuggestions: false,\n\t\t\t\t\tselectedSuggestion: null,\n\t\t\t\t\tloading: false\n\t\t\t\t});\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.setState({\n\t\t\t\tshowSuggestions: true,\n\t\t\t\tselectedSuggestion: null,\n\t\t\t\tloading: true\n\t\t\t});\n\n\t\t\tvar formData = new FormData();\n\t\t\tformData.append(\"action\", \"search_affiliate_links_query\");\n\t\t\tformData.append(\"keyword\", value);\n\t\t\tformData.append(\"paged\", 1);\n\t\t\tformData.append(\"gutenberg\", true);\n\t\t\tformData.append(\"with_images\", true);\n\n\t\t\t// We are getting data via the WP AJAX instead of rest API as it is not possible yet\n\t\t\t// to filter results with category value. This is to prepare next update to add category filter.\n\t\t\tvar request = fetch(ajaxurl, {\n\t\t\t\tmethod: \"POST\",\n\t\t\t\tbody: formData\n\t\t\t});\n\n\t\t\trequest.then(function (response) {\n\t\t\t\treturn response.json();\n\t\t\t}).then(function (response) {\n\n\t\t\t\tif (!response.affiliate_links) return;\n\n\t\t\t\tvar posts = response.affiliate_links;\n\n\t\t\t\t// A fetch Promise doesn't have an abort option. It's mimicked by\n\t\t\t\t// comparing the request reference in on the instance, which is\n\t\t\t\t// reset or deleted on subsequent requests or unmounting.\n\t\t\t\tif (_this4.suggestionsRequest !== request) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t_this4.setState({\n\t\t\t\t\tposts: posts,\n\t\t\t\t\tloading: false\n\t\t\t\t});\n\n\t\t\t\tif (!!posts.length) {\n\t\t\t\t\t_this4.props.debouncedSpeak(sprintf(_n('%d result found, use up and down arrow keys to navigate.', '%d results found, use up and down arrow keys to navigate.', posts.length), posts.length), 'assertive');\n\t\t\t\t} else {\n\t\t\t\t\t_this4.props.debouncedSpeak(__('No results.'), 'assertive');\n\t\t\t\t}\n\t\t\t}).catch(function () {\n\t\t\t\tif (_this4.suggestionsRequest === request) {\n\t\t\t\t\t_this4.setState({\n\t\t\t\t\t\tloading: false\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tthis.suggestionsRequest = request;\n\t\t}\n\n\t\t/**\r\n * Set state when an affiliate link is selected.\r\n * \r\n * @since 3.6\r\n * \r\n * @param {*} post \r\n */\n\n\t}, {\n\t\tkey: \"selectLink\",\n\t\tvalue: function selectLink(post) {\n\t\t\t// this.props.onChange( post.link, post );\n\t\t\tthis.setState({\n\t\t\t\tselectedSuggestion: post,\n\t\t\t\tshowSuggestions: false\n\t\t\t});\n\n\t\t\tthis.props.updateImageSelection(post.images, post);\n\t\t}\n\n\t\t/**\r\n * Callback handler for when affiliate link is selected.\r\n * \r\n * @param {*} post \r\n */\n\n\t}, {\n\t\tkey: \"handleOnClick\",\n\t\tvalue: function handleOnClick(post) {\n\t\t\tthis.selectLink(post);\n\t\t\t// Move focus to the input field when a link suggestion is clicked.\n\t\t\t// this.inputRef.current.focus();\n\t\t}\n\t}, {\n\t\tkey: \"render\",\n\t\tvalue: function render() {\n\t\t\tvar _this5 = this;\n\n\t\t\tvar _props = this.props,\n\t\t\t _props$value = _props.value,\n\t\t\t value = _props$value === undefined ? '' : _props$value,\n\t\t\t _props$autoFocus = _props.autoFocus,\n\t\t\t autoFocus = _props$autoFocus === undefined ? true : _props$autoFocus,\n\t\t\t instanceId = _props.instanceId;\n\t\t\tvar _state2 = this.state,\n\t\t\t showSuggestions = _state2.showSuggestions,\n\t\t\t posts = _state2.posts,\n\t\t\t selectedSuggestion = _state2.selectedSuggestion,\n\t\t\t loading = _state2.loading;\n\n\n\t\t\treturn wp.element.createElement(\n\t\t\t\t\"div\",\n\t\t\t\t{ \"class\": \"edit-search-affiliate-links\" },\n\t\t\t\twp.element.createElement(\n\t\t\t\t\t\"form\",\n\t\t\t\t\t{\n\t\t\t\t\t\tclassName: \"editor-format-toolbar__link-container-content ta-link-search-popover\",\n\t\t\t\t\t\tonSubmit: this.displayAffiliateImages\n\t\t\t\t\t},\n\t\t\t\t\twp.element.createElement(TextControl, {\n\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\tclassName: \"ta-search-affiliate-links\",\n\t\t\t\t\t\tplaceholder: __(\"Type to search affiliate links\"),\n\t\t\t\t\t\tonChange: this.searchAffiliateLinks,\n\t\t\t\t\t\tautocomplete: \"off\"\n\t\t\t\t\t}),\n\t\t\t\t\tloading && wp.element.createElement(Spinner, null),\n\t\t\t\t\tshowSuggestions && !!posts.length && wp.element.createElement(\n\t\t\t\t\t\tPopover,\n\t\t\t\t\t\t{ position: \"bottom\", focusOnMount: false },\n\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\"div\",\n\t\t\t\t\t\t\t{ \"class\": \"affilate-links-suggestions\" },\n\t\t\t\t\t\t\tposts.map(function (post, index) {\n\t\t\t\t\t\t\t\treturn wp.element.createElement(\n\t\t\t\t\t\t\t\t\t\"button\",\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tkey: post.id,\n\t\t\t\t\t\t\t\t\t\trole: \"option\",\n\t\t\t\t\t\t\t\t\t\ttabIndex: \"-1\",\n\t\t\t\t\t\t\t\t\t\tid: \"editor-url-input-suggestion-\" + instanceId + \"-\" + index,\n\t\t\t\t\t\t\t\t\t\tref: _this5.bindSuggestionNode(index),\n\t\t\t\t\t\t\t\t\t\tclassName: __WEBPACK_IMPORTED_MODULE_0_classnames___default()('editor-url-input__suggestion', {\n\t\t\t\t\t\t\t\t\t\t\t'is-selected': index === selectedSuggestion\n\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\tonClick: function onClick() {\n\t\t\t\t\t\t\t\t\t\t\treturn _this5.handleOnClick(post);\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\"aria-selected\": index === selectedSuggestion\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tpost.title || __('(no title)')\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t}]);\n\n\treturn ThirstyURLInput;\n}(Component);\n\n/* harmony default export */ __webpack_exports__[\"a\"] = (withSpokenMessages(withInstanceId(ThirstyURLInput)));\n\n/***/ }),\n/* 8 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export (immutable) */ __webpack_exports__[\"a\"] = registerFormats;\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ta_link__ = __webpack_require__(9);\nfunction _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }\n\n\n\nvar registerFormatType = wp.richText.registerFormatType;\n\n/**\r\n * Register custom formats.\r\n * \r\n * @since 3.6\r\n */\n\nfunction registerFormats() {\n\n [__WEBPACK_IMPORTED_MODULE_0__ta_link__[\"a\" /* taLink */]].forEach(function (_ref) {\n var name = _ref.name,\n settings = _objectWithoutProperties(_ref, [\"name\"]);\n\n return registerFormatType(name, settings);\n });\n}\n\n/***/ }),\n/* 9 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return taLink; });\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__inline__ = __webpack_require__(10);\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n\n\nvar __ = wp.i18n.__;\nvar _wp$element = wp.element,\n Component = _wp$element.Component,\n Fragment = _wp$element.Fragment;\nvar withSpokenMessages = wp.components.withSpokenMessages;\nvar _wp$richText = wp.richText,\n getTextContent = _wp$richText.getTextContent,\n applyFormat = _wp$richText.applyFormat,\n removeFormat = _wp$richText.removeFormat,\n slice = _wp$richText.slice;\nvar isURL = wp.url.isURL;\nvar _wp$editor = wp.editor,\n RichTextToolbarButton = _wp$editor.RichTextToolbarButton,\n RichTextShortcut = _wp$editor.RichTextShortcut;\nvar _wp$components = wp.components,\n Path = _wp$components.Path,\n SVG = _wp$components.SVG;\n\n\nvar name = \"ta/link\";\n\n/**\r\n * Custom Affiliate link format. When applied will wrap selected text with <ta href=\"\" linkid=\"\"></ta> custom element.\r\n * Custom element is implemented here as we are not allowed to use <a> tag due to Gutenberg limitations.\r\n * Element is converted to normal <a> tag on frontend via PHP script filtered on 'the_content'.\r\n * \r\n * @since 3.6\r\n */\nvar taLink = {\n\tname: name,\n\ttitle: __(\"Affiliate Link\"),\n\ttagName: \"ta\",\n\tclassName: null,\n\tattributes: {\n\t\turl: \"href\",\n\t\ttarget: \"target\"\n\t},\n\tedit: withSpokenMessages(function (_Component) {\n\t\t_inherits(LinkEdit, _Component);\n\n\t\t/**\r\n * Component constructor.\r\n * \r\n * @since 3.6\r\n */\n\t\tfunction LinkEdit() {\n\t\t\t_classCallCheck(this, LinkEdit);\n\n\t\t\tvar _this = _possibleConstructorReturn(this, (LinkEdit.__proto__ || Object.getPrototypeOf(LinkEdit)).apply(this, arguments));\n\n\t\t\t_this.addLink = _this.addLink.bind(_this);\n\t\t\t_this.stopAddingLink = _this.stopAddingLink.bind(_this);\n\t\t\t_this.onRemoveFormat = _this.onRemoveFormat.bind(_this);\n\t\t\t_this.state = {\n\t\t\t\taddingLink: false\n\t\t\t};\n\t\t\treturn _this;\n\t\t}\n\n\t\t/**\r\n * Callback to set state to adding link status.\r\n * \r\n * @since 3.6\r\n */\n\n\n\t\t_createClass(LinkEdit, [{\n\t\t\tkey: \"addLink\",\n\t\t\tvalue: function addLink() {\n\t\t\t\tvar _props = this.props,\n\t\t\t\t value = _props.value,\n\t\t\t\t onChange = _props.onChange;\n\n\t\t\t\tvar text = getTextContent(slice(value));\n\n\t\t\t\tif (text && isURL(text)) {\n\t\t\t\t\tonChange(applyFormat(value, { type: name, attributes: { url: text } }));\n\t\t\t\t} else {\n\t\t\t\t\tthis.setState({ addingLink: true });\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/**\r\n * Callback to set state to stop adding link status.\r\n * \r\n * @since 3.6\r\n */\n\n\t\t}, {\n\t\t\tkey: \"stopAddingLink\",\n\t\t\tvalue: function stopAddingLink() {\n\t\t\t\tthis.setState({ addingLink: false });\n\t\t\t}\n\n\t\t\t/**\r\n * Remove format event callback.\r\n * \r\n * @since 3.6\r\n */\n\n\t\t}, {\n\t\t\tkey: \"onRemoveFormat\",\n\t\t\tvalue: function onRemoveFormat() {\n\t\t\t\tvar _props2 = this.props,\n\t\t\t\t value = _props2.value,\n\t\t\t\t onChange = _props2.onChange,\n\t\t\t\t speak = _props2.speak;\n\n\n\t\t\t\tonChange(removeFormat(value, name));\n\t\t\t\tspeak(__(\"Affiliate Link removed.\"), \"assertive\");\n\t\t\t}\n\n\t\t\t/**\r\n * Component render method.\r\n * \r\n * @since 3.6\r\n */\n\n\t\t}, {\n\t\t\tkey: \"render\",\n\t\t\tvalue: function render() {\n\t\t\t\tvar _props3 = this.props,\n\t\t\t\t isActive = _props3.isActive,\n\t\t\t\t activeAttributes = _props3.activeAttributes,\n\t\t\t\t value = _props3.value,\n\t\t\t\t onChange = _props3.onChange;\n\n\n\t\t\t\treturn wp.element.createElement(\n\t\t\t\t\tFragment,\n\t\t\t\t\tnull,\n\t\t\t\t\twp.element.createElement(RichTextShortcut, {\n\t\t\t\t\t\ttype: \"access\",\n\t\t\t\t\t\tcharacter: \"s\",\n\t\t\t\t\t\tonUse: this.onRemoveFormat\n\t\t\t\t\t}),\n\t\t\t\t\twp.element.createElement(RichTextShortcut, {\n\t\t\t\t\t\ttype: \"primary\",\n\t\t\t\t\t\tcharacter: \"l\",\n\t\t\t\t\t\tonUse: this.addLink\n\t\t\t\t\t}),\n\t\t\t\t\twp.element.createElement(RichTextShortcut, {\n\t\t\t\t\t\ttype: \"primaryShift\",\n\t\t\t\t\t\tcharacter: \"l\",\n\t\t\t\t\t\tonUse: this.onRemoveFormat\n\t\t\t\t\t}),\n\t\t\t\t\tisActive && wp.element.createElement(RichTextToolbarButton, {\n\t\t\t\t\t\ticon: \"editor-unlink\",\n\t\t\t\t\t\ttitle: __('Remove Affiliate Link'),\n\t\t\t\t\t\tclassName: \"ta-unlink-button\",\n\t\t\t\t\t\tonClick: this.onRemoveFormat,\n\t\t\t\t\t\tisActive: isActive,\n\t\t\t\t\t\tshortcutType: \"primaryShift\",\n\t\t\t\t\t\tshortcutCharacter: \"l\"\n\t\t\t\t\t}),\n\t\t\t\t\t!isActive && wp.element.createElement(RichTextToolbarButton, {\n\t\t\t\t\t\ticon: wp.element.createElement(\n\t\t\t\t\t\t\tSVG,\n\t\t\t\t\t\t\t{ xmlns: \"http://www.w3.org/2000/svg\", width: \"16.688\", height: \"9.875\", viewBox: \"0 0 16.688 9.875\" },\n\t\t\t\t\t\t\twp.element.createElement(Path, { id: \"TA.svg\", fill: \"black\", \"class\": \"cls-1\", d: \"M2.115,15.12H4.847L6.836,7.7H9.777l0.63-2.381H1.821L1.177,7.7H4.118Zm4.758,0H9.829l1.177-1.751h3.782l0.238,1.751h2.858L16.357,5.245H13.7Zm5.5-3.866,1.835-2.816,0.35,2.816H12.378Z\", transform: \"translate(-1.188 -5.25)\" })\n\t\t\t\t\t\t),\n\t\t\t\t\t\ttitle: __('Affiliate Link'),\n\t\t\t\t\t\tclassName: \"ta-link-button\",\n\t\t\t\t\t\tonClick: this.addLink,\n\t\t\t\t\t\tshortcutType: \"primary\",\n\t\t\t\t\t\tshortcutCharacter: \"l\"\n\t\t\t\t\t}),\n\t\t\t\t\twp.element.createElement(__WEBPACK_IMPORTED_MODULE_0__inline__[\"a\" /* default */], {\n\t\t\t\t\t\taddingLink: this.state.addingLink,\n\t\t\t\t\t\tstopAddingLink: this.stopAddingLink,\n\t\t\t\t\t\tisActive: isActive,\n\t\t\t\t\t\tactiveAttributes: activeAttributes,\n\t\t\t\t\t\tvalue: value,\n\t\t\t\t\t\tonChange: onChange\n\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t}\n\t\t}]);\n\n\t\treturn LinkEdit;\n\t}(Component))\n};\n\n/***/ }),\n/* 10 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_classnames__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_classnames___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_classnames__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__positioned_at_selection__ = __webpack_require__(11);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils__ = __webpack_require__(12);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__url_popover__ = __webpack_require__(13);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__url_input__ = __webpack_require__(14);\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n\n\n\n\n\n\nvar __ = wp.i18n.__;\nvar _wp$element = wp.element,\n Component = _wp$element.Component,\n createRef = _wp$element.createRef;\nvar _wp$components = wp.components,\n ExternalLink = _wp$components.ExternalLink,\n ToggleControl = _wp$components.ToggleControl,\n IconButton = _wp$components.IconButton,\n withSpokenMessages = _wp$components.withSpokenMessages;\nvar _wp$keycodes = wp.keycodes,\n LEFT = _wp$keycodes.LEFT,\n RIGHT = _wp$keycodes.RIGHT,\n UP = _wp$keycodes.UP,\n DOWN = _wp$keycodes.DOWN,\n BACKSPACE = _wp$keycodes.BACKSPACE,\n ENTER = _wp$keycodes.ENTER;\nvar _wp$url = wp.url,\n prependHTTP = _wp$url.prependHTTP,\n safeDecodeURI = _wp$url.safeDecodeURI,\n filterURLForDisplay = _wp$url.filterURLForDisplay;\nvar _wp$richText = wp.richText,\n create = _wp$richText.create,\n insert = _wp$richText.insert,\n isCollapsed = _wp$richText.isCollapsed,\n applyFormat = _wp$richText.applyFormat,\n getTextContent = _wp$richText.getTextContent,\n slice = _wp$richText.slice;\n\n\nvar stopKeyPropagation = function stopKeyPropagation(event) {\n\treturn event.stopPropagation();\n};\n\n/**\r\n * Generates the format object that will be applied to the link text.\r\n * \r\n * @since 3.6\r\n *\r\n * @param {string} url The href of the link.\r\n * @param {boolean} linkid Affiliate link ID.\r\n * @param {Object} text The text that is being hyperlinked.\r\n *\r\n * @return {Object} The final format object.\r\n */\nfunction createLinkFormat(_ref) {\n\tvar url = _ref.url,\n\t linkid = _ref.linkid,\n\t text = _ref.text;\n\n\tvar format = {\n\t\ttype: \"ta/link\",\n\t\tattributes: {\n\t\t\turl: url,\n\t\t\tlinkid: linkid.toString()\n\t\t}\n\t};\n\n\treturn format;\n}\n\n/**\r\n * Check if input is being show.\r\n * \r\n * @since 3.6\r\n * \r\n * @param {Object} props Component props.\r\n * @param {Object} state Component state.\r\n */\nfunction isShowingInput(props, state) {\n\treturn props.addingLink || state.editLink;\n}\n\n/**\r\n * Affiliate Link editor JSX element.\r\n * \r\n * @since 3.6\r\n * \r\n * @param {Object} param0 Component props (destructred).\r\n */\nvar LinkEditor = function LinkEditor(_ref2) {\n\tvar value = _ref2.value,\n\t onChangeInputValue = _ref2.onChangeInputValue,\n\t onKeyDown = _ref2.onKeyDown,\n\t submitLink = _ref2.submitLink,\n\t invalidLink = _ref2.invalidLink,\n\t resetInvalidLink = _ref2.resetInvalidLink,\n\t autocompleteRef = _ref2.autocompleteRef;\n\treturn (\n\t\t// Disable reason: KeyPress must be suppressed so the block doesn't hide the toolbar\n\t\t/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */\n\t\twp.element.createElement(\n\t\t\t'form',\n\t\t\t{\n\t\t\t\tclassName: 'editor-format-toolbar__link-container-content ta-link-search-popover',\n\t\t\t\tonKeyPress: stopKeyPropagation,\n\t\t\t\tonKeyDown: onKeyDown,\n\t\t\t\tonSubmit: submitLink\n\t\t\t},\n\t\t\twp.element.createElement(__WEBPACK_IMPORTED_MODULE_4__url_input__[\"a\" /* default */], {\n\t\t\t\tvalue: value,\n\t\t\t\tonChange: onChangeInputValue,\n\t\t\t\tautocompleteRef: autocompleteRef,\n\t\t\t\tinvalidLink: invalidLink,\n\t\t\t\tresetInvalidLink: resetInvalidLink\n\t\t\t}),\n\t\t\twp.element.createElement(IconButton, { icon: 'editor-break', label: __('Apply'), type: 'submit' })\n\t\t)\n\t\t/* eslint-enable jsx-a11y/no-noninteractive-element-interactions */\n\n\t);\n};\n\n/**\r\n * Affiliate link url viewer JSX element.\r\n * \r\n * @param {*} param0 Component props (destructred).\r\n */\nvar LinkViewerUrl = function LinkViewerUrl(_ref3) {\n\tvar url = _ref3.url;\n\n\tvar prependedURL = prependHTTP(url);\n\tvar linkClassName = __WEBPACK_IMPORTED_MODULE_0_classnames___default()('editor-format-toolbar__link-container-value', {\n\t\t'has-invalid-link': !Object(__WEBPACK_IMPORTED_MODULE_2__utils__[\"a\" /* isValidHref */])(prependedURL)\n\t});\n\n\tif (!url) {\n\t\treturn wp.element.createElement('span', { className: linkClassName });\n\t}\n\n\treturn wp.element.createElement(\n\t\tExternalLink,\n\t\t{\n\t\t\tclassName: linkClassName,\n\t\t\thref: url\n\t\t},\n\t\tfilterURLForDisplay(safeDecodeURI(url))\n\t);\n};\n\n/**\r\n * Affiliate link viewer JSX element.\r\n * \r\n * @param {*} param0 Component props (destructred).\r\n */\nvar LinkViewer = function LinkViewer(_ref4) {\n\tvar url = _ref4.url,\n\t editLink = _ref4.editLink;\n\n\treturn (\n\t\t// Disable reason: KeyPress must be suppressed so the block doesn't hide the toolbar\n\t\t/* eslint-disable jsx-a11y/no-static-element-interactions */\n\t\twp.element.createElement(\n\t\t\t'div',\n\t\t\t{\n\t\t\t\tclassName: 'editor-format-toolbar__link-container-content',\n\t\t\t\tonKeyPress: stopKeyPropagation\n\t\t\t},\n\t\t\twp.element.createElement(LinkViewerUrl, { url: url }),\n\t\t\twp.element.createElement(IconButton, { icon: 'edit', label: __('Edit'), onClick: editLink })\n\t\t)\n\t\t/* eslint-enable jsx-a11y/no-static-element-interactions */\n\n\t);\n};\n\n/**\r\n * Inline affiliate link UI Component.\r\n * \r\n * @since 3.6\r\n * \r\n * @param {*} param0 Component props (destructred).\r\n */\n\nvar InlineAffiliateLinkUI = function (_Component) {\n\t_inherits(InlineAffiliateLinkUI, _Component);\n\n\tfunction InlineAffiliateLinkUI() {\n\t\t_classCallCheck(this, InlineAffiliateLinkUI);\n\n\t\tvar _this = _possibleConstructorReturn(this, (InlineAffiliateLinkUI.__proto__ || Object.getPrototypeOf(InlineAffiliateLinkUI)).apply(this, arguments));\n\n\t\t_this.editLink = _this.editLink.bind(_this);\n\t\t_this.submitLink = _this.submitLink.bind(_this);\n\t\t_this.onKeyDown = _this.onKeyDown.bind(_this);\n\t\t_this.onChangeInputValue = _this.onChangeInputValue.bind(_this);\n\t\t_this.onClickOutside = _this.onClickOutside.bind(_this);\n\t\t_this.resetState = _this.resetState.bind(_this);\n\t\t_this.autocompleteRef = createRef();\n\t\t_this.resetInvalidLink = _this.resetInvalidLink.bind(_this);\n\n\t\t_this.state = {\n\t\t\tinputValue: '',\n\t\t\tlinkid: 0,\n\t\t\tpost: null,\n\t\t\tinvalidLink: false\n\t\t};\n\t\treturn _this;\n\t}\n\n\t/**\r\n * Stop the key event from propagating up to ObserveTyping.startTypingInTextField.\r\n * \r\n * @since 3.6\r\n * \r\n * @param {Object} event Event object.\r\n */\n\n\n\t_createClass(InlineAffiliateLinkUI, [{\n\t\tkey: 'onKeyDown',\n\t\tvalue: function onKeyDown(event) {\n\t\t\tif ([LEFT, DOWN, RIGHT, UP, BACKSPACE, ENTER].indexOf(event.keyCode) > -1) {\n\t\t\t\tevent.stopPropagation();\n\t\t\t}\n\t\t}\n\n\t\t/**\r\n * Callback to set state when input value is changed.\r\n * \r\n * @since 3.6\r\n * \r\n * @param {*} inputValue \r\n * @param {*} post \r\n */\n\n\t}, {\n\t\tkey: 'onChangeInputValue',\n\t\tvalue: function onChangeInputValue(inputValue) {\n\t\t\tvar post = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n\n\t\t\tvar linkid = post ? post.id : 0;\n\t\t\tthis.setState({ inputValue: inputValue, linkid: linkid, post: post });\n\t\t}\n\n\t\t/**\r\n * Callback to set state when edit affiliate link (already inserted) is triggered.\r\n * \r\n * @since 3.6\r\n * \r\n * @param {*} event \r\n */\n\n\t}, {\n\t\tkey: 'editLink',\n\t\tvalue: function editLink(event) {\n\t\t\tthis.setState({ editLink: true });\n\t\t\tevent.preventDefault();\n\t\t}\n\n\t\t/**\r\n * Callback to apply the affiliate link format to the selected text or position in the active block.\r\n * \r\n * @since 3.6\r\n * \r\n * @param {*} event \r\n */\n\n\t}, {\n\t\tkey: 'submitLink',\n\t\tvalue: function submitLink(event) {\n\t\t\tvar _props = this.props,\n\t\t\t isActive = _props.isActive,\n\t\t\t value = _props.value,\n\t\t\t onChange = _props.onChange,\n\t\t\t speak = _props.speak;\n\t\t\tvar _state = this.state,\n\t\t\t inputValue = _state.inputValue,\n\t\t\t linkid = _state.linkid,\n\t\t\t post = _state.post;\n\n\t\t\tvar url = prependHTTP(inputValue);\n\t\t\tvar selectedText = getTextContent(slice(value));\n\t\t\tvar format = createLinkFormat({\n\t\t\t\turl: url,\n\t\t\t\tlinkid: linkid,\n\t\t\t\ttext: selectedText\n\t\t\t});\n\n\t\t\tevent.preventDefault();\n\n\t\t\tif (!linkid || !post) {\n\t\t\t\tthis.setState({ invalidLink: true });\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (isCollapsed(value) && !isActive) {\n\t\t\t\tvar toInsert = applyFormat(create({ text: post.title }), format, 0, url.length);\n\t\t\t\tonChange(insert(value, toInsert));\n\t\t\t} else {\n\t\t\t\tonChange(applyFormat(value, format));\n\t\t\t}\n\n\t\t\tthis.resetState();\n\n\t\t\tif (!Object(__WEBPACK_IMPORTED_MODULE_2__utils__[\"a\" /* isValidHref */])(url)) {\n\t\t\t\tspeak(__('Warning: the link has been inserted but may have errors. Please test it.'), 'assertive');\n\t\t\t} else if (isActive) {\n\t\t\t\tspeak(__('Link edited.'), 'assertive');\n\t\t\t} else {\n\t\t\t\tspeak(__('Link inserted'), 'assertive');\n\t\t\t}\n\t\t}\n\n\t\t/**\r\n * Callback to run when users clicks outside the popover UI.\r\n * \r\n * @since 3.6\r\n * \r\n * @param {*} event \r\n */\n\n\t}, {\n\t\tkey: 'onClickOutside',\n\t\tvalue: function onClickOutside(event) {\n\t\t\t// The autocomplete suggestions list renders in a separate popover (in a portal),\n\t\t\t// so onClickOutside fails to detect that a click on a suggestion occured in the\n\t\t\t// LinkContainer. Detect clicks on autocomplete suggestions using a ref here, and\n\t\t\t// return to avoid the popover being closed.\n\t\t\tvar autocompleteElement = this.autocompleteRef.current;\n\t\t\tif (autocompleteElement && autocompleteElement.contains(event.target)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.resetState();\n\t\t}\n\n\t\t/**\r\n * Reset state callback.\r\n * \r\n * @since 3.6\r\n */\n\n\t}, {\n\t\tkey: 'resetState',\n\t\tvalue: function resetState() {\n\t\t\tthis.props.stopAddingLink();\n\t\t\tthis.setState({ inputValue: '', editLink: false });\n\t\t\tthis.resetInvalidLink();\n\t\t}\n\n\t\t/**\r\n * Reset invalid link state callback. Separated as we need to run this independently from resetState() callback.\r\n * \r\n * @since 3.6\r\n */\n\n\t}, {\n\t\tkey: 'resetInvalidLink',\n\t\tvalue: function resetInvalidLink() {\n\t\t\tthis.setState({ invalidLink: false });\n\t\t}\n\n\t\t/**\r\n * Component render method.\r\n *\r\n * @since 3.6\r\n */\n\n\t}, {\n\t\tkey: 'render',\n\t\tvalue: function render() {\n\t\t\tvar _props2 = this.props,\n\t\t\t isActive = _props2.isActive,\n\t\t\t _props2$activeAttribu = _props2.activeAttributes,\n\t\t\t url = _props2$activeAttribu.url,\n\t\t\t linkid = _props2$activeAttribu.linkid,\n\t\t\t addingLink = _props2.addingLink,\n\t\t\t value = _props2.value,\n\t\t\t onChange = _props2.onChange;\n\n\n\t\t\tif (!isActive && !addingLink) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tvar _state2 = this.state,\n\t\t\t inputValue = _state2.inputValue,\n\t\t\t invalidLink = _state2.invalidLink;\n\n\t\t\tvar showInput = isShowingInput(this.props, this.state);\n\n\t\t\treturn wp.element.createElement(\n\t\t\t\t__WEBPACK_IMPORTED_MODULE_1__positioned_at_selection__[\"a\" /* default */],\n\t\t\t\t{\n\t\t\t\t\tkey: '' + value.start + value.end /* Used to force rerender on selection change */\n\t\t\t\t},\n\t\t\t\twp.element.createElement(\n\t\t\t\t\t__WEBPACK_IMPORTED_MODULE_3__url_popover__[\"a\" /* default */],\n\t\t\t\t\t{\n\t\t\t\t\t\tonClickOutside: this.onClickOutside,\n\t\t\t\t\t\tonClose: this.resetState,\n\t\t\t\t\t\tfocusOnMount: showInput ? 'firstElement' : false,\n\t\t\t\t\t\tinvalidLink: invalidLink\n\t\t\t\t\t},\n\t\t\t\t\tshowInput ? wp.element.createElement(LinkEditor, {\n\t\t\t\t\t\tvalue: inputValue,\n\t\t\t\t\t\tonChangeInputValue: this.onChangeInputValue,\n\t\t\t\t\t\tonKeyDown: this.onKeyDown,\n\t\t\t\t\t\tsubmitLink: this.submitLink,\n\t\t\t\t\t\tautocompleteRef: this.autocompleteRef,\n\t\t\t\t\t\tupdateLinkId: this.updateLinkId,\n\t\t\t\t\t\tinvalidLink: invalidLink,\n\t\t\t\t\t\tresetInvalidLink: this.resetInvalidLink\n\t\t\t\t\t}) : wp.element.createElement(LinkViewer, {\n\t\t\t\t\t\turl: url,\n\t\t\t\t\t\teditLink: this.editLink\n\t\t\t\t\t})\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t}]);\n\n\treturn InlineAffiliateLinkUI;\n}(Component);\n\n/* harmony default export */ __webpack_exports__[\"a\"] = (withSpokenMessages(InlineAffiliateLinkUI));\n\n/***/ }),\n/* 11 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar Component = wp.element.Component;\nvar _wp$dom = wp.dom,\n getOffsetParent = _wp$dom.getOffsetParent,\n getRectangleFromRange = _wp$dom.getRectangleFromRange;\n\n/**\r\n * Returns a style object for applying as `position: absolute` for an element\r\n * relative to the bottom-center of the current selection. Includes `top` and\r\n * `left` style properties.\r\n * \r\n * @since 3.6\r\n *\r\n * @return {Object} Style object.\r\n */\n\nfunction getCurrentCaretPositionStyle() {\n\tvar selection = window.getSelection();\n\n\t// Unlikely, but in the case there is no selection, return empty styles so\n\t// as to avoid a thrown error by `Selection#getRangeAt` on invalid index.\n\tif (selection.rangeCount === 0) {\n\t\treturn {};\n\t}\n\n\t// Get position relative viewport.\n\tvar rect = getRectangleFromRange(selection.getRangeAt(0));\n\tvar top = rect.top + rect.height;\n\tvar left = rect.left + rect.width / 2;\n\n\t// Offset by positioned parent, if one exists.\n\tvar offsetParent = getOffsetParent(selection.anchorNode);\n\tif (offsetParent) {\n\t\tvar parentRect = offsetParent.getBoundingClientRect();\n\t\ttop -= parentRect.top;\n\t\tleft -= parentRect.left;\n\t}\n\n\treturn { top: top, left: left };\n}\n\n/**\r\n * Component which renders itself positioned under the current caret selection.\r\n * The position is calculated at the time of the component being mounted, so it\r\n * should only be mounted after the desired selection has been made.\r\n * \r\n * @since 3.6\r\n *\r\n * @type {WPComponent}\r\n */\n\nvar ThirstyPositionedAtSelection = function (_Component) {\n\t_inherits(ThirstyPositionedAtSelection, _Component);\n\n\t/**\r\n * Component constructor method.\r\n * \r\n * @since 3.6\r\n */\n\tfunction ThirstyPositionedAtSelection() {\n\t\t_classCallCheck(this, ThirstyPositionedAtSelection);\n\n\t\tvar _this = _possibleConstructorReturn(this, (ThirstyPositionedAtSelection.__proto__ || Object.getPrototypeOf(ThirstyPositionedAtSelection)).apply(this, arguments));\n\n\t\t_this.state = {\n\t\t\tstyle: getCurrentCaretPositionStyle()\n\t\t};\n\t\treturn _this;\n\t}\n\n\t/**\r\n * Component render method.\r\n * \r\n * @since 3.6\r\n */\n\n\n\t_createClass(ThirstyPositionedAtSelection, [{\n\t\tkey: \"render\",\n\t\tvalue: function render() {\n\t\t\tvar children = this.props.children;\n\t\t\tvar style = this.state.style;\n\n\n\t\t\treturn wp.element.createElement(\n\t\t\t\t\"div\",\n\t\t\t\t{ className: \"editor-format-toolbar__selection-position\", style: style },\n\t\t\t\tchildren\n\t\t\t);\n\t\t}\n\t}]);\n\n\treturn ThirstyPositionedAtSelection;\n}(Component);\n\n/* harmony default export */ __webpack_exports__[\"a\"] = (ThirstyPositionedAtSelection);\n\n/***/ }),\n/* 12 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export (immutable) */ __webpack_exports__[\"a\"] = isValidHref;\nvar _lodash = lodash,\n startsWith = _lodash.startsWith;\nvar _wp$url = wp.url,\n getProtocol = _wp$url.getProtocol,\n isValidProtocol = _wp$url.isValidProtocol,\n getAuthority = _wp$url.getAuthority,\n isValidAuthority = _wp$url.isValidAuthority,\n getPath = _wp$url.getPath,\n isValidPath = _wp$url.isValidPath,\n getQueryString = _wp$url.getQueryString,\n isValidQueryString = _wp$url.isValidQueryString,\n getFragment = _wp$url.getFragment,\n isValidFragment = _wp$url.isValidFragment;\n\n/**\r\n * Check for issues with the provided href.\r\n * \r\n * @since 3.6\r\n *\r\n * @param {string} href The href.\r\n * @return {boolean} Is the href invalid?\r\n */\n\nfunction isValidHref(href) {\n\tif (!href) {\n\t\treturn false;\n\t}\n\n\tvar trimmedHref = href.trim();\n\n\tif (!trimmedHref) {\n\t\treturn false;\n\t}\n\n\t// Does the href start with something that looks like a URL protocol?\n\tif (/^\\S+:/.test(trimmedHref)) {\n\t\tvar protocol = getProtocol(trimmedHref);\n\t\tif (!isValidProtocol(protocol)) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Add some extra checks for http(s) URIs, since these are the most common use-case.\n\t\t// This ensures URIs with an http protocol have exactly two forward slashes following the protocol.\n\t\tif (startsWith(protocol, 'http') && !/^https?:\\/\\/[^\\/\\s]/i.test(trimmedHref)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tvar authority = getAuthority(trimmedHref);\n\t\tif (!isValidAuthority(authority)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tvar path = getPath(trimmedHref);\n\t\tif (path && !isValidPath(path)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tvar queryString = getQueryString(trimmedHref);\n\t\tif (queryString && !isValidQueryString(queryString)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tvar fragment = getFragment(trimmedHref);\n\t\tif (fragment && !isValidFragment(fragment)) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t// Validate anchor links.\n\tif (startsWith(trimmedHref, '#') && !isValidFragment(trimmedHref)) {\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\n/***/ }),\n/* 13 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar __ = wp.i18n.__;\nvar Component = wp.element.Component;\nvar _wp$components = wp.components,\n Popover = _wp$components.Popover,\n IconButton = _wp$components.IconButton;\n\n/**\r\n * Custom URL Popover component.\r\n * \r\n * @since 3.6\r\n */\n\nvar ThirstyURLPopover = function (_Component) {\n\t_inherits(ThirstyURLPopover, _Component);\n\n\t/**\r\n * Component constructor method.\r\n * \r\n * @since 3.6\r\n */\n\tfunction ThirstyURLPopover() {\n\t\t_classCallCheck(this, ThirstyURLPopover);\n\n\t\tvar _this = _possibleConstructorReturn(this, (ThirstyURLPopover.__proto__ || Object.getPrototypeOf(ThirstyURLPopover)).apply(this, arguments));\n\n\t\t_this.toggleSettingsVisibility = _this.toggleSettingsVisibility.bind(_this);\n\n\t\t_this.state = {\n\t\t\tisSettingsExpanded: false\n\t\t};\n\t\treturn _this;\n\t}\n\n\t/**\r\n * Component constructor.\r\n * \r\n * @since 3.6\r\n */\n\n\n\t_createClass(ThirstyURLPopover, [{\n\t\tkey: 'toggleSettingsVisibility',\n\t\tvalue: function toggleSettingsVisibility() {\n\t\t\tthis.setState({\n\t\t\t\tisSettingsExpanded: !this.state.isSettingsExpanded\n\t\t\t});\n\t\t}\n\n\t\t/**\r\n * Component render method.\r\n * \r\n * @since 3.6\r\n */\n\n\t}, {\n\t\tkey: 'render',\n\t\tvalue: function render() {\n\t\t\tvar _props = this.props,\n\t\t\t children = _props.children,\n\t\t\t renderSettings = _props.renderSettings,\n\t\t\t onClose = _props.onClose,\n\t\t\t onClickOutside = _props.onClickOutside,\n\t\t\t invalidLink = _props.invalidLink,\n\t\t\t _props$position = _props.position,\n\t\t\t position = _props$position === undefined ? 'bottom center' : _props$position,\n\t\t\t _props$focusOnMount = _props.focusOnMount,\n\t\t\t focusOnMount = _props$focusOnMount === undefined ? 'firstElement' : _props$focusOnMount;\n\t\t\tvar isSettingsExpanded = this.state.isSettingsExpanded;\n\n\n\t\t\tvar showSettings = !!renderSettings && isSettingsExpanded;\n\n\t\t\treturn wp.element.createElement(\n\t\t\t\tPopover,\n\t\t\t\t{\n\t\t\t\t\tclassName: 'ta-url-popover editor-url-popover',\n\t\t\t\t\tfocusOnMount: focusOnMount,\n\t\t\t\t\tposition: position,\n\t\t\t\t\tonClose: onClose,\n\t\t\t\t\tonClickOutside: onClickOutside\n\t\t\t\t},\n\t\t\t\twp.element.createElement(\n\t\t\t\t\t'div',\n\t\t\t\t\t{ className: 'editor-url-popover__row' },\n\t\t\t\t\tchildren,\n\t\t\t\t\t!!renderSettings && wp.element.createElement(IconButton, {\n\t\t\t\t\t\tclassName: 'editor-url-popover__settings-toggle',\n\t\t\t\t\t\ticon: 'ellipsis',\n\t\t\t\t\t\tlabel: __('Link Settings'),\n\t\t\t\t\t\tonClick: this.toggleSettingsVisibility,\n\t\t\t\t\t\t'aria-expanded': isSettingsExpanded\n\t\t\t\t\t})\n\t\t\t\t),\n\t\t\t\tshowSettings && wp.element.createElement(\n\t\t\t\t\t'div',\n\t\t\t\t\t{ className: 'editor-url-popover__row editor-url-popover__settings' },\n\t\t\t\t\trenderSettings()\n\t\t\t\t),\n\t\t\t\tinvalidLink && wp.element.createElement(\n\t\t\t\t\t'div',\n\t\t\t\t\t{ 'class': 'ta-invalid-link' },\n\t\t\t\t\t__('Invalid affiliate link')\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t}]);\n\n\treturn ThirstyURLPopover;\n}(Component);\n\n/* harmony default export */ __webpack_exports__[\"a\"] = (ThirstyURLPopover);\n\n/***/ }),\n/* 14 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_classnames__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_classnames___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_classnames__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_dom_scroll_into_view__ = __webpack_require__(15);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_dom_scroll_into_view___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_dom_scroll_into_view__);\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n\n\n\nvar __ = wp.i18n.__;\nvar _lodash = lodash,\n throttle = _lodash.throttle;\nvar _wp$element = wp.element,\n Component = _wp$element.Component,\n createRef = _wp$element.createRef;\nvar _wp$keycodes = wp.keycodes,\n UP = _wp$keycodes.UP,\n DOWN = _wp$keycodes.DOWN,\n ENTER = _wp$keycodes.ENTER,\n TAB = _wp$keycodes.TAB;\nvar _wp$components = wp.components,\n Spinner = _wp$components.Spinner,\n withSpokenMessages = _wp$components.withSpokenMessages,\n Popover = _wp$components.Popover;\nvar withInstanceId = wp.compose.withInstanceId;\n\n// Since URLInput is rendered in the context of other inputs, but should be\n// considered a separate modal node, prevent keyboard events from propagating\n// as being considered from the input.\n\nvar stopEventPropagation = function stopEventPropagation(event) {\n\treturn event.stopPropagation();\n};\n\n/**\r\n * Custom URL Input component.\r\n * \r\n * @since 3.6\r\n */\n\nvar ThirstyURLInput = function (_Component) {\n\t_inherits(ThirstyURLInput, _Component);\n\n\t/**\r\n * Component constructor method.\r\n * \r\n * @since 3.6\r\n * \r\n * @param {*} param0 \r\n */\n\tfunction ThirstyURLInput(_ref) {\n\t\tvar autocompleteRef = _ref.autocompleteRef;\n\n\t\t_classCallCheck(this, ThirstyURLInput);\n\n\t\tvar _this = _possibleConstructorReturn(this, (ThirstyURLInput.__proto__ || Object.getPrototypeOf(ThirstyURLInput)).apply(this, arguments));\n\n\t\t_this.onChange = _this.onChange.bind(_this);\n\t\t_this.onKeyDown = _this.onKeyDown.bind(_this);\n\t\t_this.autocompleteRef = autocompleteRef || createRef();\n\t\t_this.inputRef = createRef();\n\t\t_this.updateSuggestions = throttle(_this.updateSuggestions.bind(_this), 200);\n\n\t\t_this.suggestionNodes = [];\n\n\t\t_this.state = {\n\t\t\tposts: [],\n\t\t\tshowSuggestions: false,\n\t\t\tselectedSuggestion: null\n\t\t};\n\t\treturn _this;\n\t}\n\n\t/**\r\n * Component did update method.\r\n * \r\n * @since 3.6\r\n */\n\n\n\t_createClass(ThirstyURLInput, [{\n\t\tkey: 'componentDidUpdate',\n\t\tvalue: function componentDidUpdate() {\n\t\t\tvar _this2 = this;\n\n\t\t\tvar _state = this.state,\n\t\t\t showSuggestions = _state.showSuggestions,\n\t\t\t selectedSuggestion = _state.selectedSuggestion;\n\t\t\t// only have to worry about scrolling selected suggestion into view\n\t\t\t// when already expanded\n\n\t\t\tif (showSuggestions && selectedSuggestion !== null && !this.scrollingIntoView) {\n\t\t\t\tthis.scrollingIntoView = true;\n\t\t\t\t__WEBPACK_IMPORTED_MODULE_1_dom_scroll_into_view___default()(this.suggestionNodes[selectedSuggestion], this.autocompleteRef.current, {\n\t\t\t\t\tonlyScrollIfNeeded: true\n\t\t\t\t});\n\n\t\t\t\tsetTimeout(function () {\n\t\t\t\t\t_this2.scrollingIntoView = false;\n\t\t\t\t}, 100);\n\t\t\t}\n\t\t}\n\n\t\t/**\r\n * Component unmount method.\r\n * \r\n * @since 3.6\r\n */\n\n\t}, {\n\t\tkey: 'componentWillUnmount',\n\t\tvalue: function componentWillUnmount() {\n\t\t\tdelete this.suggestionsRequest;\n\t\t}\n\n\t\t/**\r\n * Bind suggestion to node.\r\n * \r\n * @param {*} index \r\n */\n\n\t}, {\n\t\tkey: 'bindSuggestionNode',\n\t\tvalue: function bindSuggestionNode(index) {\n\t\t\tvar _this3 = this;\n\n\t\t\treturn function (ref) {\n\t\t\t\t_this3.suggestionNodes[index] = ref;\n\t\t\t};\n\t\t}\n\n\t\t/**\r\n * Callback to show suggestions based on value inputted on search field.\r\n * \r\n * @since 3.6\r\n * \r\n * @param {*} value \r\n */\n\n\t}, {\n\t\tkey: 'updateSuggestions',\n\t\tvalue: function updateSuggestions(value) {\n\t\t\tvar _this4 = this;\n\n\t\t\t// Show the suggestions after typing at least 2 characters\n\t\t\t// and also for URLs\n\t\t\tif (value.length < 2 || /^https?:/.test(value)) {\n\t\t\t\tthis.setState({\n\t\t\t\t\tshowSuggestions: false,\n\t\t\t\t\tselectedSuggestion: null,\n\t\t\t\t\tloading: false\n\t\t\t\t});\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.setState({\n\t\t\t\tshowSuggestions: true,\n\t\t\t\tselectedSuggestion: null,\n\t\t\t\tloading: true\n\t\t\t});\n\n\t\t\tvar formData = new FormData();\n\t\t\tformData.append(\"action\", \"search_affiliate_links_query\");\n\t\t\tformData.append(\"keyword\", value);\n\t\t\tformData.append(\"paged\", 1);\n\t\t\tformData.append(\"gutenberg\", true);\n\n\t\t\t// We are getting data via the WP AJAX instead of rest API as it is not possible yet\n\t\t\t// to filter results with category value. This is to prepare next update to add category filter.\n\t\t\tvar request = fetch(ajaxurl, {\n\t\t\t\tmethod: \"POST\",\n\t\t\t\tbody: formData\n\t\t\t});\n\n\t\t\trequest.then(function (response) {\n\t\t\t\treturn response.json();\n\t\t\t}).then(function (response) {\n\n\t\t\t\tif (!response.affiliate_links) return;\n\n\t\t\t\tvar posts = response.affiliate_links;\n\n\t\t\t\t// A fetch Promise doesn't have an abort option. It's mimicked by\n\t\t\t\t// comparing the request reference in on the instance, which is\n\t\t\t\t// reset or deleted on subsequent requests or unmounting.\n\t\t\t\tif (_this4.suggestionsRequest !== request) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t_this4.setState({\n\t\t\t\t\tposts: posts,\n\t\t\t\t\tloading: false\n\t\t\t\t});\n\n\t\t\t\tif (!!posts.length) {\n\t\t\t\t\t_this4.props.debouncedSpeak(sprintf(_n('%d result found, use up and down arrow keys to navigate.', '%d results found, use up and down arrow keys to navigate.', posts.length), posts.length), 'assertive');\n\t\t\t\t} else {\n\t\t\t\t\t_this4.props.debouncedSpeak(__('No results.'), 'assertive');\n\t\t\t\t}\n\t\t\t}).catch(function () {\n\t\t\t\tif (_this4.suggestionsRequest === request) {\n\t\t\t\t\t_this4.setState({\n\t\t\t\t\t\tloading: false\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tthis.suggestionsRequest = request;\n\t\t}\n\n\t\t/**\r\n * Search input value change event callback method.\r\n * \r\n * @since 3.6\r\n * \r\n * @param {*} event \r\n */\n\n\t}, {\n\t\tkey: 'onChange',\n\t\tvalue: function onChange(event) {\n\t\t\tthis.props.resetInvalidLink();\n\t\t\tvar inputValue = event.target.value;\n\t\t\tthis.props.onChange(inputValue);\n\t\t\tthis.updateSuggestions(inputValue);\n\t\t}\n\n\t\t/**\r\n * Keydown event callback. Handles selecting result via keyboard.\r\n * \r\n * @since 3.6\r\n * \r\n * @param {*} event \r\n */\n\n\t}, {\n\t\tkey: 'onKeyDown',\n\t\tvalue: function onKeyDown(event) {\n\t\t\tvar _state2 = this.state,\n\t\t\t showSuggestions = _state2.showSuggestions,\n\t\t\t selectedSuggestion = _state2.selectedSuggestion,\n\t\t\t posts = _state2.posts,\n\t\t\t loading = _state2.loading;\n\t\t\t// If the suggestions are not shown or loading, we shouldn't handle the arrow keys\n\t\t\t// We shouldn't preventDefault to allow block arrow keys navigation\n\n\t\t\tif (!showSuggestions || !posts.length || loading) {\n\t\t\t\t// In the Windows version of Firefox the up and down arrows don't move the caret\n\t\t\t\t// within an input field like they do for Mac Firefox/Chrome/Safari. This causes\n\t\t\t\t// a form of focus trapping that is disruptive to the user experience. This disruption\n\t\t\t\t// only happens if the caret is not in the first or last position in the text input.\n\t\t\t\t// See: https://github.com/WordPress/gutenberg/issues/5693#issuecomment-436684747\n\t\t\t\tswitch (event.keyCode) {\n\t\t\t\t\t// When UP is pressed, if the caret is at the start of the text, move it to the 0\n\t\t\t\t\t// position.\n\t\t\t\t\tcase UP:\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (0 !== event.target.selectionStart) {\n\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\n\t\t\t\t\t\t\t\t// Set the input caret to position 0\n\t\t\t\t\t\t\t\tevent.target.setSelectionRange(0, 0);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t// When DOWN is pressed, if the caret is not at the end of the text, move it to the\n\t\t\t\t\t// last position.\n\t\t\t\t\tcase DOWN:\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (this.props.value.length !== event.target.selectionStart) {\n\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\n\t\t\t\t\t\t\t\t// Set the input caret to the last position\n\t\t\t\t\t\t\t\tevent.target.setSelectionRange(this.props.value.length, this.props.value.length);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar post = this.state.posts[this.state.selectedSuggestion];\n\n\t\t\tswitch (event.keyCode) {\n\t\t\t\tcase UP:\n\t\t\t\t\t{\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tvar previousIndex = !selectedSuggestion ? posts.length - 1 : selectedSuggestion - 1;\n\t\t\t\t\t\tthis.setState({\n\t\t\t\t\t\t\tselectedSuggestion: previousIndex\n\t\t\t\t\t\t});\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\tcase DOWN:\n\t\t\t\t\t{\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tvar nextIndex = selectedSuggestion === null || selectedSuggestion === posts.length - 1 ? 0 : selectedSuggestion + 1;\n\t\t\t\t\t\tthis.setState({\n\t\t\t\t\t\t\tselectedSuggestion: nextIndex\n\t\t\t\t\t\t});\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\tcase TAB:\n\t\t\t\t\t{\n\t\t\t\t\t\tif (this.state.selectedSuggestion !== null) {\n\t\t\t\t\t\t\tthis.selectLink(post);\n\t\t\t\t\t\t\t// Announce a link has been selected when tabbing away from the input field.\n\t\t\t\t\t\t\tthis.props.speak(__('Link selected'));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\tcase ENTER:\n\t\t\t\t\t{\n\t\t\t\t\t\tif (this.state.selectedSuggestion !== null) {\n\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\tthis.selectLink(post);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/**\r\n * Set state when an affiliate link is selected.\r\n * \r\n * @since 3.6\r\n * \r\n * @param {*} post \r\n */\n\n\t}, {\n\t\tkey: 'selectLink',\n\t\tvalue: function selectLink(post) {\n\t\t\tthis.props.onChange(post.link, post);\n\t\t\tthis.setState({\n\t\t\t\tselectedSuggestion: null,\n\t\t\t\tshowSuggestions: false\n\t\t\t});\n\t\t}\n\n\t\t/**\r\n * Callback handler for when affiliate link is selected.\r\n * \r\n * @param {*} post \r\n */\n\n\t}, {\n\t\tkey: 'handleOnClick',\n\t\tvalue: function handleOnClick(post) {\n\t\t\tthis.selectLink(post);\n\t\t\t// Move focus to the input field when a link suggestion is clicked.\n\t\t\tthis.inputRef.current.focus();\n\t\t}\n\n\t\t/**\r\n * Component render method.\r\n * \r\n * @since 3.6\r\n */\n\n\t}, {\n\t\tkey: 'render',\n\t\tvalue: function render() {\n\t\t\tvar _this5 = this;\n\n\t\t\tvar _props = this.props,\n\t\t\t _props$value = _props.value,\n\t\t\t value = _props$value === undefined ? '' : _props$value,\n\t\t\t _props$autoFocus = _props.autoFocus,\n\t\t\t autoFocus = _props$autoFocus === undefined ? true : _props$autoFocus,\n\t\t\t instanceId = _props.instanceId,\n\t\t\t invalidLink = _props.invalidLink;\n\t\t\tvar _state3 = this.state,\n\t\t\t showSuggestions = _state3.showSuggestions,\n\t\t\t posts = _state3.posts,\n\t\t\t selectedSuggestion = _state3.selectedSuggestion,\n\t\t\t loading = _state3.loading;\n\t\t\t/* eslint-disable jsx-a11y/no-autofocus */\n\n\t\t\treturn wp.element.createElement(\n\t\t\t\t'div',\n\t\t\t\t{ className: 'editor-url-input' },\n\t\t\t\twp.element.createElement('input', {\n\t\t\t\t\tautoFocus: autoFocus,\n\t\t\t\t\ttype: 'text',\n\t\t\t\t\t'aria-label': __('URL'),\n\t\t\t\t\trequired: true,\n\t\t\t\t\tvalue: value,\n\t\t\t\t\tonChange: this.onChange,\n\t\t\t\t\tonInput: stopEventPropagation,\n\t\t\t\t\tplaceholder: __('Paste URL or type to search'),\n\t\t\t\t\tonKeyDown: this.onKeyDown,\n\t\t\t\t\trole: 'combobox',\n\t\t\t\t\t'aria-expanded': showSuggestions,\n\t\t\t\t\t'aria-autocomplete': 'list',\n\t\t\t\t\t'aria-owns': 'editor-url-input-suggestions-' + instanceId,\n\t\t\t\t\t'aria-activedescendant': selectedSuggestion !== null ? 'editor-url-input-suggestion-' + instanceId + '-' + selectedSuggestion : undefined,\n\t\t\t\t\tref: this.inputRef\n\t\t\t\t}),\n\t\t\t\tloading && wp.element.createElement(Spinner, null),\n\t\t\t\tshowSuggestions && !!posts.length && !invalidLink && wp.element.createElement(\n\t\t\t\t\tPopover,\n\t\t\t\t\t{ position: 'bottom', noArrow: true, focusOnMount: false },\n\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t'div',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tclassName: 'editor-url-input__suggestions',\n\t\t\t\t\t\t\tid: 'editor-url-input-suggestions-' + instanceId,\n\t\t\t\t\t\t\tref: this.autocompleteRef,\n\t\t\t\t\t\t\trole: 'listbox'\n\t\t\t\t\t\t},\n\t\t\t\t\t\tposts.map(function (post, index) {\n\t\t\t\t\t\t\treturn wp.element.createElement(\n\t\t\t\t\t\t\t\t'button',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tkey: post.id,\n\t\t\t\t\t\t\t\t\trole: 'option',\n\t\t\t\t\t\t\t\t\ttabIndex: '-1',\n\t\t\t\t\t\t\t\t\tid: 'editor-url-input-suggestion-' + instanceId + '-' + index,\n\t\t\t\t\t\t\t\t\tref: _this5.bindSuggestionNode(index),\n\t\t\t\t\t\t\t\t\tclassName: __WEBPACK_IMPORTED_MODULE_0_classnames___default()('editor-url-input__suggestion', {\n\t\t\t\t\t\t\t\t\t\t'is-selected': index === selectedSuggestion\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\tonClick: function onClick() {\n\t\t\t\t\t\t\t\t\t\treturn _this5.handleOnClick(post);\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t'aria-selected': index === selectedSuggestion\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tpost.title || __('(no title)')\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t})\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t);\n\t\t\t/* eslint-enable jsx-a11y/no-autofocus */\n\t\t}\n\t}]);\n\n\treturn ThirstyURLInput;\n}(Component);\n\n/* harmony default export */ __webpack_exports__[\"a\"] = (withSpokenMessages(withInstanceId(ThirstyURLInput)));\n\n/***/ }),\n/* 15 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = __webpack_require__(16);\n\n/***/ }),\n/* 16 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar util = __webpack_require__(17);\n\nfunction scrollIntoView(elem, container, config) {\n config = config || {};\n // document 归一化到 window\n if (container.nodeType === 9) {\n container = util.getWindow(container);\n }\n\n var allowHorizontalScroll = config.allowHorizontalScroll;\n var onlyScrollIfNeeded = config.onlyScrollIfNeeded;\n var alignWithTop = config.alignWithTop;\n var alignWithLeft = config.alignWithLeft;\n var offsetTop = config.offsetTop || 0;\n var offsetLeft = config.offsetLeft || 0;\n var offsetBottom = config.offsetBottom || 0;\n var offsetRight = config.offsetRight || 0;\n\n allowHorizontalScroll = allowHorizontalScroll === undefined ? true : allowHorizontalScroll;\n\n var isWin = util.isWindow(container);\n var elemOffset = util.offset(elem);\n var eh = util.outerHeight(elem);\n var ew = util.outerWidth(elem);\n var containerOffset = undefined;\n var ch = undefined;\n var cw = undefined;\n var containerScroll = undefined;\n var diffTop = undefined;\n var diffBottom = undefined;\n var win = undefined;\n var winScroll = undefined;\n var ww = undefined;\n var wh = undefined;\n\n if (isWin) {\n win = container;\n wh = util.height(win);\n ww = util.width(win);\n winScroll = {\n left: util.scrollLeft(win),\n top: util.scrollTop(win)\n };\n // elem 相对 container 可视视窗的距离\n diffTop = {\n left: elemOffset.left - winScroll.left - offsetLeft,\n top: elemOffset.top - winScroll.top - offsetTop\n };\n diffBottom = {\n left: elemOffset.left + ew - (winScroll.left + ww) + offsetRight,\n top: elemOffset.top + eh - (winScroll.top + wh) + offsetBottom\n };\n containerScroll = winScroll;\n } else {\n containerOffset = util.offset(container);\n ch = container.clientHeight;\n cw = container.clientWidth;\n containerScroll = {\n left: container.scrollLeft,\n top: container.scrollTop\n };\n // elem 相对 container 可视视窗的距离\n // 注意边框, offset 是边框到根节点\n diffTop = {\n left: elemOffset.left - (containerOffset.left + (parseFloat(util.css(container, 'borderLeftWidth')) || 0)) - offsetLeft,\n top: elemOffset.top - (containerOffset.top + (parseFloat(util.css(container, 'borderTopWidth')) || 0)) - offsetTop\n };\n diffBottom = {\n left: elemOffset.left + ew - (containerOffset.left + cw + (parseFloat(util.css(container, 'borderRightWidth')) || 0)) + offsetRight,\n top: elemOffset.top + eh - (containerOffset.top + ch + (parseFloat(util.css(container, 'borderBottomWidth')) || 0)) + offsetBottom\n };\n }\n\n if (diffTop.top < 0 || diffBottom.top > 0) {\n // 强制向上\n if (alignWithTop === true) {\n util.scrollTop(container, containerScroll.top + diffTop.top);\n } else if (alignWithTop === false) {\n util.scrollTop(container, containerScroll.top + diffBottom.top);\n } else {\n // 自动调整\n if (diffTop.top < 0) {\n util.scrollTop(container, containerScroll.top + diffTop.top);\n } else {\n util.scrollTop(container, containerScroll.top + diffBottom.top);\n }\n }\n } else {\n if (!onlyScrollIfNeeded) {\n alignWithTop = alignWithTop === undefined ? true : !!alignWithTop;\n if (alignWithTop) {\n util.scrollTop(container, containerScroll.top + diffTop.top);\n } else {\n util.scrollTop(container, containerScroll.top + diffBottom.top);\n }\n }\n }\n\n if (allowHorizontalScroll) {\n if (diffTop.left < 0 || diffBottom.left > 0) {\n // 强制向上\n if (alignWithLeft === true) {\n util.scrollLeft(container, containerScroll.left + diffTop.left);\n } else if (alignWithLeft === false) {\n util.scrollLeft(container, containerScroll.left + diffBottom.left);\n } else {\n // 自动调整\n if (diffTop.left < 0) {\n util.scrollLeft(container, containerScroll.left + diffTop.left);\n } else {\n util.scrollLeft(container, containerScroll.left + diffBottom.left);\n }\n }\n } else {\n if (!onlyScrollIfNeeded) {\n alignWithLeft = alignWithLeft === undefined ? true : !!alignWithLeft;\n if (alignWithLeft) {\n util.scrollLeft(container, containerScroll.left + diffTop.left);\n } else {\n util.scrollLeft(container, containerScroll.left + diffBottom.left);\n }\n }\n }\n }\n}\n\nmodule.exports = scrollIntoView;\n\n/***/ }),\n/* 17 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol ? \"symbol\" : typeof obj; };\n\nvar RE_NUM = /[\\-+]?(?:\\d*\\.|)\\d+(?:[eE][\\-+]?\\d+|)/.source;\n\nfunction getClientPosition(elem) {\n var box = undefined;\n var x = undefined;\n var y = undefined;\n var doc = elem.ownerDocument;\n var body = doc.body;\n var docElem = doc && doc.documentElement;\n // 根据 GBS 最新数据,A-Grade Browsers 都已支持 getBoundingClientRect 方法,不用再考虑传统的实现方式\n box = elem.getBoundingClientRect();\n\n // 注:jQuery 还考虑减去 docElem.clientLeft/clientTop\n // 但测试发现,这样反而会导致当 html 和 body 有边距/边框样式时,获取的值不正确\n // 此外,ie6 会忽略 html 的 margin 值,幸运地是没有谁会去设置 html 的 margin\n\n x = box.left;\n y = box.top;\n\n // In IE, most of the time, 2 extra pixels are added to the top and left\n // due to the implicit 2-pixel inset border. In IE6/7 quirks mode and\n // IE6 standards mode, this border can be overridden by setting the\n // document element's border to zero -- thus, we cannot rely on the\n // offset always being 2 pixels.\n\n // In quirks mode, the offset can be determined by querying the body's\n // clientLeft/clientTop, but in standards mode, it is found by querying\n // the document element's clientLeft/clientTop. Since we already called\n // getClientBoundingRect we have already forced a reflow, so it is not\n // too expensive just to query them all.\n\n // ie 下应该减去窗口的边框吧,毕竟默认 absolute 都是相对窗口定位的\n // 窗口边框标准是设 documentElement ,quirks 时设置 body\n // 最好禁止在 body 和 html 上边框 ,但 ie < 9 html 默认有 2px ,减去\n // 但是非 ie 不可能设置窗口边框,body html 也不是窗口 ,ie 可以通过 html,body 设置\n // 标准 ie 下 docElem.clientTop 就是 border-top\n // ie7 html 即窗口边框改变不了。永远为 2\n // 但标准 firefox/chrome/ie9 下 docElem.clientTop 是窗口边框,即使设了 border-top 也为 0\n\n x -= docElem.clientLeft || body.clientLeft || 0;\n y -= docElem.clientTop || body.clientTop || 0;\n\n return {\n left: x,\n top: y\n };\n}\n\nfunction getScroll(w, top) {\n var ret = w['page' + (top ? 'Y' : 'X') + 'Offset'];\n var method = 'scroll' + (top ? 'Top' : 'Left');\n if (typeof ret !== 'number') {\n var d = w.document;\n // ie6,7,8 standard mode\n ret = d.documentElement[method];\n if (typeof ret !== 'number') {\n // quirks mode\n ret = d.body[method];\n }\n }\n return ret;\n}\n\nfunction getScrollLeft(w) {\n return getScroll(w);\n}\n\nfunction getScrollTop(w) {\n return getScroll(w, true);\n}\n\nfunction getOffset(el) {\n var pos = getClientPosition(el);\n var doc = el.ownerDocument;\n var w = doc.defaultView || doc.parentWindow;\n pos.left += getScrollLeft(w);\n pos.top += getScrollTop(w);\n return pos;\n}\nfunction _getComputedStyle(elem, name, computedStyle_) {\n var val = '';\n var d = elem.ownerDocument;\n var computedStyle = computedStyle_ || d.defaultView.getComputedStyle(elem, null);\n\n // https://github.com/kissyteam/kissy/issues/61\n if (computedStyle) {\n val = computedStyle.getPropertyValue(name) || computedStyle[name];\n }\n\n return val;\n}\n\nvar _RE_NUM_NO_PX = new RegExp('^(' + RE_NUM + ')(?!px)[a-z%]+#x27;, 'i');\nvar RE_POS = /^(top|right|bottom|left)#x2F;;\nvar CURRENT_STYLE = 'currentStyle';\nvar RUNTIME_STYLE = 'runtimeStyle';\nvar LEFT = 'left';\nvar PX = 'px';\n\nfunction _getComputedStyleIE(elem, name) {\n // currentStyle maybe null\n // http://msdn.microsoft.com/en-us/library/ms535231.aspx\n var ret = elem[CURRENT_STYLE] && elem[CURRENT_STYLE][name];\n\n // 当 width/height 设置为百分比时,通过 pixelLeft 方式转换的 width/height 值\n // 一开始就处理了! CUSTOM_STYLE.height,CUSTOM_STYLE.width ,cssHook 解决@2011-08-19\n // 在 ie 下不对,需要直接用 offset 方式\n // borderWidth 等值也有问题,但考虑到 borderWidth 设为百分比的概率很小,这里就不考虑了\n\n // From the awesome hack by Dean Edwards\n // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291\n // If we're not dealing with a regular pixel number\n // but a number that has a weird ending, we need to convert it to pixels\n // exclude left right for relativity\n if (_RE_NUM_NO_PX.test(ret) && !RE_POS.test(name)) {\n // Remember the original values\n var style = elem.style;\n var left = style[LEFT];\n var rsLeft = elem[RUNTIME_STYLE][LEFT];\n\n // prevent flashing of content\n elem[RUNTIME_STYLE][LEFT] = elem[CURRENT_STYLE][LEFT];\n\n // Put in the new values to get a computed value out\n style[LEFT] = name === 'fontSize' ? '1em' : ret || 0;\n ret = style.pixelLeft + PX;\n\n // Revert the changed values\n style[LEFT] = left;\n\n elem[RUNTIME_STYLE][LEFT] = rsLeft;\n }\n return ret === '' ? 'auto' : ret;\n}\n\nvar getComputedStyleX = undefined;\nif (typeof window !== 'undefined') {\n getComputedStyleX = window.getComputedStyle ? _getComputedStyle : _getComputedStyleIE;\n}\n\nfunction each(arr, fn) {\n for (var i = 0; i < arr.length; i++) {\n fn(arr[i]);\n }\n}\n\nfunction isBorderBoxFn(elem) {\n return getComputedStyleX(elem, 'boxSizing') === 'border-box';\n}\n\nvar BOX_MODELS = ['margin', 'border', 'padding'];\nvar CONTENT_INDEX = -1;\nvar PADDING_INDEX = 2;\nvar BORDER_INDEX = 1;\nvar MARGIN_INDEX = 0;\n\nfunction swap(elem, options, callback) {\n var old = {};\n var style = elem.style;\n var name = undefined;\n\n // Remember the old values, and insert the new ones\n for (name in options) {\n if (options.hasOwnProperty(name)) {\n old[name] = style[name];\n style[name] = options[name];\n }\n }\n\n callback.call(elem);\n\n // Revert the old values\n for (name in options) {\n if (options.hasOwnProperty(name)) {\n style[name] = old[name];\n }\n }\n}\n\nfunction getPBMWidth(elem, props, which) {\n var value = 0;\n var prop = undefined;\n var j = undefined;\n var i = undefined;\n for (j = 0; j < props.length; j++) {\n prop = props[j];\n if (prop) {\n for (i = 0; i < which.length; i++) {\n var cssProp = undefined;\n if (prop === 'border') {\n cssProp = prop + which[i] + 'Width';\n } else {\n cssProp = prop + which[i];\n }\n value += parseFloat(getComputedStyleX(elem, cssProp)) || 0;\n }\n }\n }\n return value;\n}\n\n/**\n * A crude way of determining if an object is a window\n * @member util\n */\nfunction isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj != null && obj == obj.window;\n}\n\nvar domUtils = {};\n\neach(['Width', 'Height'], function (name) {\n domUtils['doc' + name] = function (refWin) {\n var d = refWin.document;\n return Math.max(\n // firefox chrome documentElement.scrollHeight< body.scrollHeight\n // ie standard mode : documentElement.scrollHeight> body.scrollHeight\n d.documentElement['scroll' + name],\n // quirks : documentElement.scrollHeight 最大等于可视窗口多一点?\n d.body['scroll' + name], domUtils['viewport' + name](d));\n };\n\n domUtils['viewport' + name] = function (win) {\n // pc browser includes scrollbar in window.innerWidth\n var prop = 'client' + name;\n var doc = win.document;\n var body = doc.body;\n var documentElement = doc.documentElement;\n var documentElementProp = documentElement[prop];\n // 标准模式取 documentElement\n // backcompat 取 body\n return doc.compatMode === 'CSS1Compat' && documentElementProp || body && body[prop] || documentElementProp;\n };\n});\n\n/*\n 得到元素的大小信息\n @param elem\n @param name\n @param {String} [extra] 'padding' : (css width) + padding\n 'border' : (css width) + padding + border\n 'margin' : (css width) + padding + border + margin\n */\nfunction getWH(elem, name, extra) {\n if (isWindow(elem)) {\n return name === 'width' ? domUtils.viewportWidth(elem) : domUtils.viewportHeight(elem);\n } else if (elem.nodeType === 9) {\n return name === 'width' ? domUtils.docWidth(elem) : domUtils.docHeight(elem);\n }\n var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];\n var borderBoxValue = name === 'width' ? elem.offsetWidth : elem.offsetHeight;\n var computedStyle = getComputedStyleX(elem);\n var isBorderBox = isBorderBoxFn(elem, computedStyle);\n var cssBoxValue = 0;\n if (borderBoxValue == null || borderBoxValue <= 0) {\n borderBoxValue = undefined;\n // Fall back to computed then un computed css if necessary\n cssBoxValue = getComputedStyleX(elem, name);\n if (cssBoxValue == null || Number(cssBoxValue) < 0) {\n cssBoxValue = elem.style[name] || 0;\n }\n // Normalize '', auto, and prepare for extra\n cssBoxValue = parseFloat(cssBoxValue) || 0;\n }\n if (extra === undefined) {\n extra = isBorderBox ? BORDER_INDEX : CONTENT_INDEX;\n }\n var borderBoxValueOrIsBorderBox = borderBoxValue !== undefined || isBorderBox;\n var val = borderBoxValue || cssBoxValue;\n if (extra === CONTENT_INDEX) {\n if (borderBoxValueOrIsBorderBox) {\n return val - getPBMWidth(elem, ['border', 'padding'], which, computedStyle);\n }\n return cssBoxValue;\n }\n if (borderBoxValueOrIsBorderBox) {\n var padding = extra === PADDING_INDEX ? -getPBMWidth(elem, ['border'], which, computedStyle) : getPBMWidth(elem, ['margin'], which, computedStyle);\n return val + (extra === BORDER_INDEX ? 0 : padding);\n }\n return cssBoxValue + getPBMWidth(elem, BOX_MODELS.slice(extra), which, computedStyle);\n}\n\nvar cssShow = {\n position: 'absolute',\n visibility: 'hidden',\n display: 'block'\n};\n\n// fix #119 : https://github.com/kissyteam/kissy/issues/119\nfunction getWHIgnoreDisplay(elem) {\n var val = undefined;\n var args = arguments;\n // in case elem is window\n // elem.offsetWidth === undefined\n if (elem.offsetWidth !== 0) {\n val = getWH.apply(undefined, args);\n } else {\n swap(elem, cssShow, function () {\n val = getWH.apply(undefined, args);\n });\n }\n return val;\n}\n\nfunction css(el, name, v) {\n var value = v;\n if ((typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') {\n for (var i in name) {\n if (name.hasOwnProperty(i)) {\n css(el, i, name[i]);\n }\n }\n return undefined;\n }\n if (typeof value !== 'undefined') {\n if (typeof value === 'number') {\n value += 'px';\n }\n el.style[name] = value;\n return undefined;\n }\n return getComputedStyleX(el, name);\n}\n\neach(['width', 'height'], function (name) {\n var first = name.charAt(0).toUpperCase() + name.slice(1);\n domUtils['outer' + first] = function (el, includeMargin) {\n return el && getWHIgnoreDisplay(el, name, includeMargin ? MARGIN_INDEX : BORDER_INDEX);\n };\n var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];\n\n domUtils[name] = function (elem, val) {\n if (val !== undefined) {\n if (elem) {\n var computedStyle = getComputedStyleX(elem);\n var isBorderBox = isBorderBoxFn(elem);\n if (isBorderBox) {\n val += getPBMWidth(elem, ['padding', 'border'], which, computedStyle);\n }\n return css(elem, name, val);\n }\n return undefined;\n }\n return elem && getWHIgnoreDisplay(elem, name, CONTENT_INDEX);\n };\n});\n\n// 设置 elem 相对 elem.ownerDocument 的坐标\nfunction setOffset(elem, offset) {\n // set position first, in-case top/left are set even on static elem\n if (css(elem, 'position') === 'static') {\n elem.style.position = 'relative';\n }\n\n var old = getOffset(elem);\n var ret = {};\n var current = undefined;\n var key = undefined;\n\n for (key in offset) {\n if (offset.hasOwnProperty(key)) {\n current = parseFloat(css(elem, key)) || 0;\n ret[key] = current + offset[key] - old[key];\n }\n }\n css(elem, ret);\n}\n\nmodule.exports = _extends({\n getWindow: function getWindow(node) {\n var doc = node.ownerDocument || node;\n return doc.defaultView || doc.parentWindow;\n },\n offset: function offset(el, value) {\n if (typeof value !== 'undefined') {\n setOffset(el, value);\n } else {\n return getOffset(el);\n }\n },\n\n isWindow: isWindow,\n each: each,\n css: css,\n clone: function clone(obj) {\n var ret = {};\n for (var i in obj) {\n if (obj.hasOwnProperty(i)) {\n ret[i] = obj[i];\n }\n }\n var overflow = obj.overflow;\n if (overflow) {\n for (var i in obj) {\n if (obj.hasOwnProperty(i)) {\n ret.overflow[i] = obj.overflow[i];\n }\n }\n }\n return ret;\n },\n scrollLeft: function scrollLeft(w, v) {\n if (isWindow(w)) {\n if (v === undefined) {\n return getScrollLeft(w);\n }\n window.scrollTo(v, getScrollTop(w));\n } else {\n if (v === undefined) {\n return w.scrollLeft;\n }\n w.scrollLeft = v;\n }\n },\n scrollTop: function scrollTop(w, v) {\n if (isWindow(w)) {\n if (v === undefined) {\n return getScrollTop(w);\n }\n window.scrollTo(getScrollLeft(w), v);\n } else {\n if (v === undefined) {\n return w.scrollTop;\n }\n w.scrollTop = v;\n }\n },\n\n viewportWidth: 0,\n viewportHeight: 0\n}, domUtils);\n\n/***/ }),\n/* 18 */\n/***/ (function(module, exports) {\n\n// removed by extract-text-webpack-plugin\n\n/***/ })\n/******/ ]);\n\n\n// WEBPACK FOOTER //\n// gutenberg-support.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap c9935c87e3e022ad59ba","/*!\n Copyright (c) 2017 Jed Watson.\n Licensed under the MIT License (MIT), see\n http://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = [];\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (!arg) continue;\n\n\t\t\tvar argType = typeof arg;\n\n\t\t\tif (argType === 'string' || argType === 'number') {\n\t\t\t\tclasses.push(arg);\n\t\t\t} else if (Array.isArray(arg) && arg.length) {\n\t\t\t\tvar inner = classNames.apply(null, arg);\n\t\t\t\tif (inner) {\n\t\t\t\t\tclasses.push(inner);\n\t\t\t\t}\n\t\t\t} else if (argType === 'object') {\n\t\t\t\tfor (var key in arg) {\n\t\t\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\t\t\tclasses.push(key);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn classes.join(' ');\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/classnames/index.js\n// module id = 0\n// module chunks = 0","import registerBlocks from \"./blocks\";\r\nimport registerFormats from \"./formats\";\r\n\r\nimport \"./assets/styles/index.scss\";\r\n\r\nregisterBlocks();\r\nregisterFormats();\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/index.js","import * as taimage from \"./ta-image\";\r\n\r\nconst { registerBlockType } = wp.blocks;\r\n\r\n/**\r\n * Register gutenberg blocks.\r\n * \r\n * @since 3.6\r\n */\r\nexport default function registerBlocks() {\r\n\r\n [\r\n taimage\r\n ].forEach( ( block ) => {\r\n if ( ! block ) return;\r\n\r\n const { name , settings } = block;\r\n registerBlockType( name , settings );\r\n } );\r\n}\n\n\n// WEBPACK FOOTER //\n// ./src/blocks/index.js","import classnames from \"classnames\";\r\n\r\nconst { Fragment } = wp.element;\r\nconst { __ } = wp.i18n;\r\nconst { createBlock, getBlockAttributes, getPhrasingContentSchema } = wp.blocks;\r\nconst { RichText } = wp.editor;\r\nconst { Path , SVG } = wp.components;\r\n\r\nimport edit from \"./edit\";\r\n\r\nexport const name = 'ta/image';\r\n\r\nconst blockAttributes = {\r\n\turl: {\r\n\t\ttype: 'string',\r\n\t\tsource: 'attribute',\r\n\t\tselector: 'img',\r\n\t\tattribute: 'src',\r\n\t},\r\n\talt: {\r\n\t\ttype: 'string',\r\n\t\tsource: 'attribute',\r\n\t\tselector: 'img',\r\n\t\tattribute: 'alt',\r\n\t\tdefault: '',\r\n\t},\r\n\tcaption: {\r\n\t\ttype: 'string',\r\n\t\tsource: 'html',\r\n\t\tselector: 'figcaption',\r\n\t},\r\n\tid: {\r\n\t\ttype: 'number',\r\n\t},\r\n\talign: {\r\n\t\ttype: 'string',\r\n\t},\r\n\twidth: {\r\n\t\ttype: 'number',\r\n\t},\r\n\theight: {\r\n\t\ttype: 'number',\r\n\t},\r\n\tlinkid: {\r\n\t\ttype: 'number',\r\n\t},\r\n\thref: {\r\n\t\ttype: 'string',\r\n\t\tsource: 'attribute',\r\n\t\tselector: 'ta',\r\n\t\tattribute: 'href'\r\n\t},\r\n\taffiliateLink: {\r\n\t\ttype: 'object'\r\n\t}\r\n};\r\n\r\nconst imageSchema = {\r\n\timg: {\r\n\t\tattributes: [ 'src', 'alt' ],\r\n\t\tclasses: [ 'alignleft', 'aligncenter', 'alignright', 'alignnone', /^wp-image-\\d+#x2F; ],\r\n\t},\r\n};\r\n\r\nconst schema = {\r\n\tfigure: {\r\n\t\trequire: [ 'ta' , 'img' ],\r\n\t\tchildren: {\r\n\t\t\tta: {\r\n\t\t\t\tattributes: [ 'href', 'linkid' ],\r\n\t\t\t\tchildren: imageSchema,\r\n\t\t\t},\r\n\t\t\tfigcaption: {\r\n\t\t\t\tchildren: getPhrasingContentSchema(),\r\n\t\t\t},\r\n\t\t},\r\n\t},\r\n};\r\n\r\nfunction getFirstAnchorAttributeFormHTML( html, attributeName ) {\r\n\tconst { body } = document.implementation.createHTMLDocument( '' );\r\n\r\n\tbody.innerHTML = html;\r\n\r\n\tconst { firstElementChild } = body;\r\n\r\n\tif (\r\n\t\tfirstElementChild &&\r\n\t\tfirstElementChild.nodeName === 'A'\r\n\t) {\r\n\t\treturn firstElementChild.getAttribute( attributeName ) || undefined;\r\n\t}\r\n}\r\n\r\nexport const settings = {\r\n\ttitle: __( 'ThirstyAffiliates Image' ),\r\n\r\n\tdescription: __( 'Insert an image with an affiliate link to make a visual statement.' ),\r\n\r\n\ticon: <SVG viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\"><Path d=\"M0,0h24v24H0V0z\" fill=\"none\" /><Path d=\"m19 5v14h-14v-14h14m0-2h-14c-1.1 0-2 0.9-2 2v14c0 1.1 0.9 2 2 2h14c1.1 0 2-0.9 2-2v-14c0-1.1-0.9-2-2-2z\" /><Path d=\"m14.14 11.86l-3 3.87-2.14-2.59-3 3.86h12l-3.86-5.14z\" /></SVG>,\r\n\r\n\tcategory: 'common',\r\n\r\n\tkeywords: [\r\n\t\t'img', // \"img\" is not translated as it is intended to reflect the HTML <img> tag.\r\n\t\t__( 'photo' ),\r\n\t\t__( 'affiliate' )\r\n\t],\r\n\r\n\tattributes: blockAttributes,\r\n\r\n\ttransforms: {\r\n\t\tfrom: [\r\n\t\t\t{\r\n\t\t\t\ttype: 'raw',\r\n\t\t\t\tisMatch: ( node ) => node.nodeName === 'FIGURE' && !! node.querySelector( 'img' ),\r\n\t\t\t\tschema,\r\n\t\t\t\ttransform: ( node ) => {\r\n\r\n\t\t\t\t\t// Search both figure and image classes. Alignment could be\r\n\t\t\t\t\t// set on either. ID is set on the image.\r\n\t\t\t\t\tconst className = node.className + ' ' + node.querySelector( 'img' ).className;\r\n\t\t\t\t\tconst alignMatches = /(?:^|\\s)align(left|center|right)(?:$|\\s)/.exec( className );\r\n\t\t\t\t\tconst align = alignMatches ? alignMatches[ 1 ] : undefined;\r\n\t\t\t\t\tconst idMatches = /(?:^|\\s)wp-image-(\\d+)(?:$|\\s)/.exec( className );\r\n\t\t\t\t\tconst id = idMatches ? Number( idMatches[ 1 ] ) : undefined;\r\n\t\t\t\t\tconst anchorElement = node.querySelector( 'a' );\r\n\t\t\t\t\tconst linkDestination = anchorElement && anchorElement.href ? 'custom' : undefined;\r\n\t\t\t\t\tconst linkid = anchorElement && anchorElement.linkid ? anchorElement.linkid : undefined;\r\n\t\t\t\t\tconst href = anchorElement && anchorElement.href ? anchorElement.href : undefined;\r\n\t\t\t\t\tconst rel = anchorElement && anchorElement.rel ? anchorElement.rel : undefined;\r\n\t\t\t\t\tconst linkClass = anchorElement && anchorElement.className ? anchorElement.className : undefined;\r\n\t\t\t\t\tconst attributes = getBlockAttributes( 'ta/image', node.outerHTML, { align, id, linkDestination, linkid , href, rel, linkClass } );\r\n\t\t\t\t\treturn createBlock( 'ta/image', attributes );\r\n\t\t\t\t},\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\ttype: 'files',\r\n\t\t\t\tisMatch( files ) {\r\n\t\t\t\t\treturn files.length === 1 && files[ 0 ].type.indexOf( 'image/' ) === 0;\r\n\t\t\t\t},\r\n\t\t\t\ttransform( files ) {\r\n\t\t\t\t\tconst file = files[ 0 ];\r\n\t\t\t\t\t// We don't need to upload the media directly here\r\n\t\t\t\t\t// It's already done as part of the `componentDidMount`\r\n\t\t\t\t\t// int the image block\r\n\t\t\t\t\tconst block = createBlock( 'ta/image', {\r\n\t\t\t\t\t\turl: createBlobURL( file ),\r\n\t\t\t\t\t} );\r\n\r\n\t\t\t\t\treturn block;\r\n\t\t\t\t},\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\ttype: 'shortcode',\r\n\t\t\t\ttag: 'caption',\r\n\t\t\t\tattributes: {\r\n\t\t\t\t\turl: {\r\n\t\t\t\t\t\ttype: 'string',\r\n\t\t\t\t\t\tsource: 'attribute',\r\n\t\t\t\t\t\tattribute: 'src',\r\n\t\t\t\t\t\tselector: 'img',\r\n\t\t\t\t\t},\r\n\t\t\t\t\talt: {\r\n\t\t\t\t\t\ttype: 'string',\r\n\t\t\t\t\t\tsource: 'attribute',\r\n\t\t\t\t\t\tattribute: 'alt',\r\n\t\t\t\t\t\tselector: 'img',\r\n\t\t\t\t\t},\r\n\t\t\t\t\tcaption: {\r\n\t\t\t\t\t\tshortcode: ( attributes, { shortcode } ) => {\r\n\t\t\t\t\t\t\tconst { body } = document.implementation.createHTMLDocument( '' );\r\n\r\n\t\t\t\t\t\t\tbody.innerHTML = shortcode.content;\r\n\t\t\t\t\t\t\tbody.removeChild( body.firstElementChild );\r\n\r\n\t\t\t\t\t\t\treturn body.innerHTML.trim();\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t},\r\n\t\t\t\t\tid: {\r\n\t\t\t\t\t\ttype: 'number',\r\n\t\t\t\t\t\tshortcode: ( { named: { id } } ) => {\r\n\t\t\t\t\t\t\tif ( ! id ) {\r\n\t\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\treturn parseInt( id.replace( 'attachment_', '' ), 10 );\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t},\r\n\t\t\t\t\talign: {\r\n\t\t\t\t\t\ttype: 'string',\r\n\t\t\t\t\t\tshortcode: ( { named: { align = 'alignnone' } } ) => {\r\n\t\t\t\t\t\t\treturn align.replace( 'align', '' );\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t},\r\n\t\t\t\t\tlinkid: {\r\n\t\t\t\t\t\ttype: 'string',\r\n\t\t\t\t\t\tsource: 'attribute',\r\n\t\t\t\t\t\tselector: 'wp-block-ta-image > ta',\r\n\t\t\t\t\t\tattribute: 'linkid'\r\n\t\t\t\t\t},\r\n\t\t\t\t\thref: {\r\n\t\t\t\t\t\ttype: 'string',\r\n\t\t\t\t\t\tsource: 'attribute',\r\n\t\t\t\t\t\tselector: 'ta',\r\n\t\t\t\t\t\tattribute: 'href'\r\n\t\t\t\t\t},\r\n\t\t\t\t},\r\n\t\t\t},\r\n\t\t],\r\n\t},\r\n\r\n\tgetEditWrapperProps( attributes ) {\r\n\t\tconst { align, width } = attributes;\r\n\t\tif ( 'left' === align || 'center' === align || 'right' === align || 'wide' === align || 'full' === align ) {\r\n\t\t\treturn { 'data-align': align, 'data-resized': !! width };\r\n\t\t}\r\n\t},\r\n\r\n\tedit,\r\n\r\n\tsave( { attributes } ) {\r\n\t\tconst {\r\n\t\t\turl,\r\n\t\t\talt,\r\n\t\t\tcaption,\r\n\t\t\talign,\r\n\t\t\twidth,\r\n\t\t\theight,\r\n\t\t\tid,\r\n\t\t\tlinkid,\r\n\t\t\thref\r\n\t\t} = attributes;\r\n\r\n\t\tconst classes = classnames( {\r\n\t\t\t[ `align${ align }` ]: align,\r\n\t\t\t'is-resized': width || height,\r\n\t\t} );\r\n\r\n\t\tconst image = (\r\n\t\t\t<img\r\n\t\t\t\tsrc={ url }\r\n\t\t\t\talt={ alt }\r\n\t\t\t\tclassName={ id ? `wp-image-${ id }` : null }\r\n\t\t\t\twidth={ width }\r\n\t\t\t\theight={ height }\r\n\t\t\t/>\r\n\t\t);\r\n\r\n\t\tconst figure = (\r\n\t\t\t<Fragment>\r\n\t\t\t\t<ta linkid={ linkid } href={ href }>\r\n\t\t\t\t{ image }\r\n\t\t\t\t</ta>\r\n\t\t\t\t<RichText.Content tagName=\"figcaption\" value={ caption } />\r\n\t\t\t</Fragment>\r\n\t\t);\r\n\r\n\t\tif ( 'left' === align || 'right' === align || 'center' === align ) {\r\n\t\t\treturn (\r\n\t\t\t\t<div className='wp-block-image'>\r\n\t\t\t\t\t<figure className={ classes }>\r\n\t\t\t\t\t\t{ figure }\r\n\t\t\t\t\t</figure>\r\n\t\t\t\t</div>\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\treturn (\r\n\t\t\t<figure className={ `wp-block-image ${classes}` }>\r\n\t\t\t\t{ figure }\r\n\t\t\t</figure>\r\n\t\t);\r\n\t}\r\n};\n\n\n// WEBPACK FOOTER //\n// ./src/blocks/ta-image/index.js","import classnames from \"classnames\";\r\n\r\nconst { get , isEmpty , map , last , pick , compact } = lodash;\r\nconst { getPath } = wp.url;\r\nconst { __, sprintf } = wp.i18n;\r\nconst { Component, Fragment , createRef } = wp.element;\r\nconst { getBlobByURL, revokeBlobURL, isBlobURL } = wp.blob;\r\nconst { Placeholder , Button , ButtonGroup , IconButton , PanelBody , ResizableBox , SelectControl , Spinner , TextControl , TextareaControl , Toolbar , withNotices , ToggleControl , Popover } = wp.components;\r\nconst { withSelect } = wp.data;\r\nconst { RichText , BlockControls , InspectorControls , MediaUpload , MediaUploadCheck , MediaPlaceholder , BlockAlignmentToolbar , mediaUpload } = wp.editor;\r\nconst { withViewportMatch } = wp.viewport;\r\nconst { compose } = wp.compose;\r\n\r\nimport { createUpgradedEmbedBlock } from \"./util\";\r\nimport ImageSize from \"./image-size\";\r\nimport ThirstyURLInput from './search-input';\r\n\r\n/**\r\n * Module constants\r\n */\r\nconst MIN_SIZE = 20;\r\nconst LINK_DESTINATION_NONE = 'none';\r\nconst LINK_DESTINATION_MEDIA = 'media';\r\nconst LINK_DESTINATION_ATTACHMENT = 'attachment';\r\nconst LINK_DESTINATION_CUSTOM = 'custom';\r\nconst NEW_TAB_REL = 'noreferrer noopener';\r\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\r\n\r\nexport const pickRelevantMediaFiles = ( image ) => {\r\n\tconst imageProps = pick( image, [ 'alt', 'id', 'link', 'caption' ] );\r\n\timageProps.url = get( image, [ 'sizes', 'large', 'url' ] ) || get( image, [ 'media_details', 'sizes', 'large', 'source_url' ] ) || image.url;\r\n\treturn imageProps;\r\n};\r\n\r\n/**\r\n * Is the URL a temporary blob URL? A blob URL is one that is used temporarily\r\n * while the image is being uploaded and will not have an id yet allocated.\r\n *\r\n * @param {number=} id The id of the image.\r\n * @param {string=} url The url of the image.\r\n *\r\n * @return {boolean} Is the URL a Blob URL\r\n */\r\nconst isTemporaryImage = ( id, url ) => ! id && isBlobURL( url );\r\n\r\n/**\r\n * Is the url for the image hosted externally. An externally hosted image has no id\r\n * and is not a blob url.\r\n *\r\n * @param {number=} id The id of the image.\r\n * @param {string=} url The url of the image.\r\n *\r\n * @return {boolean} Is the url an externally hosted url?\r\n */\r\nconst isExternalImage = ( id, url ) => url && ! id && ! isBlobURL( url );\r\n\r\nclass ImageEdit extends Component {\r\n\tconstructor( { attributes } ) {\r\n\t\tsuper( ...arguments );\r\n\t\tthis.updateAlt = this.updateAlt.bind( this );\r\n\t\tthis.updateAlignment = this.updateAlignment.bind( this );\r\n\t\tthis.onFocusCaption = this.onFocusCaption.bind( this );\r\n\t\tthis.onImageClick = this.onImageClick.bind( this );\r\n\t\tthis.onSelectImage = this.onSelectImage.bind( this );\r\n\t\tthis.updateImageURL = this.updateImageURL.bind( this );\r\n\t\tthis.updateWidth = this.updateWidth.bind( this );\r\n\t\tthis.updateHeight = this.updateHeight.bind( this );\r\n\t\tthis.updateDimensions = this.updateDimensions.bind( this );\r\n\t\tthis.getFilename = this.getFilename.bind( this );\r\n\t\tthis.toggleIsEditing = this.toggleIsEditing.bind( this );\r\n\t\tthis.onImageError = this.onImageError.bind( this );\r\n\t\tthis.onChangeInputValue = this.onChangeInputValue.bind( this );\r\n\t\tthis.autocompleteRef = createRef();\r\n\t\tthis.resetInvalidLink = this.resetInvalidLink.bind( this );\r\n\t\tthis.updateImageSelection = this.updateImageSelection.bind( this );\r\n\t\tthis.onSelectAffiliateImage = this.onSelectAffiliateImage.bind( this );\r\n\t\tthis.editAFfiliateImage = this.editAFfiliateImage.bind( this );\r\n\r\n\t\tthis.state = {\r\n\t\t\tcaptionFocused: false,\r\n\t\t\tisEditing: ! attributes.url,\r\n\t\t\tinputValue : '',\r\n\t\t\tlinkid : 0,\r\n\t\t\tpost : null,\r\n\t\t\tshowSuggestions : false,\r\n\t\t\timageSelection : [],\r\n\t\t\taffiliateLink : null\r\n\t\t};\r\n\t}\r\n\r\n\tcomponentDidMount() {\r\n\t\tconst { attributes, setAttributes, noticeOperations } = this.props;\r\n\t\tconst { id, url = '' } = attributes;\r\n\r\n\t\tif ( isTemporaryImage( id, url ) ) {\r\n\t\t\tconst file = getBlobByURL( url );\r\n\r\n\t\t\tif ( file ) {\r\n\t\t\t\tmediaUpload( {\r\n\t\t\t\t\tfilesList: [ file ],\r\n\t\t\t\t\tonFileChange: ( [ image ] ) => {\r\n\t\t\t\t\t\tsetAttributes( pickRelevantMediaFiles( image ) );\r\n\t\t\t\t\t},\r\n\t\t\t\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\r\n\t\t\t\t\tonError: ( message ) => {\r\n\t\t\t\t\t\tnoticeOperations.createErrorNotice( message );\r\n\t\t\t\t\t\tthis.setState( { isEditing: true } );\r\n\t\t\t\t\t},\r\n\t\t\t\t} );\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tcomponentDidUpdate( prevProps ) {\r\n\t\tconst { id: prevID, url: prevURL = '' } = prevProps.attributes;\r\n\t\tconst { id, url = '' } = this.props.attributes;\r\n\r\n\t\tif ( isTemporaryImage( prevID, prevURL ) && ! isTemporaryImage( id, url ) ) {\r\n\t\t\trevokeBlobURL( url );\r\n\t\t}\r\n\r\n\t\tif ( ! this.props.isSelected && prevProps.isSelected && this.state.captionFocused ) {\r\n\t\t\tthis.setState( {\r\n\t\t\t\tcaptionFocused: false,\r\n\t\t\t} );\r\n\t\t}\r\n\t}\r\n\r\n\tonSelectImage( media ) {\r\n\r\n\t\tif ( ! media || ! media.url ) {\r\n\t\t\tthis.props.setAttributes( {\r\n\t\t\t\turl: undefined,\r\n\t\t\t\talt: undefined,\r\n\t\t\t\tid: undefined,\r\n\t\t\t\tcaption: undefined\r\n\t\t\t} );\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tconst { affiliateLink } = this.state;\r\n\r\n\t\tthis.setState( {\r\n\t\t\tisEditing: false,\r\n\t\t} );\r\n\r\n\t\tthis.props.setAttributes( {\r\n\t\t\t...pickRelevantMediaFiles( media ),\r\n\t\t\tlinkid: affiliateLink.id,\r\n\t\t\thref: affiliateLink.link,\r\n\t\t\taffiliateLink : affiliateLink,\r\n\t\t\twidth: undefined,\r\n\t\t\theight: undefined,\r\n\t\t} );\r\n\t}\r\n\r\n\tonImageError( url ) {\r\n\t\t// Check if there's an embed block that handles this URL.\r\n\t\tconst embedBlock = createUpgradedEmbedBlock(\r\n\t\t\t{ attributes: { url } }\r\n\t\t);\r\n\t\tif ( undefined !== embedBlock ) {\r\n\t\t\tthis.props.onReplace( embedBlock );\r\n\t\t}\r\n\t}\r\n\r\n\tonFocusCaption() {\r\n\t\tif ( ! this.state.captionFocused ) {\r\n\t\t\tthis.setState( {\r\n\t\t\t\tcaptionFocused: true,\r\n\t\t\t} );\r\n\t\t}\r\n\t}\r\n\r\n\tonImageClick() {\r\n\t\tif ( this.state.captionFocused ) {\r\n\t\t\tthis.setState( {\r\n\t\t\t\tcaptionFocused: false,\r\n\t\t\t} );\r\n\t\t}\r\n\t}\r\n\r\n\tupdateAlt( newAlt ) {\r\n\t\tthis.props.setAttributes( { alt: newAlt } );\r\n\t}\r\n\r\n\tupdateAlignment( nextAlign ) {\r\n\t\tconst extraUpdatedAttributes = [ 'wide', 'full' ].indexOf( nextAlign ) !== -1 ?\r\n\t\t\t{ width: undefined, height: undefined } :\r\n\t\t\t{};\r\n\t\tthis.props.setAttributes( { ...extraUpdatedAttributes, align: nextAlign } );\r\n\t}\r\n\r\n\tupdateImageURL( url ) {\r\n\t\tthis.props.setAttributes( { url, width: undefined, height: undefined } );\r\n\t}\r\n\r\n\tupdateWidth( width ) {\r\n\t\tthis.props.setAttributes( { width: parseInt( width, 10 ) } );\r\n\t}\r\n\r\n\tupdateHeight( height ) {\r\n\t\tthis.props.setAttributes( { height: parseInt( height, 10 ) } );\r\n\t}\r\n\r\n\tupdateDimensions( width = undefined, height = undefined ) {\r\n\t\treturn () => {\r\n\t\t\tthis.props.setAttributes( { width, height } );\r\n\t\t};\r\n\t}\r\n\r\n\tgetFilename( url ) {\r\n\t\tconst path = getPath( url );\r\n\t\tif ( path ) {\r\n\t\t\treturn last( path.split( '/' ) );\r\n\t\t}\r\n\t}\r\n\r\n\tgetLinkDestinationOptions() {\r\n\t\treturn [\r\n\t\t\t{ value: LINK_DESTINATION_NONE, label: __( 'None' ) },\r\n\t\t\t{ value: LINK_DESTINATION_MEDIA, label: __( 'Media File' ) },\r\n\t\t\t{ value: LINK_DESTINATION_ATTACHMENT, label: __( 'Attachment Page' ) },\r\n\t\t\t{ value: LINK_DESTINATION_CUSTOM, label: __( 'Custom URL' ) },\r\n\t\t];\r\n\t}\r\n\r\n\ttoggleIsEditing() {\r\n\t\tthis.setState( {\r\n\t\t\tisEditing: ! this.state.isEditing,\r\n\t\t} );\r\n\t}\r\n\r\n\tgetImageSizeOptions() {\r\n\t\tconst { imageSizes, image } = this.props;\r\n\t\treturn compact( map( imageSizes, ( { name, slug } ) => {\r\n\t\t\tconst sizeUrl = get( image, [ 'media_details', 'sizes', slug, 'source_url' ] );\r\n\t\t\tif ( ! sizeUrl ) {\r\n\t\t\t\treturn null;\r\n\t\t\t}\r\n\t\t\treturn {\r\n\t\t\t\tvalue: sizeUrl,\r\n\t\t\t\tlabel: name,\r\n\t\t\t};\r\n\t\t} ) );\r\n\t}\r\n\r\n\tonChangeInputValue( inputValue , post = null ) {\r\n\t\tconst linkid = post ? post.id : 0;\r\n\t\tthis.setState( { inputValue , linkid , post } );\r\n\t}\r\n\r\n\tresetInvalidLink() {\r\n\t\tthis.setState( { invalidLink : false } );\r\n\t}\r\n\r\n\tupdateImageSelection( imageSelection , affiliateLink ) {\r\n\t\tthis.setState({\r\n\t\t\timageSelection,\r\n\t\t\taffiliateLink\r\n\t\t});\r\n\t}\r\n\r\n\tonSelectAffiliateImage( image ) {\r\n\r\n\t\tconst request = wp.apiFetch( {\r\n\t\t\tpath: wp.url.addQueryArgs( 'wp/v2/media/' + image.id , {\r\n\t\t\t\tcontext: 'edit',\r\n\t\t\t\t_locale: 'user'\r\n\t\t\t} ),\r\n\t\t} );\r\n\r\n\t\trequest.then( (media) => {\r\n\t\t\tmedia.url = media.source_url;\r\n\t\t\tthis.onSelectImage( media );\r\n\t\t} );\r\n\t}\r\n\r\n\teditAFfiliateImage() {\r\n\r\n\t\tconst { attributes } = this.props;\r\n\t\tconst { affiliateLink } = attributes;\r\n\r\n\t\tthis.setState({\r\n\t\t\tisEditing : true,\r\n\t\t\timageSelection : affiliateLink.images,\r\n\t\t\taffiliateLink\r\n\t\t});\r\n\t}\r\n\r\n\trender() {\r\n\t\tconst { \r\n\t\t\tisEditing,\r\n\t\t\timageSelection,\r\n\t\t\taffiliateLink,\r\n\t\t} = this.state;\r\n\t\tconst {\r\n\t\t\tattributes,\r\n\t\t\tsetAttributes,\r\n\t\t\tisLargeViewport,\r\n\t\t\tisSelected,\r\n\t\t\tclassName,\r\n\t\t\tmaxWidth,\r\n\t\t\ttoggleSelection,\r\n\t\t\tisRTL,\r\n\t\t} = this.props;\r\n\t\tconst {\r\n\t\t\turl,\r\n\t\t\talt,\r\n\t\t\tcaption,\r\n\t\t\talign,\r\n\t\t\tlinkDestination,\r\n\t\t\twidth,\r\n\t\t\theight,\r\n\t\t\tlinkid,\r\n\t\t\thref\r\n\t\t} = attributes;\r\n\t\tconst toolbarEditButton = (\r\n\t\t\t<Toolbar>\r\n\t\t\t\t<IconButton\r\n\t\t\t\t\tclassName=\"ta-edit-image-button components-icon-button components-toolbar__control\"\r\n\t\t\t\t\tlabel={ __( 'Edit ThirstyAffiliates Image' ) }\r\n\t\t\t\t\ticon=\"edit\"\r\n\t\t\t\t\tonClick={ this.editAFfiliateImage }\r\n\t\t\t\t/>\r\n\t\t\t</Toolbar>\r\n\t\t);\r\n\r\n\t\tconst controls = (\r\n\t\t\t<BlockControls>\r\n\t\t\t\t<BlockAlignmentToolbar\r\n\t\t\t\t\tvalue={ align }\r\n\t\t\t\t\tonChange={ this.updateAlignment }\r\n\t\t\t\t/>\r\n\t\t\t\t{ toolbarEditButton }\r\n\t\t\t</BlockControls>\r\n\t\t);\r\n\r\n\t\tif ( isEditing ) {\r\n\t\t\treturn (\r\n\t\t\t\t<Fragment>\r\n\t\t\t\t\t{ controls }\r\n\t\t\t\t\t<Placeholder\r\n\t\t\t\t\t\ticon={ \"format-image\" }\r\n\t\t\t\t\t\tlabel={ __( \"ThirstyAffiliates Image\" ) }\r\n\t\t\t\t\t\tinstructions={ __( \"Search for an affiliate link and select image to insert.\" ) } \r\n\t\t\t\t\t>\t\r\n\r\n\t\t\t\t\t\t<ThirstyURLInput\r\n\t\t\t\t\t\t\tupdateImageSelection={ this.updateImageSelection }\r\n\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t{ !! imageSelection.length &&\r\n\t\t\t\t\t\t\t<div className=\"ta-image-sel-wrap\">\r\n\t\t\t\t\t\t\t\t<h3>{ `${affiliateLink.title} ${ __( 'attached images:' ) }` }</h3>\r\n\t\t\t\t\t\t\t\t<div className=\"ta-image-selection\">\r\n\t\t\t\t\t\t\t\t\t{ imageSelection.map( ( image , index ) => (\r\n\t\t\t\t\t\t\t\t\t\t<button\r\n\t\t\t\t\t\t\t\t\t\t\tonClick={ () => this.onSelectAffiliateImage( image ) }\r\n\t\t\t\t\t\t\t\t\t\t>\r\n\t\t\t\t\t\t\t\t\t\t\t<img src={ image.src } />\r\n\t\t\t\t\t\t\t\t\t\t</button>\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t) ) }\r\n\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t</Placeholder>\r\n\t\t\t\t</Fragment>\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\tconst classes = classnames( className, {\r\n\t\t\t'wp-block-image' : true,\r\n\t\t\t'is-transient': isBlobURL( url ),\r\n\t\t\t'is-resized': !! width || !! height,\r\n\t\t\t'is-focused': isSelected,\r\n\t\t} );\r\n\r\n\t\tconst isResizable = [ 'wide', 'full' ].indexOf( align ) === -1 && isLargeViewport;\r\n\t\tconst imageSizeOptions = this.getImageSizeOptions();\r\n\r\n\t\tconst getInspectorControls = ( imageWidth, imageHeight ) => (\r\n\t\t\t<InspectorControls>\r\n\t\t\t\t<PanelBody title={ __( 'Image Settings' ) }>\r\n\t\t\t\t\t<TextareaControl\r\n\t\t\t\t\t\tlabel={ __( 'Alt Text (Alternative Text)' ) }\r\n\t\t\t\t\t\tvalue={ alt }\r\n\t\t\t\t\t\tonChange={ this.updateAlt }\r\n\t\t\t\t\t\thelp={ __( 'Alternative text describes your image to people who can’t see it. Add a short description with its key details.' ) }\r\n\t\t\t\t\t/>\r\n\t\t\t\t\t{ ! isEmpty( imageSizeOptions ) && (\r\n\t\t\t\t\t\t<SelectControl\r\n\t\t\t\t\t\t\tlabel={ __( 'Image Size' ) }\r\n\t\t\t\t\t\t\tvalue={ url }\r\n\t\t\t\t\t\t\toptions={ imageSizeOptions }\r\n\t\t\t\t\t\t\tonChange={ this.updateImageURL }\r\n\t\t\t\t\t\t/>\r\n\t\t\t\t\t) }\r\n\t\t\t\t\t{ isResizable && (\r\n\t\t\t\t\t\t<div className=\"block-library-image__dimensions\">\r\n\t\t\t\t\t\t\t<p className=\"block-library-image__dimensions__row\">\r\n\t\t\t\t\t\t\t\t{ __( 'Image Dimensions' ) }\r\n\t\t\t\t\t\t\t</p>\r\n\t\t\t\t\t\t\t<div className=\"block-library-image__dimensions__row\">\r\n\t\t\t\t\t\t\t\t<TextControl\r\n\t\t\t\t\t\t\t\t\ttype=\"number\"\r\n\t\t\t\t\t\t\t\t\tclassName=\"block-library-image__dimensions__width\"\r\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Width' ) }\r\n\t\t\t\t\t\t\t\t\tvalue={ width !== undefined ? width : '' }\r\n\t\t\t\t\t\t\t\t\tplaceholder={ imageWidth }\r\n\t\t\t\t\t\t\t\t\tmin={ 1 }\r\n\t\t\t\t\t\t\t\t\tonChange={ this.updateWidth }\r\n\t\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t\t\t<TextControl\r\n\t\t\t\t\t\t\t\t\ttype=\"number\"\r\n\t\t\t\t\t\t\t\t\tclassName=\"block-library-image__dimensions__height\"\r\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Height' ) }\r\n\t\t\t\t\t\t\t\t\tvalue={ height !== undefined ? height : '' }\r\n\t\t\t\t\t\t\t\t\tplaceholder={ imageHeight }\r\n\t\t\t\t\t\t\t\t\tmin={ 1 }\r\n\t\t\t\t\t\t\t\t\tonChange={ this.updateHeight }\r\n\t\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t<div className=\"block-library-image__dimensions__row\">\r\n\t\t\t\t\t\t\t\t<ButtonGroup aria-label={ __( 'Image Size' ) }>\r\n\t\t\t\t\t\t\t\t\t{ [ 25, 50, 75, 100 ].map( ( scale ) => {\r\n\t\t\t\t\t\t\t\t\t\tconst scaledWidth = Math.round( imageWidth * ( scale / 100 ) );\r\n\t\t\t\t\t\t\t\t\t\tconst scaledHeight = Math.round( imageHeight * ( scale / 100 ) );\r\n\r\n\t\t\t\t\t\t\t\t\t\tconst isCurrent = width === scaledWidth && height === scaledHeight;\r\n\r\n\t\t\t\t\t\t\t\t\t\treturn (\r\n\t\t\t\t\t\t\t\t\t\t\t<Button\r\n\t\t\t\t\t\t\t\t\t\t\t\tkey={ scale }\r\n\t\t\t\t\t\t\t\t\t\t\t\tisSmall\r\n\t\t\t\t\t\t\t\t\t\t\t\tisPrimary={ isCurrent }\r\n\t\t\t\t\t\t\t\t\t\t\t\taria-pressed={ isCurrent }\r\n\t\t\t\t\t\t\t\t\t\t\t\tonClick={ this.updateDimensions( scaledWidth, scaledHeight ) }\r\n\t\t\t\t\t\t\t\t\t\t\t>\r\n\t\t\t\t\t\t\t\t\t\t\t\t{ scale }%\r\n\t\t\t\t\t\t\t\t\t\t\t</Button>\r\n\t\t\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t\t\t} ) }\r\n\t\t\t\t\t\t\t\t</ButtonGroup>\r\n\t\t\t\t\t\t\t\t<Button\r\n\t\t\t\t\t\t\t\t\tisSmall\r\n\t\t\t\t\t\t\t\t\tonClick={ this.updateDimensions() }\r\n\t\t\t\t\t\t\t\t>\r\n\t\t\t\t\t\t\t\t\t{ __( 'Reset' ) }\r\n\t\t\t\t\t\t\t\t</Button>\r\n\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t) }\r\n\t\t\t\t</PanelBody>\r\n\t\t\t</InspectorControls>\r\n\t\t);\r\n\r\n\t\t// Disable reason: Each block can be selected by clicking on it\r\n\t\t/* eslint-disable jsx-a11y/no-static-element-interactions, jsx-a11y/onclick-has-role, jsx-a11y/click-events-have-key-events */\r\n\t\treturn (\r\n\t\t\t<Fragment>\r\n\t\t\t\t{ controls }\r\n\t\t\t\t<figure className={ classes }>\r\n\t\t\t\t\t<ImageSize src={ url } dirtynessTrigger={ align }>\r\n\t\t\t\t\t\t{ ( sizes ) => {\r\n\t\t\t\t\t\t\tconst {\r\n\t\t\t\t\t\t\t\timageWidthWithinContainer,\r\n\t\t\t\t\t\t\t\timageHeightWithinContainer,\r\n\t\t\t\t\t\t\t\timageWidth,\r\n\t\t\t\t\t\t\t\timageHeight,\r\n\t\t\t\t\t\t\t} = sizes;\r\n\r\n\t\t\t\t\t\t\tconst filename = this.getFilename( url );\r\n\t\t\t\t\t\t\tlet defaultedAlt;\r\n\t\t\t\t\t\t\tif ( alt ) {\r\n\t\t\t\t\t\t\t\tdefaultedAlt = alt;\r\n\t\t\t\t\t\t\t} else if ( filename ) {\r\n\t\t\t\t\t\t\t\tdefaultedAlt = sprintf( __( 'This image has an empty alt attribute; its file name is %s' ), filename );\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\tdefaultedAlt = __( 'This image has an empty alt attribute' );\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\tconst img = (\r\n\t\t\t\t\t\t\t\t// Disable reason: Image itself is not meant to be interactive, but\r\n\t\t\t\t\t\t\t\t// should direct focus to block.\r\n\t\t\t\t\t\t\t\t/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */\r\n\t\t\t\t\t\t\t\t<Fragment>\r\n\t\t\t\t\t\t\t\t\t<ta linkid={ linkid } href={ href }>\r\n\t\t\t\t\t\t\t\t\t\t<img src={ url } alt={ defaultedAlt } onClick={ this.onImageClick } onError={ () => this.onImageError( url ) } />\r\n\t\t\t\t\t\t\t\t\t</ta>\r\n\t\t\t\t\t\t\t\t\t{ isBlobURL( url ) && <Spinner /> }\r\n\t\t\t\t\t\t\t\t</Fragment>\r\n\t\t\t\t\t\t\t\t/* eslint-enable jsx-a11y/no-noninteractive-element-interactions */\r\n\t\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\t\tif ( ! isResizable || ! imageWidthWithinContainer ) {\r\n\t\t\t\t\t\t\t\treturn (\r\n\t\t\t\t\t\t\t\t\t<Fragment>\r\n\t\t\t\t\t\t\t\t\t\t{ getInspectorControls( imageWidth, imageHeight ) }\r\n\t\t\t\t\t\t\t\t\t\t<div style={ { width, height } }>\r\n\t\t\t\t\t\t\t\t\t\t\t{ img }\r\n\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t</Fragment>\r\n\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\tconst currentWidth = width || imageWidthWithinContainer;\r\n\t\t\t\t\t\t\tconst currentHeight = height || imageHeightWithinContainer;\r\n\r\n\t\t\t\t\t\t\tconst ratio = imageWidth / imageHeight;\r\n\t\t\t\t\t\t\tconst minWidth = imageWidth < imageHeight ? MIN_SIZE : MIN_SIZE * ratio;\r\n\t\t\t\t\t\t\tconst minHeight = imageHeight < imageWidth ? MIN_SIZE : MIN_SIZE / ratio;\r\n\r\n\t\t\t\t\t\t\t// With the current implementation of ResizableBox, an image needs an explicit pixel value for the max-width.\r\n\t\t\t\t\t\t\t// In absence of being able to set the content-width, this max-width is currently dictated by the vanilla editor style.\r\n\t\t\t\t\t\t\t// The following variable adds a buffer to this vanilla style, so 3rd party themes have some wiggleroom.\r\n\t\t\t\t\t\t\t// This does, in most cases, allow you to scale the image beyond the width of the main column, though not infinitely.\r\n\t\t\t\t\t\t\t// @todo It would be good to revisit this once a content-width variable becomes available.\r\n\t\t\t\t\t\t\tconst maxWidthBuffer = maxWidth * 2.5;\r\n\r\n\t\t\t\t\t\t\tlet showRightHandle = false;\r\n\t\t\t\t\t\t\tlet showLeftHandle = false;\r\n\r\n\t\t\t\t\t\t\t/* eslint-disable no-lonely-if */\r\n\t\t\t\t\t\t\t// See https://github.com/WordPress/gutenberg/issues/7584.\r\n\t\t\t\t\t\t\tif ( align === 'center' ) {\r\n\t\t\t\t\t\t\t\t// When the image is centered, show both handles.\r\n\t\t\t\t\t\t\t\tshowRightHandle = true;\r\n\t\t\t\t\t\t\t\tshowLeftHandle = true;\r\n\t\t\t\t\t\t\t} else if ( isRTL ) {\r\n\t\t\t\t\t\t\t\t// In RTL mode the image is on the right by default.\r\n\t\t\t\t\t\t\t\t// Show the right handle and hide the left handle only when it is aligned left.\r\n\t\t\t\t\t\t\t\t// Otherwise always show the left handle.\r\n\t\t\t\t\t\t\t\tif ( align === 'left' ) {\r\n\t\t\t\t\t\t\t\t\tshowRightHandle = true;\r\n\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\tshowLeftHandle = true;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t// Show the left handle and hide the right handle only when the image is aligned right.\r\n\t\t\t\t\t\t\t\t// Otherwise always show the right handle.\r\n\t\t\t\t\t\t\t\tif ( align === 'right' ) {\r\n\t\t\t\t\t\t\t\t\tshowLeftHandle = true;\r\n\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\tshowRightHandle = true;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t/* eslint-enable no-lonely-if */\r\n\r\n\t\t\t\t\t\t\treturn (\r\n\t\t\t\t\t\t\t\t<Fragment>\r\n\t\t\t\t\t\t\t\t\t{ getInspectorControls( imageWidth, imageHeight ) }\r\n\t\t\t\t\t\t\t\t\t<ResizableBox\r\n\t\t\t\t\t\t\t\t\t\tsize={\r\n\t\t\t\t\t\t\t\t\t\t\twidth && height ? {\r\n\t\t\t\t\t\t\t\t\t\t\t\twidth,\r\n\t\t\t\t\t\t\t\t\t\t\t\theight,\r\n\t\t\t\t\t\t\t\t\t\t\t} : undefined\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\tminWidth={ minWidth }\r\n\t\t\t\t\t\t\t\t\t\tmaxWidth={ maxWidthBuffer }\r\n\t\t\t\t\t\t\t\t\t\tminHeight={ minHeight }\r\n\t\t\t\t\t\t\t\t\t\tmaxHeight={ maxWidthBuffer / ratio }\r\n\t\t\t\t\t\t\t\t\t\tlockAspectRatio\r\n\t\t\t\t\t\t\t\t\t\tenable={ {\r\n\t\t\t\t\t\t\t\t\t\t\ttop: false,\r\n\t\t\t\t\t\t\t\t\t\t\tright: showRightHandle,\r\n\t\t\t\t\t\t\t\t\t\t\tbottom: true,\r\n\t\t\t\t\t\t\t\t\t\t\tleft: showLeftHandle,\r\n\t\t\t\t\t\t\t\t\t\t} }\r\n\t\t\t\t\t\t\t\t\t\tonResizeStart={ () => {\r\n\t\t\t\t\t\t\t\t\t\t\ttoggleSelection( false );\r\n\t\t\t\t\t\t\t\t\t\t} }\r\n\t\t\t\t\t\t\t\t\t\tonResizeStop={ ( event, direction, elt, delta ) => {\r\n\t\t\t\t\t\t\t\t\t\t\tsetAttributes( {\r\n\t\t\t\t\t\t\t\t\t\t\t\twidth: parseInt( currentWidth + delta.width, 10 ),\r\n\t\t\t\t\t\t\t\t\t\t\t\theight: parseInt( currentHeight + delta.height, 10 ),\r\n\t\t\t\t\t\t\t\t\t\t\t} );\r\n\t\t\t\t\t\t\t\t\t\t\ttoggleSelection( true );\r\n\t\t\t\t\t\t\t\t\t\t} }\r\n\t\t\t\t\t\t\t\t\t>\r\n\t\t\t\t\t\t\t\t\t\t{ img }\r\n\t\t\t\t\t\t\t\t\t</ResizableBox>\r\n\t\t\t\t\t\t\t\t</Fragment>\r\n\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t} }\r\n\t\t\t\t\t</ImageSize>\r\n\t\t\t\t\t{ ( ! RichText.isEmpty( caption ) || isSelected ) && (\r\n\t\t\t\t\t\t<RichText\r\n\t\t\t\t\t\t\ttagName=\"figcaption\"\r\n\t\t\t\t\t\t\tplaceholder={ __( 'Write caption…' ) }\r\n\t\t\t\t\t\t\tvalue={ caption }\r\n\t\t\t\t\t\t\tunstableOnFocus={ this.onFocusCaption }\r\n\t\t\t\t\t\t\tonChange={ ( value ) => setAttributes( { caption: value } ) }\r\n\t\t\t\t\t\t\tisSelected={ this.state.captionFocused }\r\n\t\t\t\t\t\t\tinlineToolbar\r\n\t\t\t\t\t\t/>\r\n\t\t\t\t\t) }\r\n\t\t\t\t</figure>\r\n\t\t\t</Fragment>\r\n\t\t);\r\n\t\t/* eslint-enable jsx-a11y/no-static-element-interactions, jsx-a11y/onclick-has-role, jsx-a11y/click-events-have-key-events */\r\n\t}\r\n}\r\n\r\nexport default compose( [\r\n\twithSelect( ( select, props ) => {\r\n\t\tconst { getMedia } = select( 'core' );\r\n\t\tconst { getEditorSettings } = select( 'core/editor' );\r\n\t\tconst { id } = props.attributes;\r\n\t\tconst { maxWidth, isRTL, imageSizes } = getEditorSettings();\r\n\r\n\t\treturn {\r\n\t\t\timage: id ? getMedia( id ) : null,\r\n\t\t\tmaxWidth,\r\n\t\t\tisRTL,\r\n\t\t\timageSizes,\r\n\t\t};\r\n\t} ),\r\n\twithViewportMatch( { isLargeViewport: 'medium' } ),\r\n\twithNotices,\r\n] )( ImageEdit );\n\n\n// WEBPACK FOOTER //\n// ./src/blocks/ta-image/edit.js","const WORDPRESS_EMBED_BLOCK = 'core-embed/wordpress';\r\n\r\nconst { includes } = lodash;\r\nconst { renderToString } = wp.element;\r\nconst { createBlock } = wp.blocks;\r\n\r\n/***\r\n * Creates a more suitable embed block based on the passed in props\r\n * and attributes generated from an embed block's preview.\r\n *\r\n * We require `attributesFromPreview` to be generated from the latest attributes\r\n * and preview, and because of the way the react lifecycle operates, we can't\r\n * guarantee that the attributes contained in the block's props are the latest\r\n * versions, so we require that these are generated separately.\r\n * See `getAttributesFromPreview` in the generated embed edit component.\r\n *\r\n * @param {Object} props The block's props.\r\n * @param {Object} attributesFromPreview Attributes generated from the block's most up to date preview.\r\n * @return {Object|undefined} A more suitable embed block if one exists.\r\n */\r\nexport const createUpgradedEmbedBlock = ( props, attributesFromPreview ) => {\r\n\tconst { preview, name } = props;\r\n\tconst { url } = props.attributes;\r\n\r\n\tif ( ! url ) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tconst matchingBlock = findBlock( url );\r\n\r\n\t// WordPress blocks can work on multiple sites, and so don't have patterns,\r\n\t// so if we're in a WordPress block, assume the user has chosen it for a WordPress URL.\r\n\tif ( WORDPRESS_EMBED_BLOCK !== name && DEFAULT_EMBED_BLOCK !== matchingBlock ) {\r\n\t\t// At this point, we have discovered a more suitable block for this url, so transform it.\r\n\t\tif ( name !== matchingBlock ) {\r\n\t\t\treturn createBlock( matchingBlock, { url } );\r\n\t\t}\r\n\t}\r\n\r\n\tif ( preview ) {\r\n\t\tconst { html } = preview;\r\n\r\n\t\t// We can't match the URL for WordPress embeds, we have to check the HTML instead.\r\n\t\tif ( isFromWordPress( html ) ) {\r\n\t\t\t// If this is not the WordPress embed block, transform it into one.\r\n\t\t\tif ( WORDPRESS_EMBED_BLOCK !== name ) {\r\n\t\t\t\treturn createBlock(\r\n\t\t\t\t\tWORDPRESS_EMBED_BLOCK,\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\turl,\r\n\t\t\t\t\t\t// By now we have the preview, but when the new block first renders, it\r\n\t\t\t\t\t\t// won't have had all the attributes set, and so won't get the correct\r\n\t\t\t\t\t\t// type and it won't render correctly. So, we pass through the current attributes\r\n\t\t\t\t\t\t// here so that the initial render works when we switch to the WordPress\r\n\t\t\t\t\t\t// block. This only affects the WordPress block because it can't be\r\n\t\t\t\t\t\t// rendered in the usual Sandbox (it has a sandbox of its own) and it\r\n\t\t\t\t\t\t// relies on the preview to set the correct render type.\r\n\t\t\t\t\t\t...attributesFromPreview,\r\n\t\t\t\t\t}\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const isFromWordPress = ( html ) => {\r\n\treturn includes( html, 'class=\"wp-embedded-content\" data-secret' );\r\n};\n\n\n// WEBPACK FOOTER //\n// ./src/blocks/ta-image/util.js","const { noop } = lodash;\r\n\r\nconst { withGlobalEvents } = wp.compose;\r\nconst { Component } = wp.element;\r\n\r\nclass ImageSize extends Component {\r\n\tconstructor() {\r\n\t\tsuper( ...arguments );\r\n\t\tthis.state = {\r\n\t\t\twidth: undefined,\r\n\t\t\theight: undefined,\r\n\t\t};\r\n\t\tthis.bindContainer = this.bindContainer.bind( this );\r\n\t\tthis.calculateSize = this.calculateSize.bind( this );\r\n\t}\r\n\r\n\tbindContainer( ref ) {\r\n\t\tthis.container = ref;\r\n\t}\r\n\r\n\tcomponentDidUpdate( prevProps ) {\r\n\t\tif ( this.props.src !== prevProps.src ) {\r\n\t\t\tthis.setState( {\r\n\t\t\t\twidth: undefined,\r\n\t\t\t\theight: undefined,\r\n\t\t\t} );\r\n\t\t\tthis.fetchImageSize();\r\n\t\t}\r\n\r\n\t\tif ( this.props.dirtynessTrigger !== prevProps.dirtynessTrigger ) {\r\n\t\t\tthis.calculateSize();\r\n\t\t}\r\n\t}\r\n\r\n\tcomponentDidMount() {\r\n\t\tthis.fetchImageSize();\r\n\t}\r\n\r\n\tcomponentWillUnmount() {\r\n\t\tif ( this.image ) {\r\n\t\t\tthis.image.onload = noop;\r\n\t\t}\r\n\t}\r\n\r\n\tfetchImageSize() {\r\n\t\tthis.image = new window.Image();\r\n\t\tthis.image.onload = this.calculateSize;\r\n\t\tthis.image.src = this.props.src;\r\n\t}\r\n\r\n\tcalculateSize() {\r\n\t\tconst maxWidth = this.container.clientWidth;\r\n\t\tconst exceedMaxWidth = this.image.width > maxWidth;\r\n\t\tconst ratio = this.image.height / this.image.width;\r\n\t\tconst width = exceedMaxWidth ? maxWidth : this.image.width;\r\n\t\tconst height = exceedMaxWidth ? maxWidth * ratio : this.image.height;\r\n\t\tthis.setState( { width, height } );\r\n\t}\r\n\r\n\trender() {\r\n\t\tconst sizes = {\r\n\t\t\timageWidth: this.image && this.image.width,\r\n\t\t\timageHeight: this.image && this.image.height,\r\n\t\t\tcontainerWidth: this.container && this.container.clientWidth,\r\n\t\t\tcontainerHeight: this.container && this.container.clientHeight,\r\n\t\t\timageWidthWithinContainer: this.state.width,\r\n\t\t\timageHeightWithinContainer: this.state.height,\r\n\t\t};\r\n\t\treturn (\r\n\t\t\t<div ref={ this.bindContainer }>\r\n\t\t\t\t{ this.props.children( sizes ) }\r\n\t\t\t</div>\r\n\t\t);\r\n\t}\r\n}\r\n\r\nexport default withGlobalEvents( {\r\n\tresize: 'calculateSize',\r\n} )( ImageSize );\n\n\n// WEBPACK FOOTER //\n// ./src/blocks/ta-image/image-size.js","import classnames from \"classnames\";\r\n\r\nconst { __ } = wp.i18n;\r\nconst { Component , createRef } = wp.element;\r\nconst { Spinner, withSpokenMessages, Popover , TextControl } = wp.components;\r\nconst { withInstanceId } = wp.compose;\r\n\r\nclass ThirstyURLInput extends Component {\r\n\r\n /**\r\n * Component constructor method.\r\n * \r\n * @since 3.6\r\n * \r\n * @param {*} param0 \r\n */\r\n\tconstructor( { autocompleteRef } ) {\r\n\t\tsuper( ...arguments );\r\n\r\n\t\t// this.onChange = this.onChange.bind( this );\r\n\t\t// this.onKeyDown = this.onKeyDown.bind( this );\r\n\t\tthis.autocompleteRef = autocompleteRef || createRef();\r\n\t\tthis.inputRef = createRef();\r\n\t\tthis.searchAffiliateLinks = this.searchAffiliateLinks.bind( this );\r\n\t\t// this.updateSuggestions = throttle( this.updateSuggestions.bind( this ), 200 );\r\n\r\n\t\tthis.suggestionNodes = [];\r\n\r\n\t\tthis.state = {\r\n\t\t\tposts : [],\r\n\t\t\tshowSuggestions : false,\r\n\t\t\tselectedSuggestion : null,\r\n\t\t\tloading : false\r\n\t\t};\r\n\t}\r\n\r\n\t/**\r\n * Component did update method.\r\n * \r\n * @since 3.6\r\n */\r\n\tcomponentDidUpdate() {\r\n\t\tconst { showSuggestions, selectedSuggestion } = this.state;\r\n\t\t// only have to worry about scrolling selected suggestion into view\r\n\t\t// when already expanded\r\n\t\tif ( showSuggestions && selectedSuggestion !== null && ! this.scrollingIntoView ) {\r\n\t\t\tthis.scrollingIntoView = true;\r\n\t\t\tscrollIntoView( this.suggestionNodes[ selectedSuggestion ], this.autocompleteRef.current, {\r\n\t\t\t\tonlyScrollIfNeeded: true,\r\n\t\t\t} );\r\n\r\n\t\t\tsetTimeout( () => {\r\n\t\t\t\tthis.scrollingIntoView = false;\r\n\t\t\t}, 100 );\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n * Component unmount method.\r\n * \r\n * @since 3.6\r\n */\r\n\tcomponentWillUnmount() {\r\n\t\tdelete this.suggestionsRequest;\r\n\t}\r\n\r\n\t/**\r\n * Bind suggestion to node.\r\n * \r\n * @param {*} index \r\n */\r\n\tbindSuggestionNode( index ) {\r\n\t\treturn ( ref ) => {\r\n\t\t\tthis.suggestionNodes[ index ] = ref;\r\n\t\t};\r\n\t}\r\n\t\r\n\tsearchAffiliateLinks( value ) {\r\n\r\n\t\t// Show the suggestions after typing at least 2 characters=\r\n\t\tif ( value.length < 2 ) {\r\n\t\t\tthis.setState( {\r\n\t\t\t\tshowSuggestions: false,\r\n\t\t\t\tselectedSuggestion: null,\r\n\t\t\t\tloading: false,\r\n\t\t\t} );\r\n\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tthis.setState({\r\n\t\t\tshowSuggestions : true,\r\n\t\t\tselectedSuggestion : null,\r\n\t\t\tloading : true\r\n\t\t});\r\n\r\n\t\tconst formData = new FormData();\r\n formData.append( \"action\" , \"search_affiliate_links_query\" );\r\n formData.append( \"keyword\" , value );\r\n formData.append( \"paged\" , 1 );\r\n\t\tformData.append( \"gutenberg\" , true );\r\n\t\tformData.append( \"with_images\" , true );\r\n\t\t\r\n\t\t// We are getting data via the WP AJAX instead of rest API as it is not possible yet\r\n // to filter results with category value. This is to prepare next update to add category filter.\r\n const request = fetch( ajaxurl , {\r\n method : \"POST\",\r\n body : formData\r\n\t\t} );\r\n\t\t\r\n\t\trequest\r\n .then( response => response.json() )\r\n .then( ( response ) => {\r\n\r\n if ( ! response.affiliate_links ) return;\r\n\r\n const posts = response.affiliate_links;\r\n\r\n\t\t\t// A fetch Promise doesn't have an abort option. It's mimicked by\r\n\t\t\t// comparing the request reference in on the instance, which is\r\n\t\t\t// reset or deleted on subsequent requests or unmounting.\r\n\t\t\tif ( this.suggestionsRequest !== request ) {\r\n\t\t\t\treturn;\r\n }\r\n\r\n\t\t\tthis.setState( {\r\n\t\t\t\tposts,\r\n\t\t\t\tloading: false,\r\n } );\r\n\r\n\t\t\tif ( !! posts.length ) {\r\n\t\t\t\tthis.props.debouncedSpeak( sprintf( _n(\r\n\t\t\t\t\t'%d result found, use up and down arrow keys to navigate.',\r\n\t\t\t\t\t'%d results found, use up and down arrow keys to navigate.',\r\n\t\t\t\t\tposts.length\r\n\t\t\t\t), posts.length ), 'assertive' );\r\n\t\t\t} else {\r\n\t\t\t\tthis.props.debouncedSpeak( __( 'No results.' ), 'assertive' );\r\n }\r\n\r\n\t\t} ).catch( () => {\r\n\t\t\tif ( this.suggestionsRequest === request ) {\r\n\t\t\t\tthis.setState( {\r\n\t\t\t\t\tloading: false,\r\n\t\t\t\t} );\r\n\t\t\t}\r\n\t\t} );\r\n\r\n\t\tthis.suggestionsRequest = request;\r\n\t}\r\n\r\n\t/**\r\n * Set state when an affiliate link is selected.\r\n * \r\n * @since 3.6\r\n * \r\n * @param {*} post \r\n */\r\n\tselectLink( post ) {\r\n\t\t// this.props.onChange( post.link, post );\r\n\t\tthis.setState( {\r\n\t\t\tselectedSuggestion: post,\r\n\t\t\tshowSuggestions: false,\r\n\t\t} );\r\n\r\n\t\tthis.props.updateImageSelection( post.images , post );\r\n\t}\r\n\r\n\t/**\r\n * Callback handler for when affiliate link is selected.\r\n * \r\n * @param {*} post \r\n */\r\n\thandleOnClick( post ) {\r\n\t\tthis.selectLink( post );\r\n\t\t// Move focus to the input field when a link suggestion is clicked.\r\n\t\t// this.inputRef.current.focus();\r\n\t}\r\n\r\n render() {\r\n const { value = '', autoFocus = true, instanceId } = this.props;\r\n const { showSuggestions , posts, selectedSuggestion , loading } = this.state;\r\n \r\n return (\r\n <div class=\"edit-search-affiliate-links\">\r\n\t\t\t\t<form\r\n\t\t\t\t\tclassName=\"editor-format-toolbar__link-container-content ta-link-search-popover\"\r\n\t\t\t\t\tonSubmit={ this.displayAffiliateImages }\r\n\t\t\t\t>\r\n\t\t\t\t\t<TextControl\r\n\t\t\t\t\t\ttype=\"text\"\r\n\t\t\t\t\t\tclassName=\"ta-search-affiliate-links\"\r\n\t\t\t\t\t\tplaceholder={ __( \"Type to search affiliate links\" ) }\r\n\t\t\t\t\t\tonChange={ this.searchAffiliateLinks }\r\n\t\t\t\t\t\tautocomplete=\"off\"\r\n\t\t\t\t\t/>\r\n\r\n\t\t\t\t\t{ ( loading ) && <Spinner /> }\r\n\r\n\t\t\t\t\t{ showSuggestions && !! posts.length && \r\n\t\t\t\t\t\t<Popover position=\"bottom\" focusOnMount={ false }>\r\n\t\t\t\t\t\t\t<div class=\"affilate-links-suggestions\">\r\n\t\t\t\t\t\t\t\t{ posts.map( ( post, index ) => (\r\n\t\t\t\t\t\t\t\t\t<button\r\n\t\t\t\t\t\t\t\t\t\tkey={ post.id }\r\n\t\t\t\t\t\t\t\t\t\trole=\"option\"\r\n\t\t\t\t\t\t\t\t\t\ttabIndex=\"-1\"\r\n\t\t\t\t\t\t\t\t\t\tid={ `editor-url-input-suggestion-${ instanceId }-${ index }` }\r\n\t\t\t\t\t\t\t\t\t\tref={ this.bindSuggestionNode( index ) }\r\n\t\t\t\t\t\t\t\t\t\tclassName={ classnames( 'editor-url-input__suggestion', {\r\n\t\t\t\t\t\t\t\t\t\t\t'is-selected': index === selectedSuggestion,\r\n\t\t\t\t\t\t\t\t\t\t} ) }\r\n\t\t\t\t\t\t\t\t\t\tonClick={ () => this.handleOnClick( post ) }\r\n\t\t\t\t\t\t\t\t\t\taria-selected={ index === selectedSuggestion }\r\n\t\t\t\t\t\t\t\t\t>\r\n\t\t\t\t\t\t\t\t\t\t{ post.title || __( '(no title)' ) }\r\n\t\t\t\t\t\t\t\t\t</button>\r\n\t\t\t\t\t\t\t\t) ) }\r\n\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t</Popover>\r\n\t\t\t\t\t}\r\n\t\t\t\t</form>\r\n </div>\r\n );\r\n }\r\n}\r\n\r\nexport default withSpokenMessages( withInstanceId( ThirstyURLInput ) );\n\n\n// WEBPACK FOOTER //\n// ./src/blocks/ta-image/search-input.js","import { taLink } from \"./ta-link\";\r\n\r\nconst { registerFormatType } = wp.richText;\r\n\r\n/**\r\n * Register custom formats.\r\n * \r\n * @since 3.6\r\n */\r\nexport default function registerFormats() {\r\n\r\n [\r\n taLink\r\n ].forEach( ( { name , ...settings } ) => registerFormatType( name , settings ) );\r\n}\n\n\n// WEBPACK FOOTER //\n// ./src/formats/index.js","import InlineAffiliateLinkUI from './inline';\r\n\r\nconst { __ } = wp.i18n;\r\nconst { Component , Fragment } = wp.element;\r\nconst { withSpokenMessages } = wp.components;\r\nconst { getTextContent , applyFormat , removeFormat , slice } = wp.richText;\r\nconst { isURL } = wp.url;\r\nconst { RichTextToolbarButton , RichTextShortcut } = wp.editor;\r\nconst { Path , SVG } = wp.components;\r\n\r\nconst name = \"ta/link\";\r\n\r\n/**\r\n * Custom Affiliate link format. When applied will wrap selected text with <ta href=\"\" linkid=\"\"></ta> custom element.\r\n * Custom element is implemented here as we are not allowed to use <a> tag due to Gutenberg limitations.\r\n * Element is converted to normal <a> tag on frontend via PHP script filtered on 'the_content'.\r\n * \r\n * @since 3.6\r\n */\r\nexport const taLink = {\r\n name,\r\n title : __( \"Affiliate Link\" ),\r\n tagName : \"ta\",\r\n className : null,\r\n attributes : {\r\n\t\turl : \"href\",\r\n\t\ttarget : \"target\"\r\n },\r\n edit : withSpokenMessages( class LinkEdit extends Component {\r\n\t\t\r\n\t\t/**\r\n\t\t * Component constructor.\r\n\t\t * \r\n\t\t * @since 3.6\r\n\t\t */\r\n\t\tconstructor() {\r\n\t\t\tsuper( ...arguments );\r\n\r\n\t\t\tthis.addLink = this.addLink.bind( this );\r\n\t\t\tthis.stopAddingLink = this.stopAddingLink.bind( this );\r\n\t\t\tthis.onRemoveFormat = this.onRemoveFormat.bind( this );\r\n\t\t\tthis.state = {\r\n\t\t\t\taddingLink: false,\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\t/**\r\n\t\t * Callback to set state to adding link status.\r\n\t\t * \r\n\t\t * @since 3.6\r\n\t\t */\r\n\t\taddLink() {\r\n\t\t\tconst { value, onChange } = this.props;\r\n\t\t\tconst text = getTextContent( slice( value ) );\r\n\r\n\t\t\tif ( text && isURL( text ) ) {\r\n\t\t\t\tonChange( applyFormat( value, { type: name, attributes: { url: text } } ) );\r\n\t\t\t} else {\r\n\t\t\t\tthis.setState( { addingLink: true } );\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t/**\r\n\t\t * Callback to set state to stop adding link status.\r\n\t\t * \r\n\t\t * @since 3.6\r\n\t\t */\r\n\t\tstopAddingLink() {\r\n\t\t\tthis.setState( { addingLink: false } );\r\n\t\t}\r\n\r\n\t\t/**\r\n\t\t * Remove format event callback.\r\n\t\t * \r\n\t\t * @since 3.6\r\n\t\t */\r\n\t\tonRemoveFormat() {\r\n\t\t\tconst { value , onChange , speak } = this.props;\r\n\r\n\t\t\tonChange( removeFormat( value , name ) );\r\n\t\t\tspeak( __( \"Affiliate Link removed.\" ), \"assertive\" );\r\n\t\t}\r\n\r\n\t\t/**\r\n\t\t * Component render method.\r\n\t\t * \r\n\t\t * @since 3.6\r\n\t\t */\r\n\t\trender() {\r\n\t\t\tconst { isActive , activeAttributes , value , onChange } = this.props;\r\n\r\n\t\t\treturn (\r\n\t\t\t\t<Fragment>\r\n\t\t\t\t\t<RichTextShortcut\r\n\t\t\t\t\t\ttype=\"access\"\r\n\t\t\t\t\t\tcharacter=\"s\"\r\n\t\t\t\t\t\tonUse={ this.onRemoveFormat }\r\n\t\t\t\t\t/>\r\n\t\t\t\t\t<RichTextShortcut\r\n\t\t\t\t\t\ttype=\"primary\"\r\n\t\t\t\t\t\tcharacter=\"l\"\r\n\t\t\t\t\t\tonUse={ this.addLink }\r\n\t\t\t\t\t/>\r\n\t\t\t\t\t<RichTextShortcut\r\n\t\t\t\t\t\ttype=\"primaryShift\"\r\n\t\t\t\t\t\tcharacter=\"l\"\r\n\t\t\t\t\t\tonUse={ this.onRemoveFormat }\r\n\t\t\t\t\t/>\r\n\t\t\t\t\t{ isActive && <RichTextToolbarButton\r\n\t\t\t\t\t\ticon=\"editor-unlink\"\r\n\t\t\t\t\t\ttitle={ __( 'Remove Affiliate Link' ) }\r\n\t\t\t\t\t\tclassName=\"ta-unlink-button\"\r\n\t\t\t\t\t\tonClick={ this.onRemoveFormat }\r\n\t\t\t\t\t\tisActive={ isActive }\r\n\t\t\t\t\t\tshortcutType=\"primaryShift\"\r\n\t\t\t\t\t\tshortcutCharacter=\"l\"\r\n\t\t\t\t\t/> }\r\n\t\t\t\t\t{ ! isActive && <RichTextToolbarButton\r\n\t\t\t\t\t\ticon={ <SVG xmlns=\"http://www.w3.org/2000/svg\" width=\"16.688\" height=\"9.875\" viewBox=\"0 0 16.688 9.875\"><Path id=\"TA.svg\" fill=\"black\" class=\"cls-1\" d=\"M2.115,15.12H4.847L6.836,7.7H9.777l0.63-2.381H1.821L1.177,7.7H4.118Zm4.758,0H9.829l1.177-1.751h3.782l0.238,1.751h2.858L16.357,5.245H13.7Zm5.5-3.866,1.835-2.816,0.35,2.816H12.378Z\" transform=\"translate(-1.188 -5.25)\"/></SVG> }\r\n\t\t\t\t\t\ttitle={ __( 'Affiliate Link' ) }\r\n\t\t\t\t\t\tclassName=\"ta-link-button\"\r\n\t\t\t\t\t\tonClick={ this.addLink }\r\n\t\t\t\t\t\tshortcutType=\"primary\"\r\n\t\t\t\t\t\tshortcutCharacter=\"l\"\r\n\t\t\t\t\t/> }\r\n\t\t\t\t\t<InlineAffiliateLinkUI\r\n\t\t\t\t\t\taddingLink={ this.state.addingLink }\r\n\t\t\t\t\t\tstopAddingLink={ this.stopAddingLink }\r\n\t\t\t\t\t\tisActive={ isActive }\r\n\t\t\t\t\t\tactiveAttributes={ activeAttributes }\r\n\t\t\t\t\t\tvalue={ value }\r\n\t\t\t\t\t\tonChange={ onChange }\r\n\t\t\t\t\t/>\r\n\t\t\t\t</Fragment>\r\n\t\t\t);\r\n\t\t}\r\n } )\r\n}\n\n\n// WEBPACK FOOTER //\n// ./src/formats/ta-link/index.js","import classnames from \"classnames\";\r\nimport ThirstyPositionedAtSelection from './positioned-at-selection';\r\nimport { isValidHref } from './utils';\r\nimport ThirstyURLPopover from './url-popover';\r\nimport ThirstyURLInput from './url-input';\r\n\r\nconst { __ } = wp.i18n;\r\nconst { Component , createRef } = wp.element;\r\nconst { ExternalLink , ToggleControl , IconButton , withSpokenMessages } = wp.components;\r\nconst { LEFT, RIGHT, UP, DOWN, BACKSPACE, ENTER } = wp.keycodes;\r\nconst { prependHTTP , safeDecodeURI , filterURLForDisplay } = wp.url;\r\nconst { create , insert , isCollapsed , applyFormat , getTextContent , slice } = wp.richText;\r\n\r\nconst stopKeyPropagation = ( event ) => event.stopPropagation();\r\n\r\n/**\r\n * Generates the format object that will be applied to the link text.\r\n * \r\n * @since 3.6\r\n *\r\n * @param {string} url The href of the link.\r\n * @param {boolean} linkid Affiliate link ID.\r\n * @param {Object} text The text that is being hyperlinked.\r\n *\r\n * @return {Object} The final format object.\r\n */\r\nfunction createLinkFormat( { url , linkid , text } ) {\r\n\tconst format = {\r\n\t\ttype: \"ta/link\",\r\n\t\tattributes: {\r\n\t\t\turl,\r\n\t\t\tlinkid : linkid.toString()\r\n\t\t},\r\n\t};\r\n\r\n\treturn format;\r\n}\r\n\r\n/**\r\n * Check if input is being show.\r\n * \r\n * @since 3.6\r\n * \r\n * @param {Object} props Component props.\r\n * @param {Object} state Component state.\r\n */\r\nfunction isShowingInput( props , state ) {\r\n\treturn props.addingLink || state.editLink;\r\n}\r\n\r\n/**\r\n * Affiliate Link editor JSX element.\r\n * \r\n * @since 3.6\r\n * \r\n * @param {Object} param0 Component props (destructred).\r\n */\r\nconst LinkEditor = ( { value , onChangeInputValue , onKeyDown , submitLink, invalidLink , resetInvalidLink , autocompleteRef } ) => (\r\n\t// Disable reason: KeyPress must be suppressed so the block doesn't hide the toolbar\r\n\t/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */\r\n\t<form\r\n\t\tclassName=\"editor-format-toolbar__link-container-content ta-link-search-popover\"\r\n\t\tonKeyPress={ stopKeyPropagation }\r\n\t\tonKeyDown={ onKeyDown }\r\n\t\tonSubmit={ submitLink }\r\n\t>\r\n\t\t<ThirstyURLInput\r\n\t\t\tvalue={ value }\r\n\t\t\tonChange={ onChangeInputValue }\r\n\t\t\tautocompleteRef={ autocompleteRef }\r\n\t\t\tinvalidLink={ invalidLink }\r\n\t\t\tresetInvalidLink={ resetInvalidLink }\r\n\t\t/>\r\n\t\t<IconButton icon=\"editor-break\" label={ __( 'Apply' ) } type=\"submit\" />\r\n\t</form>\r\n\t/* eslint-enable jsx-a11y/no-noninteractive-element-interactions */\r\n);\r\n\r\n/**\r\n * Affiliate link url viewer JSX element.\r\n * \r\n * @param {*} param0 Component props (destructred).\r\n */\r\nconst LinkViewerUrl = ( { url } ) => {\r\n\tconst prependedURL = prependHTTP( url );\r\n\tconst linkClassName = classnames( 'editor-format-toolbar__link-container-value', {\r\n\t\t'has-invalid-link': ! isValidHref( prependedURL ),\r\n\t} );\r\n\r\n\tif ( ! url ) {\r\n\t\treturn <span className={ linkClassName }></span>;\r\n\t}\r\n\r\n\treturn (\r\n\t\t<ExternalLink\r\n\t\t\tclassName={ linkClassName }\r\n\t\t\thref={ url }\r\n\t\t>\r\n\t\t\t{ filterURLForDisplay( safeDecodeURI( url ) ) }\r\n\t\t</ExternalLink>\r\n\t);\r\n};\r\n\r\n/**\r\n * Affiliate link viewer JSX element.\r\n * \r\n * @param {*} param0 Component props (destructred).\r\n */\r\nconst LinkViewer = ( { url, editLink } ) => {\r\n\treturn (\r\n\t\t// Disable reason: KeyPress must be suppressed so the block doesn't hide the toolbar\r\n\t\t/* eslint-disable jsx-a11y/no-static-element-interactions */\r\n\t\t<div\r\n\t\t\tclassName=\"editor-format-toolbar__link-container-content\"\r\n\t\t\tonKeyPress={ stopKeyPropagation }\r\n\t\t>\r\n\t\t\t<LinkViewerUrl url={ url } />\r\n\t\t\t<IconButton icon=\"edit\" label={ __( 'Edit' ) } onClick={ editLink } />\r\n\t\t</div>\r\n\t\t/* eslint-enable jsx-a11y/no-static-element-interactions */\r\n\t);\r\n};\r\n\r\n/**\r\n * Inline affiliate link UI Component.\r\n * \r\n * @since 3.6\r\n * \r\n * @param {*} param0 Component props (destructred).\r\n */\r\nclass InlineAffiliateLinkUI extends Component {\r\n\tconstructor() {\r\n\t\tsuper( ...arguments );\r\n\r\n\t\tthis.editLink = this.editLink.bind( this );\r\n\t\tthis.submitLink = this.submitLink.bind( this );\r\n\t\tthis.onKeyDown = this.onKeyDown.bind( this );\r\n\t\tthis.onChangeInputValue = this.onChangeInputValue.bind( this );\r\n\t\tthis.onClickOutside = this.onClickOutside.bind( this );\r\n\t\tthis.resetState = this.resetState.bind( this );\r\n\t\tthis.autocompleteRef = createRef();\r\n\t\tthis.resetInvalidLink = this.resetInvalidLink.bind( this );\r\n\r\n\t\tthis.state = {\r\n\t\t\tinputValue : '',\r\n\t\t\tlinkid : 0,\r\n\t\t\tpost : null,\r\n\t\t\tinvalidLink : false\r\n\t\t};\r\n\t}\r\n\r\n\t/**\r\n\t * Stop the key event from propagating up to ObserveTyping.startTypingInTextField.\r\n\t * \r\n\t * @since 3.6\r\n\t * \r\n\t * @param {Object} event Event object.\r\n\t */\r\n\tonKeyDown( event ) {\r\n\t\tif ( [ LEFT, DOWN, RIGHT, UP, BACKSPACE, ENTER ].indexOf( event.keyCode ) > -1 ) {\r\n\t\t\tevent.stopPropagation();\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Callback to set state when input value is changed.\r\n\t * \r\n\t * @since 3.6\r\n\t * \r\n\t * @param {*} inputValue \r\n\t * @param {*} post \r\n\t */\r\n\tonChangeInputValue( inputValue , post = null ) {\r\n\t\tconst linkid = post ? post.id : 0;\r\n\t\tthis.setState( { inputValue , linkid , post } );\r\n\t}\r\n\r\n\t/**\r\n\t * Callback to set state when edit affiliate link (already inserted) is triggered.\r\n\t * \r\n\t * @since 3.6\r\n\t * \r\n\t * @param {*} event \r\n\t */\r\n\teditLink( event ) {\r\n\t\tthis.setState( { editLink: true } );\r\n\t\tevent.preventDefault();\r\n\t}\r\n\r\n\t/**\r\n\t * Callback to apply the affiliate link format to the selected text or position in the active block.\r\n\t * \r\n\t * @since 3.6\r\n\t * \r\n\t * @param {*} event \r\n\t */\r\n\tsubmitLink( event ) {\r\n\t\tconst { isActive, value, onChange, speak } = this.props;\r\n\t\tconst { inputValue, linkid , post } = this.state;\r\n\t\tconst url = prependHTTP( inputValue );\r\n\t\tconst selectedText = getTextContent( slice( value ) );\r\n\t\tconst format = createLinkFormat( {\r\n\t\t\turl,\r\n\t\t\tlinkid,\r\n\t\t\ttext: selectedText,\r\n\t\t} );\r\n\r\n\t\tevent.preventDefault();\r\n\r\n\t\tif ( ! linkid || ! post ) {\r\n\t\t\tthis.setState( { invalidLink : true } )\r\n\t\t\treturn;\r\n\t\t} \r\n\r\n\t\tif ( isCollapsed( value ) && ! isActive ) {\r\n\t\t\tconst toInsert = applyFormat( create( { text: post.title } ), format, 0, url.length );\r\n\t\t\tonChange( insert( value, toInsert ) );\r\n\t\t} else {\r\n\t\t\tonChange( applyFormat( value, format ) );\r\n\t\t}\r\n\r\n\t\tthis.resetState();\r\n\r\n\t\tif ( ! isValidHref( url ) ) {\r\n\t\t\tspeak( __( 'Warning: the link has been inserted but may have errors. Please test it.' ), 'assertive' );\r\n\t\t} else if ( isActive ) {\r\n\t\t\tspeak( __( 'Link edited.' ), 'assertive' );\r\n\t\t} else {\r\n\t\t\tspeak( __( 'Link inserted' ), 'assertive' );\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Callback to run when users clicks outside the popover UI.\r\n\t * \r\n\t * @since 3.6\r\n\t * \r\n\t * @param {*} event \r\n\t */\r\n\tonClickOutside( event ) {\r\n\t\t// The autocomplete suggestions list renders in a separate popover (in a portal),\r\n\t\t// so onClickOutside fails to detect that a click on a suggestion occured in the\r\n\t\t// LinkContainer. Detect clicks on autocomplete suggestions using a ref here, and\r\n\t\t// return to avoid the popover being closed.\r\n\t\tconst autocompleteElement = this.autocompleteRef.current;\r\n\t\tif ( autocompleteElement && autocompleteElement.contains( event.target ) ) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tthis.resetState();\r\n\t}\r\n\r\n\t/**\r\n\t * Reset state callback.\r\n\t * \r\n\t * @since 3.6\r\n\t */\r\n\tresetState() {\r\n\t\tthis.props.stopAddingLink();\r\n\t\tthis.setState( { inputValue : '' , editLink: false } );\r\n\t\tthis.resetInvalidLink();\r\n\t}\r\n\r\n\t/**\r\n\t * Reset invalid link state callback. Separated as we need to run this independently from resetState() callback.\r\n\t * \r\n\t * @since 3.6\r\n\t */\r\n\tresetInvalidLink() {\r\n\t\tthis.setState( { invalidLink : false } );\r\n\t}\r\n\r\n\t/**\r\n\t * Component render method.\r\n\t *\r\n\t * @since 3.6\r\n\t */\r\n\trender() {\r\n\t\tconst { isActive, activeAttributes: { url , linkid }, addingLink, value, onChange } = this.props;\r\n\r\n\t\tif ( ! isActive && ! addingLink ) {\r\n\t\t\treturn null;\r\n\t\t}\r\n\r\n\t\tconst { inputValue , invalidLink } = this.state;\r\n\t\tconst showInput = isShowingInput( this.props, this.state );\r\n\r\n\t\treturn (\r\n\t\t\t<ThirstyPositionedAtSelection\r\n\t\t\t\tkey={ `${ value.start }${ value.end }` /* Used to force rerender on selection change */ }\r\n\t\t\t>\r\n\t\t\t\t<ThirstyURLPopover\r\n\t\t\t\t\tonClickOutside={ this.onClickOutside }\r\n\t\t\t\t\tonClose={ this.resetState }\r\n\t\t\t\t\tfocusOnMount={ showInput ? 'firstElement' : false }\r\n\t\t\t\t\tinvalidLink={ invalidLink }\r\n\t\t\t\t>\r\n\t\t\t\t\t{ showInput ? (\r\n\t\t\t\t\t\t<LinkEditor\r\n\t\t\t\t\t\t\tvalue={ inputValue }\r\n\t\t\t\t\t\t\tonChangeInputValue={ this.onChangeInputValue }\r\n\t\t\t\t\t\t\tonKeyDown={ this.onKeyDown }\r\n\t\t\t\t\t\t\tsubmitLink={ this.submitLink }\r\n\t\t\t\t\t\t\tautocompleteRef={ this.autocompleteRef }\r\n\t\t\t\t\t\t\tupdateLinkId= { this.updateLinkId }\r\n\t\t\t\t\t\t\tinvalidLink={ invalidLink }\r\n\t\t\t\t\t\t\tresetInvalidLink={ this.resetInvalidLink }\r\n\t\t\t\t\t\t/>\r\n\t\t\t\t\t) : (\r\n\t\t\t\t\t\t<LinkViewer\r\n\t\t\t\t\t\t\turl={ url }\r\n\t\t\t\t\t\t\teditLink={ this.editLink }\r\n\t\t\t\t\t\t/>\r\n\t\t\t\t\t) }\r\n\t\t\t\t</ThirstyURLPopover>\r\n\t\t\t</ThirstyPositionedAtSelection>\r\n\t\t);\r\n\t}\r\n}\r\n\r\nexport default withSpokenMessages( InlineAffiliateLinkUI );\n\n\n// WEBPACK FOOTER //\n// ./src/formats/ta-link/inline.js","const { Component } = wp.element;\r\nconst { getOffsetParent , getRectangleFromRange } = wp.dom;\r\n\r\n/**\r\n * Returns a style object for applying as `position: absolute` for an element\r\n * relative to the bottom-center of the current selection. Includes `top` and\r\n * `left` style properties.\r\n * \r\n * @since 3.6\r\n *\r\n * @return {Object} Style object.\r\n */\r\nfunction getCurrentCaretPositionStyle() {\r\n\tconst selection = window.getSelection();\r\n\r\n\t// Unlikely, but in the case there is no selection, return empty styles so\r\n\t// as to avoid a thrown error by `Selection#getRangeAt` on invalid index.\r\n\tif ( selection.rangeCount === 0 ) {\r\n\t\treturn {};\r\n\t}\r\n\r\n\t// Get position relative viewport.\r\n\tconst rect = getRectangleFromRange( selection.getRangeAt( 0 ) );\r\n\tlet top = rect.top + rect.height;\r\n\tlet left = rect.left + ( rect.width / 2 );\r\n\r\n\t// Offset by positioned parent, if one exists.\r\n\tconst offsetParent = getOffsetParent( selection.anchorNode );\r\n\tif ( offsetParent ) {\r\n\t\tconst parentRect = offsetParent.getBoundingClientRect();\r\n\t\ttop -= parentRect.top;\r\n\t\tleft -= parentRect.left;\r\n\t}\r\n\r\n\treturn { top, left };\r\n}\r\n\r\n/**\r\n * Component which renders itself positioned under the current caret selection.\r\n * The position is calculated at the time of the component being mounted, so it\r\n * should only be mounted after the desired selection has been made.\r\n * \r\n * @since 3.6\r\n *\r\n * @type {WPComponent}\r\n */\r\nclass ThirstyPositionedAtSelection extends Component {\r\n\r\n\t/**\r\n\t * Component constructor method.\r\n\t * \r\n\t * @since 3.6\r\n\t */\r\n\tconstructor() {\r\n\t\tsuper( ...arguments );\r\n\r\n\t\tthis.state = {\r\n\t\t\tstyle: getCurrentCaretPositionStyle(),\r\n\t\t};\r\n\t}\r\n\r\n\t/**\r\n\t * Component render method.\r\n\t * \r\n\t * @since 3.6\r\n\t */\r\n\trender() {\r\n\t\tconst { children } = this.props;\r\n\t\tconst { style } = this.state;\r\n\r\n\t\treturn (\r\n\t\t\t<div className=\"editor-format-toolbar__selection-position\" style={ style }>\r\n\t\t\t\t{ children }\r\n\t\t\t</div>\r\n\t\t);\r\n\t}\r\n}\r\n\r\nexport default ThirstyPositionedAtSelection;\n\n\n// WEBPACK FOOTER //\n// ./src/formats/ta-link/positioned-at-selection.js","const { startsWith } = lodash;\r\n\r\nconst {\r\n getProtocol,\r\n\tisValidProtocol,\r\n\tgetAuthority,\r\n\tisValidAuthority,\r\n\tgetPath,\r\n\tisValidPath,\r\n\tgetQueryString,\r\n\tisValidQueryString,\r\n\tgetFragment,\r\n\tisValidFragment,\r\n} = wp.url;\r\n\r\n/**\r\n * Check for issues with the provided href.\r\n * \r\n * @since 3.6\r\n *\r\n * @param {string} href The href.\r\n * @return {boolean} Is the href invalid?\r\n */\r\nexport function isValidHref( href ) {\r\n\tif ( ! href ) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\tconst trimmedHref = href.trim();\r\n\r\n\tif ( ! trimmedHref ) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\t// Does the href start with something that looks like a URL protocol?\r\n\tif ( /^\\S+:/.test( trimmedHref ) ) {\r\n\t\tconst protocol = getProtocol( trimmedHref );\r\n\t\tif ( ! isValidProtocol( protocol ) ) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\t// Add some extra checks for http(s) URIs, since these are the most common use-case.\r\n\t\t// This ensures URIs with an http protocol have exactly two forward slashes following the protocol.\r\n\t\tif ( startsWith( protocol, 'http' ) && ! /^https?:\\/\\/[^\\/\\s]/i.test( trimmedHref ) ) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tconst authority = getAuthority( trimmedHref );\r\n\t\tif ( ! isValidAuthority( authority ) ) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tconst path = getPath( trimmedHref );\r\n\t\tif ( path && ! isValidPath( path ) ) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tconst queryString = getQueryString( trimmedHref );\r\n\t\tif ( queryString && ! isValidQueryString( queryString ) ) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tconst fragment = getFragment( trimmedHref );\r\n\t\tif ( fragment && ! isValidFragment( fragment ) ) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}\r\n\r\n\t// Validate anchor links.\r\n\tif ( startsWith( trimmedHref, '#' ) && ! isValidFragment( trimmedHref ) ) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\treturn true;\r\n}\n\n\n// WEBPACK FOOTER //\n// ./src/formats/ta-link/utils.js","const { __ } = wp.i18n;\r\nconst { Component } = wp.element;\r\nconst { Popover , IconButton } = wp.components;\r\n\r\n/**\r\n * Custom URL Popover component.\r\n * \r\n * @since 3.6\r\n */\r\nclass ThirstyURLPopover extends Component {\r\n\r\n /**\r\n * Component constructor method.\r\n * \r\n * @since 3.6\r\n */\r\n\tconstructor() {\r\n super( ...arguments );\r\n \r\n this.toggleSettingsVisibility = this.toggleSettingsVisibility.bind( this );\r\n\r\n\t\tthis.state = {\r\n\t\t\tisSettingsExpanded: false,\r\n\t\t};\r\n }\r\n \r\n /**\r\n * Component constructor.\r\n * \r\n * @since 3.6\r\n */\r\n toggleSettingsVisibility() {\r\n\t\tthis.setState( {\r\n\t\t\tisSettingsExpanded: ! this.state.isSettingsExpanded,\r\n\t\t} );\r\n\t}\r\n\r\n /**\r\n * Component render method.\r\n * \r\n * @since 3.6\r\n */\r\n\trender() {\r\n\t\tconst {\r\n\t\t\tchildren,\r\n\t\t\trenderSettings,\r\n\t\t\tonClose,\r\n onClickOutside,\r\n invalidLink,\r\n\t\t\tposition = 'bottom center',\r\n\t\t\tfocusOnMount = 'firstElement',\r\n\t\t} = this.props;\r\n\r\n\t\tconst {\r\n\t\t\tisSettingsExpanded,\r\n } = this.state;\r\n \r\n const showSettings = !! renderSettings && isSettingsExpanded;\r\n\r\n\t\treturn (\r\n\t\t\t<Popover\r\n\t\t\t\tclassName=\"ta-url-popover editor-url-popover\"\r\n\t\t\t\tfocusOnMount={ focusOnMount }\r\n\t\t\t\tposition={ position }\r\n\t\t\t\tonClose={ onClose }\r\n\t\t\t\tonClickOutside={ onClickOutside }\r\n\t\t\t>\r\n\t\t\t\t<div className=\"editor-url-popover__row\">\r\n { children }\r\n { !! renderSettings && (\r\n\t\t\t\t\t\t<IconButton\r\n\t\t\t\t\t\t\tclassName=\"editor-url-popover__settings-toggle\"\r\n\t\t\t\t\t\t\ticon=\"ellipsis\"\r\n\t\t\t\t\t\t\tlabel={ __( 'Link Settings' ) }\r\n\t\t\t\t\t\t\tonClick={ this.toggleSettingsVisibility }\r\n\t\t\t\t\t\t\taria-expanded={ isSettingsExpanded }\r\n\t\t\t\t\t\t/>\r\n ) }\r\n\t\t\t\t</div>\r\n { showSettings && (\r\n\t\t\t\t\t<div className=\"editor-url-popover__row editor-url-popover__settings\">\r\n\t\t\t\t\t\t{ renderSettings() }\r\n\t\t\t\t\t</div>\r\n ) }\r\n { invalidLink && <div class=\"ta-invalid-link\">{ __( 'Invalid affiliate link' ) }</div> }\r\n\t\t\t</Popover>\r\n\t\t);\r\n\t}\r\n}\r\n\r\nexport default ThirstyURLPopover;\n\n\n// WEBPACK FOOTER //\n// ./src/formats/ta-link/url-popover.js","import classnames from 'classnames';\r\nimport scrollIntoView from 'dom-scroll-into-view';\r\n\r\nconst { __ } = wp.i18n;\r\nconst { throttle } = lodash;\r\nconst { Component , createRef } = wp.element;\r\nconst { UP, DOWN, ENTER, TAB } = wp.keycodes;\r\nconst { Spinner, withSpokenMessages, Popover } = wp.components;\r\nconst { withInstanceId } = wp.compose;\r\n\r\n// Since URLInput is rendered in the context of other inputs, but should be\r\n// considered a separate modal node, prevent keyboard events from propagating\r\n// as being considered from the input.\r\nconst stopEventPropagation = ( event ) => event.stopPropagation();\r\n\r\n/**\r\n * Custom URL Input component.\r\n * \r\n * @since 3.6\r\n */\r\nclass ThirstyURLInput extends Component {\r\n\r\n /**\r\n * Component constructor method.\r\n * \r\n * @since 3.6\r\n * \r\n * @param {*} param0 \r\n */\r\n\tconstructor( { autocompleteRef } ) {\r\n\t\tsuper( ...arguments );\r\n\r\n\t\tthis.onChange = this.onChange.bind( this );\r\n\t\tthis.onKeyDown = this.onKeyDown.bind( this );\r\n\t\tthis.autocompleteRef = autocompleteRef || createRef();\r\n\t\tthis.inputRef = createRef();\r\n\t\tthis.updateSuggestions = throttle( this.updateSuggestions.bind( this ), 200 );\r\n\r\n\t\tthis.suggestionNodes = [];\r\n\r\n\t\tthis.state = {\r\n\t\t\tposts: [],\r\n\t\t\tshowSuggestions: false,\r\n\t\t\tselectedSuggestion: null,\r\n\t\t};\r\n\t}\r\n\r\n /**\r\n * Component did update method.\r\n * \r\n * @since 3.6\r\n */\r\n\tcomponentDidUpdate() {\r\n\t\tconst { showSuggestions, selectedSuggestion } = this.state;\r\n\t\t// only have to worry about scrolling selected suggestion into view\r\n\t\t// when already expanded\r\n\t\tif ( showSuggestions && selectedSuggestion !== null && ! this.scrollingIntoView ) {\r\n\t\t\tthis.scrollingIntoView = true;\r\n\t\t\tscrollIntoView( this.suggestionNodes[ selectedSuggestion ], this.autocompleteRef.current, {\r\n\t\t\t\tonlyScrollIfNeeded: true,\r\n\t\t\t} );\r\n\r\n\t\t\tsetTimeout( () => {\r\n\t\t\t\tthis.scrollingIntoView = false;\r\n\t\t\t}, 100 );\r\n\t\t}\r\n\t}\r\n\r\n /**\r\n * Component unmount method.\r\n * \r\n * @since 3.6\r\n */\r\n\tcomponentWillUnmount() {\r\n\t\tdelete this.suggestionsRequest;\r\n\t}\r\n\r\n /**\r\n * Bind suggestion to node.\r\n * \r\n * @param {*} index \r\n */\r\n\tbindSuggestionNode( index ) {\r\n\t\treturn ( ref ) => {\r\n\t\t\tthis.suggestionNodes[ index ] = ref;\r\n\t\t};\r\n\t}\r\n\r\n /**\r\n * Callback to show suggestions based on value inputted on search field.\r\n * \r\n * @since 3.6\r\n * \r\n * @param {*} value \r\n */\r\n\tupdateSuggestions( value ) {\r\n\t\t// Show the suggestions after typing at least 2 characters\r\n\t\t// and also for URLs\r\n\t\tif ( value.length < 2 || /^https?:/.test( value ) ) {\r\n\t\t\tthis.setState( {\r\n\t\t\t\tshowSuggestions: false,\r\n\t\t\t\tselectedSuggestion: null,\r\n\t\t\t\tloading: false,\r\n\t\t\t} );\r\n\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tthis.setState( {\r\n\t\t\tshowSuggestions: true,\r\n\t\t\tselectedSuggestion: null,\r\n\t\t\tloading: true,\r\n\t\t} );\r\n\r\n const formData = new FormData();\r\n formData.append( \"action\" , \"search_affiliate_links_query\" );\r\n formData.append( \"keyword\" , value );\r\n formData.append( \"paged\" , 1 );\r\n formData.append( \"gutenberg\" , true );\r\n \r\n // We are getting data via the WP AJAX instead of rest API as it is not possible yet\r\n // to filter results with category value. This is to prepare next update to add category filter.\r\n const request = fetch( ajaxurl , {\r\n method : \"POST\",\r\n body : formData\r\n } );\r\n\r\n request\r\n .then( response => response.json() )\r\n .then( ( response ) => {\r\n\r\n if ( ! response.affiliate_links ) return;\r\n\r\n const posts = response.affiliate_links;\r\n\r\n\t\t\t// A fetch Promise doesn't have an abort option. It's mimicked by\r\n\t\t\t// comparing the request reference in on the instance, which is\r\n\t\t\t// reset or deleted on subsequent requests or unmounting.\r\n\t\t\tif ( this.suggestionsRequest !== request ) {\r\n\t\t\t\treturn;\r\n }\r\n\r\n\t\t\tthis.setState( {\r\n\t\t\t\tposts,\r\n\t\t\t\tloading: false,\r\n } );\r\n\r\n\t\t\tif ( !! posts.length ) {\r\n\t\t\t\tthis.props.debouncedSpeak( sprintf( _n(\r\n\t\t\t\t\t'%d result found, use up and down arrow keys to navigate.',\r\n\t\t\t\t\t'%d results found, use up and down arrow keys to navigate.',\r\n\t\t\t\t\tposts.length\r\n\t\t\t\t), posts.length ), 'assertive' );\r\n\t\t\t} else {\r\n\t\t\t\tthis.props.debouncedSpeak( __( 'No results.' ), 'assertive' );\r\n }\r\n\r\n\t\t} ).catch( () => {\r\n\t\t\tif ( this.suggestionsRequest === request ) {\r\n\t\t\t\tthis.setState( {\r\n\t\t\t\t\tloading: false,\r\n\t\t\t\t} );\r\n\t\t\t}\r\n\t\t} );\r\n\r\n\t\tthis.suggestionsRequest = request;\r\n\t}\r\n\r\n /**\r\n * Search input value change event callback method.\r\n * \r\n * @since 3.6\r\n * \r\n * @param {*} event \r\n */\r\n\tonChange( event ) {\r\n this.props.resetInvalidLink();\r\n\t\tconst inputValue = event.target.value;\r\n\t\tthis.props.onChange( inputValue );\r\n\t\tthis.updateSuggestions( inputValue );\r\n\t}\r\n\r\n /**\r\n * Keydown event callback. Handles selecting result via keyboard.\r\n * \r\n * @since 3.6\r\n * \r\n * @param {*} event \r\n */\r\n\tonKeyDown( event ) {\r\n\t\tconst { showSuggestions, selectedSuggestion, posts, loading } = this.state;\r\n\t\t// If the suggestions are not shown or loading, we shouldn't handle the arrow keys\r\n\t\t// We shouldn't preventDefault to allow block arrow keys navigation\r\n\t\tif ( ! showSuggestions || ! posts.length || loading ) {\r\n\t\t\t// In the Windows version of Firefox the up and down arrows don't move the caret\r\n\t\t\t// within an input field like they do for Mac Firefox/Chrome/Safari. This causes\r\n\t\t\t// a form of focus trapping that is disruptive to the user experience. This disruption\r\n\t\t\t// only happens if the caret is not in the first or last position in the text input.\r\n\t\t\t// See: https://github.com/WordPress/gutenberg/issues/5693#issuecomment-436684747\r\n\t\t\tswitch ( event.keyCode ) {\r\n\t\t\t\t// When UP is pressed, if the caret is at the start of the text, move it to the 0\r\n\t\t\t\t// position.\r\n\t\t\t\tcase UP: {\r\n\t\t\t\t\tif ( 0 !== event.target.selectionStart ) {\r\n\t\t\t\t\t\tevent.stopPropagation();\r\n\t\t\t\t\t\tevent.preventDefault();\r\n\r\n\t\t\t\t\t\t// Set the input caret to position 0\r\n\t\t\t\t\t\tevent.target.setSelectionRange( 0, 0 );\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\t// When DOWN is pressed, if the caret is not at the end of the text, move it to the\r\n\t\t\t\t// last position.\r\n\t\t\t\tcase DOWN: {\r\n\t\t\t\t\tif ( this.props.value.length !== event.target.selectionStart ) {\r\n\t\t\t\t\t\tevent.stopPropagation();\r\n\t\t\t\t\t\tevent.preventDefault();\r\n\r\n\t\t\t\t\t\t// Set the input caret to the last position\r\n\t\t\t\t\t\tevent.target.setSelectionRange( this.props.value.length, this.props.value.length );\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tconst post = this.state.posts[ this.state.selectedSuggestion ];\r\n\r\n\t\tswitch ( event.keyCode ) {\r\n\t\t\tcase UP: {\r\n\t\t\t\tevent.stopPropagation();\r\n\t\t\t\tevent.preventDefault();\r\n\t\t\t\tconst previousIndex = ! selectedSuggestion ? posts.length - 1 : selectedSuggestion - 1;\r\n\t\t\t\tthis.setState( {\r\n\t\t\t\t\tselectedSuggestion: previousIndex,\r\n\t\t\t\t} );\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tcase DOWN: {\r\n\t\t\t\tevent.stopPropagation();\r\n\t\t\t\tevent.preventDefault();\r\n\t\t\t\tconst nextIndex = selectedSuggestion === null || ( selectedSuggestion === posts.length - 1 ) ? 0 : selectedSuggestion + 1;\r\n\t\t\t\tthis.setState( {\r\n\t\t\t\t\tselectedSuggestion: nextIndex,\r\n\t\t\t\t} );\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tcase TAB: {\r\n\t\t\t\tif ( this.state.selectedSuggestion !== null ) {\r\n\t\t\t\t\tthis.selectLink( post );\r\n\t\t\t\t\t// Announce a link has been selected when tabbing away from the input field.\r\n\t\t\t\t\tthis.props.speak( __( 'Link selected' ) );\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tcase ENTER: {\r\n\t\t\t\tif ( this.state.selectedSuggestion !== null ) {\r\n\t\t\t\t\tevent.stopPropagation();\r\n\t\t\t\t\tthis.selectLink( post );\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n /**\r\n * Set state when an affiliate link is selected.\r\n * \r\n * @since 3.6\r\n * \r\n * @param {*} post \r\n */\r\n\tselectLink( post ) {\r\n\t\tthis.props.onChange( post.link, post );\r\n\t\tthis.setState( {\r\n\t\t\tselectedSuggestion: null,\r\n\t\t\tshowSuggestions: false,\r\n\t\t} );\r\n\t}\r\n\r\n /**\r\n * Callback handler for when affiliate link is selected.\r\n * \r\n * @param {*} post \r\n */\r\n\thandleOnClick( post ) {\r\n\t\tthis.selectLink( post );\r\n\t\t// Move focus to the input field when a link suggestion is clicked.\r\n\t\tthis.inputRef.current.focus();\r\n\t}\r\n\r\n /**\r\n * Component render method.\r\n * \r\n * @since 3.6\r\n */\r\n\trender() {\r\n\t\tconst { value = '', autoFocus = true, instanceId , invalidLink } = this.props;\r\n\t\tconst { showSuggestions, posts, selectedSuggestion, loading } = this.state;\r\n\t\t/* eslint-disable jsx-a11y/no-autofocus */\r\n\t\treturn (\r\n\t\t\t<div className=\"editor-url-input\">\r\n\t\t\t\t<input\r\n\t\t\t\t\tautoFocus={ autoFocus }\r\n\t\t\t\t\ttype=\"text\"\r\n\t\t\t\t\taria-label={ __( 'URL' ) }\r\n\t\t\t\t\trequired\r\n\t\t\t\t\tvalue={ value }\r\n\t\t\t\t\tonChange={ this.onChange }\r\n\t\t\t\t\tonInput={ stopEventPropagation }\r\n\t\t\t\t\tplaceholder={ __( 'Paste URL or type to search' ) }\r\n\t\t\t\t\tonKeyDown={ this.onKeyDown }\r\n\t\t\t\t\trole=\"combobox\"\r\n\t\t\t\t\taria-expanded={ showSuggestions }\r\n\t\t\t\t\taria-autocomplete=\"list\"\r\n\t\t\t\t\taria-owns={ `editor-url-input-suggestions-${ instanceId }` }\r\n\t\t\t\t\taria-activedescendant={ selectedSuggestion !== null ? `editor-url-input-suggestion-${ instanceId }-${ selectedSuggestion }` : undefined }\r\n\t\t\t\t\tref={ this.inputRef }\r\n\t\t\t\t/>\r\n\r\n\t\t\t\t{ ( loading ) && <Spinner /> }\r\n\r\n\t\t\t\t{ showSuggestions && !! posts.length && ! invalidLink &&\r\n\t\t\t\t\t<Popover position=\"bottom\" noArrow focusOnMount={ false }>\r\n\t\t\t\t\t\t<div\r\n\t\t\t\t\t\t\tclassName=\"editor-url-input__suggestions\"\r\n\t\t\t\t\t\t\tid={ `editor-url-input-suggestions-${ instanceId }` }\r\n\t\t\t\t\t\t\tref={ this.autocompleteRef }\r\n\t\t\t\t\t\t\trole=\"listbox\"\r\n\t\t\t\t\t\t>\r\n\t\t\t\t\t\t\t{ posts.map( ( post, index ) => (\r\n\t\t\t\t\t\t\t\t<button\r\n\t\t\t\t\t\t\t\t\tkey={ post.id }\r\n\t\t\t\t\t\t\t\t\trole=\"option\"\r\n\t\t\t\t\t\t\t\t\ttabIndex=\"-1\"\r\n\t\t\t\t\t\t\t\t\tid={ `editor-url-input-suggestion-${ instanceId }-${ index }` }\r\n\t\t\t\t\t\t\t\t\tref={ this.bindSuggestionNode( index ) }\r\n\t\t\t\t\t\t\t\t\tclassName={ classnames( 'editor-url-input__suggestion', {\r\n\t\t\t\t\t\t\t\t\t\t'is-selected': index === selectedSuggestion,\r\n\t\t\t\t\t\t\t\t\t} ) }\r\n\t\t\t\t\t\t\t\t\tonClick={ () => this.handleOnClick( post ) }\r\n\t\t\t\t\t\t\t\t\taria-selected={ index === selectedSuggestion }\r\n\t\t\t\t\t\t\t\t>\r\n\t\t\t\t\t\t\t\t\t{ post.title || __( '(no title)' ) }\r\n\t\t\t\t\t\t\t\t</button>\r\n\t\t\t\t\t\t\t) ) }\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</Popover>\r\n\t\t\t\t}\r\n\t\t\t</div>\r\n\t\t);\r\n\t\t/* eslint-enable jsx-a11y/no-autofocus */\r\n\t}\r\n}\r\n\r\nexport default withSpokenMessages( withInstanceId( ThirstyURLInput ) );\n\n\n// WEBPACK FOOTER //\n// ./src/formats/ta-link/url-input.js","'use strict';\n\nmodule.exports = require('./dom-scroll-into-view');\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/dom-scroll-into-view/lib/index.js\n// module id = 15\n// module chunks = 0","'use strict';\n\nvar util = require('./util');\n\nfunction scrollIntoView(elem, container, config) {\n config = config || {};\n // document 归一化到 window\n if (container.nodeType === 9) {\n container = util.getWindow(container);\n }\n\n var allowHorizontalScroll = config.allowHorizontalScroll;\n var onlyScrollIfNeeded = config.onlyScrollIfNeeded;\n var alignWithTop = config.alignWithTop;\n var alignWithLeft = config.alignWithLeft;\n var offsetTop = config.offsetTop || 0;\n var offsetLeft = config.offsetLeft || 0;\n var offsetBottom = config.offsetBottom || 0;\n var offsetRight = config.offsetRight || 0;\n\n allowHorizontalScroll = allowHorizontalScroll === undefined ? true : allowHorizontalScroll;\n\n var isWin = util.isWindow(container);\n var elemOffset = util.offset(elem);\n var eh = util.outerHeight(elem);\n var ew = util.outerWidth(elem);\n var containerOffset = undefined;\n var ch = undefined;\n var cw = undefined;\n var containerScroll = undefined;\n var diffTop = undefined;\n var diffBottom = undefined;\n var win = undefined;\n var winScroll = undefined;\n var ww = undefined;\n var wh = undefined;\n\n if (isWin) {\n win = container;\n wh = util.height(win);\n ww = util.width(win);\n winScroll = {\n left: util.scrollLeft(win),\n top: util.scrollTop(win)\n };\n // elem 相对 container 可视视窗的距离\n diffTop = {\n left: elemOffset.left - winScroll.left - offsetLeft,\n top: elemOffset.top - winScroll.top - offsetTop\n };\n diffBottom = {\n left: elemOffset.left + ew - (winScroll.left + ww) + offsetRight,\n top: elemOffset.top + eh - (winScroll.top + wh) + offsetBottom\n };\n containerScroll = winScroll;\n } else {\n containerOffset = util.offset(container);\n ch = container.clientHeight;\n cw = container.clientWidth;\n containerScroll = {\n left: container.scrollLeft,\n top: container.scrollTop\n };\n // elem 相对 container 可视视窗的距离\n // 注意边框, offset 是边框到根节点\n diffTop = {\n left: elemOffset.left - (containerOffset.left + (parseFloat(util.css(container, 'borderLeftWidth')) || 0)) - offsetLeft,\n top: elemOffset.top - (containerOffset.top + (parseFloat(util.css(container, 'borderTopWidth')) || 0)) - offsetTop\n };\n diffBottom = {\n left: elemOffset.left + ew - (containerOffset.left + cw + (parseFloat(util.css(container, 'borderRightWidth')) || 0)) + offsetRight,\n top: elemOffset.top + eh - (containerOffset.top + ch + (parseFloat(util.css(container, 'borderBottomWidth')) || 0)) + offsetBottom\n };\n }\n\n if (diffTop.top < 0 || diffBottom.top > 0) {\n // 强制向上\n if (alignWithTop === true) {\n util.scrollTop(container, containerScroll.top + diffTop.top);\n } else if (alignWithTop === false) {\n util.scrollTop(container, containerScroll.top + diffBottom.top);\n } else {\n // 自动调整\n if (diffTop.top < 0) {\n util.scrollTop(container, containerScroll.top + diffTop.top);\n } else {\n util.scrollTop(container, containerScroll.top + diffBottom.top);\n }\n }\n } else {\n if (!onlyScrollIfNeeded) {\n alignWithTop = alignWithTop === undefined ? true : !!alignWithTop;\n if (alignWithTop) {\n util.scrollTop(container, containerScroll.top + diffTop.top);\n } else {\n util.scrollTop(container, containerScroll.top + diffBottom.top);\n }\n }\n }\n\n if (allowHorizontalScroll) {\n if (diffTop.left < 0 || diffBottom.left > 0) {\n // 强制向上\n if (alignWithLeft === true) {\n util.scrollLeft(container, containerScroll.left + diffTop.left);\n } else if (alignWithLeft === false) {\n util.scrollLeft(container, containerScroll.left + diffBottom.left);\n } else {\n // 自动调整\n if (diffTop.left < 0) {\n util.scrollLeft(container, containerScroll.left + diffTop.left);\n } else {\n util.scrollLeft(container, containerScroll.left + diffBottom.left);\n }\n }\n } else {\n if (!onlyScrollIfNeeded) {\n alignWithLeft = alignWithLeft === undefined ? true : !!alignWithLeft;\n if (alignWithLeft) {\n util.scrollLeft(container, containerScroll.left + diffTop.left);\n } else {\n util.scrollLeft(container, containerScroll.left + diffBottom.left);\n }\n }\n }\n }\n}\n\nmodule.exports = scrollIntoView;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/dom-scroll-into-view/lib/dom-scroll-into-view.js\n// module id = 16\n// module chunks = 0","'use strict';\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol ? \"symbol\" : typeof obj; };\n\nvar RE_NUM = /[\\-+]?(?:\\d*\\.|)\\d+(?:[eE][\\-+]?\\d+|)/.source;\n\nfunction getClientPosition(elem) {\n var box = undefined;\n var x = undefined;\n var y = undefined;\n var doc = elem.ownerDocument;\n var body = doc.body;\n var docElem = doc && doc.documentElement;\n // 根据 GBS 最新数据,A-Grade Browsers 都已支持 getBoundingClientRect 方法,不用再考虑传统的实现方式\n box = elem.getBoundingClientRect();\n\n // 注:jQuery 还考虑减去 docElem.clientLeft/clientTop\n // 但测试发现,这样反而会导致当 html 和 body 有边距/边框样式时,获取的值不正确\n // 此外,ie6 会忽略 html 的 margin 值,幸运地是没有谁会去设置 html 的 margin\n\n x = box.left;\n y = box.top;\n\n // In IE, most of the time, 2 extra pixels are added to the top and left\n // due to the implicit 2-pixel inset border. In IE6/7 quirks mode and\n // IE6 standards mode, this border can be overridden by setting the\n // document element's border to zero -- thus, we cannot rely on the\n // offset always being 2 pixels.\n\n // In quirks mode, the offset can be determined by querying the body's\n // clientLeft/clientTop, but in standards mode, it is found by querying\n // the document element's clientLeft/clientTop. Since we already called\n // getClientBoundingRect we have already forced a reflow, so it is not\n // too expensive just to query them all.\n\n // ie 下应该减去窗口的边框吧,毕竟默认 absolute 都是相对窗口定位的\n // 窗口边框标准是设 documentElement ,quirks 时设置 body\n // 最好禁止在 body 和 html 上边框 ,但 ie < 9 html 默认有 2px ,减去\n // 但是非 ie 不可能设置窗口边框,body html 也不是窗口 ,ie 可以通过 html,body 设置\n // 标准 ie 下 docElem.clientTop 就是 border-top\n // ie7 html 即窗口边框改变不了。永远为 2\n // 但标准 firefox/chrome/ie9 下 docElem.clientTop 是窗口边框,即使设了 border-top 也为 0\n\n x -= docElem.clientLeft || body.clientLeft || 0;\n y -= docElem.clientTop || body.clientTop || 0;\n\n return {\n left: x,\n top: y\n };\n}\n\nfunction getScroll(w, top) {\n var ret = w['page' + (top ? 'Y' : 'X') + 'Offset'];\n var method = 'scroll' + (top ? 'Top' : 'Left');\n if (typeof ret !== 'number') {\n var d = w.document;\n // ie6,7,8 standard mode\n ret = d.documentElement[method];\n if (typeof ret !== 'number') {\n // quirks mode\n ret = d.body[method];\n }\n }\n return ret;\n}\n\nfunction getScrollLeft(w) {\n return getScroll(w);\n}\n\nfunction getScrollTop(w) {\n return getScroll(w, true);\n}\n\nfunction getOffset(el) {\n var pos = getClientPosition(el);\n var doc = el.ownerDocument;\n var w = doc.defaultView || doc.parentWindow;\n pos.left += getScrollLeft(w);\n pos.top += getScrollTop(w);\n return pos;\n}\nfunction _getComputedStyle(elem, name, computedStyle_) {\n var val = '';\n var d = elem.ownerDocument;\n var computedStyle = computedStyle_ || d.defaultView.getComputedStyle(elem, null);\n\n // https://github.com/kissyteam/kissy/issues/61\n if (computedStyle) {\n val = computedStyle.getPropertyValue(name) || computedStyle[name];\n }\n\n return val;\n}\n\nvar _RE_NUM_NO_PX = new RegExp('^(' + RE_NUM + ')(?!px)[a-z%]+#x27;, 'i');\nvar RE_POS = /^(top|right|bottom|left)#x2F;;\nvar CURRENT_STYLE = 'currentStyle';\nvar RUNTIME_STYLE = 'runtimeStyle';\nvar LEFT = 'left';\nvar PX = 'px';\n\nfunction _getComputedStyleIE(elem, name) {\n // currentStyle maybe null\n // http://msdn.microsoft.com/en-us/library/ms535231.aspx\n var ret = elem[CURRENT_STYLE] && elem[CURRENT_STYLE][name];\n\n // 当 width/height 设置为百分比时,通过 pixelLeft 方式转换的 width/height 值\n // 一开始就处理了! CUSTOM_STYLE.height,CUSTOM_STYLE.width ,cssHook 解决@2011-08-19\n // 在 ie 下不对,需要直接用 offset 方式\n // borderWidth 等值也有问题,但考虑到 borderWidth 设为百分比的概率很小,这里就不考虑了\n\n // From the awesome hack by Dean Edwards\n // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291\n // If we're not dealing with a regular pixel number\n // but a number that has a weird ending, we need to convert it to pixels\n // exclude left right for relativity\n if (_RE_NUM_NO_PX.test(ret) && !RE_POS.test(name)) {\n // Remember the original values\n var style = elem.style;\n var left = style[LEFT];\n var rsLeft = elem[RUNTIME_STYLE][LEFT];\n\n // prevent flashing of content\n elem[RUNTIME_STYLE][LEFT] = elem[CURRENT_STYLE][LEFT];\n\n // Put in the new values to get a computed value out\n style[LEFT] = name === 'fontSize' ? '1em' : ret || 0;\n ret = style.pixelLeft + PX;\n\n // Revert the changed values\n style[LEFT] = left;\n\n elem[RUNTIME_STYLE][LEFT] = rsLeft;\n }\n return ret === '' ? 'auto' : ret;\n}\n\nvar getComputedStyleX = undefined;\nif (typeof window !== 'undefined') {\n getComputedStyleX = window.getComputedStyle ? _getComputedStyle : _getComputedStyleIE;\n}\n\nfunction each(arr, fn) {\n for (var i = 0; i < arr.length; i++) {\n fn(arr[i]);\n }\n}\n\nfunction isBorderBoxFn(elem) {\n return getComputedStyleX(elem, 'boxSizing') === 'border-box';\n}\n\nvar BOX_MODELS = ['margin', 'border', 'padding'];\nvar CONTENT_INDEX = -1;\nvar PADDING_INDEX = 2;\nvar BORDER_INDEX = 1;\nvar MARGIN_INDEX = 0;\n\nfunction swap(elem, options, callback) {\n var old = {};\n var style = elem.style;\n var name = undefined;\n\n // Remember the old values, and insert the new ones\n for (name in options) {\n if (options.hasOwnProperty(name)) {\n old[name] = style[name];\n style[name] = options[name];\n }\n }\n\n callback.call(elem);\n\n // Revert the old values\n for (name in options) {\n if (options.hasOwnProperty(name)) {\n style[name] = old[name];\n }\n }\n}\n\nfunction getPBMWidth(elem, props, which) {\n var value = 0;\n var prop = undefined;\n var j = undefined;\n var i = undefined;\n for (j = 0; j < props.length; j++) {\n prop = props[j];\n if (prop) {\n for (i = 0; i < which.length; i++) {\n var cssProp = undefined;\n if (prop === 'border') {\n cssProp = prop + which[i] + 'Width';\n } else {\n cssProp = prop + which[i];\n }\n value += parseFloat(getComputedStyleX(elem, cssProp)) || 0;\n }\n }\n }\n return value;\n}\n\n/**\n * A crude way of determining if an object is a window\n * @member util\n */\nfunction isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj != null && obj == obj.window;\n}\n\nvar domUtils = {};\n\neach(['Width', 'Height'], function (name) {\n domUtils['doc' + name] = function (refWin) {\n var d = refWin.document;\n return Math.max(\n // firefox chrome documentElement.scrollHeight< body.scrollHeight\n // ie standard mode : documentElement.scrollHeight> body.scrollHeight\n d.documentElement['scroll' + name],\n // quirks : documentElement.scrollHeight 最大等于可视窗口多一点?\n d.body['scroll' + name], domUtils['viewport' + name](d));\n };\n\n domUtils['viewport' + name] = function (win) {\n // pc browser includes scrollbar in window.innerWidth\n var prop = 'client' + name;\n var doc = win.document;\n var body = doc.body;\n var documentElement = doc.documentElement;\n var documentElementProp = documentElement[prop];\n // 标准模式取 documentElement\n // backcompat 取 body\n return doc.compatMode === 'CSS1Compat' && documentElementProp || body && body[prop] || documentElementProp;\n };\n});\n\n/*\n 得到元素的大小信息\n @param elem\n @param name\n @param {String} [extra] 'padding' : (css width) + padding\n 'border' : (css width) + padding + border\n 'margin' : (css width) + padding + border + margin\n */\nfunction getWH(elem, name, extra) {\n if (isWindow(elem)) {\n return name === 'width' ? domUtils.viewportWidth(elem) : domUtils.viewportHeight(elem);\n } else if (elem.nodeType === 9) {\n return name === 'width' ? domUtils.docWidth(elem) : domUtils.docHeight(elem);\n }\n var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];\n var borderBoxValue = name === 'width' ? elem.offsetWidth : elem.offsetHeight;\n var computedStyle = getComputedStyleX(elem);\n var isBorderBox = isBorderBoxFn(elem, computedStyle);\n var cssBoxValue = 0;\n if (borderBoxValue == null || borderBoxValue <= 0) {\n borderBoxValue = undefined;\n // Fall back to computed then un computed css if necessary\n cssBoxValue = getComputedStyleX(elem, name);\n if (cssBoxValue == null || Number(cssBoxValue) < 0) {\n cssBoxValue = elem.style[name] || 0;\n }\n // Normalize '', auto, and prepare for extra\n cssBoxValue = parseFloat(cssBoxValue) || 0;\n }\n if (extra === undefined) {\n extra = isBorderBox ? BORDER_INDEX : CONTENT_INDEX;\n }\n var borderBoxValueOrIsBorderBox = borderBoxValue !== undefined || isBorderBox;\n var val = borderBoxValue || cssBoxValue;\n if (extra === CONTENT_INDEX) {\n if (borderBoxValueOrIsBorderBox) {\n return val - getPBMWidth(elem, ['border', 'padding'], which, computedStyle);\n }\n return cssBoxValue;\n }\n if (borderBoxValueOrIsBorderBox) {\n var padding = extra === PADDING_INDEX ? -getPBMWidth(elem, ['border'], which, computedStyle) : getPBMWidth(elem, ['margin'], which, computedStyle);\n return val + (extra === BORDER_INDEX ? 0 : padding);\n }\n return cssBoxValue + getPBMWidth(elem, BOX_MODELS.slice(extra), which, computedStyle);\n}\n\nvar cssShow = {\n position: 'absolute',\n visibility: 'hidden',\n display: 'block'\n};\n\n// fix #119 : https://github.com/kissyteam/kissy/issues/119\nfunction getWHIgnoreDisplay(elem) {\n var val = undefined;\n var args = arguments;\n // in case elem is window\n // elem.offsetWidth === undefined\n if (elem.offsetWidth !== 0) {\n val = getWH.apply(undefined, args);\n } else {\n swap(elem, cssShow, function () {\n val = getWH.apply(undefined, args);\n });\n }\n return val;\n}\n\nfunction css(el, name, v) {\n var value = v;\n if ((typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') {\n for (var i in name) {\n if (name.hasOwnProperty(i)) {\n css(el, i, name[i]);\n }\n }\n return undefined;\n }\n if (typeof value !== 'undefined') {\n if (typeof value === 'number') {\n value += 'px';\n }\n el.style[name] = value;\n return undefined;\n }\n return getComputedStyleX(el, name);\n}\n\neach(['width', 'height'], function (name) {\n var first = name.charAt(0).toUpperCase() + name.slice(1);\n domUtils['outer' + first] = function (el, includeMargin) {\n return el && getWHIgnoreDisplay(el, name, includeMargin ? MARGIN_INDEX : BORDER_INDEX);\n };\n var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];\n\n domUtils[name] = function (elem, val) {\n if (val !== undefined) {\n if (elem) {\n var computedStyle = getComputedStyleX(elem);\n var isBorderBox = isBorderBoxFn(elem);\n if (isBorderBox) {\n val += getPBMWidth(elem, ['padding', 'border'], which, computedStyle);\n }\n return css(elem, name, val);\n }\n return undefined;\n }\n return elem && getWHIgnoreDisplay(elem, name, CONTENT_INDEX);\n };\n});\n\n// 设置 elem 相对 elem.ownerDocument 的坐标\nfunction setOffset(elem, offset) {\n // set position first, in-case top/left are set even on static elem\n if (css(elem, 'position') === 'static') {\n elem.style.position = 'relative';\n }\n\n var old = getOffset(elem);\n var ret = {};\n var current = undefined;\n var key = undefined;\n\n for (key in offset) {\n if (offset.hasOwnProperty(key)) {\n current = parseFloat(css(elem, key)) || 0;\n ret[key] = current + offset[key] - old[key];\n }\n }\n css(elem, ret);\n}\n\nmodule.exports = _extends({\n getWindow: function getWindow(node) {\n var doc = node.ownerDocument || node;\n return doc.defaultView || doc.parentWindow;\n },\n offset: function offset(el, value) {\n if (typeof value !== 'undefined') {\n setOffset(el, value);\n } else {\n return getOffset(el);\n }\n },\n\n isWindow: isWindow,\n each: each,\n css: css,\n clone: function clone(obj) {\n var ret = {};\n for (var i in obj) {\n if (obj.hasOwnProperty(i)) {\n ret[i] = obj[i];\n }\n }\n var overflow = obj.overflow;\n if (overflow) {\n for (var i in obj) {\n if (obj.hasOwnProperty(i)) {\n ret.overflow[i] = obj.overflow[i];\n }\n }\n }\n return ret;\n },\n scrollLeft: function scrollLeft(w, v) {\n if (isWindow(w)) {\n if (v === undefined) {\n return getScrollLeft(w);\n }\n window.scrollTo(v, getScrollTop(w));\n } else {\n if (v === undefined) {\n return w.scrollLeft;\n }\n w.scrollLeft = v;\n }\n },\n scrollTop: function scrollTop(w, v) {\n if (isWindow(w)) {\n if (v === undefined) {\n return getScrollTop(w);\n }\n window.scrollTo(getScrollLeft(w), v);\n } else {\n if (v === undefined) {\n return w.scrollTop;\n }\n w.scrollTop = v;\n }\n },\n\n viewportWidth: 0,\n viewportHeight: 0\n}, domUtils);\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/dom-scroll-into-view/lib/util.js\n// module id = 17\n// module chunks = 0"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack:///gutenberg-support.js","webpack:///webpack/bootstrap 765b03ea8b1e2393384e","webpack:///./node_modules/classnames/index.js","webpack:///./src/index.js","webpack:///./src/blocks/index.js","webpack:///./src/blocks/ta-image/index.js","webpack:///./src/blocks/ta-image/edit.js","webpack:///./src/blocks/ta-image/util.js","webpack:///./src/blocks/ta-image/image-size.js","webpack:///./src/blocks/ta-image/search-input.js","webpack:///./src/formats/index.js","webpack:///./src/formats/ta-link/index.js","webpack:///./src/formats/ta-link/inline.js","webpack:///./src/formats/ta-link/utils.js","webpack:///./src/formats/ta-link/url-popover.js","webpack:///./src/formats/ta-link/url-input.js","webpack:///./node_modules/dom-scroll-into-view/lib/index.js","webpack:///./node_modules/dom-scroll-into-view/lib/dom-scroll-into-view.js","webpack:///./node_modules/dom-scroll-into-view/lib/util.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","__WEBPACK_AMD_DEFINE_ARRAY__","__WEBPACK_AMD_DEFINE_RESULT__","classNames","classes","arguments","length","arg","argType","push","Array","isArray","inner","apply","key","hasOwn","join","default","undefined","__webpack_exports__","value","__WEBPACK_IMPORTED_MODULE_0__blocks__","__WEBPACK_IMPORTED_MODULE_1__formats__","__WEBPACK_IMPORTED_MODULE_2__assets_styles_index_scss__","registerBlocks","registerFormats","taimage","forEach","block","settings","registerBlockType","__WEBPACK_IMPORTED_MODULE_0__ta_image__","wp","blocks","_defineProperty","obj","writable","__WEBPACK_IMPORTED_MODULE_0_classnames__","__WEBPACK_IMPORTED_MODULE_0_classnames___default","__WEBPACK_IMPORTED_MODULE_1__edit__","Fragment","element","__","i18n","_wp$blocks","getPhrasingContentSchema","createBlock","getBlockAttributes","RichText","editor","_wp$components","components","Path","SVG","blockAttributes","url","type","source","selector","attribute","alt","caption","id","align","width","height","linkid","href","affiliateLink","imageSchema","img","attributes","title","description","icon","createElement","viewBox","xmlns","fill","category","keywords","getEditWrapperProps","data-align","data-resized","edit","save","_ref","_classnames","classnames","image","src","className","figure","Content","tagName","_classCallCheck","instance","Constructor","TypeError","_possibleConstructorReturn","self","ReferenceError","_inherits","subClass","superClass","create","constructor","setPrototypeOf","__proto__","__WEBPACK_IMPORTED_MODULE_1__util__","__WEBPACK_IMPORTED_MODULE_2__image_size__","__WEBPACK_IMPORTED_MODULE_3__search_input__","_extends","assign","target","_slicedToArray","sliceIterator","arr","_arr","_n","_d","_e","_s","_i","Symbol","iterator","next","done","err","_createClass","defineProperties","props","descriptor","protoProps","staticProps","_lodash","lodash","isEmpty","map","last","pick","compact","getPath","_wp$i18n","sprintf","_wp$element","Component","createRef","_wp$blob","blob","getBlobByURL","revokeBlobURL","isBlobURL","Placeholder","Button","ButtonGroup","IconButton","PanelBody","ResizableBox","SelectControl","Spinner","TextControl","TextareaControl","Toolbar","withNotices","withSelect","ToggleControl","Popover","data","_wp$editor","BlockControls","InspectorControls","BlockAlignmentToolbar","MediaUpload","MediaUploadCheck","MediaPlaceholder","mediaUpload","withViewportMatch","viewport","compose","ALLOWED_MEDIA_TYPES","pickRelevantMediaFiles","imageProps","isTemporaryImage","ImageEdit","_Component","this","_this","getPrototypeOf","updateAlt","bind","updateAlignment","onFocusCaption","onImageClick","onSelectImage","updateImageURL","updateWidth","updateHeight","updateDimensions","getFilename","toggleIsEditing","onImageError","onChangeInputValue","autocompleteRef","resetInvalidLink","updateImageSelection","onSelectAffiliateImage","editAFfiliateImage","state","captionFocused","isEditing","inputValue","post","showSuggestions","imageSelection","_this2","_props","setAttributes","noticeOperations","_attributes$url","file","filesList","onFileChange","_ref2","_ref3","allowedTypes","onError","message","createErrorNotice","setState","prevProps","_prevProps$attributes","prevID","_prevProps$attributes2","prevURL","_props$attributes","_props$attributes$url","isSelected","media","link","embedBlock","createUpgradedEmbedBlock","onReplace","newAlt","nextAlign","extraUpdatedAttributes","indexOf","parseInt","_this3","path","split","label","_props2","imageSizes","_ref4","slug","sizeUrl","invalidLink","_this4","apiFetch","addQueryArgs","context","_locale","then","source_url","images","_this5","_state","_props3","isLargeViewport","maxWidth","toggleSelection","isRTL","linkDestination","toolbarEditButton","onClick","controls","onChange","instructions","index","wp-block-image","is-transient","is-resized","is-focused","isResizable","imageSizeOptions","getImageSizeOptions","getInspectorControls","imageWidth","imageHeight","help","options","placeholder","min","aria-label","scale","scaledWidth","Math","round","scaledHeight","isCurrent","isSmall","isPrimary","aria-pressed","dirtynessTrigger","sizes","imageWidthWithinContainer","imageHeightWithinContainer","filename","defaultedAlt","style","currentWidth","currentHeight","ratio","minWidth","minHeight","maxWidthBuffer","showRightHandle","showLeftHandle","size","maxHeight","lockAspectRatio","enable","top","right","bottom","left","onResizeStart","onResizeStop","event","direction","elt","delta","unstableOnFocus","inlineToolbar","select","_select","getMedia","_select2","getEditorSettings","_getEditorSettings","includes","renderToString","attributesFromPreview","preview","matchingBlock","findBlock","DEFAULT_EMBED_BLOCK","html","isFromWordPress","noop","withGlobalEvents","ImageSize","bindContainer","calculateSize","ref","container","fetchImageSize","onload","window","Image","clientWidth","exceedMaxWidth","containerWidth","containerHeight","clientHeight","children","resize","withSpokenMessages","withInstanceId","ThirstyURLInput","inputRef","searchAffiliateLinks","suggestionNodes","posts","selectedSuggestion","loading","scrollingIntoView","scrollIntoView","current","onlyScrollIfNeeded","setTimeout","suggestionsRequest","formData","FormData","append","request","fetch","ajaxurl","method","body","response","json","affiliate_links","debouncedSpeak","catch","selectLink","instanceId","autoFocus","_state2","class","onSubmit","displayAffiliateImages","autocomplete","position","focusOnMount","role","tabIndex","bindSuggestionNode","is-selected","handleOnClick","aria-selected","_objectWithoutProperties","keys","taLink","registerFormatType","__WEBPACK_IMPORTED_MODULE_0__ta_link__","richText","__WEBPACK_IMPORTED_MODULE_0__inline__","_wp$richText","getTextContent","applyFormat","removeFormat","slice","isURL","RichTextToolbarButton","RichTextShortcut","getRectangleFromRange","dom","LinkEdit","addLink","stopAddingLink","onRemoveFormat","addingLink","text","speak","selection","getSelection","range","rangeCount","getRangeAt","rect","startContainer","nextElementSibling","nodeType","Node","ELEMENT_NODE","parentNode","closest","getBoundingClientRect","isActive","activeAttributes","anchorRect","getAnchorRect","character","onUse","shortcutType","shortcutCharacter","transform","createLinkFormat","toString","isShowingInput","editLink","__WEBPACK_IMPORTED_MODULE_1__utils__","__WEBPACK_IMPORTED_MODULE_2__url_popover__","__WEBPACK_IMPORTED_MODULE_3__url_input__","ExternalLink","_wp$keycodes","keycodes","LEFT","RIGHT","UP","DOWN","BACKSPACE","ENTER","_wp$url","prependHTTP","safeDecodeURI","filterURLForDisplay","insert","isCollapsed","stopKeyPropagation","stopPropagation","LinkEditor","onKeyDown","submitLink","onKeyPress","LinkViewerUrl","prependedURL","linkClassName","has-invalid-link","isValidHref","LinkViewer","InlineAffiliateLinkUI","onClickOutside","resetState","keyCode","preventDefault","selectedText","format","toInsert","autocompleteElement","contains","_props2$activeAttribu","showInput","onClose","updateLinkId","trimmedHref","trim","test","protocol","getProtocol","isValidProtocol","startsWith","authority","getAuthority","isValidAuthority","isValidPath","queryString","getQueryString","isValidQueryString","fragment","getFragment","isValidFragment","ThirstyURLPopover","toggleSettingsVisibility","isSettingsExpanded","renderSettings","_props$position","_props$focusOnMount","popoverProps","showSettings","aria-expanded","__WEBPACK_IMPORTED_MODULE_1_dom_scroll_into_view__","__WEBPACK_IMPORTED_MODULE_1_dom_scroll_into_view___default","throttle","TAB","stopEventPropagation","updateSuggestions","previousIndex","nextIndex","selectionStart","setSelectionRange","focus","_props$value","_props$autoFocus","_state3","required","onInput","aria-autocomplete","aria-owns","aria-activedescendant","noArrow","elem","config","util","getWindow","allowHorizontalScroll","alignWithTop","alignWithLeft","offsetTop","offsetLeft","offsetBottom","offsetRight","isWin","isWindow","elemOffset","offset","eh","outerHeight","ew","outerWidth","containerOffset","ch","cw","containerScroll","diffTop","diffBottom","win","winScroll","ww","wh","scrollLeft","scrollTop","parseFloat","css","getClientPosition","box","x","y","doc","ownerDocument","docElem","documentElement","clientLeft","clientTop","getScroll","w","ret","document","getScrollLeft","getScrollTop","getOffset","el","pos","defaultView","parentWindow","_getComputedStyle","computedStyle_","val","computedStyle","getComputedStyle","getPropertyValue","_getComputedStyleIE","CURRENT_STYLE","_RE_NUM_NO_PX","RE_POS","rsLeft","RUNTIME_STYLE","pixelLeft","PX","each","fn","isBorderBoxFn","getComputedStyleX","swap","callback","old","getPBMWidth","which","prop","j","cssProp","getWH","extra","domUtils","viewportWidth","viewportHeight","docWidth","docHeight","borderBoxValue","offsetWidth","offsetHeight","isBorderBox","cssBoxValue","Number","BORDER_INDEX","CONTENT_INDEX","borderBoxValueOrIsBorderBox","padding","PADDING_INDEX","BOX_MODELS","getWHIgnoreDisplay","args","cssShow","v","_typeof","setOffset","RE_NUM","RegExp","refWin","max","documentElementProp","compatMode","visibility","display","first","charAt","toUpperCase","includeMargin","node","clone","overflow","scrollTo"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAI,EAAAJ,EACAK,GAAA,EACAH,WAUA,OANAJ,GAAAE,GAAAM,KAAAH,EAAAD,QAAAC,IAAAD,QAAAH,GAGAI,EAAAE,GAAA,EAGAF,EAAAD,QAvBA,GAAAD,KA4BAF,GAAAQ,EAAAT,EAGAC,EAAAS,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,GAAAd,SAEAc,GAAAd,UAAAwE,IAIAnB,cAAA,EACAC,eAAA,GACCF,IlB2lGK,SAAUjpB,EAAQD","file":"gutenberg-support.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 1);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!\n Copyright (c) 2017 Jed Watson.\n Licensed under the MIT License (MIT), see\n http://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = [];\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (!arg) continue;\n\n\t\t\tvar argType = typeof arg;\n\n\t\t\tif (argType === 'string' || argType === 'number') {\n\t\t\t\tclasses.push(arg);\n\t\t\t} else if (Array.isArray(arg) && arg.length) {\n\t\t\t\tvar inner = classNames.apply(null, arg);\n\t\t\t\tif (inner) {\n\t\t\t\t\tclasses.push(inner);\n\t\t\t\t}\n\t\t\t} else if (argType === 'object') {\n\t\t\t\tfor (var key in arg) {\n\t\t\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\t\t\tclasses.push(key);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn classes.join(' ');\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (true) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {\n\t\t\treturn classNames;\n\t\t}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n\n\n/***/ }),\n/* 1 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nObject.defineProperty(__webpack_exports__, \"__esModule\", { value: true });\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__blocks__ = __webpack_require__(2);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__formats__ = __webpack_require__(8);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__assets_styles_index_scss__ = __webpack_require__(17);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__assets_styles_index_scss___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2__assets_styles_index_scss__);\n\n\n\n\n\nObject(__WEBPACK_IMPORTED_MODULE_0__blocks__[\"a\" /* default */])();\nObject(__WEBPACK_IMPORTED_MODULE_1__formats__[\"a\" /* default */])();\n\n/***/ }),\n/* 2 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export (immutable) */ __webpack_exports__[\"a\"] = registerBlocks;\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ta_image__ = __webpack_require__(3);\n\n\nvar registerBlockType = wp.blocks.registerBlockType;\n\n/**\n * Register gutenberg blocks.\n * \n * @since 3.6\n */\n\nfunction registerBlocks() {\n\n [__WEBPACK_IMPORTED_MODULE_0__ta_image__].forEach(function (block) {\n if (!block) return;\n\n var name = block.name,\n settings = block.settings;\n\n registerBlockType(name, settings);\n });\n}\n\n/***/ }),\n/* 3 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nObject.defineProperty(__webpack_exports__, \"__esModule\", { value: true });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"name\", function() { return name; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"settings\", function() { return settings; });\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_classnames__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_classnames___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_classnames__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__edit__ = __webpack_require__(4);\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n\n\nvar Fragment = wp.element.Fragment;\nvar __ = wp.i18n.__;\nvar _wp$blocks = wp.blocks,\n createBlock = _wp$blocks.createBlock,\n getBlockAttributes = _wp$blocks.getBlockAttributes,\n getPhrasingContentSchema = _wp$blocks.getPhrasingContentSchema;\nvar RichText = wp.editor.RichText;\nvar _wp$components = wp.components,\n Path = _wp$components.Path,\n SVG = _wp$components.SVG;\n\n\n\n\nvar name = 'ta/image';\n\nvar blockAttributes = {\n\turl: {\n\t\ttype: 'string',\n\t\tsource: 'attribute',\n\t\tselector: 'img',\n\t\tattribute: 'src'\n\t},\n\talt: {\n\t\ttype: 'string',\n\t\tsource: 'attribute',\n\t\tselector: 'img',\n\t\tattribute: 'alt',\n\t\tdefault: ''\n\t},\n\tcaption: {\n\t\ttype: 'string',\n\t\tsource: 'html',\n\t\tselector: 'figcaption'\n\t},\n\tid: {\n\t\ttype: 'number'\n\t},\n\talign: {\n\t\ttype: 'string'\n\t},\n\twidth: {\n\t\ttype: 'number'\n\t},\n\theight: {\n\t\ttype: 'number'\n\t},\n\tlinkid: {\n\t\ttype: 'number'\n\t},\n\thref: {\n\t\ttype: 'string',\n\t\tsource: 'attribute',\n\t\tselector: 'ta',\n\t\tattribute: 'href'\n\t},\n\taffiliateLink: {\n\t\ttype: 'object'\n\t}\n};\n\nvar imageSchema = {\n\timg: {\n\t\tattributes: ['src', 'alt'],\n\t\tclasses: ['alignleft', 'aligncenter', 'alignright', 'alignnone', /^wp-image-\\d+#x2F;]\n\t}\n};\n\nvar schema = {\n\tfigure: {\n\t\trequire: ['ta', 'img'],\n\t\tchildren: {\n\t\t\tta: {\n\t\t\t\tattributes: ['href', 'linkid'],\n\t\t\t\tchildren: imageSchema\n\t\t\t},\n\t\t\tfigcaption: {\n\t\t\t\tchildren: getPhrasingContentSchema()\n\t\t\t}\n\t\t}\n\t}\n};\n\nfunction getFirstAnchorAttributeFormHTML(html, attributeName) {\n\tvar _document$implementat = document.implementation.createHTMLDocument(''),\n\t body = _document$implementat.body;\n\n\tbody.innerHTML = html;\n\n\tvar firstElementChild = body.firstElementChild;\n\n\n\tif (firstElementChild && firstElementChild.nodeName === 'A') {\n\t\treturn firstElementChild.getAttribute(attributeName) || undefined;\n\t}\n}\n\nvar settings = {\n\ttitle: __('ThirstyAffiliates Image'),\n\n\tdescription: __('Insert an image with an affiliate link to make a visual statement.'),\n\n\ticon: wp.element.createElement(\n\t\tSVG,\n\t\t{ viewBox: \"0 0 24 24\", xmlns: \"http://www.w3.org/2000/svg\" },\n\t\twp.element.createElement(Path, { d: \"M0,0h24v24H0V0z\", fill: \"none\" }),\n\t\twp.element.createElement(Path, { d: \"m19 5v14h-14v-14h14m0-2h-14c-1.1 0-2 0.9-2 2v14c0 1.1 0.9 2 2 2h14c1.1 0 2-0.9 2-2v-14c0-1.1-0.9-2-2-2z\" }),\n\t\twp.element.createElement(Path, { d: \"m14.14 11.86l-3 3.87-2.14-2.59-3 3.86h12l-3.86-5.14z\" })\n\t),\n\n\tcategory: 'common',\n\n\tkeywords: ['img', // \"img\" is not translated as it is intended to reflect the HTML <img> tag.\n\t__('photo'), __('affiliate')],\n\n\tattributes: blockAttributes,\n\n\tgetEditWrapperProps: function getEditWrapperProps(attributes) {\n\t\tvar align = attributes.align,\n\t\t width = attributes.width;\n\n\t\tif ('left' === align || 'center' === align || 'right' === align || 'wide' === align || 'full' === align) {\n\t\t\treturn { 'data-align': align, 'data-resized': !!width };\n\t\t}\n\t},\n\n\n\tedit: __WEBPACK_IMPORTED_MODULE_1__edit__[\"a\" /* default */],\n\n\tsave: function save(_ref) {\n\t\tvar _classnames;\n\n\t\tvar attributes = _ref.attributes;\n\t\tvar url = attributes.url,\n\t\t alt = attributes.alt,\n\t\t caption = attributes.caption,\n\t\t align = attributes.align,\n\t\t width = attributes.width,\n\t\t height = attributes.height,\n\t\t id = attributes.id,\n\t\t linkid = attributes.linkid,\n\t\t href = attributes.href;\n\n\n\t\tvar classes = __WEBPACK_IMPORTED_MODULE_0_classnames___default()((_classnames = {}, _defineProperty(_classnames, \"align\" + align, align), _defineProperty(_classnames, 'is-resized', width || height), _classnames));\n\n\t\tvar image = wp.element.createElement(\"img\", {\n\t\t\tsrc: url,\n\t\t\talt: alt,\n\t\t\tclassName: id ? \"wp-image-\" + id : null,\n\t\t\twidth: width,\n\t\t\theight: height\n\t\t});\n\n\t\tvar figure = wp.element.createElement(\n\t\t\tFragment,\n\t\t\tnull,\n\t\t\twp.element.createElement(\n\t\t\t\t\"ta\",\n\t\t\t\t{ linkid: linkid, href: href },\n\t\t\t\timage\n\t\t\t),\n\t\t\twp.element.createElement(RichText.Content, { tagName: \"figcaption\", value: caption })\n\t\t);\n\n\t\tif ('left' === align || 'right' === align || 'center' === align) {\n\t\t\treturn wp.element.createElement(\n\t\t\t\t\"div\",\n\t\t\t\t{ className: \"wp-block-image\" },\n\t\t\t\twp.element.createElement(\n\t\t\t\t\t\"figure\",\n\t\t\t\t\t{ className: classes },\n\t\t\t\t\tfigure\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\n\t\treturn wp.element.createElement(\n\t\t\t\"figure\",\n\t\t\t{ className: \"wp-block-image \" + classes },\n\t\t\tfigure\n\t\t);\n\t}\n};\n\n/***/ }),\n/* 4 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* unused harmony export pickRelevantMediaFiles */\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_classnames__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_classnames___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_classnames__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util__ = __webpack_require__(5);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__image_size__ = __webpack_require__(6);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__search_input__ = __webpack_require__(7);\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n\n\nvar _lodash = lodash,\n get = _lodash.get,\n isEmpty = _lodash.isEmpty,\n map = _lodash.map,\n last = _lodash.last,\n pick = _lodash.pick,\n compact = _lodash.compact;\nvar getPath = wp.url.getPath;\nvar _wp$i18n = wp.i18n,\n __ = _wp$i18n.__,\n sprintf = _wp$i18n.sprintf;\nvar _wp$element = wp.element,\n Component = _wp$element.Component,\n Fragment = _wp$element.Fragment,\n createRef = _wp$element.createRef;\nvar _wp$blob = wp.blob,\n getBlobByURL = _wp$blob.getBlobByURL,\n revokeBlobURL = _wp$blob.revokeBlobURL,\n isBlobURL = _wp$blob.isBlobURL;\nvar _wp$components = wp.components,\n Placeholder = _wp$components.Placeholder,\n Button = _wp$components.Button,\n ButtonGroup = _wp$components.ButtonGroup,\n IconButton = _wp$components.IconButton,\n PanelBody = _wp$components.PanelBody,\n ResizableBox = _wp$components.ResizableBox,\n SelectControl = _wp$components.SelectControl,\n Spinner = _wp$components.Spinner,\n TextControl = _wp$components.TextControl,\n TextareaControl = _wp$components.TextareaControl,\n Toolbar = _wp$components.Toolbar,\n withNotices = _wp$components.withNotices,\n ToggleControl = _wp$components.ToggleControl,\n Popover = _wp$components.Popover;\nvar withSelect = wp.data.withSelect;\nvar _wp$editor = wp.editor,\n RichText = _wp$editor.RichText,\n BlockControls = _wp$editor.BlockControls,\n InspectorControls = _wp$editor.InspectorControls,\n MediaUpload = _wp$editor.MediaUpload,\n MediaUploadCheck = _wp$editor.MediaUploadCheck,\n MediaPlaceholder = _wp$editor.MediaPlaceholder,\n BlockAlignmentToolbar = _wp$editor.BlockAlignmentToolbar,\n mediaUpload = _wp$editor.mediaUpload;\nvar withViewportMatch = wp.viewport.withViewportMatch;\nvar compose = wp.compose.compose;\n\n\n\n\n\n\n/**\n * Module constants\n */\nvar MIN_SIZE = 20;\nvar LINK_DESTINATION_NONE = 'none';\nvar LINK_DESTINATION_MEDIA = 'media';\nvar LINK_DESTINATION_ATTACHMENT = 'attachment';\nvar LINK_DESTINATION_CUSTOM = 'custom';\nvar NEW_TAB_REL = 'noreferrer noopener';\nvar ALLOWED_MEDIA_TYPES = ['image'];\n\nvar pickRelevantMediaFiles = function pickRelevantMediaFiles(image) {\n\tvar imageProps = pick(image, ['alt', 'id', 'link', 'caption']);\n\timageProps.url = get(image, ['sizes', 'large', 'url']) || get(image, ['media_details', 'sizes', 'large', 'source_url']) || image.url;\n\treturn imageProps;\n};\n\n/**\n * Is the URL a temporary blob URL? A blob URL is one that is used temporarily\n * while the image is being uploaded and will not have an id yet allocated.\n *\n * @param {number=} id The id of the image.\n * @param {string=} url The url of the image.\n *\n * @return {boolean} Is the URL a Blob URL\n */\nvar isTemporaryImage = function isTemporaryImage(id, url) {\n\treturn !id && isBlobURL(url);\n};\n\n/**\n * Is the url for the image hosted externally. An externally hosted image has no id\n * and is not a blob url.\n *\n * @param {number=} id The id of the image.\n * @param {string=} url The url of the image.\n *\n * @return {boolean} Is the url an externally hosted url?\n */\nvar isExternalImage = function isExternalImage(id, url) {\n\treturn url && !id && !isBlobURL(url);\n};\n\nvar ImageEdit = function (_Component) {\n\t_inherits(ImageEdit, _Component);\n\n\tfunction ImageEdit(_ref) {\n\t\tvar attributes = _ref.attributes;\n\n\t\t_classCallCheck(this, ImageEdit);\n\n\t\tvar _this = _possibleConstructorReturn(this, (ImageEdit.__proto__ || Object.getPrototypeOf(ImageEdit)).apply(this, arguments));\n\n\t\t_this.updateAlt = _this.updateAlt.bind(_this);\n\t\t_this.updateAlignment = _this.updateAlignment.bind(_this);\n\t\t_this.onFocusCaption = _this.onFocusCaption.bind(_this);\n\t\t_this.onImageClick = _this.onImageClick.bind(_this);\n\t\t_this.onSelectImage = _this.onSelectImage.bind(_this);\n\t\t_this.updateImageURL = _this.updateImageURL.bind(_this);\n\t\t_this.updateWidth = _this.updateWidth.bind(_this);\n\t\t_this.updateHeight = _this.updateHeight.bind(_this);\n\t\t_this.updateDimensions = _this.updateDimensions.bind(_this);\n\t\t_this.getFilename = _this.getFilename.bind(_this);\n\t\t_this.toggleIsEditing = _this.toggleIsEditing.bind(_this);\n\t\t_this.onImageError = _this.onImageError.bind(_this);\n\t\t_this.onChangeInputValue = _this.onChangeInputValue.bind(_this);\n\t\t_this.autocompleteRef = createRef();\n\t\t_this.resetInvalidLink = _this.resetInvalidLink.bind(_this);\n\t\t_this.updateImageSelection = _this.updateImageSelection.bind(_this);\n\t\t_this.onSelectAffiliateImage = _this.onSelectAffiliateImage.bind(_this);\n\t\t_this.editAFfiliateImage = _this.editAFfiliateImage.bind(_this);\n\n\t\t_this.state = {\n\t\t\tcaptionFocused: false,\n\t\t\tisEditing: !attributes.url,\n\t\t\tinputValue: '',\n\t\t\tlinkid: 0,\n\t\t\tpost: null,\n\t\t\tshowSuggestions: false,\n\t\t\timageSelection: [],\n\t\t\taffiliateLink: null\n\t\t};\n\t\treturn _this;\n\t}\n\n\t_createClass(ImageEdit, [{\n\t\tkey: \"componentDidMount\",\n\t\tvalue: function componentDidMount() {\n\t\t\tvar _this2 = this;\n\n\t\t\tvar _props = this.props,\n\t\t\t attributes = _props.attributes,\n\t\t\t setAttributes = _props.setAttributes,\n\t\t\t noticeOperations = _props.noticeOperations;\n\t\t\tvar id = attributes.id,\n\t\t\t _attributes$url = attributes.url,\n\t\t\t url = _attributes$url === undefined ? '' : _attributes$url;\n\n\n\t\t\tif (isTemporaryImage(id, url)) {\n\t\t\t\tvar file = getBlobByURL(url);\n\n\t\t\t\tif (file) {\n\t\t\t\t\tmediaUpload({\n\t\t\t\t\t\tfilesList: [file],\n\t\t\t\t\t\tonFileChange: function onFileChange(_ref2) {\n\t\t\t\t\t\t\tvar _ref3 = _slicedToArray(_ref2, 1),\n\t\t\t\t\t\t\t image = _ref3[0];\n\n\t\t\t\t\t\t\tsetAttributes(pickRelevantMediaFiles(image));\n\t\t\t\t\t\t},\n\t\t\t\t\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\n\t\t\t\t\t\tonError: function onError(message) {\n\t\t\t\t\t\t\tnoticeOperations.createErrorNotice(message);\n\t\t\t\t\t\t\t_this2.setState({ isEditing: true });\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"componentDidUpdate\",\n\t\tvalue: function componentDidUpdate(prevProps) {\n\t\t\tvar _prevProps$attributes = prevProps.attributes,\n\t\t\t prevID = _prevProps$attributes.id,\n\t\t\t _prevProps$attributes2 = _prevProps$attributes.url,\n\t\t\t prevURL = _prevProps$attributes2 === undefined ? '' : _prevProps$attributes2;\n\t\t\tvar _props$attributes = this.props.attributes,\n\t\t\t id = _props$attributes.id,\n\t\t\t _props$attributes$url = _props$attributes.url,\n\t\t\t url = _props$attributes$url === undefined ? '' : _props$attributes$url;\n\n\n\t\t\tif (isTemporaryImage(prevID, prevURL) && !isTemporaryImage(id, url)) {\n\t\t\t\trevokeBlobURL(url);\n\t\t\t}\n\n\t\t\tif (!this.props.isSelected && prevProps.isSelected && this.state.captionFocused) {\n\t\t\t\tthis.setState({\n\t\t\t\t\tcaptionFocused: false\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"onSelectImage\",\n\t\tvalue: function onSelectImage(media) {\n\n\t\t\tif (!media || !media.url) {\n\t\t\t\tthis.props.setAttributes({\n\t\t\t\t\turl: undefined,\n\t\t\t\t\talt: undefined,\n\t\t\t\t\tid: undefined,\n\t\t\t\t\tcaption: undefined\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar affiliateLink = this.state.affiliateLink;\n\n\n\t\t\tthis.setState({\n\t\t\t\tisEditing: false\n\t\t\t});\n\n\t\t\tthis.props.setAttributes(_extends({}, pickRelevantMediaFiles(media), {\n\t\t\t\tlinkid: affiliateLink.id,\n\t\t\t\thref: affiliateLink.link,\n\t\t\t\taffiliateLink: affiliateLink,\n\t\t\t\twidth: undefined,\n\t\t\t\theight: undefined\n\t\t\t}));\n\t\t}\n\t}, {\n\t\tkey: \"onImageError\",\n\t\tvalue: function onImageError(url) {\n\t\t\t// Check if there's an embed block that handles this URL.\n\t\t\tvar embedBlock = Object(__WEBPACK_IMPORTED_MODULE_1__util__[\"a\" /* createUpgradedEmbedBlock */])({ attributes: { url: url } });\n\t\t\tif (undefined !== embedBlock) {\n\t\t\t\tthis.props.onReplace(embedBlock);\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"onFocusCaption\",\n\t\tvalue: function onFocusCaption() {\n\t\t\tif (!this.state.captionFocused) {\n\t\t\t\tthis.setState({\n\t\t\t\t\tcaptionFocused: true\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"onImageClick\",\n\t\tvalue: function onImageClick() {\n\t\t\tif (this.state.captionFocused) {\n\t\t\t\tthis.setState({\n\t\t\t\t\tcaptionFocused: false\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"updateAlt\",\n\t\tvalue: function updateAlt(newAlt) {\n\t\t\tthis.props.setAttributes({ alt: newAlt });\n\t\t}\n\t}, {\n\t\tkey: \"updateAlignment\",\n\t\tvalue: function updateAlignment(nextAlign) {\n\t\t\tvar extraUpdatedAttributes = ['wide', 'full'].indexOf(nextAlign) !== -1 ? { width: undefined, height: undefined } : {};\n\t\t\tthis.props.setAttributes(_extends({}, extraUpdatedAttributes, { align: nextAlign }));\n\t\t}\n\t}, {\n\t\tkey: \"updateImageURL\",\n\t\tvalue: function updateImageURL(url) {\n\t\t\tthis.props.setAttributes({ url: url, width: undefined, height: undefined });\n\t\t}\n\t}, {\n\t\tkey: \"updateWidth\",\n\t\tvalue: function updateWidth(width) {\n\t\t\tthis.props.setAttributes({ width: parseInt(width, 10) });\n\t\t}\n\t}, {\n\t\tkey: \"updateHeight\",\n\t\tvalue: function updateHeight(height) {\n\t\t\tthis.props.setAttributes({ height: parseInt(height, 10) });\n\t\t}\n\t}, {\n\t\tkey: \"updateDimensions\",\n\t\tvalue: function updateDimensions() {\n\t\t\tvar _this3 = this;\n\n\t\t\tvar width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;\n\t\t\tvar height = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;\n\n\t\t\treturn function () {\n\t\t\t\t_this3.props.setAttributes({ width: width, height: height });\n\t\t\t};\n\t\t}\n\t}, {\n\t\tkey: \"getFilename\",\n\t\tvalue: function getFilename(url) {\n\t\t\tvar path = getPath(url);\n\t\t\tif (path) {\n\t\t\t\treturn last(path.split('/'));\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"getLinkDestinationOptions\",\n\t\tvalue: function getLinkDestinationOptions() {\n\t\t\treturn [{ value: LINK_DESTINATION_NONE, label: __('None') }, { value: LINK_DESTINATION_MEDIA, label: __('Media File') }, { value: LINK_DESTINATION_ATTACHMENT, label: __('Attachment Page') }, { value: LINK_DESTINATION_CUSTOM, label: __('Custom URL') }];\n\t\t}\n\t}, {\n\t\tkey: \"toggleIsEditing\",\n\t\tvalue: function toggleIsEditing() {\n\t\t\tthis.setState({\n\t\t\t\tisEditing: !this.state.isEditing\n\t\t\t});\n\t\t}\n\t}, {\n\t\tkey: \"getImageSizeOptions\",\n\t\tvalue: function getImageSizeOptions() {\n\t\t\tvar _props2 = this.props,\n\t\t\t imageSizes = _props2.imageSizes,\n\t\t\t image = _props2.image;\n\n\t\t\treturn compact(map(imageSizes, function (_ref4) {\n\t\t\t\tvar name = _ref4.name,\n\t\t\t\t slug = _ref4.slug;\n\n\t\t\t\tvar sizeUrl = get(image, ['media_details', 'sizes', slug, 'source_url']);\n\t\t\t\tif (!sizeUrl) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tvalue: sizeUrl,\n\t\t\t\t\tlabel: name\n\t\t\t\t};\n\t\t\t}));\n\t\t}\n\t}, {\n\t\tkey: \"onChangeInputValue\",\n\t\tvalue: function onChangeInputValue(inputValue) {\n\t\t\tvar post = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n\n\t\t\tvar linkid = post ? post.id : 0;\n\t\t\tthis.setState({ inputValue: inputValue, linkid: linkid, post: post });\n\t\t}\n\t}, {\n\t\tkey: \"resetInvalidLink\",\n\t\tvalue: function resetInvalidLink() {\n\t\t\tthis.setState({ invalidLink: false });\n\t\t}\n\t}, {\n\t\tkey: \"updateImageSelection\",\n\t\tvalue: function updateImageSelection(imageSelection, affiliateLink) {\n\t\t\tthis.setState({\n\t\t\t\timageSelection: imageSelection,\n\t\t\t\taffiliateLink: affiliateLink\n\t\t\t});\n\t\t}\n\t}, {\n\t\tkey: \"onSelectAffiliateImage\",\n\t\tvalue: function onSelectAffiliateImage(image) {\n\t\t\tvar _this4 = this;\n\n\t\t\tvar request = wp.apiFetch({\n\t\t\t\tpath: wp.url.addQueryArgs('wp/v2/media/' + image.id, {\n\t\t\t\t\tcontext: 'edit',\n\t\t\t\t\t_locale: 'user'\n\t\t\t\t})\n\t\t\t});\n\n\t\t\trequest.then(function (media) {\n\t\t\t\tmedia.url = media.source_url;\n\t\t\t\t_this4.onSelectImage(media);\n\t\t\t});\n\t\t}\n\t}, {\n\t\tkey: \"editAFfiliateImage\",\n\t\tvalue: function editAFfiliateImage() {\n\t\t\tvar attributes = this.props.attributes;\n\t\t\tvar affiliateLink = attributes.affiliateLink;\n\n\n\t\t\tthis.setState({\n\t\t\t\tisEditing: true,\n\t\t\t\timageSelection: affiliateLink.images,\n\t\t\t\taffiliateLink: affiliateLink\n\t\t\t});\n\t\t}\n\t}, {\n\t\tkey: \"render\",\n\t\tvalue: function render() {\n\t\t\tvar _this5 = this;\n\n\t\t\tvar _state = this.state,\n\t\t\t isEditing = _state.isEditing,\n\t\t\t imageSelection = _state.imageSelection,\n\t\t\t affiliateLink = _state.affiliateLink;\n\t\t\tvar _props3 = this.props,\n\t\t\t attributes = _props3.attributes,\n\t\t\t setAttributes = _props3.setAttributes,\n\t\t\t isLargeViewport = _props3.isLargeViewport,\n\t\t\t isSelected = _props3.isSelected,\n\t\t\t className = _props3.className,\n\t\t\t maxWidth = _props3.maxWidth,\n\t\t\t toggleSelection = _props3.toggleSelection,\n\t\t\t isRTL = _props3.isRTL;\n\t\t\tvar url = attributes.url,\n\t\t\t alt = attributes.alt,\n\t\t\t caption = attributes.caption,\n\t\t\t align = attributes.align,\n\t\t\t linkDestination = attributes.linkDestination,\n\t\t\t width = attributes.width,\n\t\t\t height = attributes.height,\n\t\t\t linkid = attributes.linkid,\n\t\t\t href = attributes.href;\n\n\t\t\tvar toolbarEditButton = wp.element.createElement(\n\t\t\t\tToolbar,\n\t\t\t\tnull,\n\t\t\t\twp.element.createElement(IconButton, {\n\t\t\t\t\tclassName: \"ta-edit-image-button components-icon-button components-toolbar__control\",\n\t\t\t\t\tlabel: __('Edit ThirstyAffiliates Image'),\n\t\t\t\t\ticon: \"edit\",\n\t\t\t\t\tonClick: this.editAFfiliateImage\n\t\t\t\t})\n\t\t\t);\n\n\t\t\tvar controls = wp.element.createElement(\n\t\t\t\tBlockControls,\n\t\t\t\tnull,\n\t\t\t\twp.element.createElement(BlockAlignmentToolbar, {\n\t\t\t\t\tvalue: align,\n\t\t\t\t\tonChange: this.updateAlignment\n\t\t\t\t}),\n\t\t\t\ttoolbarEditButton\n\t\t\t);\n\n\t\t\tif (isEditing) {\n\t\t\t\treturn wp.element.createElement(\n\t\t\t\t\tFragment,\n\t\t\t\t\tnull,\n\t\t\t\t\tcontrols,\n\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\tPlaceholder,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ticon: \"format-image\",\n\t\t\t\t\t\t\tlabel: __(\"ThirstyAffiliates Image\"),\n\t\t\t\t\t\t\tinstructions: __(\"Search for an affiliate link and select image to insert.\")\n\t\t\t\t\t\t},\n\t\t\t\t\t\twp.element.createElement(__WEBPACK_IMPORTED_MODULE_3__search_input__[\"a\" /* default */], {\n\t\t\t\t\t\t\tupdateImageSelection: this.updateImageSelection\n\t\t\t\t\t\t}),\n\t\t\t\t\t\t!!imageSelection.length && wp.element.createElement(\n\t\t\t\t\t\t\t\"div\",\n\t\t\t\t\t\t\t{ className: \"ta-image-sel-wrap\" },\n\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\t\"h3\",\n\t\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t\taffiliateLink.title + \" \" + __('attached images:')\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\t\"div\",\n\t\t\t\t\t\t\t\t{ className: \"ta-image-selection\" },\n\t\t\t\t\t\t\t\timageSelection.map(function (image, index) {\n\t\t\t\t\t\t\t\t\treturn wp.element.createElement(\n\t\t\t\t\t\t\t\t\t\t\"button\",\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tonClick: function onClick() {\n\t\t\t\t\t\t\t\t\t\t\t\treturn _this5.onSelectAffiliateImage(image);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\twp.element.createElement(\"img\", { src: image.src })\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tvar classes = __WEBPACK_IMPORTED_MODULE_0_classnames___default()(className, {\n\t\t\t\t'wp-block-image': true,\n\t\t\t\t'is-transient': isBlobURL(url),\n\t\t\t\t'is-resized': !!width || !!height,\n\t\t\t\t'is-focused': isSelected\n\t\t\t});\n\n\t\t\tvar isResizable = ['wide', 'full'].indexOf(align) === -1 && isLargeViewport;\n\t\t\tvar imageSizeOptions = this.getImageSizeOptions();\n\n\t\t\tvar getInspectorControls = function getInspectorControls(imageWidth, imageHeight) {\n\t\t\t\treturn wp.element.createElement(\n\t\t\t\t\tInspectorControls,\n\t\t\t\t\tnull,\n\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\tPanelBody,\n\t\t\t\t\t\t{ title: __('Image Settings') },\n\t\t\t\t\t\twp.element.createElement(TextareaControl, {\n\t\t\t\t\t\t\tlabel: __('Alt Text (Alternative Text)'),\n\t\t\t\t\t\t\tvalue: alt,\n\t\t\t\t\t\t\tonChange: _this5.updateAlt,\n\t\t\t\t\t\t\thelp: __('Alternative text describes your image to people who can’t see it. Add a short description with its key details.')\n\t\t\t\t\t\t}),\n\t\t\t\t\t\t!isEmpty(imageSizeOptions) && wp.element.createElement(SelectControl, {\n\t\t\t\t\t\t\tlabel: __('Image Size'),\n\t\t\t\t\t\t\tvalue: url,\n\t\t\t\t\t\t\toptions: imageSizeOptions,\n\t\t\t\t\t\t\tonChange: _this5.updateImageURL\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tisResizable && wp.element.createElement(\n\t\t\t\t\t\t\t\"div\",\n\t\t\t\t\t\t\t{ className: \"block-library-image__dimensions\" },\n\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\t\"p\",\n\t\t\t\t\t\t\t\t{ className: \"block-library-image__dimensions__row\" },\n\t\t\t\t\t\t\t\t__('Image Dimensions')\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\t\"div\",\n\t\t\t\t\t\t\t\t{ className: \"block-library-image__dimensions__row\" },\n\t\t\t\t\t\t\t\twp.element.createElement(TextControl, {\n\t\t\t\t\t\t\t\t\ttype: \"number\",\n\t\t\t\t\t\t\t\t\tclassName: \"block-library-image__dimensions__width\",\n\t\t\t\t\t\t\t\t\tlabel: __('Width'),\n\t\t\t\t\t\t\t\t\tvalue: width !== undefined ? width : '',\n\t\t\t\t\t\t\t\t\tplaceholder: imageWidth,\n\t\t\t\t\t\t\t\t\tmin: 1,\n\t\t\t\t\t\t\t\t\tonChange: _this5.updateWidth\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\twp.element.createElement(TextControl, {\n\t\t\t\t\t\t\t\t\ttype: \"number\",\n\t\t\t\t\t\t\t\t\tclassName: \"block-library-image__dimensions__height\",\n\t\t\t\t\t\t\t\t\tlabel: __('Height'),\n\t\t\t\t\t\t\t\t\tvalue: height !== undefined ? height : '',\n\t\t\t\t\t\t\t\t\tplaceholder: imageHeight,\n\t\t\t\t\t\t\t\t\tmin: 1,\n\t\t\t\t\t\t\t\t\tonChange: _this5.updateHeight\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\t\"div\",\n\t\t\t\t\t\t\t\t{ className: \"block-library-image__dimensions__row\" },\n\t\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\t\tButtonGroup,\n\t\t\t\t\t\t\t\t\t{ \"aria-label\": __('Image Size') },\n\t\t\t\t\t\t\t\t\t[25, 50, 75, 100].map(function (scale) {\n\t\t\t\t\t\t\t\t\t\tvar scaledWidth = Math.round(imageWidth * (scale / 100));\n\t\t\t\t\t\t\t\t\t\tvar scaledHeight = Math.round(imageHeight * (scale / 100));\n\n\t\t\t\t\t\t\t\t\t\tvar isCurrent = width === scaledWidth && height === scaledHeight;\n\n\t\t\t\t\t\t\t\t\t\treturn wp.element.createElement(\n\t\t\t\t\t\t\t\t\t\t\tButton,\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tkey: scale,\n\t\t\t\t\t\t\t\t\t\t\t\tisSmall: true,\n\t\t\t\t\t\t\t\t\t\t\t\tisPrimary: isCurrent,\n\t\t\t\t\t\t\t\t\t\t\t\t\"aria-pressed\": isCurrent,\n\t\t\t\t\t\t\t\t\t\t\t\tonClick: _this5.updateDimensions(scaledWidth, scaledHeight)\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\tscale,\n\t\t\t\t\t\t\t\t\t\t\t\"%\"\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\t\tButton,\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tisSmall: true,\n\t\t\t\t\t\t\t\t\t\tonClick: _this5.updateDimensions()\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t__('Reset')\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t};\n\n\t\t\t// Disable reason: Each block can be selected by clicking on it\n\t\t\t/* eslint-disable jsx-a11y/no-static-element-interactions, jsx-a11y/onclick-has-role, jsx-a11y/click-events-have-key-events */\n\t\t\treturn wp.element.createElement(\n\t\t\t\tFragment,\n\t\t\t\tnull,\n\t\t\t\tcontrols,\n\t\t\t\twp.element.createElement(\n\t\t\t\t\t\"figure\",\n\t\t\t\t\t{ className: classes },\n\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t__WEBPACK_IMPORTED_MODULE_2__image_size__[\"a\" /* default */],\n\t\t\t\t\t\t{ src: url, dirtynessTrigger: align },\n\t\t\t\t\t\tfunction (sizes) {\n\t\t\t\t\t\t\tvar imageWidthWithinContainer = sizes.imageWidthWithinContainer,\n\t\t\t\t\t\t\t imageHeightWithinContainer = sizes.imageHeightWithinContainer,\n\t\t\t\t\t\t\t imageWidth = sizes.imageWidth,\n\t\t\t\t\t\t\t imageHeight = sizes.imageHeight;\n\n\n\t\t\t\t\t\t\tvar filename = _this5.getFilename(url);\n\t\t\t\t\t\t\tvar defaultedAlt = void 0;\n\t\t\t\t\t\t\tif (alt) {\n\t\t\t\t\t\t\t\tdefaultedAlt = alt;\n\t\t\t\t\t\t\t} else if (filename) {\n\t\t\t\t\t\t\t\tdefaultedAlt = sprintf(__('This image has an empty alt attribute; its file name is %s'), filename);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tdefaultedAlt = __('This image has an empty alt attribute');\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tvar img =\n\t\t\t\t\t\t\t// Disable reason: Image itself is not meant to be interactive, but\n\t\t\t\t\t\t\t// should direct focus to block.\n\t\t\t\t\t\t\t/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */\n\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\tFragment,\n\t\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\t\t\"ta\",\n\t\t\t\t\t\t\t\t\t{ linkid: linkid, href: href },\n\t\t\t\t\t\t\t\t\twp.element.createElement(\"img\", { src: url, alt: defaultedAlt, onClick: _this5.onImageClick, onError: function onError() {\n\t\t\t\t\t\t\t\t\t\t\treturn _this5.onImageError(url);\n\t\t\t\t\t\t\t\t\t\t} })\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tisBlobURL(url) && wp.element.createElement(Spinner, null)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t/* eslint-enable jsx-a11y/no-noninteractive-element-interactions */\n\t\t\t\t\t\t\t;\n\n\t\t\t\t\t\t\tif (!isResizable || !imageWidthWithinContainer) {\n\t\t\t\t\t\t\t\treturn wp.element.createElement(\n\t\t\t\t\t\t\t\t\tFragment,\n\t\t\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t\t\tgetInspectorControls(imageWidth, imageHeight),\n\t\t\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\t\t\t\"div\",\n\t\t\t\t\t\t\t\t\t\t{ style: { width: width, height: height } },\n\t\t\t\t\t\t\t\t\t\timg\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tvar currentWidth = width || imageWidthWithinContainer;\n\t\t\t\t\t\t\tvar currentHeight = height || imageHeightWithinContainer;\n\n\t\t\t\t\t\t\tvar ratio = imageWidth / imageHeight;\n\t\t\t\t\t\t\tvar minWidth = imageWidth < imageHeight ? MIN_SIZE : MIN_SIZE * ratio;\n\t\t\t\t\t\t\tvar minHeight = imageHeight < imageWidth ? MIN_SIZE : MIN_SIZE / ratio;\n\n\t\t\t\t\t\t\t// With the current implementation of ResizableBox, an image needs an explicit pixel value for the max-width.\n\t\t\t\t\t\t\t// In absence of being able to set the content-width, this max-width is currently dictated by the vanilla editor style.\n\t\t\t\t\t\t\t// The following variable adds a buffer to this vanilla style, so 3rd party themes have some wiggleroom.\n\t\t\t\t\t\t\t// This does, in most cases, allow you to scale the image beyond the width of the main column, though not infinitely.\n\t\t\t\t\t\t\t// @todo It would be good to revisit this once a content-width variable becomes available.\n\t\t\t\t\t\t\tvar maxWidthBuffer = maxWidth * 2.5;\n\n\t\t\t\t\t\t\tvar showRightHandle = false;\n\t\t\t\t\t\t\tvar showLeftHandle = false;\n\n\t\t\t\t\t\t\t/* eslint-disable no-lonely-if */\n\t\t\t\t\t\t\t// See https://github.com/WordPress/gutenberg/issues/7584.\n\t\t\t\t\t\t\tif (align === 'center') {\n\t\t\t\t\t\t\t\t// When the image is centered, show both handles.\n\t\t\t\t\t\t\t\tshowRightHandle = true;\n\t\t\t\t\t\t\t\tshowLeftHandle = true;\n\t\t\t\t\t\t\t} else if (isRTL) {\n\t\t\t\t\t\t\t\t// In RTL mode the image is on the right by default.\n\t\t\t\t\t\t\t\t// Show the right handle and hide the left handle only when it is aligned left.\n\t\t\t\t\t\t\t\t// Otherwise always show the left handle.\n\t\t\t\t\t\t\t\tif (align === 'left') {\n\t\t\t\t\t\t\t\t\tshowRightHandle = true;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tshowLeftHandle = true;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// Show the left handle and hide the right handle only when the image is aligned right.\n\t\t\t\t\t\t\t\t// Otherwise always show the right handle.\n\t\t\t\t\t\t\t\tif (align === 'right') {\n\t\t\t\t\t\t\t\t\tshowLeftHandle = true;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tshowRightHandle = true;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/* eslint-enable no-lonely-if */\n\n\t\t\t\t\t\t\treturn wp.element.createElement(\n\t\t\t\t\t\t\t\tFragment,\n\t\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t\tgetInspectorControls(imageWidth, imageHeight),\n\t\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\t\tResizableBox,\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tsize: width && height ? {\n\t\t\t\t\t\t\t\t\t\t\twidth: width,\n\t\t\t\t\t\t\t\t\t\t\theight: height\n\t\t\t\t\t\t\t\t\t\t} : undefined,\n\t\t\t\t\t\t\t\t\t\tminWidth: minWidth,\n\t\t\t\t\t\t\t\t\t\tmaxWidth: maxWidthBuffer,\n\t\t\t\t\t\t\t\t\t\tminHeight: minHeight,\n\t\t\t\t\t\t\t\t\t\tmaxHeight: maxWidthBuffer / ratio,\n\t\t\t\t\t\t\t\t\t\tlockAspectRatio: true,\n\t\t\t\t\t\t\t\t\t\tenable: {\n\t\t\t\t\t\t\t\t\t\t\ttop: false,\n\t\t\t\t\t\t\t\t\t\t\tright: showRightHandle,\n\t\t\t\t\t\t\t\t\t\t\tbottom: true,\n\t\t\t\t\t\t\t\t\t\t\tleft: showLeftHandle\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tonResizeStart: function onResizeStart() {\n\t\t\t\t\t\t\t\t\t\t\ttoggleSelection(false);\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tonResizeStop: function onResizeStop(event, direction, elt, delta) {\n\t\t\t\t\t\t\t\t\t\t\tsetAttributes({\n\t\t\t\t\t\t\t\t\t\t\t\twidth: parseInt(currentWidth + delta.width, 10),\n\t\t\t\t\t\t\t\t\t\t\t\theight: parseInt(currentHeight + delta.height, 10)\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\ttoggleSelection(true);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\timg\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t),\n\t\t\t\t\t(!RichText.isEmpty(caption) || isSelected) && wp.element.createElement(RichText, {\n\t\t\t\t\t\ttagName: \"figcaption\",\n\t\t\t\t\t\tplaceholder: __('Write caption…'),\n\t\t\t\t\t\tvalue: caption,\n\t\t\t\t\t\tunstableOnFocus: this.onFocusCaption,\n\t\t\t\t\t\tonChange: function onChange(value) {\n\t\t\t\t\t\t\treturn setAttributes({ caption: value });\n\t\t\t\t\t\t},\n\t\t\t\t\t\tisSelected: this.state.captionFocused,\n\t\t\t\t\t\tinlineToolbar: true\n\t\t\t\t\t})\n\t\t\t\t)\n\t\t\t);\n\t\t\t/* eslint-enable jsx-a11y/no-static-element-interactions, jsx-a11y/onclick-has-role, jsx-a11y/click-events-have-key-events */\n\t\t}\n\t}]);\n\n\treturn ImageEdit;\n}(Component);\n\n/* harmony default export */ __webpack_exports__[\"a\"] = (compose([withSelect(function (select, props) {\n\tvar _select = select('core'),\n\t getMedia = _select.getMedia;\n\n\tvar _select2 = select('core/editor'),\n\t getEditorSettings = _select2.getEditorSettings;\n\n\tvar id = props.attributes.id;\n\n\tvar _getEditorSettings = getEditorSettings(),\n\t maxWidth = _getEditorSettings.maxWidth,\n\t isRTL = _getEditorSettings.isRTL,\n\t imageSizes = _getEditorSettings.imageSizes;\n\n\treturn {\n\t\timage: id ? getMedia(id) : null,\n\t\tmaxWidth: maxWidth,\n\t\tisRTL: isRTL,\n\t\timageSizes: imageSizes\n\t};\n}), withViewportMatch({ isLargeViewport: 'medium' }), withNotices])(ImageEdit));\n\n/***/ }),\n/* 5 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return createUpgradedEmbedBlock; });\n/* unused harmony export isFromWordPress */\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar WORDPRESS_EMBED_BLOCK = 'core-embed/wordpress';\n\nvar _lodash = lodash,\n includes = _lodash.includes;\nvar renderToString = wp.element.renderToString;\nvar createBlock = wp.blocks.createBlock;\n\n/***\n * Creates a more suitable embed block based on the passed in props\n * and attributes generated from an embed block's preview.\n *\n * We require `attributesFromPreview` to be generated from the latest attributes\n * and preview, and because of the way the react lifecycle operates, we can't\n * guarantee that the attributes contained in the block's props are the latest\n * versions, so we require that these are generated separately.\n * See `getAttributesFromPreview` in the generated embed edit component.\n *\n * @param {Object} props The block's props.\n * @param {Object} attributesFromPreview Attributes generated from the block's most up to date preview.\n * @return {Object|undefined} A more suitable embed block if one exists.\n */\n\nvar createUpgradedEmbedBlock = function createUpgradedEmbedBlock(props, attributesFromPreview) {\n\tvar preview = props.preview,\n\t name = props.name;\n\tvar url = props.attributes.url;\n\n\n\tif (!url) {\n\t\treturn;\n\t}\n\n\tvar matchingBlock = findBlock(url);\n\n\t// WordPress blocks can work on multiple sites, and so don't have patterns,\n\t// so if we're in a WordPress block, assume the user has chosen it for a WordPress URL.\n\tif (WORDPRESS_EMBED_BLOCK !== name && DEFAULT_EMBED_BLOCK !== matchingBlock) {\n\t\t// At this point, we have discovered a more suitable block for this url, so transform it.\n\t\tif (name !== matchingBlock) {\n\t\t\treturn createBlock(matchingBlock, { url: url });\n\t\t}\n\t}\n\n\tif (preview) {\n\t\tvar html = preview.html;\n\n\t\t// We can't match the URL for WordPress embeds, we have to check the HTML instead.\n\n\t\tif (isFromWordPress(html)) {\n\t\t\t// If this is not the WordPress embed block, transform it into one.\n\t\t\tif (WORDPRESS_EMBED_BLOCK !== name) {\n\t\t\t\treturn createBlock(WORDPRESS_EMBED_BLOCK, _extends({\n\t\t\t\t\turl: url\n\t\t\t\t}, attributesFromPreview));\n\t\t\t}\n\t\t}\n\t}\n};\n\nvar isFromWordPress = function isFromWordPress(html) {\n\treturn includes(html, 'class=\"wp-embedded-content\" data-secret');\n};\n\n/***/ }),\n/* 6 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar _lodash = lodash,\n noop = _lodash.noop;\nvar withGlobalEvents = wp.compose.withGlobalEvents;\nvar Component = wp.element.Component;\n\nvar ImageSize = function (_Component) {\n\t_inherits(ImageSize, _Component);\n\n\tfunction ImageSize() {\n\t\t_classCallCheck(this, ImageSize);\n\n\t\tvar _this = _possibleConstructorReturn(this, (ImageSize.__proto__ || Object.getPrototypeOf(ImageSize)).apply(this, arguments));\n\n\t\t_this.state = {\n\t\t\twidth: undefined,\n\t\t\theight: undefined\n\t\t};\n\t\t_this.bindContainer = _this.bindContainer.bind(_this);\n\t\t_this.calculateSize = _this.calculateSize.bind(_this);\n\t\treturn _this;\n\t}\n\n\t_createClass(ImageSize, [{\n\t\tkey: 'bindContainer',\n\t\tvalue: function bindContainer(ref) {\n\t\t\tthis.container = ref;\n\t\t}\n\t}, {\n\t\tkey: 'componentDidUpdate',\n\t\tvalue: function componentDidUpdate(prevProps) {\n\t\t\tif (this.props.src !== prevProps.src) {\n\t\t\t\tthis.setState({\n\t\t\t\t\twidth: undefined,\n\t\t\t\t\theight: undefined\n\t\t\t\t});\n\t\t\t\tthis.fetchImageSize();\n\t\t\t}\n\n\t\t\tif (this.props.dirtynessTrigger !== prevProps.dirtynessTrigger) {\n\t\t\t\tthis.calculateSize();\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: 'componentDidMount',\n\t\tvalue: function componentDidMount() {\n\t\t\tthis.fetchImageSize();\n\t\t}\n\t}, {\n\t\tkey: 'componentWillUnmount',\n\t\tvalue: function componentWillUnmount() {\n\t\t\tif (this.image) {\n\t\t\t\tthis.image.onload = noop;\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: 'fetchImageSize',\n\t\tvalue: function fetchImageSize() {\n\t\t\tthis.image = new window.Image();\n\t\t\tthis.image.onload = this.calculateSize;\n\t\t\tthis.image.src = this.props.src;\n\t\t}\n\t}, {\n\t\tkey: 'calculateSize',\n\t\tvalue: function calculateSize() {\n\t\t\tvar maxWidth = this.container.clientWidth;\n\t\t\tvar exceedMaxWidth = this.image.width > maxWidth;\n\t\t\tvar ratio = this.image.height / this.image.width;\n\t\t\tvar width = exceedMaxWidth ? maxWidth : this.image.width;\n\t\t\tvar height = exceedMaxWidth ? maxWidth * ratio : this.image.height;\n\t\t\tthis.setState({ width: width, height: height });\n\t\t}\n\t}, {\n\t\tkey: 'render',\n\t\tvalue: function render() {\n\t\t\tvar sizes = {\n\t\t\t\timageWidth: this.image && this.image.width,\n\t\t\t\timageHeight: this.image && this.image.height,\n\t\t\t\tcontainerWidth: this.container && this.container.clientWidth,\n\t\t\t\tcontainerHeight: this.container && this.container.clientHeight,\n\t\t\t\timageWidthWithinContainer: this.state.width,\n\t\t\t\timageHeightWithinContainer: this.state.height\n\t\t\t};\n\t\t\treturn wp.element.createElement(\n\t\t\t\t'div',\n\t\t\t\t{ ref: this.bindContainer },\n\t\t\t\tthis.props.children(sizes)\n\t\t\t);\n\t\t}\n\t}]);\n\n\treturn ImageSize;\n}(Component);\n\n/* harmony default export */ __webpack_exports__[\"a\"] = (withGlobalEvents({\n\tresize: 'calculateSize'\n})(ImageSize));\n\n/***/ }),\n/* 7 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_classnames__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_classnames___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_classnames__);\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n\n\nvar __ = wp.i18n.__;\nvar _wp$element = wp.element,\n Component = _wp$element.Component,\n createRef = _wp$element.createRef;\nvar _wp$components = wp.components,\n Spinner = _wp$components.Spinner,\n withSpokenMessages = _wp$components.withSpokenMessages,\n Popover = _wp$components.Popover,\n TextControl = _wp$components.TextControl;\nvar withInstanceId = wp.compose.withInstanceId;\n\nvar ThirstyURLInput = function (_Component) {\n\t_inherits(ThirstyURLInput, _Component);\n\n\t/**\n * Component constructor method.\n * \n * @since 3.6\n * \n * @param {*} param0 \n */\n\tfunction ThirstyURLInput(_ref) {\n\t\tvar autocompleteRef = _ref.autocompleteRef;\n\n\t\t_classCallCheck(this, ThirstyURLInput);\n\n\t\t// this.onChange = this.onChange.bind( this );\n\t\t// this.onKeyDown = this.onKeyDown.bind( this );\n\t\tvar _this = _possibleConstructorReturn(this, (ThirstyURLInput.__proto__ || Object.getPrototypeOf(ThirstyURLInput)).apply(this, arguments));\n\n\t\t_this.autocompleteRef = autocompleteRef || createRef();\n\t\t_this.inputRef = createRef();\n\t\t_this.searchAffiliateLinks = _this.searchAffiliateLinks.bind(_this);\n\t\t// this.updateSuggestions = throttle( this.updateSuggestions.bind( this ), 200 );\n\n\t\t_this.suggestionNodes = [];\n\n\t\t_this.state = {\n\t\t\tposts: [],\n\t\t\tshowSuggestions: false,\n\t\t\tselectedSuggestion: null,\n\t\t\tloading: false\n\t\t};\n\t\treturn _this;\n\t}\n\n\t/**\n * Component did update method.\n * \n * @since 3.6\n */\n\n\n\t_createClass(ThirstyURLInput, [{\n\t\tkey: \"componentDidUpdate\",\n\t\tvalue: function componentDidUpdate() {\n\t\t\tvar _this2 = this;\n\n\t\t\tvar _state = this.state,\n\t\t\t showSuggestions = _state.showSuggestions,\n\t\t\t selectedSuggestion = _state.selectedSuggestion;\n\t\t\t// only have to worry about scrolling selected suggestion into view\n\t\t\t// when already expanded\n\n\t\t\tif (showSuggestions && selectedSuggestion !== null && !this.scrollingIntoView) {\n\t\t\t\tthis.scrollingIntoView = true;\n\t\t\t\tscrollIntoView(this.suggestionNodes[selectedSuggestion], this.autocompleteRef.current, {\n\t\t\t\t\tonlyScrollIfNeeded: true\n\t\t\t\t});\n\n\t\t\t\tsetTimeout(function () {\n\t\t\t\t\t_this2.scrollingIntoView = false;\n\t\t\t\t}, 100);\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Component unmount method.\n * \n * @since 3.6\n */\n\n\t}, {\n\t\tkey: \"componentWillUnmount\",\n\t\tvalue: function componentWillUnmount() {\n\t\t\tdelete this.suggestionsRequest;\n\t\t}\n\n\t\t/**\n * Bind suggestion to node.\n * \n * @param {*} index \n */\n\n\t}, {\n\t\tkey: \"bindSuggestionNode\",\n\t\tvalue: function bindSuggestionNode(index) {\n\t\t\tvar _this3 = this;\n\n\t\t\treturn function (ref) {\n\t\t\t\t_this3.suggestionNodes[index] = ref;\n\t\t\t};\n\t\t}\n\t}, {\n\t\tkey: \"searchAffiliateLinks\",\n\t\tvalue: function searchAffiliateLinks(value) {\n\t\t\tvar _this4 = this;\n\n\t\t\t// Show the suggestions after typing at least 2 characters=\n\t\t\tif (value.length < 2) {\n\t\t\t\tthis.setState({\n\t\t\t\t\tshowSuggestions: false,\n\t\t\t\t\tselectedSuggestion: null,\n\t\t\t\t\tloading: false\n\t\t\t\t});\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.setState({\n\t\t\t\tshowSuggestions: true,\n\t\t\t\tselectedSuggestion: null,\n\t\t\t\tloading: true\n\t\t\t});\n\n\t\t\tvar formData = new FormData();\n\t\t\tformData.append(\"action\", \"search_affiliate_links_query\");\n\t\t\tformData.append(\"keyword\", value);\n\t\t\tformData.append(\"paged\", 1);\n\t\t\tformData.append(\"gutenberg\", true);\n\t\t\tformData.append(\"with_images\", true);\n\n\t\t\t// We are getting data via the WP AJAX instead of rest API as it is not possible yet\n\t\t\t// to filter results with category value. This is to prepare next update to add category filter.\n\t\t\tvar request = fetch(ajaxurl, {\n\t\t\t\tmethod: \"POST\",\n\t\t\t\tbody: formData\n\t\t\t});\n\n\t\t\trequest.then(function (response) {\n\t\t\t\treturn response.json();\n\t\t\t}).then(function (response) {\n\n\t\t\t\tif (!response.affiliate_links) return;\n\n\t\t\t\tvar posts = response.affiliate_links;\n\n\t\t\t\t// A fetch Promise doesn't have an abort option. It's mimicked by\n\t\t\t\t// comparing the request reference in on the instance, which is\n\t\t\t\t// reset or deleted on subsequent requests or unmounting.\n\t\t\t\tif (_this4.suggestionsRequest !== request) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t_this4.setState({\n\t\t\t\t\tposts: posts,\n\t\t\t\t\tloading: false\n\t\t\t\t});\n\n\t\t\t\tif (!!posts.length) {\n\t\t\t\t\t_this4.props.debouncedSpeak(sprintf(_n('%d result found, use up and down arrow keys to navigate.', '%d results found, use up and down arrow keys to navigate.', posts.length), posts.length), 'assertive');\n\t\t\t\t} else {\n\t\t\t\t\t_this4.props.debouncedSpeak(__('No results.'), 'assertive');\n\t\t\t\t}\n\t\t\t}).catch(function () {\n\t\t\t\tif (_this4.suggestionsRequest === request) {\n\t\t\t\t\t_this4.setState({\n\t\t\t\t\t\tloading: false\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tthis.suggestionsRequest = request;\n\t\t}\n\n\t\t/**\n * Set state when an affiliate link is selected.\n * \n * @since 3.6\n * \n * @param {*} post \n */\n\n\t}, {\n\t\tkey: \"selectLink\",\n\t\tvalue: function selectLink(post) {\n\t\t\t// this.props.onChange( post.link, post );\n\t\t\tthis.setState({\n\t\t\t\tselectedSuggestion: post,\n\t\t\t\tshowSuggestions: false\n\t\t\t});\n\n\t\t\tthis.props.updateImageSelection(post.images, post);\n\t\t}\n\n\t\t/**\n * Callback handler for when affiliate link is selected.\n * \n * @param {*} post \n */\n\n\t}, {\n\t\tkey: \"handleOnClick\",\n\t\tvalue: function handleOnClick(post) {\n\t\t\tthis.selectLink(post);\n\t\t\t// Move focus to the input field when a link suggestion is clicked.\n\t\t\t// this.inputRef.current.focus();\n\t\t}\n\t}, {\n\t\tkey: \"render\",\n\t\tvalue: function render() {\n\t\t\tvar _this5 = this;\n\n\t\t\tvar _props = this.props,\n\t\t\t _props$value = _props.value,\n\t\t\t value = _props$value === undefined ? '' : _props$value,\n\t\t\t _props$autoFocus = _props.autoFocus,\n\t\t\t autoFocus = _props$autoFocus === undefined ? true : _props$autoFocus,\n\t\t\t instanceId = _props.instanceId;\n\t\t\tvar _state2 = this.state,\n\t\t\t showSuggestions = _state2.showSuggestions,\n\t\t\t posts = _state2.posts,\n\t\t\t selectedSuggestion = _state2.selectedSuggestion,\n\t\t\t loading = _state2.loading;\n\n\n\t\t\treturn wp.element.createElement(\n\t\t\t\t\"div\",\n\t\t\t\t{ \"class\": \"edit-search-affiliate-links\" },\n\t\t\t\twp.element.createElement(\n\t\t\t\t\t\"form\",\n\t\t\t\t\t{\n\t\t\t\t\t\tclassName: \"editor-format-toolbar__link-container-content block-editor-format-toolbar__link-container-content ta-link-search-popover\",\n\t\t\t\t\t\tonSubmit: this.displayAffiliateImages\n\t\t\t\t\t},\n\t\t\t\t\twp.element.createElement(TextControl, {\n\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\tclassName: \"ta-search-affiliate-links\",\n\t\t\t\t\t\tplaceholder: __(\"Type to search affiliate links\"),\n\t\t\t\t\t\tonChange: this.searchAffiliateLinks,\n\t\t\t\t\t\tautocomplete: \"off\"\n\t\t\t\t\t}),\n\t\t\t\t\tloading && wp.element.createElement(Spinner, null),\n\t\t\t\t\tshowSuggestions && !!posts.length && wp.element.createElement(\n\t\t\t\t\t\tPopover,\n\t\t\t\t\t\t{ position: \"bottom\", focusOnMount: false },\n\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\"div\",\n\t\t\t\t\t\t\t{ \"class\": \"affilate-links-suggestions\" },\n\t\t\t\t\t\t\tposts.map(function (post, index) {\n\t\t\t\t\t\t\t\treturn wp.element.createElement(\n\t\t\t\t\t\t\t\t\t\"button\",\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tkey: post.id,\n\t\t\t\t\t\t\t\t\t\trole: \"option\",\n\t\t\t\t\t\t\t\t\t\ttabIndex: \"-1\",\n\t\t\t\t\t\t\t\t\t\tid: \"editor-url-input-suggestion-\" + instanceId + \"-\" + index,\n\t\t\t\t\t\t\t\t\t\tref: _this5.bindSuggestionNode(index),\n\t\t\t\t\t\t\t\t\t\tclassName: __WEBPACK_IMPORTED_MODULE_0_classnames___default()('editor-url-input__suggestion block-editor-url-input__suggestion', {\n\t\t\t\t\t\t\t\t\t\t\t'is-selected': index === selectedSuggestion\n\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\tonClick: function onClick() {\n\t\t\t\t\t\t\t\t\t\t\treturn _this5.handleOnClick(post);\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\"aria-selected\": index === selectedSuggestion\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tpost.title || __('(no title)')\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t}]);\n\n\treturn ThirstyURLInput;\n}(Component);\n\n/* harmony default export */ __webpack_exports__[\"a\"] = (withSpokenMessages(withInstanceId(ThirstyURLInput)));\n\n/***/ }),\n/* 8 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export (immutable) */ __webpack_exports__[\"a\"] = registerFormats;\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ta_link__ = __webpack_require__(9);\nfunction _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }\n\n\n\nvar registerFormatType = wp.richText.registerFormatType;\n\n/**\n * Register custom formats.\n * \n * @since 3.6\n */\n\nfunction registerFormats() {\n\n [__WEBPACK_IMPORTED_MODULE_0__ta_link__[\"a\" /* taLink */]].forEach(function (_ref) {\n var name = _ref.name,\n settings = _objectWithoutProperties(_ref, [\"name\"]);\n\n return registerFormatType(name, settings);\n });\n}\n\n/***/ }),\n/* 9 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return taLink; });\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__inline__ = __webpack_require__(10);\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n\n\nvar __ = wp.i18n.__;\nvar _wp$element = wp.element,\n Component = _wp$element.Component,\n Fragment = _wp$element.Fragment;\nvar withSpokenMessages = wp.components.withSpokenMessages;\nvar _wp$richText = wp.richText,\n getTextContent = _wp$richText.getTextContent,\n applyFormat = _wp$richText.applyFormat,\n removeFormat = _wp$richText.removeFormat,\n slice = _wp$richText.slice;\nvar isURL = wp.url.isURL;\nvar _wp$editor = wp.editor,\n RichTextToolbarButton = _wp$editor.RichTextToolbarButton,\n RichTextShortcut = _wp$editor.RichTextShortcut;\nvar _wp$components = wp.components,\n Path = _wp$components.Path,\n SVG = _wp$components.SVG;\nvar getRectangleFromRange = wp.dom.getRectangleFromRange;\n\n\nvar name = \"ta/link\";\n\n/**\n * Custom Affiliate link format. When applied will wrap selected text with <ta href=\"\" linkid=\"\"></ta> custom element.\n * Custom element is implemented here as we are not allowed to use <a> tag due to Gutenberg limitations.\n * Element is converted to normal <a> tag on frontend via PHP script filtered on 'the_content'.\n * \n * @since 3.6\n */\nvar taLink = {\n\tname: name,\n\ttitle: __(\"Affiliate Link\"),\n\ttagName: \"ta\",\n\tclassName: null,\n\tattributes: {\n\t\turl: \"href\",\n\t\ttarget: \"target\"\n\t},\n\tedit: withSpokenMessages(function (_Component) {\n\t\t_inherits(LinkEdit, _Component);\n\n\t\t/**\n * Component constructor.\n * \n * @since 3.6\n */\n\t\tfunction LinkEdit() {\n\t\t\t_classCallCheck(this, LinkEdit);\n\n\t\t\tvar _this = _possibleConstructorReturn(this, (LinkEdit.__proto__ || Object.getPrototypeOf(LinkEdit)).apply(this, arguments));\n\n\t\t\t_this.addLink = _this.addLink.bind(_this);\n\t\t\t_this.stopAddingLink = _this.stopAddingLink.bind(_this);\n\t\t\t_this.onRemoveFormat = _this.onRemoveFormat.bind(_this);\n\t\t\t_this.state = {\n\t\t\t\taddingLink: false\n\t\t\t};\n\t\t\treturn _this;\n\t\t}\n\n\t\t/**\n * Callback to set state to adding link status.\n * \n * @since 3.6\n */\n\n\n\t\t_createClass(LinkEdit, [{\n\t\t\tkey: \"addLink\",\n\t\t\tvalue: function addLink() {\n\t\t\t\tvar _props = this.props,\n\t\t\t\t value = _props.value,\n\t\t\t\t onChange = _props.onChange;\n\n\t\t\t\tvar text = getTextContent(slice(value));\n\n\t\t\t\tif (text && isURL(text)) {\n\t\t\t\t\tonChange(applyFormat(value, { type: name, attributes: { url: text } }));\n\t\t\t\t} else {\n\t\t\t\t\tthis.setState({ addingLink: true });\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/**\n * Callback to set state to stop adding link status.\n * \n * @since 3.6\n */\n\n\t\t}, {\n\t\t\tkey: \"stopAddingLink\",\n\t\t\tvalue: function stopAddingLink() {\n\t\t\t\tthis.setState({ addingLink: false });\n\t\t\t}\n\n\t\t\t/**\n * Remove format event callback.\n * \n * @since 3.6\n */\n\n\t\t}, {\n\t\t\tkey: \"onRemoveFormat\",\n\t\t\tvalue: function onRemoveFormat() {\n\t\t\t\tvar _props2 = this.props,\n\t\t\t\t value = _props2.value,\n\t\t\t\t onChange = _props2.onChange,\n\t\t\t\t speak = _props2.speak;\n\n\n\t\t\t\tonChange(removeFormat(value, name));\n\t\t\t\tspeak(__(\"Affiliate Link removed.\"), \"assertive\");\n\t\t\t}\n\n\t\t\t/**\n * Get selected anchor text.\n * \n * @since 3.9\n */\n\n\t\t}, {\n\t\t\tkey: \"getAnchorRect\",\n\t\t\tvalue: function getAnchorRect() {\n\n\t\t\t\tvar selection = window.getSelection();\n\t\t\t\tvar range = selection.rangeCount > 0 ? selection.getRangeAt(0) : null;\n\n\t\t\t\tif (!range) return;\n\n\t\t\t\tvar rect = null;\n\n\t\t\t\tif (this.state.addingLink) {\n\t\t\t\t\trect = getRectangleFromRange(range);\n\t\t\t\t} else {\n\n\t\t\t\t\tvar element = range.startContainer;\n\n\t\t\t\t\t// If the caret is right before the element, select the next element.\n\t\t\t\t\telement = element.nextElementSibling || element;\n\n\t\t\t\t\twhile (element.nodeType !== window.Node.ELEMENT_NODE) {\n\t\t\t\t\t\telement = element.parentNode;\n\t\t\t\t\t}\n\n\t\t\t\t\tvar closest = element.closest('ta');\n\t\t\t\t\tif (closest) {\n\t\t\t\t\t\trect = closest.getBoundingClientRect();\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn rect;\n\t\t\t}\n\n\t\t\t/**\n * Component render method.\n * \n * @since 3.6\n */\n\n\t\t}, {\n\t\t\tkey: \"render\",\n\t\t\tvalue: function render() {\n\t\t\t\tvar _props3 = this.props,\n\t\t\t\t isActive = _props3.isActive,\n\t\t\t\t activeAttributes = _props3.activeAttributes,\n\t\t\t\t value = _props3.value,\n\t\t\t\t onChange = _props3.onChange;\n\n\n\t\t\t\tvar anchorRect = this.getAnchorRect();\n\n\t\t\t\treturn wp.element.createElement(\n\t\t\t\t\tFragment,\n\t\t\t\t\tnull,\n\t\t\t\t\twp.element.createElement(RichTextShortcut, {\n\t\t\t\t\t\ttype: \"access\",\n\t\t\t\t\t\tcharacter: \"s\",\n\t\t\t\t\t\tonUse: this.onRemoveFormat\n\t\t\t\t\t}),\n\t\t\t\t\twp.element.createElement(RichTextShortcut, {\n\t\t\t\t\t\ttype: \"primary\",\n\t\t\t\t\t\tcharacter: \"l\",\n\t\t\t\t\t\tonUse: this.addLink\n\t\t\t\t\t}),\n\t\t\t\t\twp.element.createElement(RichTextShortcut, {\n\t\t\t\t\t\ttype: \"primaryShift\",\n\t\t\t\t\t\tcharacter: \"l\",\n\t\t\t\t\t\tonUse: this.onRemoveFormat\n\t\t\t\t\t}),\n\t\t\t\t\tisActive && wp.element.createElement(RichTextToolbarButton, {\n\t\t\t\t\t\ticon: \"editor-unlink\",\n\t\t\t\t\t\ttitle: __('Remove Affiliate Link'),\n\t\t\t\t\t\tclassName: \"ta-unlink-button\",\n\t\t\t\t\t\tonClick: this.onRemoveFormat,\n\t\t\t\t\t\tisActive: isActive,\n\t\t\t\t\t\tshortcutType: \"primaryShift\",\n\t\t\t\t\t\tshortcutCharacter: \"l\"\n\t\t\t\t\t}),\n\t\t\t\t\t!isActive && wp.element.createElement(RichTextToolbarButton, {\n\t\t\t\t\t\ticon: wp.element.createElement(\n\t\t\t\t\t\t\tSVG,\n\t\t\t\t\t\t\t{ xmlns: \"http://www.w3.org/2000/svg\", width: \"16.688\", height: \"9.875\", viewBox: \"0 0 16.688 9.875\" },\n\t\t\t\t\t\t\twp.element.createElement(Path, { id: \"TA.svg\", fill: \"black\", \"class\": \"cls-1\", d: \"M2.115,15.12H4.847L6.836,7.7H9.777l0.63-2.381H1.821L1.177,7.7H4.118Zm4.758,0H9.829l1.177-1.751h3.782l0.238,1.751h2.858L16.357,5.245H13.7Zm5.5-3.866,1.835-2.816,0.35,2.816H12.378Z\", transform: \"translate(-1.188 -5.25)\" })\n\t\t\t\t\t\t),\n\t\t\t\t\t\ttitle: __('Affiliate Link'),\n\t\t\t\t\t\tclassName: \"ta-link-button\",\n\t\t\t\t\t\tonClick: this.addLink,\n\t\t\t\t\t\tshortcutType: \"primary\",\n\t\t\t\t\t\tshortcutCharacter: \"l\"\n\t\t\t\t\t}),\n\t\t\t\t\twp.element.createElement(__WEBPACK_IMPORTED_MODULE_0__inline__[\"a\" /* default */], {\n\t\t\t\t\t\taddingLink: this.state.addingLink,\n\t\t\t\t\t\tstopAddingLink: this.stopAddingLink,\n\t\t\t\t\t\tisActive: isActive,\n\t\t\t\t\t\tactiveAttributes: activeAttributes,\n\t\t\t\t\t\tanchorRect: anchorRect,\n\t\t\t\t\t\tvalue: value,\n\t\t\t\t\t\tonChange: onChange\n\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t}\n\t\t}]);\n\n\t\treturn LinkEdit;\n\t}(Component))\n};\n\n/***/ }),\n/* 10 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_classnames__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_classnames___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_classnames__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__utils__ = __webpack_require__(11);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__url_popover__ = __webpack_require__(12);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__url_input__ = __webpack_require__(13);\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n\n\n\n\n\nvar __ = wp.i18n.__;\nvar _wp$element = wp.element,\n Component = _wp$element.Component,\n createRef = _wp$element.createRef;\nvar _wp$components = wp.components,\n ExternalLink = _wp$components.ExternalLink,\n ToggleControl = _wp$components.ToggleControl,\n IconButton = _wp$components.IconButton,\n withSpokenMessages = _wp$components.withSpokenMessages;\nvar _wp$keycodes = wp.keycodes,\n LEFT = _wp$keycodes.LEFT,\n RIGHT = _wp$keycodes.RIGHT,\n UP = _wp$keycodes.UP,\n DOWN = _wp$keycodes.DOWN,\n BACKSPACE = _wp$keycodes.BACKSPACE,\n ENTER = _wp$keycodes.ENTER;\nvar _wp$url = wp.url,\n prependHTTP = _wp$url.prependHTTP,\n safeDecodeURI = _wp$url.safeDecodeURI,\n filterURLForDisplay = _wp$url.filterURLForDisplay;\nvar _wp$richText = wp.richText,\n create = _wp$richText.create,\n insert = _wp$richText.insert,\n isCollapsed = _wp$richText.isCollapsed,\n applyFormat = _wp$richText.applyFormat,\n getTextContent = _wp$richText.getTextContent,\n slice = _wp$richText.slice;\n\n\nvar stopKeyPropagation = function stopKeyPropagation(event) {\n\treturn event.stopPropagation();\n};\n\n/**\n * Generates the format object that will be applied to the link text.\n * \n * @since 3.6\n *\n * @param {string} url The href of the link.\n * @param {boolean} linkid Affiliate link ID.\n * @param {Object} text The text that is being hyperlinked.\n *\n * @return {Object} The final format object.\n */\nfunction createLinkFormat(_ref) {\n\tvar url = _ref.url,\n\t linkid = _ref.linkid,\n\t text = _ref.text;\n\n\tvar format = {\n\t\ttype: \"ta/link\",\n\t\tattributes: {\n\t\t\turl: url,\n\t\t\tlinkid: linkid.toString()\n\t\t}\n\t};\n\n\treturn format;\n}\n\n/**\n * Check if input is being show.\n * \n * @since 3.6\n * \n * @param {Object} props Component props.\n * @param {Object} state Component state.\n */\nfunction isShowingInput(props, state) {\n\treturn props.addingLink || state.editLink;\n}\n\n/**\n * Affiliate Link editor JSX element.\n * \n * @since 3.6\n * \n * @param {Object} param0 Component props (destructred).\n */\nvar LinkEditor = function LinkEditor(_ref2) {\n\tvar value = _ref2.value,\n\t onChangeInputValue = _ref2.onChangeInputValue,\n\t onKeyDown = _ref2.onKeyDown,\n\t submitLink = _ref2.submitLink,\n\t invalidLink = _ref2.invalidLink,\n\t resetInvalidLink = _ref2.resetInvalidLink,\n\t autocompleteRef = _ref2.autocompleteRef;\n\treturn (\n\t\t// Disable reason: KeyPress must be suppressed so the block doesn't hide the toolbar\n\t\t/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */\n\t\twp.element.createElement(\n\t\t\t'form',\n\t\t\t{\n\t\t\t\tclassName: 'editor-format-toolbar__link-container-content block-editor-format-toolbar__link-container-content ta-link-search-popover',\n\t\t\t\tonKeyPress: stopKeyPropagation,\n\t\t\t\tonKeyDown: onKeyDown,\n\t\t\t\tonSubmit: submitLink\n\t\t\t},\n\t\t\twp.element.createElement(__WEBPACK_IMPORTED_MODULE_3__url_input__[\"a\" /* default */], {\n\t\t\t\tvalue: value,\n\t\t\t\tonChange: onChangeInputValue,\n\t\t\t\tautocompleteRef: autocompleteRef,\n\t\t\t\tinvalidLink: invalidLink,\n\t\t\t\tresetInvalidLink: resetInvalidLink\n\t\t\t}),\n\t\t\twp.element.createElement(IconButton, { icon: 'editor-break', label: __('Apply'), type: 'submit' })\n\t\t)\n\t\t/* eslint-enable jsx-a11y/no-noninteractive-element-interactions */\n\n\t);\n};\n\n/**\n * Affiliate link url viewer JSX element.\n * \n * @param {*} param0 Component props (destructred).\n */\nvar LinkViewerUrl = function LinkViewerUrl(_ref3) {\n\tvar url = _ref3.url;\n\n\tvar prependedURL = prependHTTP(url);\n\tvar linkClassName = __WEBPACK_IMPORTED_MODULE_0_classnames___default()('editor-format-toolbar__link-container-value block-editor-format-toolbar__link-container-value', {\n\t\t'has-invalid-link': !Object(__WEBPACK_IMPORTED_MODULE_1__utils__[\"a\" /* isValidHref */])(prependedURL)\n\t});\n\n\tif (!url) {\n\t\treturn wp.element.createElement('span', { className: linkClassName });\n\t}\n\n\treturn wp.element.createElement(\n\t\tExternalLink,\n\t\t{\n\t\t\tclassName: linkClassName,\n\t\t\thref: url\n\t\t},\n\t\tfilterURLForDisplay(safeDecodeURI(url))\n\t);\n};\n\n/**\n * Affiliate link viewer JSX element.\n * \n * @param {*} param0 Component props (destructred).\n */\nvar LinkViewer = function LinkViewer(_ref4) {\n\tvar url = _ref4.url,\n\t editLink = _ref4.editLink;\n\n\treturn (\n\t\t// Disable reason: KeyPress must be suppressed so the block doesn't hide the toolbar\n\t\t/* eslint-disable jsx-a11y/no-static-element-interactions */\n\t\twp.element.createElement(\n\t\t\t'div',\n\t\t\t{\n\t\t\t\tclassName: 'editor-format-toolbar__link-container-content block-editor-format-toolbar__link-container-content',\n\t\t\t\tonKeyPress: stopKeyPropagation\n\t\t\t},\n\t\t\twp.element.createElement(LinkViewerUrl, { url: url }),\n\t\t\twp.element.createElement(IconButton, { icon: 'edit', label: __('Edit'), onClick: editLink })\n\t\t)\n\t\t/* eslint-enable jsx-a11y/no-static-element-interactions */\n\n\t);\n};\n\n/**\n * Inline affiliate link UI Component.\n * \n * @since 3.6\n * \n * @param {*} param0 Component props (destructred).\n */\n\nvar InlineAffiliateLinkUI = function (_Component) {\n\t_inherits(InlineAffiliateLinkUI, _Component);\n\n\tfunction InlineAffiliateLinkUI() {\n\t\t_classCallCheck(this, InlineAffiliateLinkUI);\n\n\t\tvar _this = _possibleConstructorReturn(this, (InlineAffiliateLinkUI.__proto__ || Object.getPrototypeOf(InlineAffiliateLinkUI)).apply(this, arguments));\n\n\t\t_this.editLink = _this.editLink.bind(_this);\n\t\t_this.submitLink = _this.submitLink.bind(_this);\n\t\t_this.onKeyDown = _this.onKeyDown.bind(_this);\n\t\t_this.onChangeInputValue = _this.onChangeInputValue.bind(_this);\n\t\t_this.onClickOutside = _this.onClickOutside.bind(_this);\n\t\t_this.resetState = _this.resetState.bind(_this);\n\t\t_this.autocompleteRef = createRef();\n\t\t_this.resetInvalidLink = _this.resetInvalidLink.bind(_this);\n\n\t\t_this.state = {\n\t\t\tinputValue: '',\n\t\t\tlinkid: 0,\n\t\t\tpost: null,\n\t\t\tinvalidLink: false\n\t\t};\n\t\treturn _this;\n\t}\n\n\t/**\n * Stop the key event from propagating up to ObserveTyping.startTypingInTextField.\n * \n * @since 3.6\n * \n * @param {Object} event Event object.\n */\n\n\n\t_createClass(InlineAffiliateLinkUI, [{\n\t\tkey: 'onKeyDown',\n\t\tvalue: function onKeyDown(event) {\n\t\t\tif ([LEFT, DOWN, RIGHT, UP, BACKSPACE, ENTER].indexOf(event.keyCode) > -1) {\n\t\t\t\tevent.stopPropagation();\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Callback to set state when input value is changed.\n * \n * @since 3.6\n * \n * @param {*} inputValue \n * @param {*} post \n */\n\n\t}, {\n\t\tkey: 'onChangeInputValue',\n\t\tvalue: function onChangeInputValue(inputValue) {\n\t\t\tvar post = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n\n\t\t\tvar linkid = post ? post.id : 0;\n\t\t\tthis.setState({ inputValue: inputValue, linkid: linkid, post: post });\n\t\t}\n\n\t\t/**\n * Callback to set state when edit affiliate link (already inserted) is triggered.\n * \n * @since 3.6\n * \n * @param {*} event \n */\n\n\t}, {\n\t\tkey: 'editLink',\n\t\tvalue: function editLink(event) {\n\t\t\tthis.setState({ editLink: true });\n\t\t\tevent.preventDefault();\n\t\t}\n\n\t\t/**\n * Callback to apply the affiliate link format to the selected text or position in the active block.\n * \n * @since 3.6\n * \n * @param {*} event \n */\n\n\t}, {\n\t\tkey: 'submitLink',\n\t\tvalue: function submitLink(event) {\n\t\t\tvar _props = this.props,\n\t\t\t isActive = _props.isActive,\n\t\t\t value = _props.value,\n\t\t\t onChange = _props.onChange,\n\t\t\t speak = _props.speak;\n\t\t\tvar _state = this.state,\n\t\t\t inputValue = _state.inputValue,\n\t\t\t linkid = _state.linkid,\n\t\t\t post = _state.post;\n\n\t\t\tvar url = prependHTTP(inputValue);\n\t\t\tvar selectedText = getTextContent(slice(value));\n\t\t\tvar format = createLinkFormat({\n\t\t\t\turl: url,\n\t\t\t\tlinkid: linkid,\n\t\t\t\ttext: selectedText\n\t\t\t});\n\n\t\t\tevent.preventDefault();\n\n\t\t\tif (!linkid || !post) {\n\t\t\t\tthis.setState({ invalidLink: true });\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (isCollapsed(value) && !isActive) {\n\t\t\t\tvar toInsert = applyFormat(create({ text: post.title }), format, 0, url.length);\n\t\t\t\tonChange(insert(value, toInsert));\n\t\t\t} else {\n\t\t\t\tonChange(applyFormat(value, format));\n\t\t\t}\n\n\t\t\tthis.resetState();\n\n\t\t\tif (!Object(__WEBPACK_IMPORTED_MODULE_1__utils__[\"a\" /* isValidHref */])(url)) {\n\t\t\t\tspeak(__('Warning: the link has been inserted but may have errors. Please test it.'), 'assertive');\n\t\t\t} else if (isActive) {\n\t\t\t\tspeak(__('Link edited.'), 'assertive');\n\t\t\t} else {\n\t\t\t\tspeak(__('Link inserted'), 'assertive');\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Callback to run when users clicks outside the popover UI.\n * \n * @since 3.6\n * \n * @param {*} event \n */\n\n\t}, {\n\t\tkey: 'onClickOutside',\n\t\tvalue: function onClickOutside(event) {\n\t\t\t// The autocomplete suggestions list renders in a separate popover (in a portal),\n\t\t\t// so onClickOutside fails to detect that a click on a suggestion occured in the\n\t\t\t// LinkContainer. Detect clicks on autocomplete suggestions using a ref here, and\n\t\t\t// return to avoid the popover being closed.\n\t\t\tvar autocompleteElement = this.autocompleteRef.current;\n\t\t\tif (autocompleteElement && autocompleteElement.contains(event.target)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.resetState();\n\t\t}\n\n\t\t/**\n * Reset state callback.\n * \n * @since 3.6\n */\n\n\t}, {\n\t\tkey: 'resetState',\n\t\tvalue: function resetState() {\n\t\t\tthis.props.stopAddingLink();\n\t\t\tthis.setState({ inputValue: '', editLink: false });\n\t\t\tthis.resetInvalidLink();\n\t\t}\n\n\t\t/**\n * Reset invalid link state callback. Separated as we need to run this independently from resetState() callback.\n * \n * @since 3.6\n */\n\n\t}, {\n\t\tkey: 'resetInvalidLink',\n\t\tvalue: function resetInvalidLink() {\n\t\t\tthis.setState({ invalidLink: false });\n\t\t}\n\n\t\t/**\n * Component render method.\n *\n * @since 3.6\n */\n\n\t}, {\n\t\tkey: 'render',\n\t\tvalue: function render() {\n\t\t\tvar _props2 = this.props,\n\t\t\t isActive = _props2.isActive,\n\t\t\t _props2$activeAttribu = _props2.activeAttributes,\n\t\t\t url = _props2$activeAttribu.url,\n\t\t\t linkid = _props2$activeAttribu.linkid,\n\t\t\t addingLink = _props2.addingLink,\n\t\t\t anchorRect = _props2.anchorRect,\n\t\t\t value = _props2.value,\n\t\t\t onChange = _props2.onChange;\n\n\n\t\t\tif (!isActive && !addingLink) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tvar _state2 = this.state,\n\t\t\t inputValue = _state2.inputValue,\n\t\t\t invalidLink = _state2.invalidLink;\n\n\t\t\tvar showInput = isShowingInput(this.props, this.state);\n\n\t\t\treturn wp.element.createElement(\n\t\t\t\t__WEBPACK_IMPORTED_MODULE_2__url_popover__[\"a\" /* default */],\n\t\t\t\t{\n\t\t\t\t\tonClickOutside: this.onClickOutside,\n\t\t\t\t\tonClose: this.resetState,\n\t\t\t\t\tfocusOnMount: showInput ? 'firstElement' : false,\n\t\t\t\t\tinvalidLink: invalidLink,\n\t\t\t\t\tanchorRect: anchorRect\n\t\t\t\t},\n\t\t\t\tshowInput ? wp.element.createElement(LinkEditor, {\n\t\t\t\t\tvalue: inputValue,\n\t\t\t\t\tonChangeInputValue: this.onChangeInputValue,\n\t\t\t\t\tonKeyDown: this.onKeyDown,\n\t\t\t\t\tsubmitLink: this.submitLink,\n\t\t\t\t\tautocompleteRef: this.autocompleteRef,\n\t\t\t\t\tupdateLinkId: this.updateLinkId,\n\t\t\t\t\tinvalidLink: invalidLink,\n\t\t\t\t\tresetInvalidLink: this.resetInvalidLink\n\t\t\t\t}) : wp.element.createElement(LinkViewer, {\n\t\t\t\t\turl: url,\n\t\t\t\t\teditLink: this.editLink\n\t\t\t\t})\n\t\t\t);\n\t\t}\n\t}]);\n\n\treturn InlineAffiliateLinkUI;\n}(Component);\n\n/* harmony default export */ __webpack_exports__[\"a\"] = (withSpokenMessages(InlineAffiliateLinkUI));\n\n/***/ }),\n/* 11 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export (immutable) */ __webpack_exports__[\"a\"] = isValidHref;\nvar _lodash = lodash,\n startsWith = _lodash.startsWith;\nvar _wp$url = wp.url,\n getProtocol = _wp$url.getProtocol,\n isValidProtocol = _wp$url.isValidProtocol,\n getAuthority = _wp$url.getAuthority,\n isValidAuthority = _wp$url.isValidAuthority,\n getPath = _wp$url.getPath,\n isValidPath = _wp$url.isValidPath,\n getQueryString = _wp$url.getQueryString,\n isValidQueryString = _wp$url.isValidQueryString,\n getFragment = _wp$url.getFragment,\n isValidFragment = _wp$url.isValidFragment;\n\n/**\n * Check for issues with the provided href.\n * \n * @since 3.6\n *\n * @param {string} href The href.\n * @return {boolean} Is the href invalid?\n */\n\nfunction isValidHref(href) {\n\tif (!href) {\n\t\treturn false;\n\t}\n\n\tvar trimmedHref = href.trim();\n\n\tif (!trimmedHref) {\n\t\treturn false;\n\t}\n\n\t// Does the href start with something that looks like a URL protocol?\n\tif (/^\\S+:/.test(trimmedHref)) {\n\t\tvar protocol = getProtocol(trimmedHref);\n\t\tif (!isValidProtocol(protocol)) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Add some extra checks for http(s) URIs, since these are the most common use-case.\n\t\t// This ensures URIs with an http protocol have exactly two forward slashes following the protocol.\n\t\tif (startsWith(protocol, 'http') && !/^https?:\\/\\/[^\\/\\s]/i.test(trimmedHref)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tvar authority = getAuthority(trimmedHref);\n\t\tif (!isValidAuthority(authority)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tvar path = getPath(trimmedHref);\n\t\tif (path && !isValidPath(path)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tvar queryString = getQueryString(trimmedHref);\n\t\tif (queryString && !isValidQueryString(queryString)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tvar fragment = getFragment(trimmedHref);\n\t\tif (fragment && !isValidFragment(fragment)) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t// Validate anchor links.\n\tif (startsWith(trimmedHref, '#') && !isValidFragment(trimmedHref)) {\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\n/***/ }),\n/* 12 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar __ = wp.i18n.__;\nvar Component = wp.element.Component;\nvar _wp$components = wp.components,\n Popover = _wp$components.Popover,\n IconButton = _wp$components.IconButton;\n\n/**\n * Custom URL Popover component.\n * \n * @since 3.6\n */\n\nvar ThirstyURLPopover = function (_Component) {\n\t_inherits(ThirstyURLPopover, _Component);\n\n\t/**\n * Component constructor method.\n * \n * @since 3.6\n */\n\tfunction ThirstyURLPopover() {\n\t\t_classCallCheck(this, ThirstyURLPopover);\n\n\t\tvar _this = _possibleConstructorReturn(this, (ThirstyURLPopover.__proto__ || Object.getPrototypeOf(ThirstyURLPopover)).apply(this, arguments));\n\n\t\t_this.toggleSettingsVisibility = _this.toggleSettingsVisibility.bind(_this);\n\n\t\t_this.state = {\n\t\t\tisSettingsExpanded: false\n\t\t};\n\t\treturn _this;\n\t}\n\n\t/**\n * Component constructor.\n * \n * @since 3.6\n */\n\n\n\t_createClass(ThirstyURLPopover, [{\n\t\tkey: 'toggleSettingsVisibility',\n\t\tvalue: function toggleSettingsVisibility() {\n\t\t\tthis.setState({\n\t\t\t\tisSettingsExpanded: !this.state.isSettingsExpanded\n\t\t\t});\n\t\t}\n\n\t\t/**\n * Component render method.\n * \n * @since 3.6\n */\n\n\t}, {\n\t\tkey: 'render',\n\t\tvalue: function render() {\n\t\t\tvar _props = this.props,\n\t\t\t children = _props.children,\n\t\t\t renderSettings = _props.renderSettings,\n\t\t\t invalidLink = _props.invalidLink,\n\t\t\t _props$position = _props.position,\n\t\t\t position = _props$position === undefined ? 'bottom center' : _props$position,\n\t\t\t _props$focusOnMount = _props.focusOnMount,\n\t\t\t focusOnMount = _props$focusOnMount === undefined ? 'firstElement' : _props$focusOnMount,\n\t\t\t popoverProps = _objectWithoutProperties(_props, ['children', 'renderSettings', 'invalidLink', 'position', 'focusOnMount']);\n\n\t\t\tvar isSettingsExpanded = this.state.isSettingsExpanded;\n\n\n\t\t\tvar showSettings = !!renderSettings && isSettingsExpanded;\n\n\t\t\treturn wp.element.createElement(\n\t\t\t\tPopover,\n\t\t\t\t_extends({\n\t\t\t\t\tclassName: 'ta-url-popover editor-url-popover block-editor-url-popover',\n\t\t\t\t\tfocusOnMount: focusOnMount,\n\t\t\t\t\tposition: position\n\t\t\t\t}, popoverProps),\n\t\t\t\twp.element.createElement(\n\t\t\t\t\t'div',\n\t\t\t\t\t{ className: 'editor-url-popover__row' },\n\t\t\t\t\tchildren,\n\t\t\t\t\t!!renderSettings && wp.element.createElement(IconButton, {\n\t\t\t\t\t\tclassName: 'editor-url-popover__settings-toggle',\n\t\t\t\t\t\ticon: 'ellipsis',\n\t\t\t\t\t\tlabel: __('Link Settings'),\n\t\t\t\t\t\tonClick: this.toggleSettingsVisibility,\n\t\t\t\t\t\t'aria-expanded': isSettingsExpanded\n\t\t\t\t\t})\n\t\t\t\t),\n\t\t\t\tshowSettings && wp.element.createElement(\n\t\t\t\t\t'div',\n\t\t\t\t\t{ className: 'editor-url-popover__row editor-url-popover__settings' },\n\t\t\t\t\trenderSettings()\n\t\t\t\t),\n\t\t\t\tinvalidLink && wp.element.createElement(\n\t\t\t\t\t'div',\n\t\t\t\t\t{ 'class': 'ta-invalid-link' },\n\t\t\t\t\t__('Invalid affiliate link')\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t}]);\n\n\treturn ThirstyURLPopover;\n}(Component);\n\n/* harmony default export */ __webpack_exports__[\"a\"] = (ThirstyURLPopover);\n\n/***/ }),\n/* 13 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_classnames__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_classnames___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_classnames__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_dom_scroll_into_view__ = __webpack_require__(14);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_dom_scroll_into_view___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_dom_scroll_into_view__);\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n\n\n\nvar __ = wp.i18n.__;\nvar _lodash = lodash,\n throttle = _lodash.throttle;\nvar _wp$element = wp.element,\n Component = _wp$element.Component,\n createRef = _wp$element.createRef;\nvar _wp$keycodes = wp.keycodes,\n UP = _wp$keycodes.UP,\n DOWN = _wp$keycodes.DOWN,\n ENTER = _wp$keycodes.ENTER,\n TAB = _wp$keycodes.TAB;\nvar _wp$components = wp.components,\n Spinner = _wp$components.Spinner,\n withSpokenMessages = _wp$components.withSpokenMessages,\n Popover = _wp$components.Popover;\nvar withInstanceId = wp.compose.withInstanceId;\n\n// Since URLInput is rendered in the context of other inputs, but should be\n// considered a separate modal node, prevent keyboard events from propagating\n// as being considered from the input.\n\nvar stopEventPropagation = function stopEventPropagation(event) {\n\treturn event.stopPropagation();\n};\n\n/**\n * Custom URL Input component.\n * \n * @since 3.6\n */\n\nvar ThirstyURLInput = function (_Component) {\n\t_inherits(ThirstyURLInput, _Component);\n\n\t/**\n * Component constructor method.\n * \n * @since 3.6\n * \n * @param {*} param0 \n */\n\tfunction ThirstyURLInput(_ref) {\n\t\tvar autocompleteRef = _ref.autocompleteRef;\n\n\t\t_classCallCheck(this, ThirstyURLInput);\n\n\t\tvar _this = _possibleConstructorReturn(this, (ThirstyURLInput.__proto__ || Object.getPrototypeOf(ThirstyURLInput)).apply(this, arguments));\n\n\t\t_this.onChange = _this.onChange.bind(_this);\n\t\t_this.onKeyDown = _this.onKeyDown.bind(_this);\n\t\t_this.autocompleteRef = autocompleteRef || createRef();\n\t\t_this.inputRef = createRef();\n\t\t_this.updateSuggestions = throttle(_this.updateSuggestions.bind(_this), 200);\n\n\t\t_this.suggestionNodes = [];\n\n\t\t_this.state = {\n\t\t\tposts: [],\n\t\t\tshowSuggestions: false,\n\t\t\tselectedSuggestion: null\n\t\t};\n\t\treturn _this;\n\t}\n\n\t/**\n * Component did update method.\n * \n * @since 3.6\n */\n\n\n\t_createClass(ThirstyURLInput, [{\n\t\tkey: 'componentDidUpdate',\n\t\tvalue: function componentDidUpdate() {\n\t\t\tvar _this2 = this;\n\n\t\t\tvar _state = this.state,\n\t\t\t showSuggestions = _state.showSuggestions,\n\t\t\t selectedSuggestion = _state.selectedSuggestion;\n\t\t\t// only have to worry about scrolling selected suggestion into view\n\t\t\t// when already expanded\n\n\t\t\tif (showSuggestions && selectedSuggestion !== null && !this.scrollingIntoView) {\n\t\t\t\tthis.scrollingIntoView = true;\n\t\t\t\t__WEBPACK_IMPORTED_MODULE_1_dom_scroll_into_view___default()(this.suggestionNodes[selectedSuggestion], this.autocompleteRef.current, {\n\t\t\t\t\tonlyScrollIfNeeded: true\n\t\t\t\t});\n\n\t\t\t\tsetTimeout(function () {\n\t\t\t\t\t_this2.scrollingIntoView = false;\n\t\t\t\t}, 100);\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Component unmount method.\n * \n * @since 3.6\n */\n\n\t}, {\n\t\tkey: 'componentWillUnmount',\n\t\tvalue: function componentWillUnmount() {\n\t\t\tdelete this.suggestionsRequest;\n\t\t}\n\n\t\t/**\n * Bind suggestion to node.\n * \n * @param {*} index \n */\n\n\t}, {\n\t\tkey: 'bindSuggestionNode',\n\t\tvalue: function bindSuggestionNode(index) {\n\t\t\tvar _this3 = this;\n\n\t\t\treturn function (ref) {\n\t\t\t\t_this3.suggestionNodes[index] = ref;\n\t\t\t};\n\t\t}\n\n\t\t/**\n * Callback to show suggestions based on value inputted on search field.\n * \n * @since 3.6\n * \n * @param {*} value \n */\n\n\t}, {\n\t\tkey: 'updateSuggestions',\n\t\tvalue: function updateSuggestions(value) {\n\t\t\tvar _this4 = this;\n\n\t\t\t// Show the suggestions after typing at least 2 characters\n\t\t\t// and also for URLs\n\t\t\tif (value.length < 2 || /^https?:/.test(value)) {\n\t\t\t\tthis.setState({\n\t\t\t\t\tshowSuggestions: false,\n\t\t\t\t\tselectedSuggestion: null,\n\t\t\t\t\tloading: false\n\t\t\t\t});\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.setState({\n\t\t\t\tshowSuggestions: true,\n\t\t\t\tselectedSuggestion: null,\n\t\t\t\tloading: true\n\t\t\t});\n\n\t\t\tvar formData = new FormData();\n\t\t\tformData.append(\"action\", \"search_affiliate_links_query\");\n\t\t\tformData.append(\"keyword\", value);\n\t\t\tformData.append(\"paged\", 1);\n\t\t\tformData.append(\"gutenberg\", true);\n\n\t\t\t// We are getting data via the WP AJAX instead of rest API as it is not possible yet\n\t\t\t// to filter results with category value. This is to prepare next update to add category filter.\n\t\t\tvar request = fetch(ajaxurl, {\n\t\t\t\tmethod: \"POST\",\n\t\t\t\tbody: formData\n\t\t\t});\n\n\t\t\trequest.then(function (response) {\n\t\t\t\treturn response.json();\n\t\t\t}).then(function (response) {\n\n\t\t\t\tif (!response.affiliate_links) return;\n\n\t\t\t\tvar posts = response.affiliate_links;\n\n\t\t\t\t// A fetch Promise doesn't have an abort option. It's mimicked by\n\t\t\t\t// comparing the request reference in on the instance, which is\n\t\t\t\t// reset or deleted on subsequent requests or unmounting.\n\t\t\t\tif (_this4.suggestionsRequest !== request) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t_this4.setState({\n\t\t\t\t\tposts: posts,\n\t\t\t\t\tloading: false\n\t\t\t\t});\n\n\t\t\t\tif (!!posts.length) {\n\t\t\t\t\t_this4.props.debouncedSpeak(sprintf(_n('%d result found, use up and down arrow keys to navigate.', '%d results found, use up and down arrow keys to navigate.', posts.length), posts.length), 'assertive');\n\t\t\t\t} else {\n\t\t\t\t\t_this4.props.debouncedSpeak(__('No results.'), 'assertive');\n\t\t\t\t}\n\t\t\t}).catch(function () {\n\t\t\t\tif (_this4.suggestionsRequest === request) {\n\t\t\t\t\t_this4.setState({\n\t\t\t\t\t\tloading: false\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tthis.suggestionsRequest = request;\n\t\t}\n\n\t\t/**\n * Search input value change event callback method.\n * \n * @since 3.6\n * \n * @param {*} event \n */\n\n\t}, {\n\t\tkey: 'onChange',\n\t\tvalue: function onChange(event) {\n\t\t\tthis.props.resetInvalidLink();\n\t\t\tvar inputValue = event.target.value;\n\t\t\tthis.props.onChange(inputValue);\n\t\t\tthis.updateSuggestions(inputValue);\n\t\t}\n\n\t\t/**\n * Keydown event callback. Handles selecting result via keyboard.\n * \n * @since 3.6\n * \n * @param {*} event \n */\n\n\t}, {\n\t\tkey: 'onKeyDown',\n\t\tvalue: function onKeyDown(event) {\n\t\t\tvar _state2 = this.state,\n\t\t\t showSuggestions = _state2.showSuggestions,\n\t\t\t selectedSuggestion = _state2.selectedSuggestion,\n\t\t\t posts = _state2.posts,\n\t\t\t loading = _state2.loading;\n\t\t\t// If the suggestions are not shown or loading, we shouldn't handle the arrow keys\n\t\t\t// We shouldn't preventDefault to allow block arrow keys navigation\n\n\t\t\tif (!showSuggestions || !posts.length || loading) {\n\t\t\t\t// In the Windows version of Firefox the up and down arrows don't move the caret\n\t\t\t\t// within an input field like they do for Mac Firefox/Chrome/Safari. This causes\n\t\t\t\t// a form of focus trapping that is disruptive to the user experience. This disruption\n\t\t\t\t// only happens if the caret is not in the first or last position in the text input.\n\t\t\t\t// See: https://github.com/WordPress/gutenberg/issues/5693#issuecomment-436684747\n\t\t\t\tswitch (event.keyCode) {\n\t\t\t\t\t// When UP is pressed, if the caret is at the start of the text, move it to the 0\n\t\t\t\t\t// position.\n\t\t\t\t\tcase UP:\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (0 !== event.target.selectionStart) {\n\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\n\t\t\t\t\t\t\t\t// Set the input caret to position 0\n\t\t\t\t\t\t\t\tevent.target.setSelectionRange(0, 0);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t// When DOWN is pressed, if the caret is not at the end of the text, move it to the\n\t\t\t\t\t// last position.\n\t\t\t\t\tcase DOWN:\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (this.props.value.length !== event.target.selectionStart) {\n\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\n\t\t\t\t\t\t\t\t// Set the input caret to the last position\n\t\t\t\t\t\t\t\tevent.target.setSelectionRange(this.props.value.length, this.props.value.length);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar post = this.state.posts[this.state.selectedSuggestion];\n\n\t\t\tswitch (event.keyCode) {\n\t\t\t\tcase UP:\n\t\t\t\t\t{\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tvar previousIndex = !selectedSuggestion ? posts.length - 1 : selectedSuggestion - 1;\n\t\t\t\t\t\tthis.setState({\n\t\t\t\t\t\t\tselectedSuggestion: previousIndex\n\t\t\t\t\t\t});\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\tcase DOWN:\n\t\t\t\t\t{\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tvar nextIndex = selectedSuggestion === null || selectedSuggestion === posts.length - 1 ? 0 : selectedSuggestion + 1;\n\t\t\t\t\t\tthis.setState({\n\t\t\t\t\t\t\tselectedSuggestion: nextIndex\n\t\t\t\t\t\t});\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\tcase TAB:\n\t\t\t\t\t{\n\t\t\t\t\t\tif (this.state.selectedSuggestion !== null) {\n\t\t\t\t\t\t\tthis.selectLink(post);\n\t\t\t\t\t\t\t// Announce a link has been selected when tabbing away from the input field.\n\t\t\t\t\t\t\tthis.props.speak(__('Link selected'));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\tcase ENTER:\n\t\t\t\t\t{\n\t\t\t\t\t\tif (this.state.selectedSuggestion !== null) {\n\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\tthis.selectLink(post);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Set state when an affiliate link is selected.\n * \n * @since 3.6\n * \n * @param {*} post \n */\n\n\t}, {\n\t\tkey: 'selectLink',\n\t\tvalue: function selectLink(post) {\n\t\t\tthis.props.onChange(post.link, post);\n\t\t\tthis.setState({\n\t\t\t\tselectedSuggestion: null,\n\t\t\t\tshowSuggestions: false\n\t\t\t});\n\t\t}\n\n\t\t/**\n * Callback handler for when affiliate link is selected.\n * \n * @param {*} post \n */\n\n\t}, {\n\t\tkey: 'handleOnClick',\n\t\tvalue: function handleOnClick(post) {\n\t\t\tthis.selectLink(post);\n\t\t\t// Move focus to the input field when a link suggestion is clicked.\n\t\t\tthis.inputRef.current.focus();\n\t\t}\n\n\t\t/**\n * Component render method.\n * \n * @since 3.6\n */\n\n\t}, {\n\t\tkey: 'render',\n\t\tvalue: function render() {\n\t\t\tvar _this5 = this;\n\n\t\t\tvar _props = this.props,\n\t\t\t _props$value = _props.value,\n\t\t\t value = _props$value === undefined ? '' : _props$value,\n\t\t\t _props$autoFocus = _props.autoFocus,\n\t\t\t autoFocus = _props$autoFocus === undefined ? true : _props$autoFocus,\n\t\t\t instanceId = _props.instanceId,\n\t\t\t invalidLink = _props.invalidLink;\n\t\t\tvar _state3 = this.state,\n\t\t\t showSuggestions = _state3.showSuggestions,\n\t\t\t posts = _state3.posts,\n\t\t\t selectedSuggestion = _state3.selectedSuggestion,\n\t\t\t loading = _state3.loading;\n\t\t\t/* eslint-disable jsx-a11y/no-autofocus */\n\n\t\t\treturn wp.element.createElement(\n\t\t\t\t'div',\n\t\t\t\t{ className: 'editor-url-input block-editor-url-input' },\n\t\t\t\twp.element.createElement('input', {\n\t\t\t\t\tautoFocus: autoFocus,\n\t\t\t\t\ttype: 'text',\n\t\t\t\t\t'aria-label': __('URL'),\n\t\t\t\t\trequired: true,\n\t\t\t\t\tvalue: value,\n\t\t\t\t\tonChange: this.onChange,\n\t\t\t\t\tonInput: stopEventPropagation,\n\t\t\t\t\tplaceholder: __('Paste URL or type to search'),\n\t\t\t\t\tonKeyDown: this.onKeyDown,\n\t\t\t\t\trole: 'combobox',\n\t\t\t\t\t'aria-expanded': showSuggestions,\n\t\t\t\t\t'aria-autocomplete': 'list',\n\t\t\t\t\t'aria-owns': 'editor-url-input-suggestions-' + instanceId,\n\t\t\t\t\t'aria-activedescendant': selectedSuggestion !== null ? 'editor-url-input-suggestion-' + instanceId + '-' + selectedSuggestion : undefined,\n\t\t\t\t\tref: this.inputRef\n\t\t\t\t}),\n\t\t\t\tloading && wp.element.createElement(Spinner, null),\n\t\t\t\tshowSuggestions && !!posts.length && !invalidLink && wp.element.createElement(\n\t\t\t\t\tPopover,\n\t\t\t\t\t{ position: 'bottom', noArrow: true, focusOnMount: false },\n\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t'div',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tclassName: 'editor-url-input__suggestions block-editor-url-input__suggestions',\n\t\t\t\t\t\t\tid: 'editor-url-input-suggestions-' + instanceId,\n\t\t\t\t\t\t\tref: this.autocompleteRef,\n\t\t\t\t\t\t\trole: 'listbox'\n\t\t\t\t\t\t},\n\t\t\t\t\t\tposts.map(function (post, index) {\n\t\t\t\t\t\t\treturn wp.element.createElement(\n\t\t\t\t\t\t\t\t'button',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tkey: post.id,\n\t\t\t\t\t\t\t\t\trole: 'option',\n\t\t\t\t\t\t\t\t\ttabIndex: '-1',\n\t\t\t\t\t\t\t\t\tid: 'block-editor-url-input-suggestion-' + instanceId + '-' + index,\n\t\t\t\t\t\t\t\t\tref: _this5.bindSuggestionNode(index),\n\t\t\t\t\t\t\t\t\tclassName: __WEBPACK_IMPORTED_MODULE_0_classnames___default()('editor-url-input__suggestion block-editor-url-input__suggestion', {\n\t\t\t\t\t\t\t\t\t\t'is-selected': index === selectedSuggestion\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\tonClick: function onClick() {\n\t\t\t\t\t\t\t\t\t\treturn _this5.handleOnClick(post);\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t'aria-selected': index === selectedSuggestion\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tpost.title || __('(no title)')\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t})\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t);\n\t\t\t/* eslint-enable jsx-a11y/no-autofocus */\n\t\t}\n\t}]);\n\n\treturn ThirstyURLInput;\n}(Component);\n\n/* harmony default export */ __webpack_exports__[\"a\"] = (withSpokenMessages(withInstanceId(ThirstyURLInput)));\n\n/***/ }),\n/* 14 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = __webpack_require__(15);\n\n/***/ }),\n/* 15 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar util = __webpack_require__(16);\n\nfunction scrollIntoView(elem, container, config) {\n config = config || {};\n // document 归一化到 window\n if (container.nodeType === 9) {\n container = util.getWindow(container);\n }\n\n var allowHorizontalScroll = config.allowHorizontalScroll;\n var onlyScrollIfNeeded = config.onlyScrollIfNeeded;\n var alignWithTop = config.alignWithTop;\n var alignWithLeft = config.alignWithLeft;\n var offsetTop = config.offsetTop || 0;\n var offsetLeft = config.offsetLeft || 0;\n var offsetBottom = config.offsetBottom || 0;\n var offsetRight = config.offsetRight || 0;\n\n allowHorizontalScroll = allowHorizontalScroll === undefined ? true : allowHorizontalScroll;\n\n var isWin = util.isWindow(container);\n var elemOffset = util.offset(elem);\n var eh = util.outerHeight(elem);\n var ew = util.outerWidth(elem);\n var containerOffset = undefined;\n var ch = undefined;\n var cw = undefined;\n var containerScroll = undefined;\n var diffTop = undefined;\n var diffBottom = undefined;\n var win = undefined;\n var winScroll = undefined;\n var ww = undefined;\n var wh = undefined;\n\n if (isWin) {\n win = container;\n wh = util.height(win);\n ww = util.width(win);\n winScroll = {\n left: util.scrollLeft(win),\n top: util.scrollTop(win)\n };\n // elem 相对 container 可视视窗的距离\n diffTop = {\n left: elemOffset.left - winScroll.left - offsetLeft,\n top: elemOffset.top - winScroll.top - offsetTop\n };\n diffBottom = {\n left: elemOffset.left + ew - (winScroll.left + ww) + offsetRight,\n top: elemOffset.top + eh - (winScroll.top + wh) + offsetBottom\n };\n containerScroll = winScroll;\n } else {\n containerOffset = util.offset(container);\n ch = container.clientHeight;\n cw = container.clientWidth;\n containerScroll = {\n left: container.scrollLeft,\n top: container.scrollTop\n };\n // elem 相对 container 可视视窗的距离\n // 注意边框, offset 是边框到根节点\n diffTop = {\n left: elemOffset.left - (containerOffset.left + (parseFloat(util.css(container, 'borderLeftWidth')) || 0)) - offsetLeft,\n top: elemOffset.top - (containerOffset.top + (parseFloat(util.css(container, 'borderTopWidth')) || 0)) - offsetTop\n };\n diffBottom = {\n left: elemOffset.left + ew - (containerOffset.left + cw + (parseFloat(util.css(container, 'borderRightWidth')) || 0)) + offsetRight,\n top: elemOffset.top + eh - (containerOffset.top + ch + (parseFloat(util.css(container, 'borderBottomWidth')) || 0)) + offsetBottom\n };\n }\n\n if (diffTop.top < 0 || diffBottom.top > 0) {\n // 强制向上\n if (alignWithTop === true) {\n util.scrollTop(container, containerScroll.top + diffTop.top);\n } else if (alignWithTop === false) {\n util.scrollTop(container, containerScroll.top + diffBottom.top);\n } else {\n // 自动调整\n if (diffTop.top < 0) {\n util.scrollTop(container, containerScroll.top + diffTop.top);\n } else {\n util.scrollTop(container, containerScroll.top + diffBottom.top);\n }\n }\n } else {\n if (!onlyScrollIfNeeded) {\n alignWithTop = alignWithTop === undefined ? true : !!alignWithTop;\n if (alignWithTop) {\n util.scrollTop(container, containerScroll.top + diffTop.top);\n } else {\n util.scrollTop(container, containerScroll.top + diffBottom.top);\n }\n }\n }\n\n if (allowHorizontalScroll) {\n if (diffTop.left < 0 || diffBottom.left > 0) {\n // 强制向上\n if (alignWithLeft === true) {\n util.scrollLeft(container, containerScroll.left + diffTop.left);\n } else if (alignWithLeft === false) {\n util.scrollLeft(container, containerScroll.left + diffBottom.left);\n } else {\n // 自动调整\n if (diffTop.left < 0) {\n util.scrollLeft(container, containerScroll.left + diffTop.left);\n } else {\n util.scrollLeft(container, containerScroll.left + diffBottom.left);\n }\n }\n } else {\n if (!onlyScrollIfNeeded) {\n alignWithLeft = alignWithLeft === undefined ? true : !!alignWithLeft;\n if (alignWithLeft) {\n util.scrollLeft(container, containerScroll.left + diffTop.left);\n } else {\n util.scrollLeft(container, containerScroll.left + diffBottom.left);\n }\n }\n }\n }\n}\n\nmodule.exports = scrollIntoView;\n\n/***/ }),\n/* 16 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol ? \"symbol\" : typeof obj; };\n\nvar RE_NUM = /[\\-+]?(?:\\d*\\.|)\\d+(?:[eE][\\-+]?\\d+|)/.source;\n\nfunction getClientPosition(elem) {\n var box = undefined;\n var x = undefined;\n var y = undefined;\n var doc = elem.ownerDocument;\n var body = doc.body;\n var docElem = doc && doc.documentElement;\n // 根据 GBS 最新数据,A-Grade Browsers 都已支持 getBoundingClientRect 方法,不用再考虑传统的实现方式\n box = elem.getBoundingClientRect();\n\n // 注:jQuery 还考虑减去 docElem.clientLeft/clientTop\n // 但测试发现,这样反而会导致当 html 和 body 有边距/边框样式时,获取的值不正确\n // 此外,ie6 会忽略 html 的 margin 值,幸运地是没有谁会去设置 html 的 margin\n\n x = box.left;\n y = box.top;\n\n // In IE, most of the time, 2 extra pixels are added to the top and left\n // due to the implicit 2-pixel inset border. In IE6/7 quirks mode and\n // IE6 standards mode, this border can be overridden by setting the\n // document element's border to zero -- thus, we cannot rely on the\n // offset always being 2 pixels.\n\n // In quirks mode, the offset can be determined by querying the body's\n // clientLeft/clientTop, but in standards mode, it is found by querying\n // the document element's clientLeft/clientTop. Since we already called\n // getClientBoundingRect we have already forced a reflow, so it is not\n // too expensive just to query them all.\n\n // ie 下应该减去窗口的边框吧,毕竟默认 absolute 都是相对窗口定位的\n // 窗口边框标准是设 documentElement ,quirks 时设置 body\n // 最好禁止在 body 和 html 上边框 ,但 ie < 9 html 默认有 2px ,减去\n // 但是非 ie 不可能设置窗口边框,body html 也不是窗口 ,ie 可以通过 html,body 设置\n // 标准 ie 下 docElem.clientTop 就是 border-top\n // ie7 html 即窗口边框改变不了。永远为 2\n // 但标准 firefox/chrome/ie9 下 docElem.clientTop 是窗口边框,即使设了 border-top 也为 0\n\n x -= docElem.clientLeft || body.clientLeft || 0;\n y -= docElem.clientTop || body.clientTop || 0;\n\n return {\n left: x,\n top: y\n };\n}\n\nfunction getScroll(w, top) {\n var ret = w['page' + (top ? 'Y' : 'X') + 'Offset'];\n var method = 'scroll' + (top ? 'Top' : 'Left');\n if (typeof ret !== 'number') {\n var d = w.document;\n // ie6,7,8 standard mode\n ret = d.documentElement[method];\n if (typeof ret !== 'number') {\n // quirks mode\n ret = d.body[method];\n }\n }\n return ret;\n}\n\nfunction getScrollLeft(w) {\n return getScroll(w);\n}\n\nfunction getScrollTop(w) {\n return getScroll(w, true);\n}\n\nfunction getOffset(el) {\n var pos = getClientPosition(el);\n var doc = el.ownerDocument;\n var w = doc.defaultView || doc.parentWindow;\n pos.left += getScrollLeft(w);\n pos.top += getScrollTop(w);\n return pos;\n}\nfunction _getComputedStyle(elem, name, computedStyle_) {\n var val = '';\n var d = elem.ownerDocument;\n var computedStyle = computedStyle_ || d.defaultView.getComputedStyle(elem, null);\n\n // https://github.com/kissyteam/kissy/issues/61\n if (computedStyle) {\n val = computedStyle.getPropertyValue(name) || computedStyle[name];\n }\n\n return val;\n}\n\nvar _RE_NUM_NO_PX = new RegExp('^(' + RE_NUM + ')(?!px)[a-z%]+#x27;, 'i');\nvar RE_POS = /^(top|right|bottom|left)#x2F;;\nvar CURRENT_STYLE = 'currentStyle';\nvar RUNTIME_STYLE = 'runtimeStyle';\nvar LEFT = 'left';\nvar PX = 'px';\n\nfunction _getComputedStyleIE(elem, name) {\n // currentStyle maybe null\n // http://msdn.microsoft.com/en-us/library/ms535231.aspx\n var ret = elem[CURRENT_STYLE] && elem[CURRENT_STYLE][name];\n\n // 当 width/height 设置为百分比时,通过 pixelLeft 方式转换的 width/height 值\n // 一开始就处理了! CUSTOM_STYLE.height,CUSTOM_STYLE.width ,cssHook 解决@2011-08-19\n // 在 ie 下不对,需要直接用 offset 方式\n // borderWidth 等值也有问题,但考虑到 borderWidth 设为百分比的概率很小,这里就不考虑了\n\n // From the awesome hack by Dean Edwards\n // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291\n // If we're not dealing with a regular pixel number\n // but a number that has a weird ending, we need to convert it to pixels\n // exclude left right for relativity\n if (_RE_NUM_NO_PX.test(ret) && !RE_POS.test(name)) {\n // Remember the original values\n var style = elem.style;\n var left = style[LEFT];\n var rsLeft = elem[RUNTIME_STYLE][LEFT];\n\n // prevent flashing of content\n elem[RUNTIME_STYLE][LEFT] = elem[CURRENT_STYLE][LEFT];\n\n // Put in the new values to get a computed value out\n style[LEFT] = name === 'fontSize' ? '1em' : ret || 0;\n ret = style.pixelLeft + PX;\n\n // Revert the changed values\n style[LEFT] = left;\n\n elem[RUNTIME_STYLE][LEFT] = rsLeft;\n }\n return ret === '' ? 'auto' : ret;\n}\n\nvar getComputedStyleX = undefined;\nif (typeof window !== 'undefined') {\n getComputedStyleX = window.getComputedStyle ? _getComputedStyle : _getComputedStyleIE;\n}\n\nfunction each(arr, fn) {\n for (var i = 0; i < arr.length; i++) {\n fn(arr[i]);\n }\n}\n\nfunction isBorderBoxFn(elem) {\n return getComputedStyleX(elem, 'boxSizing') === 'border-box';\n}\n\nvar BOX_MODELS = ['margin', 'border', 'padding'];\nvar CONTENT_INDEX = -1;\nvar PADDING_INDEX = 2;\nvar BORDER_INDEX = 1;\nvar MARGIN_INDEX = 0;\n\nfunction swap(elem, options, callback) {\n var old = {};\n var style = elem.style;\n var name = undefined;\n\n // Remember the old values, and insert the new ones\n for (name in options) {\n if (options.hasOwnProperty(name)) {\n old[name] = style[name];\n style[name] = options[name];\n }\n }\n\n callback.call(elem);\n\n // Revert the old values\n for (name in options) {\n if (options.hasOwnProperty(name)) {\n style[name] = old[name];\n }\n }\n}\n\nfunction getPBMWidth(elem, props, which) {\n var value = 0;\n var prop = undefined;\n var j = undefined;\n var i = undefined;\n for (j = 0; j < props.length; j++) {\n prop = props[j];\n if (prop) {\n for (i = 0; i < which.length; i++) {\n var cssProp = undefined;\n if (prop === 'border') {\n cssProp = prop + which[i] + 'Width';\n } else {\n cssProp = prop + which[i];\n }\n value += parseFloat(getComputedStyleX(elem, cssProp)) || 0;\n }\n }\n }\n return value;\n}\n\n/**\n * A crude way of determining if an object is a window\n * @member util\n */\nfunction isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj != null && obj == obj.window;\n}\n\nvar domUtils = {};\n\neach(['Width', 'Height'], function (name) {\n domUtils['doc' + name] = function (refWin) {\n var d = refWin.document;\n return Math.max(\n // firefox chrome documentElement.scrollHeight< body.scrollHeight\n // ie standard mode : documentElement.scrollHeight> body.scrollHeight\n d.documentElement['scroll' + name],\n // quirks : documentElement.scrollHeight 最大等于可视窗口多一点?\n d.body['scroll' + name], domUtils['viewport' + name](d));\n };\n\n domUtils['viewport' + name] = function (win) {\n // pc browser includes scrollbar in window.innerWidth\n var prop = 'client' + name;\n var doc = win.document;\n var body = doc.body;\n var documentElement = doc.documentElement;\n var documentElementProp = documentElement[prop];\n // 标准模式取 documentElement\n // backcompat 取 body\n return doc.compatMode === 'CSS1Compat' && documentElementProp || body && body[prop] || documentElementProp;\n };\n});\n\n/*\n 得到元素的大小信息\n @param elem\n @param name\n @param {String} [extra] 'padding' : (css width) + padding\n 'border' : (css width) + padding + border\n 'margin' : (css width) + padding + border + margin\n */\nfunction getWH(elem, name, extra) {\n if (isWindow(elem)) {\n return name === 'width' ? domUtils.viewportWidth(elem) : domUtils.viewportHeight(elem);\n } else if (elem.nodeType === 9) {\n return name === 'width' ? domUtils.docWidth(elem) : domUtils.docHeight(elem);\n }\n var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];\n var borderBoxValue = name === 'width' ? elem.offsetWidth : elem.offsetHeight;\n var computedStyle = getComputedStyleX(elem);\n var isBorderBox = isBorderBoxFn(elem, computedStyle);\n var cssBoxValue = 0;\n if (borderBoxValue == null || borderBoxValue <= 0) {\n borderBoxValue = undefined;\n // Fall back to computed then un computed css if necessary\n cssBoxValue = getComputedStyleX(elem, name);\n if (cssBoxValue == null || Number(cssBoxValue) < 0) {\n cssBoxValue = elem.style[name] || 0;\n }\n // Normalize '', auto, and prepare for extra\n cssBoxValue = parseFloat(cssBoxValue) || 0;\n }\n if (extra === undefined) {\n extra = isBorderBox ? BORDER_INDEX : CONTENT_INDEX;\n }\n var borderBoxValueOrIsBorderBox = borderBoxValue !== undefined || isBorderBox;\n var val = borderBoxValue || cssBoxValue;\n if (extra === CONTENT_INDEX) {\n if (borderBoxValueOrIsBorderBox) {\n return val - getPBMWidth(elem, ['border', 'padding'], which, computedStyle);\n }\n return cssBoxValue;\n }\n if (borderBoxValueOrIsBorderBox) {\n var padding = extra === PADDING_INDEX ? -getPBMWidth(elem, ['border'], which, computedStyle) : getPBMWidth(elem, ['margin'], which, computedStyle);\n return val + (extra === BORDER_INDEX ? 0 : padding);\n }\n return cssBoxValue + getPBMWidth(elem, BOX_MODELS.slice(extra), which, computedStyle);\n}\n\nvar cssShow = {\n position: 'absolute',\n visibility: 'hidden',\n display: 'block'\n};\n\n// fix #119 : https://github.com/kissyteam/kissy/issues/119\nfunction getWHIgnoreDisplay(elem) {\n var val = undefined;\n var args = arguments;\n // in case elem is window\n // elem.offsetWidth === undefined\n if (elem.offsetWidth !== 0) {\n val = getWH.apply(undefined, args);\n } else {\n swap(elem, cssShow, function () {\n val = getWH.apply(undefined, args);\n });\n }\n return val;\n}\n\nfunction css(el, name, v) {\n var value = v;\n if ((typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') {\n for (var i in name) {\n if (name.hasOwnProperty(i)) {\n css(el, i, name[i]);\n }\n }\n return undefined;\n }\n if (typeof value !== 'undefined') {\n if (typeof value === 'number') {\n value += 'px';\n }\n el.style[name] = value;\n return undefined;\n }\n return getComputedStyleX(el, name);\n}\n\neach(['width', 'height'], function (name) {\n var first = name.charAt(0).toUpperCase() + name.slice(1);\n domUtils['outer' + first] = function (el, includeMargin) {\n return el && getWHIgnoreDisplay(el, name, includeMargin ? MARGIN_INDEX : BORDER_INDEX);\n };\n var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];\n\n domUtils[name] = function (elem, val) {\n if (val !== undefined) {\n if (elem) {\n var computedStyle = getComputedStyleX(elem);\n var isBorderBox = isBorderBoxFn(elem);\n if (isBorderBox) {\n val += getPBMWidth(elem, ['padding', 'border'], which, computedStyle);\n }\n return css(elem, name, val);\n }\n return undefined;\n }\n return elem && getWHIgnoreDisplay(elem, name, CONTENT_INDEX);\n };\n});\n\n// 设置 elem 相对 elem.ownerDocument 的坐标\nfunction setOffset(elem, offset) {\n // set position first, in-case top/left are set even on static elem\n if (css(elem, 'position') === 'static') {\n elem.style.position = 'relative';\n }\n\n var old = getOffset(elem);\n var ret = {};\n var current = undefined;\n var key = undefined;\n\n for (key in offset) {\n if (offset.hasOwnProperty(key)) {\n current = parseFloat(css(elem, key)) || 0;\n ret[key] = current + offset[key] - old[key];\n }\n }\n css(elem, ret);\n}\n\nmodule.exports = _extends({\n getWindow: function getWindow(node) {\n var doc = node.ownerDocument || node;\n return doc.defaultView || doc.parentWindow;\n },\n offset: function offset(el, value) {\n if (typeof value !== 'undefined') {\n setOffset(el, value);\n } else {\n return getOffset(el);\n }\n },\n\n isWindow: isWindow,\n each: each,\n css: css,\n clone: function clone(obj) {\n var ret = {};\n for (var i in obj) {\n if (obj.hasOwnProperty(i)) {\n ret[i] = obj[i];\n }\n }\n var overflow = obj.overflow;\n if (overflow) {\n for (var i in obj) {\n if (obj.hasOwnProperty(i)) {\n ret.overflow[i] = obj.overflow[i];\n }\n }\n }\n return ret;\n },\n scrollLeft: function scrollLeft(w, v) {\n if (isWindow(w)) {\n if (v === undefined) {\n return getScrollLeft(w);\n }\n window.scrollTo(v, getScrollTop(w));\n } else {\n if (v === undefined) {\n return w.scrollLeft;\n }\n w.scrollLeft = v;\n }\n },\n scrollTop: function scrollTop(w, v) {\n if (isWindow(w)) {\n if (v === undefined) {\n return getScrollTop(w);\n }\n window.scrollTo(getScrollLeft(w), v);\n } else {\n if (v === undefined) {\n return w.scrollTop;\n }\n w.scrollTop = v;\n }\n },\n\n viewportWidth: 0,\n viewportHeight: 0\n}, domUtils);\n\n/***/ }),\n/* 17 */\n/***/ (function(module, exports) {\n\n// removed by extract-text-webpack-plugin\n\n/***/ })\n/******/ ]);\n\n\n// WEBPACK FOOTER //\n// gutenberg-support.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 765b03ea8b1e2393384e","/*!\n Copyright (c) 2017 Jed Watson.\n Licensed under the MIT License (MIT), see\n http://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = [];\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (!arg) continue;\n\n\t\t\tvar argType = typeof arg;\n\n\t\t\tif (argType === 'string' || argType === 'number') {\n\t\t\t\tclasses.push(arg);\n\t\t\t} else if (Array.isArray(arg) && arg.length) {\n\t\t\t\tvar inner = classNames.apply(null, arg);\n\t\t\t\tif (inner) {\n\t\t\t\t\tclasses.push(inner);\n\t\t\t\t}\n\t\t\t} else if (argType === 'object') {\n\t\t\t\tfor (var key in arg) {\n\t\t\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\t\t\tclasses.push(key);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn classes.join(' ');\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/classnames/index.js\n// module id = 0\n// module chunks = 0","import registerBlocks from \"./blocks\";\nimport registerFormats from \"./formats\";\n\nimport \"./assets/styles/index.scss\";\n\nregisterBlocks();\nregisterFormats();\n\n\n\n// WEBPACK FOOTER //\n// ./src/index.js","import * as taimage from \"./ta-image\";\n\nconst { registerBlockType } = wp.blocks;\n\n/**\n * Register gutenberg blocks.\n * \n * @since 3.6\n */\nexport default function registerBlocks() {\n\n [\n taimage\n ].forEach( ( block ) => {\n if ( ! block ) return;\n\n const { name , settings } = block;\n registerBlockType( name , settings );\n } );\n}\n\n\n// WEBPACK FOOTER //\n// ./src/blocks/index.js","import classnames from \"classnames\";\n\nconst { Fragment } = wp.element;\nconst { __ } = wp.i18n;\nconst { createBlock, getBlockAttributes, getPhrasingContentSchema } = wp.blocks;\nconst { RichText } = wp.editor;\nconst { Path , SVG } = wp.components;\n\nimport edit from \"./edit\";\n\nexport const name = 'ta/image';\n\nconst blockAttributes = {\n\turl: {\n\t\ttype: 'string',\n\t\tsource: 'attribute',\n\t\tselector: 'img',\n\t\tattribute: 'src',\n\t},\n\talt: {\n\t\ttype: 'string',\n\t\tsource: 'attribute',\n\t\tselector: 'img',\n\t\tattribute: 'alt',\n\t\tdefault: '',\n\t},\n\tcaption: {\n\t\ttype: 'string',\n\t\tsource: 'html',\n\t\tselector: 'figcaption',\n\t},\n\tid: {\n\t\ttype: 'number',\n\t},\n\talign: {\n\t\ttype: 'string',\n\t},\n\twidth: {\n\t\ttype: 'number',\n\t},\n\theight: {\n\t\ttype: 'number',\n\t},\n\tlinkid: {\n\t\ttype: 'number',\n\t},\n\thref: {\n\t\ttype: 'string',\n\t\tsource: 'attribute',\n\t\tselector: 'ta',\n\t\tattribute: 'href'\n\t},\n\taffiliateLink: {\n\t\ttype: 'object'\n\t}\n};\n\nconst imageSchema = {\n\timg: {\n\t\tattributes: [ 'src', 'alt' ],\n\t\tclasses: [ 'alignleft', 'aligncenter', 'alignright', 'alignnone', /^wp-image-\\d+#x2F; ],\n\t},\n};\n\nconst schema = {\n\tfigure: {\n\t\trequire: [ 'ta' , 'img' ],\n\t\tchildren: {\n\t\t\tta: {\n\t\t\t\tattributes: [ 'href', 'linkid' ],\n\t\t\t\tchildren: imageSchema,\n\t\t\t},\n\t\t\tfigcaption: {\n\t\t\t\tchildren: getPhrasingContentSchema(),\n\t\t\t},\n\t\t},\n\t},\n};\n\nfunction getFirstAnchorAttributeFormHTML( html, attributeName ) {\n\tconst { body } = document.implementation.createHTMLDocument( '' );\n\n\tbody.innerHTML = html;\n\n\tconst { firstElementChild } = body;\n\n\tif (\n\t\tfirstElementChild &&\n\t\tfirstElementChild.nodeName === 'A'\n\t) {\n\t\treturn firstElementChild.getAttribute( attributeName ) || undefined;\n\t}\n}\n\nexport const settings = {\n\ttitle: __( 'ThirstyAffiliates Image' ),\n\n\tdescription: __( 'Insert an image with an affiliate link to make a visual statement.' ),\n\n\ticon: <SVG viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\"><Path d=\"M0,0h24v24H0V0z\" fill=\"none\" /><Path d=\"m19 5v14h-14v-14h14m0-2h-14c-1.1 0-2 0.9-2 2v14c0 1.1 0.9 2 2 2h14c1.1 0 2-0.9 2-2v-14c0-1.1-0.9-2-2-2z\" /><Path d=\"m14.14 11.86l-3 3.87-2.14-2.59-3 3.86h12l-3.86-5.14z\" /></SVG>,\n\n\tcategory: 'common',\n\n\tkeywords: [\n\t\t'img', // \"img\" is not translated as it is intended to reflect the HTML <img> tag.\n\t\t__( 'photo' ),\n\t\t__( 'affiliate' )\n\t],\n\n\tattributes: blockAttributes,\n\n\tgetEditWrapperProps( attributes ) {\n\t\tconst { align, width } = attributes;\n\t\tif ( 'left' === align || 'center' === align || 'right' === align || 'wide' === align || 'full' === align ) {\n\t\t\treturn { 'data-align': align, 'data-resized': !! width };\n\t\t}\n\t},\n\n\tedit,\n\n\tsave( { attributes } ) {\n\t\tconst {\n\t\t\turl,\n\t\t\talt,\n\t\t\tcaption,\n\t\t\talign,\n\t\t\twidth,\n\t\t\theight,\n\t\t\tid,\n\t\t\tlinkid,\n\t\t\thref\n\t\t} = attributes;\n\n\t\tconst classes = classnames( {\n\t\t\t[ `align${ align }` ]: align,\n\t\t\t'is-resized': width || height,\n\t\t} );\n\n\t\tconst image = (\n\t\t\t<img\n\t\t\t\tsrc={ url }\n\t\t\t\talt={ alt }\n\t\t\t\tclassName={ id ? `wp-image-${ id }` : null }\n\t\t\t\twidth={ width }\n\t\t\t\theight={ height }\n\t\t\t/>\n\t\t);\n\n\t\tconst figure = (\n\t\t\t<Fragment>\n\t\t\t\t<ta linkid={ linkid } href={ href }>\n\t\t\t\t{ image }\n\t\t\t\t</ta>\n\t\t\t\t<RichText.Content tagName=\"figcaption\" value={ caption } />\n\t\t\t</Fragment>\n\t\t);\n\n\t\tif ( 'left' === align || 'right' === align || 'center' === align ) {\n\t\t\treturn (\n\t\t\t\t<div className='wp-block-image'>\n\t\t\t\t\t<figure className={ classes }>\n\t\t\t\t\t\t{ figure }\n\t\t\t\t\t</figure>\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<figure className={ `wp-block-image ${classes}` }>\n\t\t\t\t{ figure }\n\t\t\t</figure>\n\t\t);\n\t}\n};\n\n\n// WEBPACK FOOTER //\n// ./src/blocks/ta-image/index.js","import classnames from \"classnames\";\n\nconst { get , isEmpty , map , last , pick , compact } = lodash;\nconst { getPath } = wp.url;\nconst { __, sprintf } = wp.i18n;\nconst { Component, Fragment , createRef } = wp.element;\nconst { getBlobByURL, revokeBlobURL, isBlobURL } = wp.blob;\nconst { Placeholder , Button , ButtonGroup , IconButton , PanelBody , ResizableBox , SelectControl , Spinner , TextControl , TextareaControl , Toolbar , withNotices , ToggleControl , Popover } = wp.components;\nconst { withSelect } = wp.data;\nconst { RichText , BlockControls , InspectorControls , MediaUpload , MediaUploadCheck , MediaPlaceholder , BlockAlignmentToolbar , mediaUpload } = wp.editor;\nconst { withViewportMatch } = wp.viewport;\nconst { compose } = wp.compose;\n\nimport { createUpgradedEmbedBlock } from \"./util\";\nimport ImageSize from \"./image-size\";\nimport ThirstyURLInput from './search-input';\n\n/**\n * Module constants\n */\nconst MIN_SIZE = 20;\nconst LINK_DESTINATION_NONE = 'none';\nconst LINK_DESTINATION_MEDIA = 'media';\nconst LINK_DESTINATION_ATTACHMENT = 'attachment';\nconst LINK_DESTINATION_CUSTOM = 'custom';\nconst NEW_TAB_REL = 'noreferrer noopener';\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\n\nexport const pickRelevantMediaFiles = ( image ) => {\n\tconst imageProps = pick( image, [ 'alt', 'id', 'link', 'caption' ] );\n\timageProps.url = get( image, [ 'sizes', 'large', 'url' ] ) || get( image, [ 'media_details', 'sizes', 'large', 'source_url' ] ) || image.url;\n\treturn imageProps;\n};\n\n/**\n * Is the URL a temporary blob URL? A blob URL is one that is used temporarily\n * while the image is being uploaded and will not have an id yet allocated.\n *\n * @param {number=} id The id of the image.\n * @param {string=} url The url of the image.\n *\n * @return {boolean} Is the URL a Blob URL\n */\nconst isTemporaryImage = ( id, url ) => ! id && isBlobURL( url );\n\n/**\n * Is the url for the image hosted externally. An externally hosted image has no id\n * and is not a blob url.\n *\n * @param {number=} id The id of the image.\n * @param {string=} url The url of the image.\n *\n * @return {boolean} Is the url an externally hosted url?\n */\nconst isExternalImage = ( id, url ) => url && ! id && ! isBlobURL( url );\n\nclass ImageEdit extends Component {\n\tconstructor( { attributes } ) {\n\t\tsuper( ...arguments );\n\t\tthis.updateAlt = this.updateAlt.bind( this );\n\t\tthis.updateAlignment = this.updateAlignment.bind( this );\n\t\tthis.onFocusCaption = this.onFocusCaption.bind( this );\n\t\tthis.onImageClick = this.onImageClick.bind( this );\n\t\tthis.onSelectImage = this.onSelectImage.bind( this );\n\t\tthis.updateImageURL = this.updateImageURL.bind( this );\n\t\tthis.updateWidth = this.updateWidth.bind( this );\n\t\tthis.updateHeight = this.updateHeight.bind( this );\n\t\tthis.updateDimensions = this.updateDimensions.bind( this );\n\t\tthis.getFilename = this.getFilename.bind( this );\n\t\tthis.toggleIsEditing = this.toggleIsEditing.bind( this );\n\t\tthis.onImageError = this.onImageError.bind( this );\n\t\tthis.onChangeInputValue = this.onChangeInputValue.bind( this );\n\t\tthis.autocompleteRef = createRef();\n\t\tthis.resetInvalidLink = this.resetInvalidLink.bind( this );\n\t\tthis.updateImageSelection = this.updateImageSelection.bind( this );\n\t\tthis.onSelectAffiliateImage = this.onSelectAffiliateImage.bind( this );\n\t\tthis.editAFfiliateImage = this.editAFfiliateImage.bind( this );\n\n\t\tthis.state = {\n\t\t\tcaptionFocused: false,\n\t\t\tisEditing: ! attributes.url,\n\t\t\tinputValue : '',\n\t\t\tlinkid : 0,\n\t\t\tpost : null,\n\t\t\tshowSuggestions : false,\n\t\t\timageSelection : [],\n\t\t\taffiliateLink : null\n\t\t};\n\t}\n\n\tcomponentDidMount() {\n\t\tconst { attributes, setAttributes, noticeOperations } = this.props;\n\t\tconst { id, url = '' } = attributes;\n\n\t\tif ( isTemporaryImage( id, url ) ) {\n\t\t\tconst file = getBlobByURL( url );\n\n\t\t\tif ( file ) {\n\t\t\t\tmediaUpload( {\n\t\t\t\t\tfilesList: [ file ],\n\t\t\t\t\tonFileChange: ( [ image ] ) => {\n\t\t\t\t\t\tsetAttributes( pickRelevantMediaFiles( image ) );\n\t\t\t\t\t},\n\t\t\t\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\n\t\t\t\t\tonError: ( message ) => {\n\t\t\t\t\t\tnoticeOperations.createErrorNotice( message );\n\t\t\t\t\t\tthis.setState( { isEditing: true } );\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t}\n\n\tcomponentDidUpdate( prevProps ) {\n\t\tconst { id: prevID, url: prevURL = '' } = prevProps.attributes;\n\t\tconst { id, url = '' } = this.props.attributes;\n\n\t\tif ( isTemporaryImage( prevID, prevURL ) && ! isTemporaryImage( id, url ) ) {\n\t\t\trevokeBlobURL( url );\n\t\t}\n\n\t\tif ( ! this.props.isSelected && prevProps.isSelected && this.state.captionFocused ) {\n\t\t\tthis.setState( {\n\t\t\t\tcaptionFocused: false,\n\t\t\t} );\n\t\t}\n\t}\n\n\tonSelectImage( media ) {\n\n\t\tif ( ! media || ! media.url ) {\n\t\t\tthis.props.setAttributes( {\n\t\t\t\turl: undefined,\n\t\t\t\talt: undefined,\n\t\t\t\tid: undefined,\n\t\t\t\tcaption: undefined\n\t\t\t} );\n\t\t\treturn;\n\t\t}\n\n\t\tconst { affiliateLink } = this.state;\n\n\t\tthis.setState( {\n\t\t\tisEditing: false,\n\t\t} );\n\n\t\tthis.props.setAttributes( {\n\t\t\t...pickRelevantMediaFiles( media ),\n\t\t\tlinkid: affiliateLink.id,\n\t\t\thref: affiliateLink.link,\n\t\t\taffiliateLink : affiliateLink,\n\t\t\twidth: undefined,\n\t\t\theight: undefined,\n\t\t} );\n\t}\n\n\tonImageError( url ) {\n\t\t// Check if there's an embed block that handles this URL.\n\t\tconst embedBlock = createUpgradedEmbedBlock(\n\t\t\t{ attributes: { url } }\n\t\t);\n\t\tif ( undefined !== embedBlock ) {\n\t\t\tthis.props.onReplace( embedBlock );\n\t\t}\n\t}\n\n\tonFocusCaption() {\n\t\tif ( ! this.state.captionFocused ) {\n\t\t\tthis.setState( {\n\t\t\t\tcaptionFocused: true,\n\t\t\t} );\n\t\t}\n\t}\n\n\tonImageClick() {\n\t\tif ( this.state.captionFocused ) {\n\t\t\tthis.setState( {\n\t\t\t\tcaptionFocused: false,\n\t\t\t} );\n\t\t}\n\t}\n\n\tupdateAlt( newAlt ) {\n\t\tthis.props.setAttributes( { alt: newAlt } );\n\t}\n\n\tupdateAlignment( nextAlign ) {\n\t\tconst extraUpdatedAttributes = [ 'wide', 'full' ].indexOf( nextAlign ) !== -1 ?\n\t\t\t{ width: undefined, height: undefined } :\n\t\t\t{};\n\t\tthis.props.setAttributes( { ...extraUpdatedAttributes, align: nextAlign } );\n\t}\n\n\tupdateImageURL( url ) {\n\t\tthis.props.setAttributes( { url, width: undefined, height: undefined } );\n\t}\n\n\tupdateWidth( width ) {\n\t\tthis.props.setAttributes( { width: parseInt( width, 10 ) } );\n\t}\n\n\tupdateHeight( height ) {\n\t\tthis.props.setAttributes( { height: parseInt( height, 10 ) } );\n\t}\n\n\tupdateDimensions( width = undefined, height = undefined ) {\n\t\treturn () => {\n\t\t\tthis.props.setAttributes( { width, height } );\n\t\t};\n\t}\n\n\tgetFilename( url ) {\n\t\tconst path = getPath( url );\n\t\tif ( path ) {\n\t\t\treturn last( path.split( '/' ) );\n\t\t}\n\t}\n\n\tgetLinkDestinationOptions() {\n\t\treturn [\n\t\t\t{ value: LINK_DESTINATION_NONE, label: __( 'None' ) },\n\t\t\t{ value: LINK_DESTINATION_MEDIA, label: __( 'Media File' ) },\n\t\t\t{ value: LINK_DESTINATION_ATTACHMENT, label: __( 'Attachment Page' ) },\n\t\t\t{ value: LINK_DESTINATION_CUSTOM, label: __( 'Custom URL' ) },\n\t\t];\n\t}\n\n\ttoggleIsEditing() {\n\t\tthis.setState( {\n\t\t\tisEditing: ! this.state.isEditing,\n\t\t} );\n\t}\n\n\tgetImageSizeOptions() {\n\t\tconst { imageSizes, image } = this.props;\n\t\treturn compact( map( imageSizes, ( { name, slug } ) => {\n\t\t\tconst sizeUrl = get( image, [ 'media_details', 'sizes', slug, 'source_url' ] );\n\t\t\tif ( ! sizeUrl ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tvalue: sizeUrl,\n\t\t\t\tlabel: name,\n\t\t\t};\n\t\t} ) );\n\t}\n\n\tonChangeInputValue( inputValue , post = null ) {\n\t\tconst linkid = post ? post.id : 0;\n\t\tthis.setState( { inputValue , linkid , post } );\n\t}\n\n\tresetInvalidLink() {\n\t\tthis.setState( { invalidLink : false } );\n\t}\n\n\tupdateImageSelection( imageSelection , affiliateLink ) {\n\t\tthis.setState({\n\t\t\timageSelection,\n\t\t\taffiliateLink\n\t\t});\n\t}\n\n\tonSelectAffiliateImage( image ) {\n\n\t\tconst request = wp.apiFetch( {\n\t\t\tpath: wp.url.addQueryArgs( 'wp/v2/media/' + image.id , {\n\t\t\t\tcontext: 'edit',\n\t\t\t\t_locale: 'user'\n\t\t\t} ),\n\t\t} );\n\n\t\trequest.then( (media) => {\n\t\t\tmedia.url = media.source_url;\n\t\t\tthis.onSelectImage( media );\n\t\t} );\n\t}\n\n\teditAFfiliateImage() {\n\n\t\tconst { attributes } = this.props;\n\t\tconst { affiliateLink } = attributes;\n\n\t\tthis.setState({\n\t\t\tisEditing : true,\n\t\t\timageSelection : affiliateLink.images,\n\t\t\taffiliateLink\n\t\t});\n\t}\n\n\trender() {\n\t\tconst { \n\t\t\tisEditing,\n\t\t\timageSelection,\n\t\t\taffiliateLink,\n\t\t} = this.state;\n\t\tconst {\n\t\t\tattributes,\n\t\t\tsetAttributes,\n\t\t\tisLargeViewport,\n\t\t\tisSelected,\n\t\t\tclassName,\n\t\t\tmaxWidth,\n\t\t\ttoggleSelection,\n\t\t\tisRTL,\n\t\t} = this.props;\n\t\tconst {\n\t\t\turl,\n\t\t\talt,\n\t\t\tcaption,\n\t\t\talign,\n\t\t\tlinkDestination,\n\t\t\twidth,\n\t\t\theight,\n\t\t\tlinkid,\n\t\t\thref\n\t\t} = attributes;\n\t\tconst toolbarEditButton = (\n\t\t\t<Toolbar>\n\t\t\t\t<IconButton\n\t\t\t\t\tclassName=\"ta-edit-image-button components-icon-button components-toolbar__control\"\n\t\t\t\t\tlabel={ __( 'Edit ThirstyAffiliates Image' ) }\n\t\t\t\t\ticon=\"edit\"\n\t\t\t\t\tonClick={ this.editAFfiliateImage }\n\t\t\t\t/>\n\t\t\t</Toolbar>\n\t\t);\n\n\t\tconst controls = (\n\t\t\t<BlockControls>\n\t\t\t\t<BlockAlignmentToolbar\n\t\t\t\t\tvalue={ align }\n\t\t\t\t\tonChange={ this.updateAlignment }\n\t\t\t\t/>\n\t\t\t\t{ toolbarEditButton }\n\t\t\t</BlockControls>\n\t\t);\n\n\t\tif ( isEditing ) {\n\t\t\treturn (\n\t\t\t\t<Fragment>\n\t\t\t\t\t{ controls }\n\t\t\t\t\t<Placeholder\n\t\t\t\t\t\ticon={ \"format-image\" }\n\t\t\t\t\t\tlabel={ __( \"ThirstyAffiliates Image\" ) }\n\t\t\t\t\t\tinstructions={ __( \"Search for an affiliate link and select image to insert.\" ) } \n\t\t\t\t\t>\t\n\n\t\t\t\t\t\t<ThirstyURLInput\n\t\t\t\t\t\t\tupdateImageSelection={ this.updateImageSelection }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t\n\t\t\t\t\t\t{ !! imageSelection.length &&\n\t\t\t\t\t\t\t<div className=\"ta-image-sel-wrap\">\n\t\t\t\t\t\t\t\t<h3>{ `${affiliateLink.title} ${ __( 'attached images:' ) }` }</h3>\n\t\t\t\t\t\t\t\t<div className=\"ta-image-selection\">\n\t\t\t\t\t\t\t\t\t{ imageSelection.map( ( image , index ) => (\n\t\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\t\tonClick={ () => this.onSelectAffiliateImage( image ) }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<img src={ image.src } />\n\t\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t</Placeholder>\n\t\t\t\t</Fragment>\n\t\t\t);\n\t\t}\n\n\t\tconst classes = classnames( className, {\n\t\t\t'wp-block-image' : true,\n\t\t\t'is-transient': isBlobURL( url ),\n\t\t\t'is-resized': !! width || !! height,\n\t\t\t'is-focused': isSelected,\n\t\t} );\n\n\t\tconst isResizable = [ 'wide', 'full' ].indexOf( align ) === -1 && isLargeViewport;\n\t\tconst imageSizeOptions = this.getImageSizeOptions();\n\n\t\tconst getInspectorControls = ( imageWidth, imageHeight ) => (\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Image Settings' ) }>\n\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\tlabel={ __( 'Alt Text (Alternative Text)' ) }\n\t\t\t\t\t\tvalue={ alt }\n\t\t\t\t\t\tonChange={ this.updateAlt }\n\t\t\t\t\t\thelp={ __( 'Alternative text describes your image to people who can’t see it. Add a short description with its key details.' ) }\n\t\t\t\t\t/>\n\t\t\t\t\t{ ! isEmpty( imageSizeOptions ) && (\n\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\tlabel={ __( 'Image Size' ) }\n\t\t\t\t\t\t\tvalue={ url }\n\t\t\t\t\t\t\toptions={ imageSizeOptions }\n\t\t\t\t\t\t\tonChange={ this.updateImageURL }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isResizable && (\n\t\t\t\t\t\t<div className=\"block-library-image__dimensions\">\n\t\t\t\t\t\t\t<p className=\"block-library-image__dimensions__row\">\n\t\t\t\t\t\t\t\t{ __( 'Image Dimensions' ) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t<div className=\"block-library-image__dimensions__row\">\n\t\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\t\t\t\tclassName=\"block-library-image__dimensions__width\"\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\t\t\t\t\tvalue={ width !== undefined ? width : '' }\n\t\t\t\t\t\t\t\t\tplaceholder={ imageWidth }\n\t\t\t\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\t\t\t\tonChange={ this.updateWidth }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\t\t\t\tclassName=\"block-library-image__dimensions__height\"\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Height' ) }\n\t\t\t\t\t\t\t\t\tvalue={ height !== undefined ? height : '' }\n\t\t\t\t\t\t\t\t\tplaceholder={ imageHeight }\n\t\t\t\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\t\t\t\tonChange={ this.updateHeight }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div className=\"block-library-image__dimensions__row\">\n\t\t\t\t\t\t\t\t<ButtonGroup aria-label={ __( 'Image Size' ) }>\n\t\t\t\t\t\t\t\t\t{ [ 25, 50, 75, 100 ].map( ( scale ) => {\n\t\t\t\t\t\t\t\t\t\tconst scaledWidth = Math.round( imageWidth * ( scale / 100 ) );\n\t\t\t\t\t\t\t\t\t\tconst scaledHeight = Math.round( imageHeight * ( scale / 100 ) );\n\n\t\t\t\t\t\t\t\t\t\tconst isCurrent = width === scaledWidth && height === scaledHeight;\n\n\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\tkey={ scale }\n\t\t\t\t\t\t\t\t\t\t\t\tisSmall\n\t\t\t\t\t\t\t\t\t\t\t\tisPrimary={ isCurrent }\n\t\t\t\t\t\t\t\t\t\t\t\taria-pressed={ isCurrent }\n\t\t\t\t\t\t\t\t\t\t\t\tonClick={ this.updateDimensions( scaledWidth, scaledHeight ) }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{ scale }%\n\t\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t\t</ButtonGroup>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tisSmall\n\t\t\t\t\t\t\t\t\tonClick={ this.updateDimensions() }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Reset' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t);\n\n\t\t// Disable reason: Each block can be selected by clicking on it\n\t\t/* eslint-disable jsx-a11y/no-static-element-interactions, jsx-a11y/onclick-has-role, jsx-a11y/click-events-have-key-events */\n\t\treturn (\n\t\t\t<Fragment>\n\t\t\t\t{ controls }\n\t\t\t\t<figure className={ classes }>\n\t\t\t\t\t<ImageSize src={ url } dirtynessTrigger={ align }>\n\t\t\t\t\t\t{ ( sizes ) => {\n\t\t\t\t\t\t\tconst {\n\t\t\t\t\t\t\t\timageWidthWithinContainer,\n\t\t\t\t\t\t\t\timageHeightWithinContainer,\n\t\t\t\t\t\t\t\timageWidth,\n\t\t\t\t\t\t\t\timageHeight,\n\t\t\t\t\t\t\t} = sizes;\n\n\t\t\t\t\t\t\tconst filename = this.getFilename( url );\n\t\t\t\t\t\t\tlet defaultedAlt;\n\t\t\t\t\t\t\tif ( alt ) {\n\t\t\t\t\t\t\t\tdefaultedAlt = alt;\n\t\t\t\t\t\t\t} else if ( filename ) {\n\t\t\t\t\t\t\t\tdefaultedAlt = sprintf( __( 'This image has an empty alt attribute; its file name is %s' ), filename );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tdefaultedAlt = __( 'This image has an empty alt attribute' );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst img = (\n\t\t\t\t\t\t\t\t// Disable reason: Image itself is not meant to be interactive, but\n\t\t\t\t\t\t\t\t// should direct focus to block.\n\t\t\t\t\t\t\t\t/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */\n\t\t\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t\t\t<ta linkid={ linkid } href={ href }>\n\t\t\t\t\t\t\t\t\t\t<img src={ url } alt={ defaultedAlt } onClick={ this.onImageClick } onError={ () => this.onImageError( url ) } />\n\t\t\t\t\t\t\t\t\t</ta>\n\t\t\t\t\t\t\t\t\t{ isBlobURL( url ) && <Spinner /> }\n\t\t\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t\t\t\t/* eslint-enable jsx-a11y/no-noninteractive-element-interactions */\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif ( ! isResizable || ! imageWidthWithinContainer ) {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t\t\t\t{ getInspectorControls( imageWidth, imageHeight ) }\n\t\t\t\t\t\t\t\t\t\t<div style={ { width, height } }>\n\t\t\t\t\t\t\t\t\t\t\t{ img }\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst currentWidth = width || imageWidthWithinContainer;\n\t\t\t\t\t\t\tconst currentHeight = height || imageHeightWithinContainer;\n\n\t\t\t\t\t\t\tconst ratio = imageWidth / imageHeight;\n\t\t\t\t\t\t\tconst minWidth = imageWidth < imageHeight ? MIN_SIZE : MIN_SIZE * ratio;\n\t\t\t\t\t\t\tconst minHeight = imageHeight < imageWidth ? MIN_SIZE : MIN_SIZE / ratio;\n\n\t\t\t\t\t\t\t// With the current implementation of ResizableBox, an image needs an explicit pixel value for the max-width.\n\t\t\t\t\t\t\t// In absence of being able to set the content-width, this max-width is currently dictated by the vanilla editor style.\n\t\t\t\t\t\t\t// The following variable adds a buffer to this vanilla style, so 3rd party themes have some wiggleroom.\n\t\t\t\t\t\t\t// This does, in most cases, allow you to scale the image beyond the width of the main column, though not infinitely.\n\t\t\t\t\t\t\t// @todo It would be good to revisit this once a content-width variable becomes available.\n\t\t\t\t\t\t\tconst maxWidthBuffer = maxWidth * 2.5;\n\n\t\t\t\t\t\t\tlet showRightHandle = false;\n\t\t\t\t\t\t\tlet showLeftHandle = false;\n\n\t\t\t\t\t\t\t/* eslint-disable no-lonely-if */\n\t\t\t\t\t\t\t// See https://github.com/WordPress/gutenberg/issues/7584.\n\t\t\t\t\t\t\tif ( align === 'center' ) {\n\t\t\t\t\t\t\t\t// When the image is centered, show both handles.\n\t\t\t\t\t\t\t\tshowRightHandle = true;\n\t\t\t\t\t\t\t\tshowLeftHandle = true;\n\t\t\t\t\t\t\t} else if ( isRTL ) {\n\t\t\t\t\t\t\t\t// In RTL mode the image is on the right by default.\n\t\t\t\t\t\t\t\t// Show the right handle and hide the left handle only when it is aligned left.\n\t\t\t\t\t\t\t\t// Otherwise always show the left handle.\n\t\t\t\t\t\t\t\tif ( align === 'left' ) {\n\t\t\t\t\t\t\t\t\tshowRightHandle = true;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tshowLeftHandle = true;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// Show the left handle and hide the right handle only when the image is aligned right.\n\t\t\t\t\t\t\t\t// Otherwise always show the right handle.\n\t\t\t\t\t\t\t\tif ( align === 'right' ) {\n\t\t\t\t\t\t\t\t\tshowLeftHandle = true;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tshowRightHandle = true;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/* eslint-enable no-lonely-if */\n\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t\t\t{ getInspectorControls( imageWidth, imageHeight ) }\n\t\t\t\t\t\t\t\t\t<ResizableBox\n\t\t\t\t\t\t\t\t\t\tsize={\n\t\t\t\t\t\t\t\t\t\t\twidth && height ? {\n\t\t\t\t\t\t\t\t\t\t\t\twidth,\n\t\t\t\t\t\t\t\t\t\t\t\theight,\n\t\t\t\t\t\t\t\t\t\t\t} : undefined\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tminWidth={ minWidth }\n\t\t\t\t\t\t\t\t\t\tmaxWidth={ maxWidthBuffer }\n\t\t\t\t\t\t\t\t\t\tminHeight={ minHeight }\n\t\t\t\t\t\t\t\t\t\tmaxHeight={ maxWidthBuffer / ratio }\n\t\t\t\t\t\t\t\t\t\tlockAspectRatio\n\t\t\t\t\t\t\t\t\t\tenable={ {\n\t\t\t\t\t\t\t\t\t\t\ttop: false,\n\t\t\t\t\t\t\t\t\t\t\tright: showRightHandle,\n\t\t\t\t\t\t\t\t\t\t\tbottom: true,\n\t\t\t\t\t\t\t\t\t\t\tleft: showLeftHandle,\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\tonResizeStart={ () => {\n\t\t\t\t\t\t\t\t\t\t\ttoggleSelection( false );\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\tonResizeStop={ ( event, direction, elt, delta ) => {\n\t\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\t\twidth: parseInt( currentWidth + delta.width, 10 ),\n\t\t\t\t\t\t\t\t\t\t\t\theight: parseInt( currentHeight + delta.height, 10 ),\n\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t\ttoggleSelection( true );\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ img }\n\t\t\t\t\t\t\t\t\t</ResizableBox>\n\t\t\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t</ImageSize>\n\t\t\t\t\t{ ( ! RichText.isEmpty( caption ) || isSelected ) && (\n\t\t\t\t\t\t<RichText\n\t\t\t\t\t\t\ttagName=\"figcaption\"\n\t\t\t\t\t\t\tplaceholder={ __( 'Write caption…' ) }\n\t\t\t\t\t\t\tvalue={ caption }\n\t\t\t\t\t\t\tunstableOnFocus={ this.onFocusCaption }\n\t\t\t\t\t\t\tonChange={ ( value ) => setAttributes( { caption: value } ) }\n\t\t\t\t\t\t\tisSelected={ this.state.captionFocused }\n\t\t\t\t\t\t\tinlineToolbar\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</figure>\n\t\t\t</Fragment>\n\t\t);\n\t\t/* eslint-enable jsx-a11y/no-static-element-interactions, jsx-a11y/onclick-has-role, jsx-a11y/click-events-have-key-events */\n\t}\n}\n\nexport default compose( [\n\twithSelect( ( select, props ) => {\n\t\tconst { getMedia } = select( 'core' );\n\t\tconst { getEditorSettings } = select( 'core/editor' );\n\t\tconst { id } = props.attributes;\n\t\tconst { maxWidth, isRTL, imageSizes } = getEditorSettings();\n\n\t\treturn {\n\t\t\timage: id ? getMedia( id ) : null,\n\t\t\tmaxWidth,\n\t\t\tisRTL,\n\t\t\timageSizes,\n\t\t};\n\t} ),\n\twithViewportMatch( { isLargeViewport: 'medium' } ),\n\twithNotices,\n] )( ImageEdit );\n\n\n// WEBPACK FOOTER //\n// ./src/blocks/ta-image/edit.js","const WORDPRESS_EMBED_BLOCK = 'core-embed/wordpress';\n\nconst { includes } = lodash;\nconst { renderToString } = wp.element;\nconst { createBlock } = wp.blocks;\n\n/***\n * Creates a more suitable embed block based on the passed in props\n * and attributes generated from an embed block's preview.\n *\n * We require `attributesFromPreview` to be generated from the latest attributes\n * and preview, and because of the way the react lifecycle operates, we can't\n * guarantee that the attributes contained in the block's props are the latest\n * versions, so we require that these are generated separately.\n * See `getAttributesFromPreview` in the generated embed edit component.\n *\n * @param {Object} props The block's props.\n * @param {Object} attributesFromPreview Attributes generated from the block's most up to date preview.\n * @return {Object|undefined} A more suitable embed block if one exists.\n */\nexport const createUpgradedEmbedBlock = ( props, attributesFromPreview ) => {\n\tconst { preview, name } = props;\n\tconst { url } = props.attributes;\n\n\tif ( ! url ) {\n\t\treturn;\n\t}\n\n\tconst matchingBlock = findBlock( url );\n\n\t// WordPress blocks can work on multiple sites, and so don't have patterns,\n\t// so if we're in a WordPress block, assume the user has chosen it for a WordPress URL.\n\tif ( WORDPRESS_EMBED_BLOCK !== name && DEFAULT_EMBED_BLOCK !== matchingBlock ) {\n\t\t// At this point, we have discovered a more suitable block for this url, so transform it.\n\t\tif ( name !== matchingBlock ) {\n\t\t\treturn createBlock( matchingBlock, { url } );\n\t\t}\n\t}\n\n\tif ( preview ) {\n\t\tconst { html } = preview;\n\n\t\t// We can't match the URL for WordPress embeds, we have to check the HTML instead.\n\t\tif ( isFromWordPress( html ) ) {\n\t\t\t// If this is not the WordPress embed block, transform it into one.\n\t\t\tif ( WORDPRESS_EMBED_BLOCK !== name ) {\n\t\t\t\treturn createBlock(\n\t\t\t\t\tWORDPRESS_EMBED_BLOCK,\n\t\t\t\t\t{\n\t\t\t\t\t\turl,\n\t\t\t\t\t\t// By now we have the preview, but when the new block first renders, it\n\t\t\t\t\t\t// won't have had all the attributes set, and so won't get the correct\n\t\t\t\t\t\t// type and it won't render correctly. So, we pass through the current attributes\n\t\t\t\t\t\t// here so that the initial render works when we switch to the WordPress\n\t\t\t\t\t\t// block. This only affects the WordPress block because it can't be\n\t\t\t\t\t\t// rendered in the usual Sandbox (it has a sandbox of its own) and it\n\t\t\t\t\t\t// relies on the preview to set the correct render type.\n\t\t\t\t\t\t...attributesFromPreview,\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n};\n\nexport const isFromWordPress = ( html ) => {\n\treturn includes( html, 'class=\"wp-embedded-content\" data-secret' );\n};\n\n\n// WEBPACK FOOTER //\n// ./src/blocks/ta-image/util.js","const { noop } = lodash;\n\nconst { withGlobalEvents } = wp.compose;\nconst { Component } = wp.element;\n\nclass ImageSize extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\t\tthis.state = {\n\t\t\twidth: undefined,\n\t\t\theight: undefined,\n\t\t};\n\t\tthis.bindContainer = this.bindContainer.bind( this );\n\t\tthis.calculateSize = this.calculateSize.bind( this );\n\t}\n\n\tbindContainer( ref ) {\n\t\tthis.container = ref;\n\t}\n\n\tcomponentDidUpdate( prevProps ) {\n\t\tif ( this.props.src !== prevProps.src ) {\n\t\t\tthis.setState( {\n\t\t\t\twidth: undefined,\n\t\t\t\theight: undefined,\n\t\t\t} );\n\t\t\tthis.fetchImageSize();\n\t\t}\n\n\t\tif ( this.props.dirtynessTrigger !== prevProps.dirtynessTrigger ) {\n\t\t\tthis.calculateSize();\n\t\t}\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.fetchImageSize();\n\t}\n\n\tcomponentWillUnmount() {\n\t\tif ( this.image ) {\n\t\t\tthis.image.onload = noop;\n\t\t}\n\t}\n\n\tfetchImageSize() {\n\t\tthis.image = new window.Image();\n\t\tthis.image.onload = this.calculateSize;\n\t\tthis.image.src = this.props.src;\n\t}\n\n\tcalculateSize() {\n\t\tconst maxWidth = this.container.clientWidth;\n\t\tconst exceedMaxWidth = this.image.width > maxWidth;\n\t\tconst ratio = this.image.height / this.image.width;\n\t\tconst width = exceedMaxWidth ? maxWidth : this.image.width;\n\t\tconst height = exceedMaxWidth ? maxWidth * ratio : this.image.height;\n\t\tthis.setState( { width, height } );\n\t}\n\n\trender() {\n\t\tconst sizes = {\n\t\t\timageWidth: this.image && this.image.width,\n\t\t\timageHeight: this.image && this.image.height,\n\t\t\tcontainerWidth: this.container && this.container.clientWidth,\n\t\t\tcontainerHeight: this.container && this.container.clientHeight,\n\t\t\timageWidthWithinContainer: this.state.width,\n\t\t\timageHeightWithinContainer: this.state.height,\n\t\t};\n\t\treturn (\n\t\t\t<div ref={ this.bindContainer }>\n\t\t\t\t{ this.props.children( sizes ) }\n\t\t\t</div>\n\t\t);\n\t}\n}\n\nexport default withGlobalEvents( {\n\tresize: 'calculateSize',\n} )( ImageSize );\n\n\n// WEBPACK FOOTER //\n// ./src/blocks/ta-image/image-size.js","import classnames from \"classnames\";\n\nconst { __ } = wp.i18n;\nconst { Component , createRef } = wp.element;\nconst { Spinner, withSpokenMessages, Popover , TextControl } = wp.components;\nconst { withInstanceId } = wp.compose;\n\nclass ThirstyURLInput extends Component {\n\n /**\n * Component constructor method.\n * \n * @since 3.6\n * \n * @param {*} param0 \n */\n\tconstructor( { autocompleteRef } ) {\n\t\tsuper( ...arguments );\n\n\t\t// this.onChange = this.onChange.bind( this );\n\t\t// this.onKeyDown = this.onKeyDown.bind( this );\n\t\tthis.autocompleteRef = autocompleteRef || createRef();\n\t\tthis.inputRef = createRef();\n\t\tthis.searchAffiliateLinks = this.searchAffiliateLinks.bind( this );\n\t\t// this.updateSuggestions = throttle( this.updateSuggestions.bind( this ), 200 );\n\n\t\tthis.suggestionNodes = [];\n\n\t\tthis.state = {\n\t\t\tposts : [],\n\t\t\tshowSuggestions : false,\n\t\t\tselectedSuggestion : null,\n\t\t\tloading : false\n\t\t};\n\t}\n\n\t/**\n * Component did update method.\n * \n * @since 3.6\n */\n\tcomponentDidUpdate() {\n\t\tconst { showSuggestions, selectedSuggestion } = this.state;\n\t\t// only have to worry about scrolling selected suggestion into view\n\t\t// when already expanded\n\t\tif ( showSuggestions && selectedSuggestion !== null && ! this.scrollingIntoView ) {\n\t\t\tthis.scrollingIntoView = true;\n\t\t\tscrollIntoView( this.suggestionNodes[ selectedSuggestion ], this.autocompleteRef.current, {\n\t\t\t\tonlyScrollIfNeeded: true,\n\t\t\t} );\n\n\t\t\tsetTimeout( () => {\n\t\t\t\tthis.scrollingIntoView = false;\n\t\t\t}, 100 );\n\t\t}\n\t}\n\n\t/**\n * Component unmount method.\n * \n * @since 3.6\n */\n\tcomponentWillUnmount() {\n\t\tdelete this.suggestionsRequest;\n\t}\n\n\t/**\n * Bind suggestion to node.\n * \n * @param {*} index \n */\n\tbindSuggestionNode( index ) {\n\t\treturn ( ref ) => {\n\t\t\tthis.suggestionNodes[ index ] = ref;\n\t\t};\n\t}\n\t\n\tsearchAffiliateLinks( value ) {\n\n\t\t// Show the suggestions after typing at least 2 characters=\n\t\tif ( value.length < 2 ) {\n\t\t\tthis.setState( {\n\t\t\t\tshowSuggestions: false,\n\t\t\t\tselectedSuggestion: null,\n\t\t\t\tloading: false,\n\t\t\t} );\n\n\t\t\treturn;\n\t\t}\n\n\t\tthis.setState({\n\t\t\tshowSuggestions : true,\n\t\t\tselectedSuggestion : null,\n\t\t\tloading : true\n\t\t});\n\n\t\tconst formData = new FormData();\n formData.append( \"action\" , \"search_affiliate_links_query\" );\n formData.append( \"keyword\" , value );\n formData.append( \"paged\" , 1 );\n\t\tformData.append( \"gutenberg\" , true );\n\t\tformData.append( \"with_images\" , true );\n\t\t\n\t\t// We are getting data via the WP AJAX instead of rest API as it is not possible yet\n // to filter results with category value. This is to prepare next update to add category filter.\n const request = fetch( ajaxurl , {\n method : \"POST\",\n body : formData\n\t\t} );\n\t\t\n\t\trequest\n .then( response => response.json() )\n .then( ( response ) => {\n\n if ( ! response.affiliate_links ) return;\n\n const posts = response.affiliate_links;\n\n\t\t\t// A fetch Promise doesn't have an abort option. It's mimicked by\n\t\t\t// comparing the request reference in on the instance, which is\n\t\t\t// reset or deleted on subsequent requests or unmounting.\n\t\t\tif ( this.suggestionsRequest !== request ) {\n\t\t\t\treturn;\n }\n\n\t\t\tthis.setState( {\n\t\t\t\tposts,\n\t\t\t\tloading: false,\n } );\n\n\t\t\tif ( !! posts.length ) {\n\t\t\t\tthis.props.debouncedSpeak( sprintf( _n(\n\t\t\t\t\t'%d result found, use up and down arrow keys to navigate.',\n\t\t\t\t\t'%d results found, use up and down arrow keys to navigate.',\n\t\t\t\t\tposts.length\n\t\t\t\t), posts.length ), 'assertive' );\n\t\t\t} else {\n\t\t\t\tthis.props.debouncedSpeak( __( 'No results.' ), 'assertive' );\n }\n\n\t\t} ).catch( () => {\n\t\t\tif ( this.suggestionsRequest === request ) {\n\t\t\t\tthis.setState( {\n\t\t\t\t\tloading: false,\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\n\t\tthis.suggestionsRequest = request;\n\t}\n\n\t/**\n * Set state when an affiliate link is selected.\n * \n * @since 3.6\n * \n * @param {*} post \n */\n\tselectLink( post ) {\n\t\t// this.props.onChange( post.link, post );\n\t\tthis.setState( {\n\t\t\tselectedSuggestion: post,\n\t\t\tshowSuggestions: false,\n\t\t} );\n\n\t\tthis.props.updateImageSelection( post.images , post );\n\t}\n\n\t/**\n * Callback handler for when affiliate link is selected.\n * \n * @param {*} post \n */\n\thandleOnClick( post ) {\n\t\tthis.selectLink( post );\n\t\t// Move focus to the input field when a link suggestion is clicked.\n\t\t// this.inputRef.current.focus();\n\t}\n\n render() {\n const { value = '', autoFocus = true, instanceId } = this.props;\n const { showSuggestions , posts, selectedSuggestion , loading } = this.state;\n \n return (\n <div class=\"edit-search-affiliate-links\">\n\t\t\t\t<form\n\t\t\t\t\tclassName=\"editor-format-toolbar__link-container-content block-editor-format-toolbar__link-container-content ta-link-search-popover\"\n\t\t\t\t\tonSubmit={ this.displayAffiliateImages }\n\t\t\t\t>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\tclassName=\"ta-search-affiliate-links\"\n\t\t\t\t\t\tplaceholder={ __( \"Type to search affiliate links\" ) }\n\t\t\t\t\t\tonChange={ this.searchAffiliateLinks }\n\t\t\t\t\t\tautocomplete=\"off\"\n\t\t\t\t\t/>\n\n\t\t\t\t\t{ ( loading ) && <Spinner /> }\n\n\t\t\t\t\t{ showSuggestions && !! posts.length && \n\t\t\t\t\t\t<Popover position=\"bottom\" focusOnMount={ false }>\n\t\t\t\t\t\t\t<div class=\"affilate-links-suggestions\">\n\t\t\t\t\t\t\t\t{ posts.map( ( post, index ) => (\n\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\tkey={ post.id }\n\t\t\t\t\t\t\t\t\t\trole=\"option\"\n\t\t\t\t\t\t\t\t\t\ttabIndex=\"-1\"\n\t\t\t\t\t\t\t\t\t\tid={ `editor-url-input-suggestion-${ instanceId }-${ index }` }\n\t\t\t\t\t\t\t\t\t\tref={ this.bindSuggestionNode( index ) }\n\t\t\t\t\t\t\t\t\t\tclassName={ classnames( 'editor-url-input__suggestion block-editor-url-input__suggestion', {\n\t\t\t\t\t\t\t\t\t\t\t'is-selected': index === selectedSuggestion,\n\t\t\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t\t\t\tonClick={ () => this.handleOnClick( post ) }\n\t\t\t\t\t\t\t\t\t\taria-selected={ index === selectedSuggestion }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ post.title || __( '(no title)' ) }\n\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</Popover>\n\t\t\t\t\t}\n\t\t\t\t</form>\n </div>\n );\n }\n}\n\nexport default withSpokenMessages( withInstanceId( ThirstyURLInput ) );\n\n\n// WEBPACK FOOTER //\n// ./src/blocks/ta-image/search-input.js","import { taLink } from \"./ta-link\";\n\nconst { registerFormatType } = wp.richText;\n\n/**\n * Register custom formats.\n * \n * @since 3.6\n */\nexport default function registerFormats() {\n\n [\n taLink\n ].forEach( ( { name , ...settings } ) => registerFormatType( name , settings ) );\n}\n\n\n// WEBPACK FOOTER //\n// ./src/formats/index.js","import InlineAffiliateLinkUI from './inline';\n\nconst { __ } = wp.i18n;\nconst { Component , Fragment } = wp.element;\nconst { withSpokenMessages } = wp.components;\nconst { getTextContent , applyFormat , removeFormat , slice } = wp.richText;\nconst { isURL } = wp.url;\nconst { RichTextToolbarButton , RichTextShortcut } = wp.editor;\nconst { Path , SVG } = wp.components;\nconst { getRectangleFromRange } = wp.dom;\n\nconst name = \"ta/link\";\n\n/**\n * Custom Affiliate link format. When applied will wrap selected text with <ta href=\"\" linkid=\"\"></ta> custom element.\n * Custom element is implemented here as we are not allowed to use <a> tag due to Gutenberg limitations.\n * Element is converted to normal <a> tag on frontend via PHP script filtered on 'the_content'.\n * \n * @since 3.6\n */\nexport const taLink = {\n name,\n title : __( \"Affiliate Link\" ),\n tagName : \"ta\",\n className : null,\n attributes : {\n\t\turl : \"href\",\n\t\ttarget : \"target\"\n },\n edit : withSpokenMessages( class LinkEdit extends Component {\n\t\t\n\t\t/**\n\t\t * Component constructor.\n\t\t * \n\t\t * @since 3.6\n\t\t */\n\t\tconstructor() {\n\t\t\tsuper( ...arguments );\n\n\t\t\tthis.addLink = this.addLink.bind( this );\n\t\t\tthis.stopAddingLink = this.stopAddingLink.bind( this );\n\t\t\tthis.onRemoveFormat = this.onRemoveFormat.bind( this );\n\t\t\tthis.state = {\n\t\t\t\taddingLink: false,\n\t\t\t};\n\t\t}\n\n\t\t/**\n\t\t * Callback to set state to adding link status.\n\t\t * \n\t\t * @since 3.6\n\t\t */\n\t\taddLink() {\n\n\t\t\tconst { value, onChange } = this.props;\n\t\t\tconst text = getTextContent( slice( value ) );\n\n\t\t\tif ( text && isURL( text ) ) {\n\t\t\t\tonChange( applyFormat( value, { type: name, attributes: { url: text } } ) );\n\t\t\t} else {\n\t\t\t\tthis.setState( { addingLink: true } );\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Callback to set state to stop adding link status.\n\t\t * \n\t\t * @since 3.6\n\t\t */\n\t\tstopAddingLink() {\n\t\t\tthis.setState( { addingLink: false } );\n\t\t}\n\n\t\t/**\n\t\t * Remove format event callback.\n\t\t * \n\t\t * @since 3.6\n\t\t */\n\t\tonRemoveFormat() {\n\t\t\tconst { value , onChange , speak } = this.props;\n\n\t\t\tonChange( removeFormat( value , name ) );\n\t\t\tspeak( __( \"Affiliate Link removed.\" ), \"assertive\" );\n\t\t}\n\n\t\t/**\n\t\t * Get selected anchor text.\n\t\t * \n\t\t * @since 3.9\n\t\t */\n\t\tgetAnchorRect() {\n\n\t\t\tconst selection = window.getSelection();\n\t\t\tconst range = selection.rangeCount > 0 ? selection.getRangeAt( 0 ) : null;\n\n\t\t\tif ( ! range ) return;\n\n\t\t\tlet rect = null;\n\n\t\t\tif ( this.state.addingLink ) {\n\t\t\t\trect = getRectangleFromRange( range );\n\t\t\t} else {\n\n\t\t\t\tlet element = range.startContainer;\n\n\t\t\t\t// If the caret is right before the element, select the next element.\n\t\t\t\telement = element.nextElementSibling || element;\n\n\t\t\t\twhile ( element.nodeType !== window.Node.ELEMENT_NODE ) {\n\t\t\t\t\telement = element.parentNode;\n\t\t\t\t}\n\n\t\t\t\tconst closest = element.closest( 'ta' );\n\t\t\t\tif ( closest ) {\n\t\t\t\t\trect = closest.getBoundingClientRect();\n\t\t\t\t}\n\t\t\t\n\t\t\t}\n\n\t\t\treturn rect;\n\t\t}\n\n\t\t/**\n\t\t * Component render method.\n\t\t * \n\t\t * @since 3.6\n\t\t */\n\t\trender() {\n\t\t\tconst { isActive , activeAttributes , value , onChange } = this.props;\n\n\t\t\tconst anchorRect = this.getAnchorRect();\n\n\t\t\treturn (\n\t\t\t\t<Fragment>\n\t\t\t\t\t<RichTextShortcut\n\t\t\t\t\t\ttype=\"access\"\n\t\t\t\t\t\tcharacter=\"s\"\n\t\t\t\t\t\tonUse={ this.onRemoveFormat }\n\t\t\t\t\t/>\n\t\t\t\t\t<RichTextShortcut\n\t\t\t\t\t\ttype=\"primary\"\n\t\t\t\t\t\tcharacter=\"l\"\n\t\t\t\t\t\tonUse={ this.addLink }\n\t\t\t\t\t/>\n\t\t\t\t\t<RichTextShortcut\n\t\t\t\t\t\ttype=\"primaryShift\"\n\t\t\t\t\t\tcharacter=\"l\"\n\t\t\t\t\t\tonUse={ this.onRemoveFormat }\n\t\t\t\t\t/>\n\t\t\t\t\t{ isActive && <RichTextToolbarButton\n\t\t\t\t\t\ticon=\"editor-unlink\"\n\t\t\t\t\t\ttitle={ __( 'Remove Affiliate Link' ) }\n\t\t\t\t\t\tclassName=\"ta-unlink-button\"\n\t\t\t\t\t\tonClick={ this.onRemoveFormat }\n\t\t\t\t\t\tisActive={ isActive }\n\t\t\t\t\t\tshortcutType=\"primaryShift\"\n\t\t\t\t\t\tshortcutCharacter=\"l\"\n\t\t\t\t\t/> }\n\t\t\t\t\t{ ! isActive && <RichTextToolbarButton\n\t\t\t\t\t\ticon={ <SVG xmlns=\"http://www.w3.org/2000/svg\" width=\"16.688\" height=\"9.875\" viewBox=\"0 0 16.688 9.875\"><Path id=\"TA.svg\" fill=\"black\" class=\"cls-1\" d=\"M2.115,15.12H4.847L6.836,7.7H9.777l0.63-2.381H1.821L1.177,7.7H4.118Zm4.758,0H9.829l1.177-1.751h3.782l0.238,1.751h2.858L16.357,5.245H13.7Zm5.5-3.866,1.835-2.816,0.35,2.816H12.378Z\" transform=\"translate(-1.188 -5.25)\"/></SVG> }\n\t\t\t\t\t\ttitle={ __( 'Affiliate Link' ) }\n\t\t\t\t\t\tclassName=\"ta-link-button\"\n\t\t\t\t\t\tonClick={ this.addLink }\n\t\t\t\t\t\tshortcutType=\"primary\"\n\t\t\t\t\t\tshortcutCharacter=\"l\"\n\t\t\t\t\t/> }\n\t\t\t\t\t<InlineAffiliateLinkUI\n\t\t\t\t\t\taddingLink={ this.state.addingLink }\n\t\t\t\t\t\tstopAddingLink={ this.stopAddingLink }\n\t\t\t\t\t\tisActive={ isActive }\n\t\t\t\t\t\tactiveAttributes={ activeAttributes }\n\t\t\t\t\t\tanchorRect={ anchorRect }\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t/>\n\t\t\t\t</Fragment>\n\t\t\t);\n\t\t}\n } )\n}\n\n\n// WEBPACK FOOTER //\n// ./src/formats/ta-link/index.js","import classnames from \"classnames\";\nimport { isValidHref } from './utils';\nimport ThirstyURLPopover from './url-popover';\nimport ThirstyURLInput from './url-input';\n\nconst { __ } = wp.i18n;\nconst { Component , createRef } = wp.element;\nconst { ExternalLink , ToggleControl , IconButton , withSpokenMessages } = wp.components;\nconst { LEFT, RIGHT, UP, DOWN, BACKSPACE, ENTER } = wp.keycodes;\nconst { prependHTTP , safeDecodeURI , filterURLForDisplay } = wp.url;\nconst { create , insert , isCollapsed , applyFormat , getTextContent , slice } = wp.richText;\n\nconst stopKeyPropagation = ( event ) => event.stopPropagation();\n\n/**\n * Generates the format object that will be applied to the link text.\n * \n * @since 3.6\n *\n * @param {string} url The href of the link.\n * @param {boolean} linkid Affiliate link ID.\n * @param {Object} text The text that is being hyperlinked.\n *\n * @return {Object} The final format object.\n */\nfunction createLinkFormat( { url , linkid , text } ) {\n\tconst format = {\n\t\ttype: \"ta/link\",\n\t\tattributes: {\n\t\t\turl,\n\t\t\tlinkid : linkid.toString()\n\t\t},\n\t};\n\n\treturn format;\n}\n\n/**\n * Check if input is being show.\n * \n * @since 3.6\n * \n * @param {Object} props Component props.\n * @param {Object} state Component state.\n */\nfunction isShowingInput( props , state ) {\n\treturn props.addingLink || state.editLink;\n}\n\n/**\n * Affiliate Link editor JSX element.\n * \n * @since 3.6\n * \n * @param {Object} param0 Component props (destructred).\n */\nconst LinkEditor = ( { value , onChangeInputValue , onKeyDown , submitLink, invalidLink , resetInvalidLink , autocompleteRef } ) => (\n\t// Disable reason: KeyPress must be suppressed so the block doesn't hide the toolbar\n\t/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */\n\t<form\n\t\tclassName=\"editor-format-toolbar__link-container-content block-editor-format-toolbar__link-container-content ta-link-search-popover\"\n\t\tonKeyPress={ stopKeyPropagation }\n\t\tonKeyDown={ onKeyDown }\n\t\tonSubmit={ submitLink }\n\t>\n\t\t<ThirstyURLInput\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChangeInputValue }\n\t\t\tautocompleteRef={ autocompleteRef }\n\t\t\tinvalidLink={ invalidLink }\n\t\t\tresetInvalidLink={ resetInvalidLink }\n\t\t/>\n\t\t<IconButton icon=\"editor-break\" label={ __( 'Apply' ) } type=\"submit\" />\n\t</form>\n\t/* eslint-enable jsx-a11y/no-noninteractive-element-interactions */\n);\n\n/**\n * Affiliate link url viewer JSX element.\n * \n * @param {*} param0 Component props (destructred).\n */\nconst LinkViewerUrl = ( { url } ) => {\n\tconst prependedURL = prependHTTP( url );\n\tconst linkClassName = classnames( 'editor-format-toolbar__link-container-value block-editor-format-toolbar__link-container-value', {\n\t\t'has-invalid-link': ! isValidHref( prependedURL ),\n\t} );\n\n\tif ( ! url ) {\n\t\treturn <span className={ linkClassName }></span>;\n\t}\n\n\treturn (\n\t\t<ExternalLink\n\t\t\tclassName={ linkClassName }\n\t\t\thref={ url }\n\t\t>\n\t\t\t{ filterURLForDisplay( safeDecodeURI( url ) ) }\n\t\t</ExternalLink>\n\t);\n};\n\n/**\n * Affiliate link viewer JSX element.\n * \n * @param {*} param0 Component props (destructred).\n */\nconst LinkViewer = ( { url, editLink } ) => {\n\treturn (\n\t\t// Disable reason: KeyPress must be suppressed so the block doesn't hide the toolbar\n\t\t/* eslint-disable jsx-a11y/no-static-element-interactions */\n\t\t<div\n\t\t\tclassName=\"editor-format-toolbar__link-container-content block-editor-format-toolbar__link-container-content\"\n\t\t\tonKeyPress={ stopKeyPropagation }\n\t\t>\n\t\t\t<LinkViewerUrl url={ url } />\n\t\t\t<IconButton icon=\"edit\" label={ __( 'Edit' ) } onClick={ editLink } />\n\t\t</div>\n\t\t/* eslint-enable jsx-a11y/no-static-element-interactions */\n\t);\n};\n\n/**\n * Inline affiliate link UI Component.\n * \n * @since 3.6\n * \n * @param {*} param0 Component props (destructred).\n */\nclass InlineAffiliateLinkUI extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.editLink = this.editLink.bind( this );\n\t\tthis.submitLink = this.submitLink.bind( this );\n\t\tthis.onKeyDown = this.onKeyDown.bind( this );\n\t\tthis.onChangeInputValue = this.onChangeInputValue.bind( this );\n\t\tthis.onClickOutside = this.onClickOutside.bind( this );\n\t\tthis.resetState = this.resetState.bind( this );\n\t\tthis.autocompleteRef = createRef();\n\t\tthis.resetInvalidLink = this.resetInvalidLink.bind( this );\n\n\t\tthis.state = {\n\t\t\tinputValue : '',\n\t\t\tlinkid : 0,\n\t\t\tpost : null,\n\t\t\tinvalidLink : false\n\t\t};\n\t}\n\n\t/**\n\t * Stop the key event from propagating up to ObserveTyping.startTypingInTextField.\n\t * \n\t * @since 3.6\n\t * \n\t * @param {Object} event Event object.\n\t */\n\tonKeyDown( event ) {\n\t\tif ( [ LEFT, DOWN, RIGHT, UP, BACKSPACE, ENTER ].indexOf( event.keyCode ) > -1 ) {\n\t\t\tevent.stopPropagation();\n\t\t}\n\t}\n\n\t/**\n\t * Callback to set state when input value is changed.\n\t * \n\t * @since 3.6\n\t * \n\t * @param {*} inputValue \n\t * @param {*} post \n\t */\n\tonChangeInputValue( inputValue , post = null ) {\n\t\tconst linkid = post ? post.id : 0;\n\t\tthis.setState( { inputValue , linkid , post } );\n\t}\n\n\t/**\n\t * Callback to set state when edit affiliate link (already inserted) is triggered.\n\t * \n\t * @since 3.6\n\t * \n\t * @param {*} event \n\t */\n\teditLink( event ) {\n\t\tthis.setState( { editLink: true } );\n\t\tevent.preventDefault();\n\t}\n\n\t/**\n\t * Callback to apply the affiliate link format to the selected text or position in the active block.\n\t * \n\t * @since 3.6\n\t * \n\t * @param {*} event \n\t */\n\tsubmitLink( event ) {\n\t\tconst { isActive, value, onChange, speak } = this.props;\n\t\tconst { inputValue, linkid , post } = this.state;\n\t\tconst url = prependHTTP( inputValue );\n\t\tconst selectedText = getTextContent( slice( value ) );\n\t\tconst format = createLinkFormat( {\n\t\t\turl,\n\t\t\tlinkid,\n\t\t\ttext: selectedText,\n\t\t} );\n\n\t\tevent.preventDefault();\n\n\t\tif ( ! linkid || ! post ) {\n\t\t\tthis.setState( { invalidLink : true } )\n\t\t\treturn;\n\t\t} \n\n\t\tif ( isCollapsed( value ) && ! isActive ) {\n\t\t\tconst toInsert = applyFormat( create( { text: post.title } ), format, 0, url.length );\n\t\t\tonChange( insert( value, toInsert ) );\n\t\t} else {\n\t\t\tonChange( applyFormat( value, format ) );\n\t\t}\n\n\t\tthis.resetState();\n\n\t\tif ( ! isValidHref( url ) ) {\n\t\t\tspeak( __( 'Warning: the link has been inserted but may have errors. Please test it.' ), 'assertive' );\n\t\t} else if ( isActive ) {\n\t\t\tspeak( __( 'Link edited.' ), 'assertive' );\n\t\t} else {\n\t\t\tspeak( __( 'Link inserted' ), 'assertive' );\n\t\t}\n\t}\n\n\t/**\n\t * Callback to run when users clicks outside the popover UI.\n\t * \n\t * @since 3.6\n\t * \n\t * @param {*} event \n\t */\n\tonClickOutside( event ) {\n\t\t// The autocomplete suggestions list renders in a separate popover (in a portal),\n\t\t// so onClickOutside fails to detect that a click on a suggestion occured in the\n\t\t// LinkContainer. Detect clicks on autocomplete suggestions using a ref here, and\n\t\t// return to avoid the popover being closed.\n\t\tconst autocompleteElement = this.autocompleteRef.current;\n\t\tif ( autocompleteElement && autocompleteElement.contains( event.target ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.resetState();\n\t}\n\n\t/**\n\t * Reset state callback.\n\t * \n\t * @since 3.6\n\t */\n\tresetState() {\n\t\tthis.props.stopAddingLink();\n\t\tthis.setState( { inputValue : '' , editLink: false } );\n\t\tthis.resetInvalidLink();\n\t}\n\n\t/**\n\t * Reset invalid link state callback. Separated as we need to run this independently from resetState() callback.\n\t * \n\t * @since 3.6\n\t */\n\tresetInvalidLink() {\n\t\tthis.setState( { invalidLink : false } );\n\t}\n\n\t/**\n\t * Component render method.\n\t *\n\t * @since 3.6\n\t */\n\trender() {\n\t\tconst { isActive, activeAttributes: { url , linkid }, addingLink, anchorRect, value, onChange } = this.props;\n\n\t\tif ( ! isActive && ! addingLink ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst { inputValue , invalidLink } = this.state;\n\t\tconst showInput = isShowingInput( this.props, this.state );\n\n\t\treturn (\n\t\t\t<ThirstyURLPopover\n\t\t\t\tonClickOutside={ this.onClickOutside }\n\t\t\t\tonClose={ this.resetState }\n\t\t\t\tfocusOnMount={ showInput ? 'firstElement' : false }\n\t\t\t\tinvalidLink={ invalidLink }\n\t\t\t\tanchorRect= { anchorRect }\n\t\t\t>\n\t\t\t\t{ showInput ? (\n\t\t\t\t\t<LinkEditor\n\t\t\t\t\t\tvalue={ inputValue }\n\t\t\t\t\t\tonChangeInputValue={ this.onChangeInputValue }\n\t\t\t\t\t\tonKeyDown={ this.onKeyDown }\n\t\t\t\t\t\tsubmitLink={ this.submitLink }\n\t\t\t\t\t\tautocompleteRef={ this.autocompleteRef }\n\t\t\t\t\t\tupdateLinkId= { this.updateLinkId }\n\t\t\t\t\t\tinvalidLink={ invalidLink }\n\t\t\t\t\t\tresetInvalidLink={ this.resetInvalidLink }\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<LinkViewer\n\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\teditLink={ this.editLink }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</ThirstyURLPopover>\n\t\t);\n\t}\n}\n\nexport default withSpokenMessages( InlineAffiliateLinkUI );\n\n\n// WEBPACK FOOTER //\n// ./src/formats/ta-link/inline.js","const { startsWith } = lodash;\n\nconst {\n getProtocol,\n\tisValidProtocol,\n\tgetAuthority,\n\tisValidAuthority,\n\tgetPath,\n\tisValidPath,\n\tgetQueryString,\n\tisValidQueryString,\n\tgetFragment,\n\tisValidFragment,\n} = wp.url;\n\n/**\n * Check for issues with the provided href.\n * \n * @since 3.6\n *\n * @param {string} href The href.\n * @return {boolean} Is the href invalid?\n */\nexport function isValidHref( href ) {\n\tif ( ! href ) {\n\t\treturn false;\n\t}\n\n\tconst trimmedHref = href.trim();\n\n\tif ( ! trimmedHref ) {\n\t\treturn false;\n\t}\n\n\t// Does the href start with something that looks like a URL protocol?\n\tif ( /^\\S+:/.test( trimmedHref ) ) {\n\t\tconst protocol = getProtocol( trimmedHref );\n\t\tif ( ! isValidProtocol( protocol ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Add some extra checks for http(s) URIs, since these are the most common use-case.\n\t\t// This ensures URIs with an http protocol have exactly two forward slashes following the protocol.\n\t\tif ( startsWith( protocol, 'http' ) && ! /^https?:\\/\\/[^\\/\\s]/i.test( trimmedHref ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst authority = getAuthority( trimmedHref );\n\t\tif ( ! isValidAuthority( authority ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst path = getPath( trimmedHref );\n\t\tif ( path && ! isValidPath( path ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst queryString = getQueryString( trimmedHref );\n\t\tif ( queryString && ! isValidQueryString( queryString ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst fragment = getFragment( trimmedHref );\n\t\tif ( fragment && ! isValidFragment( fragment ) ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t// Validate anchor links.\n\tif ( startsWith( trimmedHref, '#' ) && ! isValidFragment( trimmedHref ) ) {\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\n\n// WEBPACK FOOTER //\n// ./src/formats/ta-link/utils.js","const { __ } = wp.i18n;\nconst { Component } = wp.element;\nconst { Popover , IconButton } = wp.components;\n\n/**\n * Custom URL Popover component.\n * \n * @since 3.6\n */\nclass ThirstyURLPopover extends Component {\n\n /**\n * Component constructor method.\n * \n * @since 3.6\n */\n\tconstructor() {\n super( ...arguments );\n \n this.toggleSettingsVisibility = this.toggleSettingsVisibility.bind( this );\n\n\t\tthis.state = {\n\t\t\tisSettingsExpanded: false,\n\t\t};\n }\n \n /**\n * Component constructor.\n * \n * @since 3.6\n */\n toggleSettingsVisibility() {\n\t\tthis.setState( {\n\t\t\tisSettingsExpanded: ! this.state.isSettingsExpanded,\n\t\t} );\n\t}\n\n /**\n * Component render method.\n * \n * @since 3.6\n */\n\trender() {\n\t\tconst {\n\t\t\tchildren,\n\t\t\trenderSettings,\n invalidLink,\n\t\t\tposition = 'bottom center',\n\t\t\tfocusOnMount = 'firstElement',\n\t\t\t...popoverProps\n\t\t} = this.props;\n\n\t\tconst {\n\t\t\tisSettingsExpanded,\n } = this.state;\n \n const showSettings = !! renderSettings && isSettingsExpanded;\n\n\t\treturn (\n\t\t\t<Popover\n\t\t\t\tclassName=\"ta-url-popover editor-url-popover block-editor-url-popover\"\n\t\t\t\tfocusOnMount={ focusOnMount }\n\t\t\t\tposition={ position }\n\t\t\t\t{ ...popoverProps }\n\t\t\t>\n\t\t\t\t<div className=\"editor-url-popover__row\">\n { children }\n { !! renderSettings && (\n\t\t\t\t\t\t<IconButton\n\t\t\t\t\t\t\tclassName=\"editor-url-popover__settings-toggle\"\n\t\t\t\t\t\t\ticon=\"ellipsis\"\n\t\t\t\t\t\t\tlabel={ __( 'Link Settings' ) }\n\t\t\t\t\t\t\tonClick={ this.toggleSettingsVisibility }\n\t\t\t\t\t\t\taria-expanded={ isSettingsExpanded }\n\t\t\t\t\t\t/>\n ) }\n\t\t\t\t</div>\n { showSettings && (\n\t\t\t\t\t<div className=\"editor-url-popover__row editor-url-popover__settings\">\n\t\t\t\t\t\t{ renderSettings() }\n\t\t\t\t\t</div>\n ) }\n { invalidLink && <div class=\"ta-invalid-link\">{ __( 'Invalid affiliate link' ) }</div> }\n\t\t\t</Popover>\n\t\t);\n\t}\n}\n\nexport default ThirstyURLPopover;\n\n\n// WEBPACK FOOTER //\n// ./src/formats/ta-link/url-popover.js","import classnames from 'classnames';\nimport scrollIntoView from 'dom-scroll-into-view';\n\nconst { __ } = wp.i18n;\nconst { throttle } = lodash;\nconst { Component , createRef } = wp.element;\nconst { UP, DOWN, ENTER, TAB } = wp.keycodes;\nconst { Spinner, withSpokenMessages, Popover } = wp.components;\nconst { withInstanceId } = wp.compose;\n\n// Since URLInput is rendered in the context of other inputs, but should be\n// considered a separate modal node, prevent keyboard events from propagating\n// as being considered from the input.\nconst stopEventPropagation = ( event ) => event.stopPropagation();\n\n/**\n * Custom URL Input component.\n * \n * @since 3.6\n */\nclass ThirstyURLInput extends Component {\n\n /**\n * Component constructor method.\n * \n * @since 3.6\n * \n * @param {*} param0 \n */\n\tconstructor( { autocompleteRef } ) {\n\t\tsuper( ...arguments );\n\n\t\tthis.onChange = this.onChange.bind( this );\n\t\tthis.onKeyDown = this.onKeyDown.bind( this );\n\t\tthis.autocompleteRef = autocompleteRef || createRef();\n\t\tthis.inputRef = createRef();\n\t\tthis.updateSuggestions = throttle( this.updateSuggestions.bind( this ), 200 );\n\n\t\tthis.suggestionNodes = [];\n\n\t\tthis.state = {\n\t\t\tposts: [],\n\t\t\tshowSuggestions: false,\n\t\t\tselectedSuggestion: null,\n\t\t};\n\t}\n\n /**\n * Component did update method.\n * \n * @since 3.6\n */\n\tcomponentDidUpdate() {\n\t\tconst { showSuggestions, selectedSuggestion } = this.state;\n\t\t// only have to worry about scrolling selected suggestion into view\n\t\t// when already expanded\n\t\tif ( showSuggestions && selectedSuggestion !== null && ! this.scrollingIntoView ) {\n\t\t\tthis.scrollingIntoView = true;\n\t\t\tscrollIntoView( this.suggestionNodes[ selectedSuggestion ], this.autocompleteRef.current, {\n\t\t\t\tonlyScrollIfNeeded: true,\n\t\t\t} );\n\n\t\t\tsetTimeout( () => {\n\t\t\t\tthis.scrollingIntoView = false;\n\t\t\t}, 100 );\n\t\t}\n\t}\n\n /**\n * Component unmount method.\n * \n * @since 3.6\n */\n\tcomponentWillUnmount() {\n\t\tdelete this.suggestionsRequest;\n\t}\n\n /**\n * Bind suggestion to node.\n * \n * @param {*} index \n */\n\tbindSuggestionNode( index ) {\n\t\treturn ( ref ) => {\n\t\t\tthis.suggestionNodes[ index ] = ref;\n\t\t};\n\t}\n\n /**\n * Callback to show suggestions based on value inputted on search field.\n * \n * @since 3.6\n * \n * @param {*} value \n */\n\tupdateSuggestions( value ) {\n\t\t// Show the suggestions after typing at least 2 characters\n\t\t// and also for URLs\n\t\tif ( value.length < 2 || /^https?:/.test( value ) ) {\n\t\t\tthis.setState( {\n\t\t\t\tshowSuggestions: false,\n\t\t\t\tselectedSuggestion: null,\n\t\t\t\tloading: false,\n\t\t\t} );\n\n\t\t\treturn;\n\t\t}\n\n\t\tthis.setState( {\n\t\t\tshowSuggestions: true,\n\t\t\tselectedSuggestion: null,\n\t\t\tloading: true,\n\t\t} );\n\n const formData = new FormData();\n formData.append( \"action\" , \"search_affiliate_links_query\" );\n formData.append( \"keyword\" , value );\n formData.append( \"paged\" , 1 );\n formData.append( \"gutenberg\" , true );\n \n // We are getting data via the WP AJAX instead of rest API as it is not possible yet\n // to filter results with category value. This is to prepare next update to add category filter.\n const request = fetch( ajaxurl , {\n method : \"POST\",\n body : formData\n } );\n\n request\n .then( response => response.json() )\n .then( ( response ) => {\n\n if ( ! response.affiliate_links ) return;\n\n const posts = response.affiliate_links;\n\n\t\t\t// A fetch Promise doesn't have an abort option. It's mimicked by\n\t\t\t// comparing the request reference in on the instance, which is\n\t\t\t// reset or deleted on subsequent requests or unmounting.\n\t\t\tif ( this.suggestionsRequest !== request ) {\n\t\t\t\treturn;\n }\n\n\t\t\tthis.setState( {\n\t\t\t\tposts,\n\t\t\t\tloading: false,\n } );\n\n\t\t\tif ( !! posts.length ) {\n\t\t\t\tthis.props.debouncedSpeak( sprintf( _n(\n\t\t\t\t\t'%d result found, use up and down arrow keys to navigate.',\n\t\t\t\t\t'%d results found, use up and down arrow keys to navigate.',\n\t\t\t\t\tposts.length\n\t\t\t\t), posts.length ), 'assertive' );\n\t\t\t} else {\n\t\t\t\tthis.props.debouncedSpeak( __( 'No results.' ), 'assertive' );\n }\n\n\t\t} ).catch( () => {\n\t\t\tif ( this.suggestionsRequest === request ) {\n\t\t\t\tthis.setState( {\n\t\t\t\t\tloading: false,\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\n\t\tthis.suggestionsRequest = request;\n\t}\n\n /**\n * Search input value change event callback method.\n * \n * @since 3.6\n * \n * @param {*} event \n */\n\tonChange( event ) {\n this.props.resetInvalidLink();\n\t\tconst inputValue = event.target.value;\n\t\tthis.props.onChange( inputValue );\n\t\tthis.updateSuggestions( inputValue );\n\t}\n\n /**\n * Keydown event callback. Handles selecting result via keyboard.\n * \n * @since 3.6\n * \n * @param {*} event \n */\n\tonKeyDown( event ) {\n\t\tconst { showSuggestions, selectedSuggestion, posts, loading } = this.state;\n\t\t// If the suggestions are not shown or loading, we shouldn't handle the arrow keys\n\t\t// We shouldn't preventDefault to allow block arrow keys navigation\n\t\tif ( ! showSuggestions || ! posts.length || loading ) {\n\t\t\t// In the Windows version of Firefox the up and down arrows don't move the caret\n\t\t\t// within an input field like they do for Mac Firefox/Chrome/Safari. This causes\n\t\t\t// a form of focus trapping that is disruptive to the user experience. This disruption\n\t\t\t// only happens if the caret is not in the first or last position in the text input.\n\t\t\t// See: https://github.com/WordPress/gutenberg/issues/5693#issuecomment-436684747\n\t\t\tswitch ( event.keyCode ) {\n\t\t\t\t// When UP is pressed, if the caret is at the start of the text, move it to the 0\n\t\t\t\t// position.\n\t\t\t\tcase UP: {\n\t\t\t\t\tif ( 0 !== event.target.selectionStart ) {\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\tevent.preventDefault();\n\n\t\t\t\t\t\t// Set the input caret to position 0\n\t\t\t\t\t\tevent.target.setSelectionRange( 0, 0 );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t// When DOWN is pressed, if the caret is not at the end of the text, move it to the\n\t\t\t\t// last position.\n\t\t\t\tcase DOWN: {\n\t\t\t\t\tif ( this.props.value.length !== event.target.selectionStart ) {\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\tevent.preventDefault();\n\n\t\t\t\t\t\t// Set the input caret to the last position\n\t\t\t\t\t\tevent.target.setSelectionRange( this.props.value.length, this.props.value.length );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst post = this.state.posts[ this.state.selectedSuggestion ];\n\n\t\tswitch ( event.keyCode ) {\n\t\t\tcase UP: {\n\t\t\t\tevent.stopPropagation();\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst previousIndex = ! selectedSuggestion ? posts.length - 1 : selectedSuggestion - 1;\n\t\t\t\tthis.setState( {\n\t\t\t\t\tselectedSuggestion: previousIndex,\n\t\t\t\t} );\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase DOWN: {\n\t\t\t\tevent.stopPropagation();\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst nextIndex = selectedSuggestion === null || ( selectedSuggestion === posts.length - 1 ) ? 0 : selectedSuggestion + 1;\n\t\t\t\tthis.setState( {\n\t\t\t\t\tselectedSuggestion: nextIndex,\n\t\t\t\t} );\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase TAB: {\n\t\t\t\tif ( this.state.selectedSuggestion !== null ) {\n\t\t\t\t\tthis.selectLink( post );\n\t\t\t\t\t// Announce a link has been selected when tabbing away from the input field.\n\t\t\t\t\tthis.props.speak( __( 'Link selected' ) );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ENTER: {\n\t\t\t\tif ( this.state.selectedSuggestion !== null ) {\n\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\tthis.selectLink( post );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n /**\n * Set state when an affiliate link is selected.\n * \n * @since 3.6\n * \n * @param {*} post \n */\n\tselectLink( post ) {\n\t\tthis.props.onChange( post.link, post );\n\t\tthis.setState( {\n\t\t\tselectedSuggestion: null,\n\t\t\tshowSuggestions: false,\n\t\t} );\n\t}\n\n /**\n * Callback handler for when affiliate link is selected.\n * \n * @param {*} post \n */\n\thandleOnClick( post ) {\n\t\tthis.selectLink( post );\n\t\t// Move focus to the input field when a link suggestion is clicked.\n\t\tthis.inputRef.current.focus();\n\t}\n\n /**\n * Component render method.\n * \n * @since 3.6\n */\n\trender() {\n\t\tconst { value = '', autoFocus = true, instanceId , invalidLink } = this.props;\n\t\tconst { showSuggestions, posts, selectedSuggestion, loading } = this.state;\n\t\t/* eslint-disable jsx-a11y/no-autofocus */\n\t\treturn (\n\t\t\t<div className=\"editor-url-input block-editor-url-input\">\n\t\t\t\t<input\n\t\t\t\t\tautoFocus={ autoFocus }\n\t\t\t\t\ttype=\"text\"\n\t\t\t\t\taria-label={ __( 'URL' ) }\n\t\t\t\t\trequired\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonChange={ this.onChange }\n\t\t\t\t\tonInput={ stopEventPropagation }\n\t\t\t\t\tplaceholder={ __( 'Paste URL or type to search' ) }\n\t\t\t\t\tonKeyDown={ this.onKeyDown }\n\t\t\t\t\trole=\"combobox\"\n\t\t\t\t\taria-expanded={ showSuggestions }\n\t\t\t\t\taria-autocomplete=\"list\"\n\t\t\t\t\taria-owns={ `editor-url-input-suggestions-${ instanceId }` }\n\t\t\t\t\taria-activedescendant={ selectedSuggestion !== null ? `editor-url-input-suggestion-${ instanceId }-${ selectedSuggestion }` : undefined }\n\t\t\t\t\tref={ this.inputRef }\n\t\t\t\t/>\n\n\t\t\t\t{ ( loading ) && <Spinner /> }\n\n\t\t\t\t{ showSuggestions && !! posts.length && ! invalidLink &&\n\t\t\t\t\t<Popover position=\"bottom\" noArrow focusOnMount={ false }>\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName=\"editor-url-input__suggestions block-editor-url-input__suggestions\"\n\t\t\t\t\t\t\tid={ `editor-url-input-suggestions-${ instanceId }` }\n\t\t\t\t\t\t\tref={ this.autocompleteRef }\n\t\t\t\t\t\t\trole=\"listbox\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ posts.map( ( post, index ) => (\n\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\tkey={ post.id }\n\t\t\t\t\t\t\t\t\trole=\"option\"\n\t\t\t\t\t\t\t\t\ttabIndex=\"-1\"\n\t\t\t\t\t\t\t\t\tid={ `block-editor-url-input-suggestion-${ instanceId }-${ index }` }\n\t\t\t\t\t\t\t\t\tref={ this.bindSuggestionNode( index ) }\n\t\t\t\t\t\t\t\t\tclassName={ classnames( 'editor-url-input__suggestion block-editor-url-input__suggestion', {\n\t\t\t\t\t\t\t\t\t\t'is-selected': index === selectedSuggestion,\n\t\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t\t\tonClick={ () => this.handleOnClick( post ) }\n\t\t\t\t\t\t\t\t\taria-selected={ index === selectedSuggestion }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ post.title || __( '(no title)' ) }\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</Popover>\n\t\t\t\t}\n\t\t\t</div>\n\t\t);\n\t\t/* eslint-enable jsx-a11y/no-autofocus */\n\t}\n}\n\nexport default withSpokenMessages( withInstanceId( ThirstyURLInput ) );\n\n\n// WEBPACK FOOTER //\n// ./src/formats/ta-link/url-input.js","'use strict';\n\nmodule.exports = require('./dom-scroll-into-view');\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/dom-scroll-into-view/lib/index.js\n// module id = 14\n// module chunks = 0","'use strict';\n\nvar util = require('./util');\n\nfunction scrollIntoView(elem, container, config) {\n config = config || {};\n // document 归一化到 window\n if (container.nodeType === 9) {\n container = util.getWindow(container);\n }\n\n var allowHorizontalScroll = config.allowHorizontalScroll;\n var onlyScrollIfNeeded = config.onlyScrollIfNeeded;\n var alignWithTop = config.alignWithTop;\n var alignWithLeft = config.alignWithLeft;\n var offsetTop = config.offsetTop || 0;\n var offsetLeft = config.offsetLeft || 0;\n var offsetBottom = config.offsetBottom || 0;\n var offsetRight = config.offsetRight || 0;\n\n allowHorizontalScroll = allowHorizontalScroll === undefined ? true : allowHorizontalScroll;\n\n var isWin = util.isWindow(container);\n var elemOffset = util.offset(elem);\n var eh = util.outerHeight(elem);\n var ew = util.outerWidth(elem);\n var containerOffset = undefined;\n var ch = undefined;\n var cw = undefined;\n var containerScroll = undefined;\n var diffTop = undefined;\n var diffBottom = undefined;\n var win = undefined;\n var winScroll = undefined;\n var ww = undefined;\n var wh = undefined;\n\n if (isWin) {\n win = container;\n wh = util.height(win);\n ww = util.width(win);\n winScroll = {\n left: util.scrollLeft(win),\n top: util.scrollTop(win)\n };\n // elem 相对 container 可视视窗的距离\n diffTop = {\n left: elemOffset.left - winScroll.left - offsetLeft,\n top: elemOffset.top - winScroll.top - offsetTop\n };\n diffBottom = {\n left: elemOffset.left + ew - (winScroll.left + ww) + offsetRight,\n top: elemOffset.top + eh - (winScroll.top + wh) + offsetBottom\n };\n containerScroll = winScroll;\n } else {\n containerOffset = util.offset(container);\n ch = container.clientHeight;\n cw = container.clientWidth;\n containerScroll = {\n left: container.scrollLeft,\n top: container.scrollTop\n };\n // elem 相对 container 可视视窗的距离\n // 注意边框, offset 是边框到根节点\n diffTop = {\n left: elemOffset.left - (containerOffset.left + (parseFloat(util.css(container, 'borderLeftWidth')) || 0)) - offsetLeft,\n top: elemOffset.top - (containerOffset.top + (parseFloat(util.css(container, 'borderTopWidth')) || 0)) - offsetTop\n };\n diffBottom = {\n left: elemOffset.left + ew - (containerOffset.left + cw + (parseFloat(util.css(container, 'borderRightWidth')) || 0)) + offsetRight,\n top: elemOffset.top + eh - (containerOffset.top + ch + (parseFloat(util.css(container, 'borderBottomWidth')) || 0)) + offsetBottom\n };\n }\n\n if (diffTop.top < 0 || diffBottom.top > 0) {\n // 强制向上\n if (alignWithTop === true) {\n util.scrollTop(container, containerScroll.top + diffTop.top);\n } else if (alignWithTop === false) {\n util.scrollTop(container, containerScroll.top + diffBottom.top);\n } else {\n // 自动调整\n if (diffTop.top < 0) {\n util.scrollTop(container, containerScroll.top + diffTop.top);\n } else {\n util.scrollTop(container, containerScroll.top + diffBottom.top);\n }\n }\n } else {\n if (!onlyScrollIfNeeded) {\n alignWithTop = alignWithTop === undefined ? true : !!alignWithTop;\n if (alignWithTop) {\n util.scrollTop(container, containerScroll.top + diffTop.top);\n } else {\n util.scrollTop(container, containerScroll.top + diffBottom.top);\n }\n }\n }\n\n if (allowHorizontalScroll) {\n if (diffTop.left < 0 || diffBottom.left > 0) {\n // 强制向上\n if (alignWithLeft === true) {\n util.scrollLeft(container, containerScroll.left + diffTop.left);\n } else if (alignWithLeft === false) {\n util.scrollLeft(container, containerScroll.left + diffBottom.left);\n } else {\n // 自动调整\n if (diffTop.left < 0) {\n util.scrollLeft(container, containerScroll.left + diffTop.left);\n } else {\n util.scrollLeft(container, containerScroll.left + diffBottom.left);\n }\n }\n } else {\n if (!onlyScrollIfNeeded) {\n alignWithLeft = alignWithLeft === undefined ? true : !!alignWithLeft;\n if (alignWithLeft) {\n util.scrollLeft(container, containerScroll.left + diffTop.left);\n } else {\n util.scrollLeft(container, containerScroll.left + diffBottom.left);\n }\n }\n }\n }\n}\n\nmodule.exports = scrollIntoView;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/dom-scroll-into-view/lib/dom-scroll-into-view.js\n// module id = 15\n// module chunks = 0","'use strict';\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol ? \"symbol\" : typeof obj; };\n\nvar RE_NUM = /[\\-+]?(?:\\d*\\.|)\\d+(?:[eE][\\-+]?\\d+|)/.source;\n\nfunction getClientPosition(elem) {\n var box = undefined;\n var x = undefined;\n var y = undefined;\n var doc = elem.ownerDocument;\n var body = doc.body;\n var docElem = doc && doc.documentElement;\n // 根据 GBS 最新数据,A-Grade Browsers 都已支持 getBoundingClientRect 方法,不用再考虑传统的实现方式\n box = elem.getBoundingClientRect();\n\n // 注:jQuery 还考虑减去 docElem.clientLeft/clientTop\n // 但测试发现,这样反而会导致当 html 和 body 有边距/边框样式时,获取的值不正确\n // 此外,ie6 会忽略 html 的 margin 值,幸运地是没有谁会去设置 html 的 margin\n\n x = box.left;\n y = box.top;\n\n // In IE, most of the time, 2 extra pixels are added to the top and left\n // due to the implicit 2-pixel inset border. In IE6/7 quirks mode and\n // IE6 standards mode, this border can be overridden by setting the\n // document element's border to zero -- thus, we cannot rely on the\n // offset always being 2 pixels.\n\n // In quirks mode, the offset can be determined by querying the body's\n // clientLeft/clientTop, but in standards mode, it is found by querying\n // the document element's clientLeft/clientTop. Since we already called\n // getClientBoundingRect we have already forced a reflow, so it is not\n // too expensive just to query them all.\n\n // ie 下应该减去窗口的边框吧,毕竟默认 absolute 都是相对窗口定位的\n // 窗口边框标准是设 documentElement ,quirks 时设置 body\n // 最好禁止在 body 和 html 上边框 ,但 ie < 9 html 默认有 2px ,减去\n // 但是非 ie 不可能设置窗口边框,body html 也不是窗口 ,ie 可以通过 html,body 设置\n // 标准 ie 下 docElem.clientTop 就是 border-top\n // ie7 html 即窗口边框改变不了。永远为 2\n // 但标准 firefox/chrome/ie9 下 docElem.clientTop 是窗口边框,即使设了 border-top 也为 0\n\n x -= docElem.clientLeft || body.clientLeft || 0;\n y -= docElem.clientTop || body.clientTop || 0;\n\n return {\n left: x,\n top: y\n };\n}\n\nfunction getScroll(w, top) {\n var ret = w['page' + (top ? 'Y' : 'X') + 'Offset'];\n var method = 'scroll' + (top ? 'Top' : 'Left');\n if (typeof ret !== 'number') {\n var d = w.document;\n // ie6,7,8 standard mode\n ret = d.documentElement[method];\n if (typeof ret !== 'number') {\n // quirks mode\n ret = d.body[method];\n }\n }\n return ret;\n}\n\nfunction getScrollLeft(w) {\n return getScroll(w);\n}\n\nfunction getScrollTop(w) {\n return getScroll(w, true);\n}\n\nfunction getOffset(el) {\n var pos = getClientPosition(el);\n var doc = el.ownerDocument;\n var w = doc.defaultView || doc.parentWindow;\n pos.left += getScrollLeft(w);\n pos.top += getScrollTop(w);\n return pos;\n}\nfunction _getComputedStyle(elem, name, computedStyle_) {\n var val = '';\n var d = elem.ownerDocument;\n var computedStyle = computedStyle_ || d.defaultView.getComputedStyle(elem, null);\n\n // https://github.com/kissyteam/kissy/issues/61\n if (computedStyle) {\n val = computedStyle.getPropertyValue(name) || computedStyle[name];\n }\n\n return val;\n}\n\nvar _RE_NUM_NO_PX = new RegExp('^(' + RE_NUM + ')(?!px)[a-z%]+#x27;, 'i');\nvar RE_POS = /^(top|right|bottom|left)#x2F;;\nvar CURRENT_STYLE = 'currentStyle';\nvar RUNTIME_STYLE = 'runtimeStyle';\nvar LEFT = 'left';\nvar PX = 'px';\n\nfunction _getComputedStyleIE(elem, name) {\n // currentStyle maybe null\n // http://msdn.microsoft.com/en-us/library/ms535231.aspx\n var ret = elem[CURRENT_STYLE] && elem[CURRENT_STYLE][name];\n\n // 当 width/height 设置为百分比时,通过 pixelLeft 方式转换的 width/height 值\n // 一开始就处理了! CUSTOM_STYLE.height,CUSTOM_STYLE.width ,cssHook 解决@2011-08-19\n // 在 ie 下不对,需要直接用 offset 方式\n // borderWidth 等值也有问题,但考虑到 borderWidth 设为百分比的概率很小,这里就不考虑了\n\n // From the awesome hack by Dean Edwards\n // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291\n // If we're not dealing with a regular pixel number\n // but a number that has a weird ending, we need to convert it to pixels\n // exclude left right for relativity\n if (_RE_NUM_NO_PX.test(ret) && !RE_POS.test(name)) {\n // Remember the original values\n var style = elem.style;\n var left = style[LEFT];\n var rsLeft = elem[RUNTIME_STYLE][LEFT];\n\n // prevent flashing of content\n elem[RUNTIME_STYLE][LEFT] = elem[CURRENT_STYLE][LEFT];\n\n // Put in the new values to get a computed value out\n style[LEFT] = name === 'fontSize' ? '1em' : ret || 0;\n ret = style.pixelLeft + PX;\n\n // Revert the changed values\n style[LEFT] = left;\n\n elem[RUNTIME_STYLE][LEFT] = rsLeft;\n }\n return ret === '' ? 'auto' : ret;\n}\n\nvar getComputedStyleX = undefined;\nif (typeof window !== 'undefined') {\n getComputedStyleX = window.getComputedStyle ? _getComputedStyle : _getComputedStyleIE;\n}\n\nfunction each(arr, fn) {\n for (var i = 0; i < arr.length; i++) {\n fn(arr[i]);\n }\n}\n\nfunction isBorderBoxFn(elem) {\n return getComputedStyleX(elem, 'boxSizing') === 'border-box';\n}\n\nvar BOX_MODELS = ['margin', 'border', 'padding'];\nvar CONTENT_INDEX = -1;\nvar PADDING_INDEX = 2;\nvar BORDER_INDEX = 1;\nvar MARGIN_INDEX = 0;\n\nfunction swap(elem, options, callback) {\n var old = {};\n var style = elem.style;\n var name = undefined;\n\n // Remember the old values, and insert the new ones\n for (name in options) {\n if (options.hasOwnProperty(name)) {\n old[name] = style[name];\n style[name] = options[name];\n }\n }\n\n callback.call(elem);\n\n // Revert the old values\n for (name in options) {\n if (options.hasOwnProperty(name)) {\n style[name] = old[name];\n }\n }\n}\n\nfunction getPBMWidth(elem, props, which) {\n var value = 0;\n var prop = undefined;\n var j = undefined;\n var i = undefined;\n for (j = 0; j < props.length; j++) {\n prop = props[j];\n if (prop) {\n for (i = 0; i < which.length; i++) {\n var cssProp = undefined;\n if (prop === 'border') {\n cssProp = prop + which[i] + 'Width';\n } else {\n cssProp = prop + which[i];\n }\n value += parseFloat(getComputedStyleX(elem, cssProp)) || 0;\n }\n }\n }\n return value;\n}\n\n/**\n * A crude way of determining if an object is a window\n * @member util\n */\nfunction isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj != null && obj == obj.window;\n}\n\nvar domUtils = {};\n\neach(['Width', 'Height'], function (name) {\n domUtils['doc' + name] = function (refWin) {\n var d = refWin.document;\n return Math.max(\n // firefox chrome documentElement.scrollHeight< body.scrollHeight\n // ie standard mode : documentElement.scrollHeight> body.scrollHeight\n d.documentElement['scroll' + name],\n // quirks : documentElement.scrollHeight 最大等于可视窗口多一点?\n d.body['scroll' + name], domUtils['viewport' + name](d));\n };\n\n domUtils['viewport' + name] = function (win) {\n // pc browser includes scrollbar in window.innerWidth\n var prop = 'client' + name;\n var doc = win.document;\n var body = doc.body;\n var documentElement = doc.documentElement;\n var documentElementProp = documentElement[prop];\n // 标准模式取 documentElement\n // backcompat 取 body\n return doc.compatMode === 'CSS1Compat' && documentElementProp || body && body[prop] || documentElementProp;\n };\n});\n\n/*\n 得到元素的大小信息\n @param elem\n @param name\n @param {String} [extra] 'padding' : (css width) + padding\n 'border' : (css width) + padding + border\n 'margin' : (css width) + padding + border + margin\n */\nfunction getWH(elem, name, extra) {\n if (isWindow(elem)) {\n return name === 'width' ? domUtils.viewportWidth(elem) : domUtils.viewportHeight(elem);\n } else if (elem.nodeType === 9) {\n return name === 'width' ? domUtils.docWidth(elem) : domUtils.docHeight(elem);\n }\n var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];\n var borderBoxValue = name === 'width' ? elem.offsetWidth : elem.offsetHeight;\n var computedStyle = getComputedStyleX(elem);\n var isBorderBox = isBorderBoxFn(elem, computedStyle);\n var cssBoxValue = 0;\n if (borderBoxValue == null || borderBoxValue <= 0) {\n borderBoxValue = undefined;\n // Fall back to computed then un computed css if necessary\n cssBoxValue = getComputedStyleX(elem, name);\n if (cssBoxValue == null || Number(cssBoxValue) < 0) {\n cssBoxValue = elem.style[name] || 0;\n }\n // Normalize '', auto, and prepare for extra\n cssBoxValue = parseFloat(cssBoxValue) || 0;\n }\n if (extra === undefined) {\n extra = isBorderBox ? BORDER_INDEX : CONTENT_INDEX;\n }\n var borderBoxValueOrIsBorderBox = borderBoxValue !== undefined || isBorderBox;\n var val = borderBoxValue || cssBoxValue;\n if (extra === CONTENT_INDEX) {\n if (borderBoxValueOrIsBorderBox) {\n return val - getPBMWidth(elem, ['border', 'padding'], which, computedStyle);\n }\n return cssBoxValue;\n }\n if (borderBoxValueOrIsBorderBox) {\n var padding = extra === PADDING_INDEX ? -getPBMWidth(elem, ['border'], which, computedStyle) : getPBMWidth(elem, ['margin'], which, computedStyle);\n return val + (extra === BORDER_INDEX ? 0 : padding);\n }\n return cssBoxValue + getPBMWidth(elem, BOX_MODELS.slice(extra), which, computedStyle);\n}\n\nvar cssShow = {\n position: 'absolute',\n visibility: 'hidden',\n display: 'block'\n};\n\n// fix #119 : https://github.com/kissyteam/kissy/issues/119\nfunction getWHIgnoreDisplay(elem) {\n var val = undefined;\n var args = arguments;\n // in case elem is window\n // elem.offsetWidth === undefined\n if (elem.offsetWidth !== 0) {\n val = getWH.apply(undefined, args);\n } else {\n swap(elem, cssShow, function () {\n val = getWH.apply(undefined, args);\n });\n }\n return val;\n}\n\nfunction css(el, name, v) {\n var value = v;\n if ((typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') {\n for (var i in name) {\n if (name.hasOwnProperty(i)) {\n css(el, i, name[i]);\n }\n }\n return undefined;\n }\n if (typeof value !== 'undefined') {\n if (typeof value === 'number') {\n value += 'px';\n }\n el.style[name] = value;\n return undefined;\n }\n return getComputedStyleX(el, name);\n}\n\neach(['width', 'height'], function (name) {\n var first = name.charAt(0).toUpperCase() + name.slice(1);\n domUtils['outer' + first] = function (el, includeMargin) {\n return el && getWHIgnoreDisplay(el, name, includeMargin ? MARGIN_INDEX : BORDER_INDEX);\n };\n var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];\n\n domUtils[name] = function (elem, val) {\n if (val !== undefined) {\n if (elem) {\n var computedStyle = getComputedStyleX(elem);\n var isBorderBox = isBorderBoxFn(elem);\n if (isBorderBox) {\n val += getPBMWidth(elem, ['padding', 'border'], which, computedStyle);\n }\n return css(elem, name, val);\n }\n return undefined;\n }\n return elem && getWHIgnoreDisplay(elem, name, CONTENT_INDEX);\n };\n});\n\n// 设置 elem 相对 elem.ownerDocument 的坐标\nfunction setOffset(elem, offset) {\n // set position first, in-case top/left are set even on static elem\n if (css(elem, 'position') === 'static') {\n elem.style.position = 'relative';\n }\n\n var old = getOffset(elem);\n var ret = {};\n var current = undefined;\n var key = undefined;\n\n for (key in offset) {\n if (offset.hasOwnProperty(key)) {\n current = parseFloat(css(elem, key)) || 0;\n ret[key] = current + offset[key] - old[key];\n }\n }\n css(elem, ret);\n}\n\nmodule.exports = _extends({\n getWindow: function getWindow(node) {\n var doc = node.ownerDocument || node;\n return doc.defaultView || doc.parentWindow;\n },\n offset: function offset(el, value) {\n if (typeof value !== 'undefined') {\n setOffset(el, value);\n } else {\n return getOffset(el);\n }\n },\n\n isWindow: isWindow,\n each: each,\n css: css,\n clone: function clone(obj) {\n var ret = {};\n for (var i in obj) {\n if (obj.hasOwnProperty(i)) {\n ret[i] = obj[i];\n }\n }\n var overflow = obj.overflow;\n if (overflow) {\n for (var i in obj) {\n if (obj.hasOwnProperty(i)) {\n ret.overflow[i] = obj.overflow[i];\n }\n }\n }\n return ret;\n },\n scrollLeft: function scrollLeft(w, v) {\n if (isWindow(w)) {\n if (v === undefined) {\n return getScrollLeft(w);\n }\n window.scrollTo(v, getScrollTop(w));\n } else {\n if (v === undefined) {\n return w.scrollLeft;\n }\n w.scrollLeft = v;\n }\n },\n scrollTop: function scrollTop(w, v) {\n if (isWindow(w)) {\n if (v === undefined) {\n return getScrollTop(w);\n }\n window.scrollTo(getScrollLeft(w), v);\n } else {\n if (v === undefined) {\n return w.scrollTop;\n }\n w.scrollTop = v;\n }\n },\n\n viewportWidth: 0,\n viewportHeight: 0\n}, domUtils);\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/dom-scroll-into-view/lib/util.js\n// module id = 16\n// module chunks = 0"],"sourceRoot":""}
js/app/gutenberg_support/src/blocks/ta-image/index.js CHANGED
@@ -109,107 +109,6 @@ export const settings = {
109
110
attributes: blockAttributes,
111
112
- transforms: {
113
- from: [
114
- {
115
- type: 'raw',
116
- isMatch: ( node ) => node.nodeName === 'FIGURE' && !! node.querySelector( 'img' ),
117
- schema,
118
- transform: ( node ) => {
119
-
120
- // Search both figure and image classes. Alignment could be
121
- // set on either. ID is set on the image.
122
- const className = node.className + ' ' + node.querySelector( 'img' ).className;
123
- const alignMatches = /(?:^|\s)align(left|center|right)(?:$|\s)/.exec( className );
124
- const align = alignMatches ? alignMatches[ 1 ] : undefined;
125
- const idMatches = /(?:^|\s)wp-image-(\d+)(?:$|\s)/.exec( className );
126
- const id = idMatches ? Number( idMatches[ 1 ] ) : undefined;
127
- const anchorElement = node.querySelector( 'a' );
128
- const linkDestination = anchorElement && anchorElement.href ? 'custom' : undefined;
129
- const linkid = anchorElement && anchorElement.linkid ? anchorElement.linkid : undefined;
130
- const href = anchorElement && anchorElement.href ? anchorElement.href : undefined;
131
- const rel = anchorElement && anchorElement.rel ? anchorElement.rel : undefined;
132
- const linkClass = anchorElement && anchorElement.className ? anchorElement.className : undefined;
133
- const attributes = getBlockAttributes( 'ta/image', node.outerHTML, { align, id, linkDestination, linkid , href, rel, linkClass } );
134
- return createBlock( 'ta/image', attributes );
135
- },
136
- },
137
- {
138
- type: 'files',
139
- isMatch( files ) {
140
- return files.length === 1 && files[ 0 ].type.indexOf( 'image/' ) === 0;
141
- },
142
- transform( files ) {
143
- const file = files[ 0 ];
144
- // We don't need to upload the media directly here
145
- // It's already done as part of the `componentDidMount`
146
- // int the image block
147
- const block = createBlock( 'ta/image', {
148
- url: createBlobURL( file ),
149
- } );
150
-
151
- return block;
152
- },
153
- },
154
- {
155
- type: 'shortcode',
156
- tag: 'caption',
157
- attributes: {
158
- url: {
159
- type: 'string',
160
- source: 'attribute',
161
- attribute: 'src',
162
- selector: 'img',
163
- },
164
- alt: {
165
- type: 'string',
166
- source: 'attribute',
167
- attribute: 'alt',
168
- selector: 'img',
169
- },
170
- caption: {
171
- shortcode: ( attributes, { shortcode } ) => {
172
- const { body } = document.implementation.createHTMLDocument( '' );
173
-
174
- body.innerHTML = shortcode.content;
175
- body.removeChild( body.firstElementChild );
176
-
177
- return body.innerHTML.trim();
178
- },
179
- },
180
- id: {
181
- type: 'number',
182
- shortcode: ( { named: { id } } ) => {
183
- if ( ! id ) {
184
- return;
185
- }
186
-
187
- return parseInt( id.replace( 'attachment_', '' ), 10 );
188
- },
189
- },
190
- align: {
191
- type: 'string',
192
- shortcode: ( { named: { align = 'alignnone' } } ) => {
193
- return align.replace( 'align', '' );
194
- },
195
- },
196
- linkid: {
197
- type: 'string',
198
- source: 'attribute',
199
- selector: 'wp-block-ta-image > ta',
200
- attribute: 'linkid'
201
- },
202
- href: {
203
- type: 'string',
204
- source: 'attribute',
205
- selector: 'ta',
206
- attribute: 'href'
207
- },
208
- },
209
- },
210
- ],
211
- },
212
-
213
getEditWrapperProps( attributes ) {
214
const { align, width } = attributes;
215
if ( 'left' === align || 'center' === align || 'right' === align || 'wide' === align || 'full' === align ) {
109
110
attributes: blockAttributes,
111
112
getEditWrapperProps( attributes ) {
113
const { align, width } = attributes;
114
if ( 'left' === align || 'center' === align || 'right' === align || 'wide' === align || 'full' === align ) {
js/app/gutenberg_support/src/blocks/ta-image/search-input.js CHANGED
@@ -184,7 +184,7 @@ class ThirstyURLInput extends Component {
184
return (
185
<div class="edit-search-affiliate-links">
186
<form
187
- className="editor-format-toolbar__link-container-content ta-link-search-popover"
188
onSubmit={ this.displayAffiliateImages }
189
>
190
<TextControl
@@ -207,7 +207,7 @@ class ThirstyURLInput extends Component {
207
tabIndex="-1"
208
id={ `editor-url-input-suggestion-${ instanceId }-${ index }` }
209
ref={ this.bindSuggestionNode( index ) }
210
- className={ classnames( 'editor-url-input__suggestion', {
211
'is-selected': index === selectedSuggestion,
212
} ) }
213
onClick={ () => this.handleOnClick( post ) }
184
return (
185
<div class="edit-search-affiliate-links">
186
<form
187
+ className="editor-format-toolbar__link-container-content block-editor-format-toolbar__link-container-content ta-link-search-popover"
188
onSubmit={ this.displayAffiliateImages }
189
>
190
<TextControl
207
tabIndex="-1"
208
id={ `editor-url-input-suggestion-${ instanceId }-${ index }` }
209
ref={ this.bindSuggestionNode( index ) }
210
+ className={ classnames( 'editor-url-input__suggestion block-editor-url-input__suggestion', {
211
'is-selected': index === selectedSuggestion,
212
} ) }
213
onClick={ () => this.handleOnClick( post ) }
js/app/gutenberg_support/src/formats/ta-link/index.js CHANGED
@@ -7,6 +7,7 @@ const { getTextContent , applyFormat , removeFormat , slice } = wp.richText;
7
const { isURL } = wp.url;
8
const { RichTextToolbarButton , RichTextShortcut } = wp.editor;
9
const { Path , SVG } = wp.components;
10
11
const name = "ta/link";
12
@@ -50,6 +51,7 @@ export const taLink = {
50
* @since 3.6
51
*/
52
addLink() {
53
const { value, onChange } = this.props;
54
const text = getTextContent( slice( value ) );
55
@@ -81,6 +83,43 @@ export const taLink = {
81
speak( __( "Affiliate Link removed." ), "assertive" );
82
}
83
84
/**
85
* Component render method.
86
*
@@ -89,6 +128,8 @@ export const taLink = {
89
render() {
90
const { isActive , activeAttributes , value , onChange } = this.props;
91
92
return (
93
<Fragment>
94
<RichTextShortcut
@@ -128,6 +169,7 @@ export const taLink = {
128
stopAddingLink={ this.stopAddingLink }
129
isActive={ isActive }
130
activeAttributes={ activeAttributes }
131
value={ value }
132
onChange={ onChange }
133
/>
7
const { isURL } = wp.url;
8
const { RichTextToolbarButton , RichTextShortcut } = wp.editor;
9
const { Path , SVG } = wp.components;
10
+ const { getRectangleFromRange } = wp.dom;
11
12
const name = "ta/link";
13
51
* @since 3.6
52
*/
53
addLink() {
54
+
55
const { value, onChange } = this.props;
56
const text = getTextContent( slice( value ) );
57
83
speak( __( "Affiliate Link removed." ), "assertive" );
84
}
85
86
+ /**
87
+ * Get selected anchor text.
88
+ *
89
+ * @since 3.9
90
+ */
91
+ getAnchorRect() {
92
+
93
+ const selection = window.getSelection();
94
+ const range = selection.rangeCount > 0 ? selection.getRangeAt( 0 ) : null;
95
+
96
+ if ( ! range ) return;
97
+
98
+ let rect = null;
99
+
100
+ if ( this.state.addingLink ) {
101
+ rect = getRectangleFromRange( range );
102
+ } else {
103
+
104
+ let element = range.startContainer;
105
+
106
+ // If the caret is right before the element, select the next element.
107
+ element = element.nextElementSibling || element;
108
+
109
+ while ( element.nodeType !== window.Node.ELEMENT_NODE ) {
110
+ element = element.parentNode;
111
+ }
112
+
113
+ const closest = element.closest( 'ta' );
114
+ if ( closest ) {
115
+ rect = closest.getBoundingClientRect();
116
+ }
117
+
118
+ }
119
+
120
+ return rect;
121
+ }
122
+
123
/**
124
* Component render method.
125
*
128
render() {
129
const { isActive , activeAttributes , value , onChange } = this.props;
130
131
+ const anchorRect = this.getAnchorRect();
132
+
133
return (
134
<Fragment>
135
<RichTextShortcut
169
stopAddingLink={ this.stopAddingLink }
170
isActive={ isActive }
171
activeAttributes={ activeAttributes }
172
+ anchorRect={ anchorRect }
173
value={ value }
174
onChange={ onChange }
175
/>
js/app/gutenberg_support/src/formats/ta-link/inline.js CHANGED
@@ -1,5 +1,4 @@
1
import classnames from "classnames";
2
- import ThirstyPositionedAtSelection from './positioned-at-selection';
3
import { isValidHref } from './utils';
4
import ThirstyURLPopover from './url-popover';
5
import ThirstyURLInput from './url-input';
@@ -59,7 +58,7 @@ const LinkEditor = ( { value , onChangeInputValue , onKeyDown , submitLink, inva
59
// Disable reason: KeyPress must be suppressed so the block doesn't hide the toolbar
60
/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */
61
<form
62
- className="editor-format-toolbar__link-container-content ta-link-search-popover"
63
onKeyPress={ stopKeyPropagation }
64
onKeyDown={ onKeyDown }
65
onSubmit={ submitLink }
@@ -83,7 +82,7 @@ const LinkEditor = ( { value , onChangeInputValue , onKeyDown , submitLink, inva
83
*/
84
const LinkViewerUrl = ( { url } ) => {
85
const prependedURL = prependHTTP( url );
86
- const linkClassName = classnames( 'editor-format-toolbar__link-container-value', {
87
'has-invalid-link': ! isValidHref( prependedURL ),
88
} );
89
@@ -111,7 +110,7 @@ const LinkViewer = ( { url, editLink } ) => {
111
// Disable reason: KeyPress must be suppressed so the block doesn't hide the toolbar
112
/* eslint-disable jsx-a11y/no-static-element-interactions */
113
<div
114
- className="editor-format-toolbar__link-container-content"
115
onKeyPress={ stopKeyPropagation }
116
>
117
<LinkViewerUrl url={ url } />
@@ -276,7 +275,7 @@ class InlineAffiliateLinkUI extends Component {
276
* @since 3.6
277
*/
278
render() {
279
- const { isActive, activeAttributes: { url , linkid }, addingLink, value, onChange } = this.props;
280
281
if ( ! isActive && ! addingLink ) {
282
return null;
@@ -286,34 +285,31 @@ class InlineAffiliateLinkUI extends Component {
286
const showInput = isShowingInput( this.props, this.state );
287
288
return (
289
- <ThirstyPositionedAtSelection
290
- key={ `${ value.start }${ value.end }` /* Used to force rerender on selection change */ }
291
>
292
- <ThirstyURLPopover
293
- onClickOutside={ this.onClickOutside }
294
- onClose={ this.resetState }
295
- focusOnMount={ showInput ? 'firstElement' : false }
296
- invalidLink={ invalidLink }
297
- >
298
- { showInput ? (
299
- <LinkEditor
300
- value={ inputValue }
301
- onChangeInputValue={ this.onChangeInputValue }
302
- onKeyDown={ this.onKeyDown }
303
- submitLink={ this.submitLink }
304
- autocompleteRef={ this.autocompleteRef }
305
- updateLinkId= { this.updateLinkId }
306
- invalidLink={ invalidLink }
307
- resetInvalidLink={ this.resetInvalidLink }
308
- />
309
- ) : (
310
- <LinkViewer
311
- url={ url }
312
- editLink={ this.editLink }
313
- />
314
- ) }
315
- </ThirstyURLPopover>
316
- </ThirstyPositionedAtSelection>
317
);
318
}
319
}
1
import classnames from "classnames";
2
import { isValidHref } from './utils';
3
import ThirstyURLPopover from './url-popover';
4
import ThirstyURLInput from './url-input';
58
// Disable reason: KeyPress must be suppressed so the block doesn't hide the toolbar
59
/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */
60
<form
61
+ className="editor-format-toolbar__link-container-content block-editor-format-toolbar__link-container-content ta-link-search-popover"
62
onKeyPress={ stopKeyPropagation }
63
onKeyDown={ onKeyDown }
64
onSubmit={ submitLink }
82
*/
83
const LinkViewerUrl = ( { url } ) => {
84
const prependedURL = prependHTTP( url );
85
+ const linkClassName = classnames( 'editor-format-toolbar__link-container-value block-editor-format-toolbar__link-container-value', {
86
'has-invalid-link': ! isValidHref( prependedURL ),
87
} );
88
110
// Disable reason: KeyPress must be suppressed so the block doesn't hide the toolbar
111
/* eslint-disable jsx-a11y/no-static-element-interactions */
112
<div
113
+ className="editor-format-toolbar__link-container-content block-editor-format-toolbar__link-container-content"
114
onKeyPress={ stopKeyPropagation }
115
>
116
<LinkViewerUrl url={ url } />
275
* @since 3.6
276
*/
277
render() {
278
+ const { isActive, activeAttributes: { url , linkid }, addingLink, anchorRect, value, onChange } = this.props;
279
280
if ( ! isActive && ! addingLink ) {
281
return null;
285
const showInput = isShowingInput( this.props, this.state );
286
287
return (
288
+ <ThirstyURLPopover
289
+ onClickOutside={ this.onClickOutside }
290
+ onClose={ this.resetState }
291
+ focusOnMount={ showInput ? 'firstElement' : false }
292
+ invalidLink={ invalidLink }
293
+ anchorRect= { anchorRect }
294
>
295
+ { showInput ? (
296
+ <LinkEditor
297
+ value={ inputValue }
298
+ onChangeInputValue={ this.onChangeInputValue }
299
+ onKeyDown={ this.onKeyDown }
300
+ submitLink={ this.submitLink }
301
+ autocompleteRef={ this.autocompleteRef }
302
+ updateLinkId= { this.updateLinkId }
303
+ invalidLink={ invalidLink }
304
+ resetInvalidLink={ this.resetInvalidLink }
305
+ />
306
+ ) : (
307
+ <LinkViewer
308
+ url={ url }
309
+ editLink={ this.editLink }
310
+ />
311
+ ) }
312
+ </ThirstyURLPopover>
313
);
314
}
315
}
js/app/gutenberg_support/src/formats/ta-link/positioned-at-selection.js DELETED
@@ -1,79 +0,0 @@
1
- const { Component } = wp.element;
2
- const { getOffsetParent , getRectangleFromRange } = wp.dom;
3
-
4
- /**
5
- * Returns a style object for applying as `position: absolute` for an element
6
- * relative to the bottom-center of the current selection. Includes `top` and
7
- * `left` style properties.
8
- *
9
- * @since 3.6
10
- *
11
- * @return {Object} Style object.
12
- */
13
- function getCurrentCaretPositionStyle() {
14
- const selection = window.getSelection();
15
-
16
- // Unlikely, but in the case there is no selection, return empty styles so
17
- // as to avoid a thrown error by `Selection#getRangeAt` on invalid index.
18
- if ( selection.rangeCount === 0 ) {
19
- return {};
20
- }
21
-
22
- // Get position relative viewport.
23
- const rect = getRectangleFromRange( selection.getRangeAt( 0 ) );
24
- let top = rect.top + rect.height;
25
- let left = rect.left + ( rect.width / 2 );
26
-
27
- // Offset by positioned parent, if one exists.
28
- const offsetParent = getOffsetParent( selection.anchorNode );
29
- if ( offsetParent ) {
30
- const parentRect = offsetParent.getBoundingClientRect();
31
- top -= parentRect.top;
32
- left -= parentRect.left;
33
- }
34
-
35
- return { top, left };
36
- }
37
-
38
- /**
39
- * Component which renders itself positioned under the current caret selection.
40
- * The position is calculated at the time of the component being mounted, so it
41
- * should only be mounted after the desired selection has been made.
42
- *
43
- * @since 3.6
44
- *
45
- * @type {WPComponent}
46
- */
47
- class ThirstyPositionedAtSelection extends Component {
48
-
49
- /**
50
- * Component constructor method.
51
- *
52
- * @since 3.6
53
- */
54
- constructor() {
55
- super( ...arguments );
56
-
57
- this.state = {
58
- style: getCurrentCaretPositionStyle(),
59
- };
60
- }
61
-
62
- /**
63
- * Component render method.
64
- *
65
- * @since 3.6
66
- */
67
- render() {
68
- const { children } = this.props;
69
- const { style } = this.state;
70
-
71
- return (
72
- <div className="editor-format-toolbar__selection-position" style={ style }>
73
- { children }
74
- </div>
75
- );
76
- }
77
- }
78
-
79
- export default ThirstyPositionedAtSelection;
js/app/gutenberg_support/src/formats/ta-link/url-input.js CHANGED
@@ -302,7 +302,7 @@ class ThirstyURLInput extends Component {
302
const { showSuggestions, posts, selectedSuggestion, loading } = this.state;
303
/* eslint-disable jsx-a11y/no-autofocus */
304
return (
305
- <div className="editor-url-input">
306
<input
307
autoFocus={ autoFocus }
308
type="text"
@@ -326,7 +326,7 @@ class ThirstyURLInput extends Component {
326
{ showSuggestions && !! posts.length && ! invalidLink &&
327
<Popover position="bottom" noArrow focusOnMount={ false }>
328
<div
329
- className="editor-url-input__suggestions"
330
id={ `editor-url-input-suggestions-${ instanceId }` }
331
ref={ this.autocompleteRef }
332
role="listbox"
@@ -336,9 +336,9 @@ class ThirstyURLInput extends Component {
336
key={ post.id }
337
role="option"
338
tabIndex="-1"
339
- id={ `editor-url-input-suggestion-${ instanceId }-${ index }` }
340
ref={ this.bindSuggestionNode( index ) }
341
- className={ classnames( 'editor-url-input__suggestion', {
342
'is-selected': index === selectedSuggestion,
343
} ) }
344
onClick={ () => this.handleOnClick( post ) }
302
const { showSuggestions, posts, selectedSuggestion, loading } = this.state;
303
/* eslint-disable jsx-a11y/no-autofocus */
304
return (
305
+ <div className="editor-url-input block-editor-url-input">
306
<input
307
autoFocus={ autoFocus }
308
type="text"
326
{ showSuggestions && !! posts.length && ! invalidLink &&
327
<Popover position="bottom" noArrow focusOnMount={ false }>
328
<div
329
+ className="editor-url-input__suggestions block-editor-url-input__suggestions"
330
id={ `editor-url-input-suggestions-${ instanceId }` }
331
ref={ this.autocompleteRef }
332
role="listbox"
336
key={ post.id }
337
role="option"
338
tabIndex="-1"
339
+ id={ `block-editor-url-input-suggestion-${ instanceId }-${ index }` }
340
ref={ this.bindSuggestionNode( index ) }
341
+ className={ classnames( 'editor-url-input__suggestion block-editor-url-input__suggestion', {
342
'is-selected': index === selectedSuggestion,
343
} ) }
344
onClick={ () => this.handleOnClick( post ) }
js/app/gutenberg_support/src/formats/ta-link/url-popover.js CHANGED
@@ -44,11 +44,10 @@ class ThirstyURLPopover extends Component {
44
const {
45
children,
46
renderSettings,
47
- onClose,
48
- onClickOutside,
49
invalidLink,
50
position = 'bottom center',
51
focusOnMount = 'firstElement',
52
} = this.props;
53
54
const {
@@ -59,11 +58,10 @@ class ThirstyURLPopover extends Component {
59
60
return (
61
<Popover
62
- className="ta-url-popover editor-url-popover"
63
focusOnMount={ focusOnMount }
64
position={ position }
65
- onClose={ onClose }
66
- onClickOutside={ onClickOutside }
67
>
68
<div className="editor-url-popover__row">
69
{ children }
44
const {
45
children,
46
renderSettings,
47
invalidLink,
48
position = 'bottom center',
49
focusOnMount = 'firstElement',
50
+ ...popoverProps
51
} = this.props;
52
53
const {
58
59
return (
60
<Popover
61
+ className="ta-url-popover editor-url-popover block-editor-url-popover"
62
focusOnMount={ focusOnMount }
63
position={ position }
64
+ { ...popoverProps }
65
>
66
<div className="editor-url-popover__row">
67
{ children }
languages/thirstyaffiliates.pot CHANGED
@@ -2,14 +2,14 @@
2
msgid ""
3
msgstr ""
4
"Project-Id-Version: ThirstyAffiliates\n"
5
- "POT-Creation-Date: 2019-04-01 09:00+0800\n"
6
"PO-Revision-Date: 2016-04-29 07:38+0800\n"
7
"Last-Translator: \n"
8
"Language-Team: Rymera Web Co <support@thirstyaffiliates.com>\n"
9
"MIME-Version: 1.0\n"
10
"Content-Type: text/plain; charset=UTF-8\n"
11
"Content-Transfer-Encoding: 8bit\n"
12
- "X-Generator: Poedit 2.1.1\n"
13
"X-Poedit-Basepath: ..\n"
14
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
15
"Language: en\n"
2
msgid ""
3
msgstr ""
4
"Project-Id-Version: ThirstyAffiliates\n"
5
+ "POT-Creation-Date: 2019-06-05 09:16+0800\n"
6
"PO-Revision-Date: 2016-04-29 07:38+0800\n"
7
"Last-Translator: \n"
8
"Language-Team: Rymera Web Co <support@thirstyaffiliates.com>\n"
9
"MIME-Version: 1.0\n"
10
"Content-Type: text/plain; charset=UTF-8\n"
11
"Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 2.2.3\n"
13
"X-Poedit-Basepath: ..\n"
14
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
15
"Language: en\n"
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: affiliate, link, affiliate link management, link cloaker, link redirect, s
5
Requires at least: 3.4
6
Requires PHP: 5.6
7
Tested up to: 5.1.1
8
- Stable tag: 3.8
9
License: GPLv2 or later
10
License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
@@ -159,6 +159,12 @@ See our [Knowledge Base](https://thirstyaffiliates.com/knowledge-base/?utm_sourc
159
160
== Changelog ==
161
162
= 3.8 =
163
* Bug Fix: The "convert to blocks" button is not working with Gutenberg
164
5
Requires at least: 3.4
6
Requires PHP: 5.6
7
Tested up to: 5.1.1
8
+ Stable tag: 3.9
9
License: GPLv2 or later
10
License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
159
160
== Changelog ==
161
162
+ = 3.9 =
163
+ * Bug Fix: Gutenberg Input affiliate link as shortcode should show the error to admin only
164
+ * Bug Fix: Convert to blocks converts images on posts as ThirstyAffiliates Image block
165
+ * Bug Fix: UTC-2 and UTC+11 Timezone produces Fatal Error when activating the plugin
166
+ * Bug Fix: TA button style for block editor changes in WP 5.2.1
167
+
168
= 3.8 =
169
* Bug Fix: The "convert to blocks" button is not working with Gutenberg
170
thirstyaffiliates.php CHANGED
@@ -3,11 +3,11 @@
3
* Plugin Name: ThirstyAffiliates
4
* Plugin URI: http://thirstyaffiliates.com/
5
* Description: ThirstyAffiliates is a revolution in affiliate link management. Collect, collate and store your affiliate links for use in your posts and pages.
6
- * Version: 3.8
7
* Author: Rymera Web Co
8
* Author URI: https://rymera.com.au/
9
* Requires at least: 4.5
10
- * Tested up to: 5.1.1
11
*
12
* Text Domain: thirstyaffiliates
13
* Domain Path: /languages/
3
* Plugin Name: ThirstyAffiliates
4
* Plugin URI: http://thirstyaffiliates.com/
5
* Description: ThirstyAffiliates is a revolution in affiliate link management. Collect, collate and store your affiliate links for use in your posts and pages.
6
+ * Version: 3.9
7
* Author: Rymera Web Co
8
* Author URI: https://rymera.com.au/
9
* Requires at least: 4.5
10
+ * Tested up to: 5.2.1
11
*
12
* Text Domain: thirstyaffiliates
13
* Domain Path: /languages/