ThirstyAffiliates Affiliate Link Manager - Version 3.10.13

Version Description

  • Bug Fix: TA Link Inserter jumping to bottom of page on WP 6.1
  • Bug Fix: Warning message being HTML escaped
Download this release

Release Info

Developer caseproof
Plugin Icon 128x128 ThirstyAffiliates Affiliate Link Manager
Version 3.10.13
Comparing to
See all releases

Code changes from version 3.10.12 to 3.10.13

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.10.12';
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.10.13';
31
  const TEXT_DOMAIN = 'thirstyaffiliates';
32
  const THEME_TEMPLATE_PATH = 'thirstyaffiliates';
33
  const META_DATA_PREFIX = '_ta_';
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(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 m}),n.d(t,"settings",function(){return b});var o=n(0),r=n.n(o),a=n(4),l=wp.element.Fragment,s=wp.i18n.__,u=wp.dom.getPhrasingContentSchema?wp.dom:wp.blocks,c=u.getPhrasingContentSchema,p=wp.blockEditor?wp.blockEditor:wp.editor,d=p.RichText,f=wp.components,h=f.Path,g=f.SVG,m="ta/image",v={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"}},w={img:{attributes:["src","alt"],classes:["alignleft","aligncenter","alignright","alignnone",/^wp-image-\d+$/]}},b=(c(),{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(h,{d:"M0,0h24v24H0V0z",fill:"none"}),wp.element.createElement(h,{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(h,{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:v,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,g=n.href,m=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:g},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: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,H=x.Spinner,B=x.TextControl,U=x.TextareaControl,M=x.Toolbar,K=x.withNotices,q=wp.data.withSelect,G=wp.editor.mediaUpload,Q=wp.blockEditor?wp.blockEditor:wp.editor,Z=Q.InspectorControls,$=Q.BlockControls,X=Q.RichText,Y=Q.BlockAlignmentToolbar,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,t){return t&&!e&&!A(t)},re=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&&G({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;if(oe(e.id,e.src))e.url=e.src,this.onSelectImage(e);else{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,{label:E("ThirstyAffiliates Image Settings")},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($,null,wp.element.createElement(Y,{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(Z,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(B,{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(B,{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(H,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))}),(!X.isEmpty(y)||d)&&wp.element.createElement(X,{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])(re)},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 C});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.blockEditor?wp.blockEditor:wp.editor,y=b.RichTextToolbarButton,k=b.RichTextShortcut,S=wp.components,E=S.Path,_=S.SVG,L=wp.dom.getRectangleFromRange,O=null,C={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){if(e.anchorNode.nodeType!==window.Node.TEXT_NODE)return O;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 O=n,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()},H=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"}))},B=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(B,{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(H,{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%]+$","i"),E=/^(top|right|bottom|left)$/,_="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
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 b});var o=n(0),r=n.n(o),a=n(4),l=wp.element.Fragment,s=wp.i18n.__,u=wp.dom.getPhrasingContentSchema?wp.dom:wp.blocks,c=u.getPhrasingContentSchema,p=wp.blockEditor?wp.blockEditor:wp.editor,d=p.RichText,f=wp.components,h=f.Path,m=f.SVG,g="ta/image",v={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"}},w={img:{attributes:["src","alt"],classes:["alignleft","aligncenter","alignright","alignnone",/^wp-image-\d+$/]}},b=(c(),{title:s("ThirstyAffiliates Image"),description:s("Insert an image with an affiliate link to make a visual statement."),icon:wp.element.createElement(m,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement(h,{d:"M0,0h24v24H0V0z",fill:"none"}),wp.element.createElement(h,{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(h,{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:v,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},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,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,A=T.revokeBlobURL,P=T.isBlobURL,x=wp.components,N=x.Placeholder,j=x.Button,F=x.ButtonGroup,W=x.PanelBody,D=x.ResizableBox,V=x.SelectControl,z=x.Spinner,H=x.TextControl,B=x.TextareaControl,U=x.Toolbar,M=x.withNotices,K=wp.data.withSelect,q=wp.editor.mediaUpload,G=wp.blockEditor?wp.blockEditor:wp.editor,Q=G.InspectorControls,Z=G.BlockControls,$=G.RichText,X=G.BlockAlignmentToolbar,Y=wp.viewport.withViewportMatch,J=wp.compose.compose,ee=["image"],te=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},ne=function(e,t){return!e&&P(t)},ie=function(e,t){return t&&!e&&!P(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(ne(r,l)){var s=R(l);s&&q({filesList:[s],onFileChange:function(e){var t=d(e,1),n=t[0];i(te(n))},allowedTypes:ee,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;ne(n,o)&&!ne(a,s)&&A(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({},te(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;if(ie(e.id,e.src))e.url=e.src,this.onSelectImage(e);else{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,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,{label:E("ThirstyAffiliates Image Settings")},wp.element.createElement(j,{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(N,{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 A=l()(f,{"wp-block-image":!0,"is-transient":P(w),"is-resized":!!S||!!L,"is-focused":d}),x=-1===["wide","full"].indexOf(k)&&p,M=this.getImageSizeOptions(),K=function(t,n){return wp.element.createElement(Q,null,wp.element.createElement(W,{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(M)&&wp.element.createElement(V,{label:E("Image Size"),value:w,options:M,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(j,{key:i,isSmall:!0,isPrimary:a,"aria-pressed":a,onClick:e.updateDimensions(o,r)},i,"%")})),wp.element.createElement(j,{isSmall:!0,onClick:e.updateDimensions()},E("Reset"))))))};return wp.element.createElement(C,null,R,wp.element.createElement("figure",{className:A},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)}})),P(w)&&wp.element.createElement(z,null));if(!x||!n)return wp.element.createElement(C,null,K(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,g=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,K(o,r),wp.element.createElement(D,{size:S&&L?{width:S,height:L}:void 0,minWidth:f,maxWidth:y,minHeight:g,maxHeight:y/d,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)||d)&&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=J([K(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}}),Y({isLargeViewport:"medium"}),M])(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,m=f.withSpokenMessages,g=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(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 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=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,d=wp.components.withSpokenMessages,f=wp.richText,h=f.getTextContent,m=f.applyFormat,g=f.removeFormat,v=f.slice,w=wp.url.isURL,b=wp.blockEditor?wp.blockEditor: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: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(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,r=e.contentRef;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,contentRef:r}))}}]),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.__,m=wp.element,g=m.Component,v=m.createRef,w=wp.components,b=w.ExternalLink,y=w.Button,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,A=T.safeDecodeURI,P=T.filterURLForDisplay,x=wp.richText,N=x.create,j=x.insert,F=x.isCollapsed,W=x.applyFormat,D=x.getTextContent,V=x.slice,z=function(e){return e.stopPropagation()},H=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,autoFocus:!1,onChange:n,autocompleteRef:l,invalidLink:r,resetInvalidLink:a}),wp.element.createElement(y,{icon:"editor-break",label:h("Apply"),type:"submit"}))},B=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},P(A(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(B,{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)),m=a({url:d,linkid:u,text:f});if(e.preventDefault(),!u||!p)return void this.setState({invalidLink:!0});if(F(i)&&!n){var g=W(N({text:p.title}),m,0,d.length);o(j(i,g))}else o(W(i,m));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.url,i=e.addingLink,o=e.value,r=e.contentRef;if(!t&&!i)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",addingLink:i,invalidLink:u,value:o,contentRef:r},c?wp.element.createElement(H,{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:n,editLink:this.editLink}))}}]),t}(g);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=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,d=a.isValidPath,f=a.getQueryString,h=a.isValidQueryString,m=a.getFragment,g=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){var t=e.children,n=e.renderSettings,o=e.addingLink,u=e.invalidLink,m=e.position,g=void 0===m?"bottom center":m,v=e.focusOnMount,w=void 0===v?"firstElement":v,b=e.value,y=e.contentRef,k=i(e,["children","renderSettings","addingLink","invalidLink","position","focusOnMount","value","contentRef"]),S=s(!1),E=a(S,2),_=E[0],L=E[1],O=!!n&&_(),C=void 0;return C=d?{anchor:d({editableContentElement:y.current,value:b,settings:{tagName:"ta"}})}:{anchorRect:function(){var e=window.getSelection(),t=e.rangeCount>0?e.getRangeAt(0):null;if(t){if(e.anchorNode.nodeType!==window.Node.TEXT_NODE)return h;var n=null;if(o)n=f(t);else{var i=t.startContainer;for(i=i.nextElementSibling||i;i.nodeType!==window.Node.ELEMENT_NODE;)i=i.parentNode;var r=i.closest("ta");r&&(n=r.getBoundingClientRect())}return h=n,n}}()},wp.element.createElement(c,r({className:"ta-url-popover editor-url-popover block-editor-url-popover",focusOnMount:w,position:g},C,k),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:function(){L(!_())},"aria-expanded":_()})),O&&wp.element.createElement("div",{className:"editor-url-popover__row editor-url-popover__settings"},n()),u&&wp.element.createElement("div",{className:"ta-invalid-link"},l("Invalid affiliate link")))}var r=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},a=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")}}(),l=wp.i18n.__,s=wp.element.useState,u=wp.components,c=u.Popover,p=u.Button,d=wp.richText.useAnchor,f=wp.dom.getRectangleFromRange,h=null;t.a=o},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,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=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}(m);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),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;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+m-(E.left+_)+p,top:f.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:f.left-(g.left+(parseFloat(o.css(t,"borderLeftWidth"))||0))-u,top:f.top-(g.top+(parseFloat(o.css(t,"borderTopWidth"))||0))-s},k={left:f.left+m-(g.left+w+(parseFloat(o.css(t,"borderRightWidth"))||0))+p,top:f.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(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 m(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?P: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===A?-f(e,["border"],i,r):f(e,["margin"],i,r);return u+(n===P?0:c)}return l+f(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):d(e,N,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%]+$","i"),E=/^(top|right|bottom|left)$/,_="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,A=2,P=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 N={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&&g(t,e,n?0:P)};var n="width"===e?["Left","Right"]:["Top","Bottom"];x[e]=function(t,i){if(void 0===i)return t&&g(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 27b23956e00af8e89c28","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","_ref","dom","getPhrasingContentSchema","_ref2","blockEditor","editor","RichText","_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","_ref3","_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","data","mediaUpload","InspectorControls","BlockControls","BlockAlignmentToolbar","withViewportMatch","viewport","compose","ALLOWED_MEDIA_TYPES","pickRelevantMediaFiles","imageProps","isTemporaryImage","isExternalImage","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","_ref4","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","_ref5","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","createBlock","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","Popover","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","lastAnchorRect","LinkEdit","addLink","stopAddingLink","onRemoveFormat","addingLink","text","speak","selection","getSelection","range","rangeCount","getRangeAt","anchorNode","nodeType","Node","TEXT_NODE","rect","startContainer","nextElementSibling","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","ToggleControl","_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,KA4BA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D,GAAAH,EAEAlP,QAAA8T,SAAAlB,EAAAtD,EAAAJ,QACK,CACL,OAAAnkB,KAAA6nB,EACA,MAAA1D,GAAAf,UAEAe,GAAAf,WAAAyE,IAGAxE,UAAA,SAAAc,EAAA0D,GACA,GAAA1F,EAAAgC,GAAA,CACA,OAAAnkB,KAAA6nB,EACA,MAAAtD,GAAAJ,EAEAlP,QAAA8T,SAAAzE,EAAAH,GAAA0D,OACK,CACL,OAAA7nB,KAAA6nB,EACA,MAAA1D,GAAAd,SAEAc,GAAAd,UAAAwE,IAIAnB,cAAA,EACAC,eAAA,GACCF,IlBymGK,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.__;\n\nvar _ref = wp.dom.getPhrasingContentSchema ? wp.dom : wp.blocks,\n getPhrasingContentSchema = _ref.getPhrasingContentSchema;\n\nvar _ref2 = wp.blockEditor ? wp.blockEditor : wp.editor,\n RichText = _ref2.RichText;\n\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+$/]\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(_ref3) {\n\t\tvar _classnames;\n\n\t\tvar attributes = _ref3.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;\nvar withSelect = wp.data.withSelect;\nvar mediaUpload = wp.editor.mediaUpload;\n\nvar _ref = wp.blockEditor ? wp.blockEditor : wp.editor,\n InspectorControls = _ref.InspectorControls,\n BlockControls = _ref.BlockControls,\n RichText = _ref.RichText,\n BlockAlignmentToolbar = _ref.BlockAlignmentToolbar;\n\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(_ref2) {\n\t\tvar attributes = _ref2.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(_ref3) {\n\t\t\t\t\t\t\tvar _ref4 = _slicedToArray(_ref3, 1),\n\t\t\t\t\t\t\t image = _ref4[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 (_ref5) {\n\t\t\t\tvar name = _ref5.name,\n\t\t\t\t slug = _ref5.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\tif (isExternalImage(image.id, image.src)) {\n\t\t\t\timage.url = image.src;\n\t\t\t\tthis.onSelectImage(image);\n\t\t\t} else {\n\t\t\t\tvar request = wp.apiFetch({\n\t\t\t\t\tpath: wp.url.addQueryArgs('/wp/v2/media/' + image.id, {\n\t\t\t\t\t\tcontext: 'edit',\n\t\t\t\t\t\t_locale: 'user'\n\t\t\t\t\t})\n\t\t\t\t});\n\n\t\t\t\trequest.then(function (media) {\n\t\t\t\t\tmedia.url = media.source_url;\n\t\t\t\t\t_this4.onSelectImage(media);\n\t\t\t\t});\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\t{ label: __('ThirstyAffiliates Image Settings') },\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;\n\nvar _ref = wp.blockEditor ? wp.blockEditor : wp.editor,\n RichTextToolbarButton = _ref.RichTextToolbarButton,\n RichTextShortcut = _ref.RichTextShortcut;\n\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\";\nvar lastAnchorRect = null;\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\t// Fix for the link UI jumping around the screen on WP 5.6\n\t\t\t\tif (selection.anchorNode.nodeType !== window.Node.TEXT_NODE) {\n\t\t\t\t\treturn lastAnchorRect;\n\t\t\t\t}\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\tlastAnchorRect = rect;\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%]+$', 'i');\nvar RE_POS = /^(top|right|bottom|left)$/;\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 27b23956e00af8e89c28","/*!\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 { getPhrasingContentSchema } = wp.dom.getPhrasingContentSchema ? wp.dom : wp.blocks;\nconst { RichText } = wp.blockEditor ? wp.blockEditor : 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+$/ ],\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\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 } = wp.components;\nconst { withSelect } = wp.data;\nconst { mediaUpload } = wp.editor;\nconst { InspectorControls , BlockControls , RichText , BlockAlignmentToolbar } = wp.blockEditor ? wp.blockEditor : 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\tif ( isExternalImage( image.id, image.src ) ) {\n\t\t\timage.url = image.src;\n\t\t\tthis.onSelectImage( image );\n\t\t} else {\n\t\t\tconst 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( (media) => {\n\t\t\t\tmedia.url = media.source_url;\n\t\t\t\tthis.onSelectImage( media );\n\t\t\t} );\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 label={ __( 'ThirstyAffiliates Image Settings' ) }>\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>\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\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\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\n\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\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\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.blockEditor ? wp.blockEditor : wp.editor;\nconst { Path , SVG } = wp.components;\nconst { getRectangleFromRange } = wp.dom;\n\nconst name = \"ta/link\";\nlet lastAnchorRect = null;\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\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\t// Fix for the link UI jumping around the screen on WP 5.6\n\t\t\tif(selection.anchorNode.nodeType !== window.Node.TEXT_NODE) {\n\t\t\t return lastAnchorRect;\n }\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\n\t\t\t}\n\n lastAnchorRect = rect;\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 anchorRect={ 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\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 anchorRect={ 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\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\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%]+$', 'i');\nvar RE_POS = /^(top|right|bottom|left)$/;\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":""}
1
+ {"version":3,"sources":["webpack:///gutenberg-support.js","webpack:///webpack/bootstrap f55f8d9b8eae6571a043","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","_ref","dom","getPhrasingContentSchema","_ref2","blockEditor","editor","RichText","_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","_ref3","_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","PanelBody","ResizableBox","SelectControl","Spinner","TextControl","TextareaControl","Toolbar","withNotices","withSelect","data","mediaUpload","InspectorControls","BlockControls","BlockAlignmentToolbar","withViewportMatch","viewport","compose","ALLOWED_MEDIA_TYPES","pickRelevantMediaFiles","imageProps","isTemporaryImage","isExternalImage","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","_ref4","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","_ref5","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","createBlock","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","Popover","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","LinkEdit","addLink","stopAddingLink","onRemoveFormat","addingLink","text","speak","isActive","activeAttributes","contentRef","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","showInput","onClose","updateLinkId","trimmedHref","trim","test","protocol","getProtocol","isValidProtocol","startsWith","authority","getAuthority","isValidAuthority","isValidPath","queryString","getQueryString","isValidQueryString","fragment","getFragment","isValidFragment","ThirstyURLPopover","renderSettings","_ref$position","_ref$focusOnMount","popoverProps","_useState","useState","_useState2","isSettingsExpanded","setIsSettingsExpanded","showSettings","anchorProps","useAnchor","anchor","editableContentElement","anchorRect","selection","getSelection","range","rangeCount","getRangeAt","anchorNode","nodeType","Node","TEXT_NODE","lastAnchorRect","rect","getRectangleFromRange","startContainer","nextElementSibling","ELEMENT_NODE","parentNode","closest","getBoundingClientRect","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,EAAAP,EAGAF,EAAAU,EAAA,SAAAP,EAAAQ,EAAAC,GACAZ,EAAAa,EAAAV,EAAAQ,IACAG,OAAAC,eAAA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gF,EAAA/E,eAAA+E,CACA,OAAAhF,GAAAe,aAAAf,EAAAgB,cAEAvC,OAAA,SAAAoC,EAAA3kB,GACA,YAAAA,EAGA,MAAA0kB,GAAAC,EAFAsD,GAAAtD,EAAA3kB,IAMAqiB,WACAwD,OACApC,MACAsF,MAAA,SAAAhoB,GACA,GAAAujB,KACA,QAAA/mB,KAAAwD,GACAA,EAAArC,eAAAnB,KACA+mB,EAAA/mB,GAAAwD,EAAAxD,GAIA,IADAwD,EAAAioB,SAEA,OAAAzrB,KAAAwD,GACAA,EAAArC,eAAAnB,KACA+mB,EAAA0E,SAAAzrB,GAAAwD,EAAAioB,SAAAzrB,GAIA,OAAA+mB,IAEAhB,WAAA,SAAAe,EAAA0D,GACA,GAAA1F,EAAAgC,GAAA,CACA,OAAAvkB,KAAAioB,EACA,MAAAvD,GAAAH,EAEAvP,QAAAmU,SAAAlB,EAAAtD,EAAAJ,QACK,CACL,OAAAvkB,KAAAioB,EACA,MAAA1D,GAAAf,UAEAe,GAAAf,WAAAyE,IAGAxE,UAAA,SAAAc,EAAA0D,GACA,GAAA1F,EAAAgC,GAAA,CACA,OAAAvkB,KAAAioB,EACA,MAAAtD,GAAAJ,EAEAvP,QAAAmU,SAAAzE,EAAAH,GAAA0D,OACK,CACL,OAAAjoB,KAAAioB,EACA,MAAA1D,GAAAd,SAEAc,GAAAd,UAAAwE,IAIAnB,cAAA,EACAC,eAAA,GACCF,IlBykGK,SAAUrpB,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.__;\n\nvar _ref = wp.dom.getPhrasingContentSchema ? wp.dom : wp.blocks,\n getPhrasingContentSchema = _ref.getPhrasingContentSchema;\n\nvar _ref2 = wp.blockEditor ? wp.blockEditor : wp.editor,\n RichText = _ref2.RichText;\n\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+$/]\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(_ref3) {\n\t\tvar _classnames;\n\n\t\tvar attributes = _ref3.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 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;\nvar withSelect = wp.data.withSelect;\nvar mediaUpload = wp.editor.mediaUpload;\n\nvar _ref = wp.blockEditor ? wp.blockEditor : wp.editor,\n InspectorControls = _ref.InspectorControls,\n BlockControls = _ref.BlockControls,\n RichText = _ref.RichText,\n BlockAlignmentToolbar = _ref.BlockAlignmentToolbar;\n\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(_ref2) {\n\t\tvar attributes = _ref2.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(_ref3) {\n\t\t\t\t\t\t\tvar _ref4 = _slicedToArray(_ref3, 1),\n\t\t\t\t\t\t\t image = _ref4[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 (_ref5) {\n\t\t\t\tvar name = _ref5.name,\n\t\t\t\t slug = _ref5.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\tif (isExternalImage(image.id, image.src)) {\n\t\t\t\timage.url = image.src;\n\t\t\t\tthis.onSelectImage(image);\n\t\t\t} else {\n\t\t\t\tvar request = wp.apiFetch({\n\t\t\t\t\tpath: wp.url.addQueryArgs('/wp/v2/media/' + image.id, {\n\t\t\t\t\t\tcontext: 'edit',\n\t\t\t\t\t\t_locale: 'user'\n\t\t\t\t\t})\n\t\t\t\t});\n\n\t\t\t\trequest.then(function (media) {\n\t\t\t\t\tmedia.url = media.source_url;\n\t\t\t\t\t_this4.onSelectImage(media);\n\t\t\t\t});\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\t{ label: __('ThirstyAffiliates Image Settings') },\n\t\t\t\twp.element.createElement(Button, {\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;\n\nvar _ref = wp.blockEditor ? wp.blockEditor : wp.editor,\n RichTextToolbarButton = _ref.RichTextToolbarButton,\n RichTextShortcut = _ref.RichTextShortcut;\n\nvar _wp$components = wp.components,\n Path = _wp$components.Path,\n SVG = _wp$components.SVG;\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 * 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\t\t\t\t contentRef = _props3.contentRef;\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\tcontentRef: contentRef\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 Button = _wp$components.Button,\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\tautoFocus: false,\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(Button, { 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(Button, { 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 url = _props2.activeAttributes.url,\n\t\t\t addingLink = _props2.addingLink,\n\t\t\t value = _props2.value,\n\t\t\t contentRef = _props2.contentRef;\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\taddingLink: addingLink,\n\t\t\t\t\tinvalidLink: invalidLink,\n\t\t\t\t\tvalue: value,\n\t\t\t\t\tcontentRef: contentRef\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 _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\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\nvar __ = wp.i18n.__;\nvar useState = wp.element.useState;\nvar _wp$components = wp.components,\n Popover = _wp$components.Popover,\n Button = _wp$components.Button;\nvar useAnchor = wp.richText.useAnchor;\nvar getRectangleFromRange = wp.dom.getRectangleFromRange;\n\nvar lastAnchorRect = null;\n\n/**\n * Custom URL Popover component.\n *\n * @since 3.6\n */\nfunction ThirstyURLPopover(_ref) {\n var children = _ref.children,\n renderSettings = _ref.renderSettings,\n addingLink = _ref.addingLink,\n invalidLink = _ref.invalidLink,\n _ref$position = _ref.position,\n position = _ref$position === undefined ? 'bottom center' : _ref$position,\n _ref$focusOnMount = _ref.focusOnMount,\n focusOnMount = _ref$focusOnMount === undefined ? 'firstElement' : _ref$focusOnMount,\n value = _ref.value,\n contentRef = _ref.contentRef,\n popoverProps = _objectWithoutProperties(_ref, ['children', 'renderSettings', 'addingLink', 'invalidLink', 'position', 'focusOnMount', 'value', 'contentRef']);\n\n /**\n * Get selected anchor text.\n *\n * Helper method for WP <6.1.\n *\n * @since 3.9\n */\n function getAnchorRect() {\n var selection = window.getSelection();\n var range = selection.rangeCount > 0 ? selection.getRangeAt(0) : null;\n\n if (!range) {\n return;\n }\n\n // Fix for the link UI jumping around the screen on WP 5.6\n if (selection.anchorNode.nodeType !== window.Node.TEXT_NODE) {\n return lastAnchorRect;\n }\n\n var rect = null;\n\n if (addingLink) {\n rect = getRectangleFromRange(range);\n } else {\n\n var element = range.startContainer;\n\n // If the caret is right before the element, select the next element.\n element = element.nextElementSibling || element;\n\n while (element.nodeType !== window.Node.ELEMENT_NODE) {\n element = element.parentNode;\n }\n\n var closest = element.closest('ta');\n if (closest) {\n rect = closest.getBoundingClientRect();\n }\n }\n\n lastAnchorRect = rect;\n\n return rect;\n }\n\n var _useState = useState(false),\n _useState2 = _slicedToArray(_useState, 2),\n isSettingsExpanded = _useState2[0],\n setIsSettingsExpanded = _useState2[1];\n\n var showSettings = !!renderSettings && isSettingsExpanded();\n var anchorProps = void 0;\n\n if (useAnchor) {\n // Prefer useAnchor over useAnchorRef, this is WP 6.1+ only\n anchorProps = {\n anchor: useAnchor({\n editableContentElement: contentRef.current,\n value: value,\n settings: {\n tagName: 'ta'\n }\n })\n };\n } else {\n anchorProps = {\n anchorRect: getAnchorRect()\n };\n }\n\n return wp.element.createElement(\n Popover,\n _extends({\n className: 'ta-url-popover editor-url-popover block-editor-url-popover',\n focusOnMount: focusOnMount,\n position: position\n }, anchorProps, popoverProps),\n wp.element.createElement(\n 'div',\n { className: 'editor-url-popover__row' },\n children,\n !!renderSettings && wp.element.createElement(Button, {\n className: 'editor-url-popover__settings-toggle',\n icon: 'ellipsis',\n label: __('Link Settings'),\n onClick: function onClick() {\n setIsSettingsExpanded(!isSettingsExpanded());\n },\n 'aria-expanded': isSettingsExpanded()\n })\n ),\n showSettings && wp.element.createElement(\n 'div',\n { className: 'editor-url-popover__row editor-url-popover__settings' },\n renderSettings()\n ),\n invalidLink && wp.element.createElement(\n 'div',\n { className: 'ta-invalid-link' },\n __('Invalid affiliate link')\n )\n );\n}\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%]+$', 'i');\nvar RE_POS = /^(top|right|bottom|left)$/;\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 f55f8d9b8eae6571a043","/*!\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 { getPhrasingContentSchema } = wp.dom.getPhrasingContentSchema ? wp.dom : wp.blocks;\nconst { RichText } = wp.blockEditor ? wp.blockEditor : 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+$/ ],\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\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 , PanelBody , ResizableBox , SelectControl , Spinner , TextControl , TextareaControl , Toolbar , withNotices } = wp.components;\nconst { withSelect } = wp.data;\nconst { mediaUpload } = wp.editor;\nconst { InspectorControls , BlockControls , RichText , BlockAlignmentToolbar } = wp.blockEditor ? wp.blockEditor : 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\tif ( isExternalImage( image.id, image.src ) ) {\n\t\t\timage.url = image.src;\n\t\t\tthis.onSelectImage( image );\n\t\t} else {\n\t\t\tconst 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( (media) => {\n\t\t\t\tmedia.url = media.source_url;\n\t\t\t\tthis.onSelectImage( media );\n\t\t\t} );\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 label={ __( 'ThirstyAffiliates Image Settings' ) }>\n\t\t\t\t<Button\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>\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\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\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\n\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\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\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.blockEditor ? wp.blockEditor : wp.editor;\nconst { Path , SVG } = wp.components;\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\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 * 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 , contentRef } = this.props;\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\tvalue={ value }\n onChange={ onChange }\n contentRef={ contentRef }\n />\n\t\t\t\t</Fragment>\n\t\t\t);\n\t\t}\n } )\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 , Button , 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 autoFocus={ false }\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<Button 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<Button 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 }, addingLink, value, contentRef } = 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 addingLink={ addingLink }\n invalidLink={ invalidLink }\n value={ value }\n contentRef={ contentRef }\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\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 { useState } = wp.element;\nconst { Popover , Button } = wp.components;\nconst { useAnchor } = wp.richText;\nconst { getRectangleFromRange } = wp.dom;\nlet lastAnchorRect = null;\n\n/**\n * Custom URL Popover component.\n *\n * @since 3.6\n */\nfunction ThirstyURLPopover ( {\n children,\n renderSettings,\n addingLink,\n invalidLink,\n position = 'bottom center',\n focusOnMount = 'firstElement',\n value,\n contentRef,\n ...popoverProps\n} ) {\n /**\n * Get selected anchor text.\n *\n * Helper method for WP <6.1.\n *\n * @since 3.9\n */\n function getAnchorRect() {\n const selection = window.getSelection();\n const range = selection.rangeCount > 0 ? selection.getRangeAt( 0 ) : null;\n\n if ( ! range ) {\n return;\n }\n\n // Fix for the link UI jumping around the screen on WP 5.6\n if(selection.anchorNode.nodeType !== window.Node.TEXT_NODE) {\n return lastAnchorRect;\n }\n\n let rect = null;\n\n if ( addingLink ) {\n rect = getRectangleFromRange( range );\n } else {\n\n let element = range.startContainer;\n\n // If the caret is right before the element, select the next element.\n element = element.nextElementSibling || element;\n\n while ( element.nodeType !== window.Node.ELEMENT_NODE ) {\n element = element.parentNode;\n }\n\n const closest = element.closest( 'ta' );\n if ( closest ) {\n rect = closest.getBoundingClientRect();\n }\n\n }\n\n lastAnchorRect = rect;\n\n return rect;\n }\n\n const [ isSettingsExpanded, setIsSettingsExpanded ] = useState( false );\n const showSettings = !! renderSettings && isSettingsExpanded();\n let anchorProps;\n\n if ( useAnchor ) {\n // Prefer useAnchor over useAnchorRef, this is WP 6.1+ only\n anchorProps = {\n anchor: useAnchor( {\n editableContentElement: contentRef.current,\n value,\n settings: {\n tagName: 'ta'\n },\n } )\n };\n } else {\n anchorProps = {\n anchorRect: getAnchorRect(),\n };\n }\n\n return (\n <Popover\n className=\"ta-url-popover editor-url-popover block-editor-url-popover\"\n focusOnMount={ focusOnMount }\n position={ position }\n { ...anchorProps }\n { ...popoverProps }\n >\n <div className=\"editor-url-popover__row\">\n { children }\n { !! renderSettings && (\n <Button\n className=\"editor-url-popover__settings-toggle\"\n icon=\"ellipsis\"\n label={ __( 'Link Settings' ) }\n onClick={ () => { setIsSettingsExpanded( !isSettingsExpanded() ) } }\n aria-expanded={ isSettingsExpanded() }\n />\n ) }\n </div>\n { showSettings && (\n <div className=\"editor-url-popover__row editor-url-popover__settings\">\n { renderSettings() }\n </div>\n ) }\n { invalidLink && <div className=\"ta-invalid-link\">{ __( 'Invalid affiliate link' ) }</div> }\n </Popover>\n );\n}\n\nexport default ThirstyURLPopover;\n\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\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%]+$', 'i');\nvar RE_POS = /^(top|right|bottom|left)$/;\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/edit.js CHANGED
@@ -5,7 +5,7 @@ const { getPath } = wp.url;
5
  const { __, sprintf } = wp.i18n;
6
  const { Component, Fragment , createRef } = wp.element;
7
  const { getBlobByURL, revokeBlobURL, isBlobURL } = wp.blob;
8
- const { Placeholder , Button , ButtonGroup , IconButton , PanelBody , ResizableBox , SelectControl , Spinner , TextControl , TextareaControl , Toolbar , withNotices } = wp.components;
9
  const { withSelect } = wp.data;
10
  const { mediaUpload } = wp.editor;
11
  const { InspectorControls , BlockControls , RichText , BlockAlignmentToolbar } = wp.blockEditor ? wp.blockEditor : wp.editor;
@@ -323,7 +323,7 @@ class ImageEdit extends Component {
323
  } = attributes;
324
  const toolbarEditButton = (
325
  <Toolbar label={ __( 'ThirstyAffiliates Image Settings' ) }>
326
- <IconButton
327
  className="ta-edit-image-button components-icon-button components-toolbar__control"
328
  label={ __( 'Edit ThirstyAffiliates Image' ) }
329
  icon="edit"
5
  const { __, sprintf } = wp.i18n;
6
  const { Component, Fragment , createRef } = wp.element;
7
  const { getBlobByURL, revokeBlobURL, isBlobURL } = wp.blob;
8
+ const { Placeholder , Button , ButtonGroup , PanelBody , ResizableBox , SelectControl , Spinner , TextControl , TextareaControl , Toolbar , withNotices } = wp.components;
9
  const { withSelect } = wp.data;
10
  const { mediaUpload } = wp.editor;
11
  const { InspectorControls , BlockControls , RichText , BlockAlignmentToolbar } = wp.blockEditor ? wp.blockEditor : wp.editor;
323
  } = attributes;
324
  const toolbarEditButton = (
325
  <Toolbar label={ __( 'ThirstyAffiliates Image Settings' ) }>
326
+ <Button
327
  className="ta-edit-image-button components-icon-button components-toolbar__control"
328
  label={ __( 'Edit ThirstyAffiliates Image' ) }
329
  icon="edit"
js/app/gutenberg_support/src/formats/ta-link/index.js CHANGED
@@ -7,10 +7,8 @@ const { getTextContent , applyFormat , removeFormat , slice } = wp.richText;
7
  const { isURL } = wp.url;
8
  const { RichTextToolbarButton , RichTextShortcut } = wp.blockEditor ? wp.blockEditor : wp.editor;
9
  const { Path , SVG } = wp.components;
10
- const { getRectangleFromRange } = wp.dom;
11
 
12
  const name = "ta/link";
13
- let lastAnchorRect = null;
14
 
15
  /**
16
  * Custom Affiliate link format. When applied will wrap selected text with <ta href="" linkid=""></ta> custom element.
@@ -84,59 +82,13 @@ export const taLink = {
84
  speak( __( "Affiliate Link removed." ), "assertive" );
85
  }
86
 
87
- /**
88
- * Get selected anchor text.
89
- *
90
- * @since 3.9
91
- */
92
- getAnchorRect() {
93
-
94
- const selection = window.getSelection();
95
- const range = selection.rangeCount > 0 ? selection.getRangeAt( 0 ) : null;
96
-
97
- if ( ! range ) return;
98
-
99
- // Fix for the link UI jumping around the screen on WP 5.6
100
- if(selection.anchorNode.nodeType !== window.Node.TEXT_NODE) {
101
- return lastAnchorRect;
102
- }
103
-
104
- let rect = null;
105
-
106
- if ( this.state.addingLink ) {
107
- rect = getRectangleFromRange( range );
108
- } else {
109
-
110
- let element = range.startContainer;
111
-
112
- // If the caret is right before the element, select the next element.
113
- element = element.nextElementSibling || element;
114
-
115
- while ( element.nodeType !== window.Node.ELEMENT_NODE ) {
116
- element = element.parentNode;
117
- }
118
-
119
- const closest = element.closest( 'ta' );
120
- if ( closest ) {
121
- rect = closest.getBoundingClientRect();
122
- }
123
-
124
- }
125
-
126
- lastAnchorRect = rect;
127
-
128
- return rect;
129
- }
130
-
131
  /**
132
  * Component render method.
133
  *
134
  * @since 3.6
135
  */
136
  render() {
137
- const { isActive , activeAttributes , value , onChange } = this.props;
138
-
139
- const anchorRect = this.getAnchorRect();
140
 
141
  return (
142
  <Fragment>
@@ -177,10 +129,10 @@ export const taLink = {
177
  stopAddingLink={ this.stopAddingLink }
178
  isActive={ isActive }
179
  activeAttributes={ activeAttributes }
180
- anchorRect={ anchorRect }
181
  value={ value }
182
- onChange={ onChange }
183
- />
 
184
  </Fragment>
185
  );
186
  }
7
  const { isURL } = wp.url;
8
  const { RichTextToolbarButton , RichTextShortcut } = wp.blockEditor ? wp.blockEditor : wp.editor;
9
  const { Path , SVG } = wp.components;
 
10
 
11
  const name = "ta/link";
 
12
 
13
  /**
14
  * Custom Affiliate link format. When applied will wrap selected text with <ta href="" linkid=""></ta> custom element.
82
  speak( __( "Affiliate Link removed." ), "assertive" );
83
  }
84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  /**
86
  * Component render method.
87
  *
88
  * @since 3.6
89
  */
90
  render() {
91
+ const { isActive , activeAttributes , value , onChange , contentRef } = this.props;
 
 
92
 
93
  return (
94
  <Fragment>
129
  stopAddingLink={ this.stopAddingLink }
130
  isActive={ isActive }
131
  activeAttributes={ activeAttributes }
 
132
  value={ value }
133
+ onChange={ onChange }
134
+ contentRef={ contentRef }
135
+ />
136
  </Fragment>
137
  );
138
  }
js/app/gutenberg_support/src/formats/ta-link/inline.js CHANGED
@@ -5,7 +5,7 @@ import ThirstyURLInput from './url-input';
5
 
6
  const { __ } = wp.i18n;
7
  const { Component , createRef } = wp.element;
8
- const { ExternalLink , ToggleControl , IconButton , withSpokenMessages } = wp.components;
9
  const { LEFT, RIGHT, UP, DOWN, BACKSPACE, ENTER } = wp.keycodes;
10
  const { prependHTTP , safeDecodeURI , filterURLForDisplay } = wp.url;
11
  const { create , insert , isCollapsed , applyFormat , getTextContent , slice } = wp.richText;
@@ -65,12 +65,13 @@ const LinkEditor = ( { value , onChangeInputValue , onKeyDown , submitLink, inva
65
  >
66
  <ThirstyURLInput
67
  value={ value }
 
68
  onChange={ onChangeInputValue }
69
  autocompleteRef={ autocompleteRef }
70
  invalidLink={ invalidLink }
71
  resetInvalidLink={ resetInvalidLink }
72
  />
73
- <IconButton icon="editor-break" label={ __( 'Apply' ) } type="submit" />
74
  </form>
75
  /* eslint-enable jsx-a11y/no-noninteractive-element-interactions */
76
  );
@@ -114,7 +115,7 @@ const LinkViewer = ( { url, editLink } ) => {
114
  onKeyPress={ stopKeyPropagation }
115
  >
116
  <LinkViewerUrl url={ url } />
117
- <IconButton icon="edit" label={ __( 'Edit' ) } onClick={ editLink } />
118
  </div>
119
  /* eslint-enable jsx-a11y/no-static-element-interactions */
120
  );
@@ -275,7 +276,7 @@ class InlineAffiliateLinkUI extends Component {
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;
@@ -289,8 +290,10 @@ class InlineAffiliateLinkUI extends Component {
289
  onClickOutside={ this.onClickOutside }
290
  onClose={ this.resetState }
291
  focusOnMount={ showInput ? 'firstElement' : false }
292
- invalidLink={ invalidLink }
293
- anchorRect={ anchorRect }
 
 
294
  >
295
  { showInput ? (
296
  <LinkEditor
5
 
6
  const { __ } = wp.i18n;
7
  const { Component , createRef } = wp.element;
8
+ const { ExternalLink , Button , withSpokenMessages } = wp.components;
9
  const { LEFT, RIGHT, UP, DOWN, BACKSPACE, ENTER } = wp.keycodes;
10
  const { prependHTTP , safeDecodeURI , filterURLForDisplay } = wp.url;
11
  const { create , insert , isCollapsed , applyFormat , getTextContent , slice } = wp.richText;
65
  >
66
  <ThirstyURLInput
67
  value={ value }
68
+ autoFocus={ false }
69
  onChange={ onChangeInputValue }
70
  autocompleteRef={ autocompleteRef }
71
  invalidLink={ invalidLink }
72
  resetInvalidLink={ resetInvalidLink }
73
  />
74
+ <Button icon="editor-break" label={ __( 'Apply' ) } type="submit" />
75
  </form>
76
  /* eslint-enable jsx-a11y/no-noninteractive-element-interactions */
77
  );
115
  onKeyPress={ stopKeyPropagation }
116
  >
117
  <LinkViewerUrl url={ url } />
118
+ <Button icon="edit" label={ __( 'Edit' ) } onClick={ editLink } />
119
  </div>
120
  /* eslint-enable jsx-a11y/no-static-element-interactions */
121
  );
276
  * @since 3.6
277
  */
278
  render() {
279
+ const { isActive, activeAttributes: { url }, addingLink, value, contentRef } = this.props;
280
 
281
  if ( ! isActive && ! addingLink ) {
282
  return null;
290
  onClickOutside={ this.onClickOutside }
291
  onClose={ this.resetState }
292
  focusOnMount={ showInput ? 'firstElement' : false }
293
+ addingLink={ addingLink }
294
+ invalidLink={ invalidLink }
295
+ value={ value }
296
+ contentRef={ contentRef }
297
  >
298
  { showInput ? (
299
  <LinkEditor
js/app/gutenberg_support/src/formats/ta-link/url-popover.js CHANGED
@@ -1,89 +1,122 @@
1
  const { __ } = wp.i18n;
2
- const { Component } = wp.element;
3
- const { Popover , IconButton } = wp.components;
 
 
 
4
 
5
  /**
6
  * Custom URL Popover component.
7
- *
8
  * @since 3.6
9
  */
10
- class ThirstyURLPopover extends Component {
11
-
 
 
 
 
 
 
 
 
 
12
  /**
13
- * Component constructor method.
14
- *
15
- * @since 3.6
 
 
16
  */
17
- constructor() {
18
- super( ...arguments );
19
-
20
- this.toggleSettingsVisibility = this.toggleSettingsVisibility.bind( this );
21
-
22
- this.state = {
23
- isSettingsExpanded: false,
24
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  }
26
-
27
- /**
28
- * Component constructor.
29
- *
30
- * @since 3.6
31
- */
32
- toggleSettingsVisibility() {
33
- this.setState( {
34
- isSettingsExpanded: ! this.state.isSettingsExpanded,
35
- } );
36
- }
37
 
38
- /**
39
- * Component render method.
40
- *
41
- * @since 3.6
42
- */
43
- render() {
44
- const {
45
- children,
46
- renderSettings,
47
- invalidLink,
48
- position = 'bottom center',
49
- focusOnMount = 'firstElement',
50
- ...popoverProps
51
- } = this.props;
52
-
53
- const {
54
- isSettingsExpanded,
55
- } = this.state;
56
-
57
- const showSettings = !! renderSettings && isSettingsExpanded;
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 }
68
- { !! renderSettings && (
69
- <IconButton
70
- className="editor-url-popover__settings-toggle"
71
- icon="ellipsis"
72
- label={ __( 'Link Settings' ) }
73
- onClick={ this.toggleSettingsVisibility }
74
- aria-expanded={ isSettingsExpanded }
75
- />
76
- ) }
77
- </div>
78
- { showSettings && (
79
- <div className="editor-url-popover__row editor-url-popover__settings">
80
- { renderSettings() }
81
- </div>
82
  ) }
83
- { invalidLink && <div class="ta-invalid-link">{ __( 'Invalid affiliate link' ) }</div> }
84
- </Popover>
85
- );
86
- }
 
 
 
 
 
87
  }
88
 
89
- export default ThirstyURLPopover;
1
  const { __ } = wp.i18n;
2
+ const { useState } = wp.element;
3
+ const { Popover , Button } = wp.components;
4
+ const { useAnchor } = wp.richText;
5
+ const { getRectangleFromRange } = wp.dom;
6
+ let lastAnchorRect = null;
7
 
8
  /**
9
  * Custom URL Popover component.
10
+ *
11
  * @since 3.6
12
  */
13
+ function ThirstyURLPopover ( {
14
+ children,
15
+ renderSettings,
16
+ addingLink,
17
+ invalidLink,
18
+ position = 'bottom center',
19
+ focusOnMount = 'firstElement',
20
+ value,
21
+ contentRef,
22
+ ...popoverProps
23
+ } ) {
24
  /**
25
+ * Get selected anchor text.
26
+ *
27
+ * Helper method for WP <6.1.
28
+ *
29
+ * @since 3.9
30
  */
31
+ function getAnchorRect() {
32
+ const selection = window.getSelection();
33
+ const range = selection.rangeCount > 0 ? selection.getRangeAt( 0 ) : null;
34
+
35
+ if ( ! range ) {
36
+ return;
37
+ }
38
+
39
+ // Fix for the link UI jumping around the screen on WP 5.6
40
+ if(selection.anchorNode.nodeType !== window.Node.TEXT_NODE) {
41
+ return lastAnchorRect;
42
+ }
43
+
44
+ let rect = null;
45
+
46
+ if ( addingLink ) {
47
+ rect = getRectangleFromRange( range );
48
+ } else {
49
+
50
+ let element = range.startContainer;
51
+
52
+ // If the caret is right before the element, select the next element.
53
+ element = element.nextElementSibling || element;
54
+
55
+ while ( element.nodeType !== window.Node.ELEMENT_NODE ) {
56
+ element = element.parentNode;
57
+ }
58
+
59
+ const closest = element.closest( 'ta' );
60
+ if ( closest ) {
61
+ rect = closest.getBoundingClientRect();
62
+ }
63
+
64
+ }
65
+
66
+ lastAnchorRect = rect;
67
+
68
+ return rect;
69
  }
 
 
 
 
 
 
 
 
 
 
 
70
 
71
+ const [ isSettingsExpanded, setIsSettingsExpanded ] = useState( false );
72
+ const showSettings = !! renderSettings && isSettingsExpanded();
73
+ let anchorProps;
74
+
75
+ if ( useAnchor ) {
76
+ // Prefer useAnchor over useAnchorRef, this is WP 6.1+ only
77
+ anchorProps = {
78
+ anchor: useAnchor( {
79
+ editableContentElement: contentRef.current,
80
+ value,
81
+ settings: {
82
+ tagName: 'ta'
83
+ },
84
+ } )
85
+ };
86
+ } else {
87
+ anchorProps = {
88
+ anchorRect: getAnchorRect(),
89
+ };
90
+ }
91
+
92
+ return (
93
+ <Popover
94
+ className="ta-url-popover editor-url-popover block-editor-url-popover"
95
+ focusOnMount={ focusOnMount }
96
+ position={ position }
97
+ { ...anchorProps }
98
+ { ...popoverProps }
99
+ >
100
+ <div className="editor-url-popover__row">
101
+ { children }
102
+ { !! renderSettings && (
103
+ <Button
104
+ className="editor-url-popover__settings-toggle"
105
+ icon="ellipsis"
106
+ label={ __( 'Link Settings' ) }
107
+ onClick={ () => { setIsSettingsExpanded( !isSettingsExpanded() ) } }
108
+ aria-expanded={ isSettingsExpanded() }
109
+ />
 
 
 
 
 
110
  ) }
111
+ </div>
112
+ { showSettings && (
113
+ <div className="editor-url-popover__row editor-url-popover__settings">
114
+ { renderSettings() }
115
+ </div>
116
+ ) }
117
+ { invalidLink && <div className="ta-invalid-link">{ __( 'Invalid affiliate link' ) }</div> }
118
+ </Popover>
119
+ );
120
  }
121
 
122
+ export default ThirstyURLPopover;
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: affiliate links, link branding, link shortner, link tracking, redirects, a
5
  Requires at least: 5.0
6
  Requires PHP: 5.6
7
  Tested up to: 6.1
8
- Stable tag: 3.10.12
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -159,6 +159,10 @@ See our [Knowledge Base](https://thirstyaffiliates.com/knowledge-base/?utm_sourc
159
 
160
  == Changelog ==
161
 
 
 
 
 
162
  = 3.10.12 =
163
  * Bug Fix: PHP warning
164
 
5
  Requires at least: 5.0
6
  Requires PHP: 5.6
7
  Tested up to: 6.1
8
+ Stable tag: 3.10.13
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
159
 
160
  == Changelog ==
161
 
162
+ = 3.10.13 =
163
+ * Bug Fix: TA Link Inserter jumping to bottom of page on WP 6.1
164
+ * Bug Fix: Warning message being HTML escaped
165
+
166
  = 3.10.12 =
167
  * Bug Fix: PHP warning
168
 
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.10.12
7
  * Author: Caseproof
8
  * Author URI: https://caseproof.com/
9
  * Requires at least: 5.0
10
- * Tested up to: 6.0
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.10.13
7
  * Author: Caseproof
8
  * Author URI: https://caseproof.com/
9
  * Requires at least: 5.0
10
+ * Tested up to: 6.1
11
  *
12
  * Text Domain: thirstyaffiliates
13
  * Domain Path: /languages/
views/cpt/view-urls-metabox.php CHANGED
@@ -21,7 +21,7 @@ wp_nonce_field( 'thirsty_affiliates_cpt_nonce', '_thirstyaffiliates_nonce' ); ?>
21
  </span>
22
  <span class="slug-fields" style="display: none;">
23
  <input type="text" class="ta-form-input" id="ta_slug" name="post_name" pattern="[a-z0-9-_% ]+" value="<?php echo esc_attr( $thirstylink->get_prop( 'slug' ) ); ?>">
24
- <span class="edit-slug-warning"><?php esc_html_e( '<strong>Warning:</strong> Editing the slug will break already inserted links for this affiliate link.' , 'thirstyaffiliates' ); ?></span>
25
  <button type="button" class="save-ta-slug button"><?php esc_html_e( 'Save' , 'thirstyaffiliates' ); ?></button>
26
  </span>
27
  </p>
21
  </span>
22
  <span class="slug-fields" style="display: none;">
23
  <input type="text" class="ta-form-input" id="ta_slug" name="post_name" pattern="[a-z0-9-_% ]+" value="<?php echo esc_attr( $thirstylink->get_prop( 'slug' ) ); ?>">
24
+ <span class="edit-slug-warning"><?php _e( '<strong>Warning:</strong> Editing the slug will break already inserted links for this affiliate link.' , 'thirstyaffiliates' ); ?></span>
25
  <button type="button" class="save-ta-slug button"><?php esc_html_e( 'Save' , 'thirstyaffiliates' ); ?></button>
26
  </span>
27
  </p>