-
Notifications
You must be signed in to change notification settings - Fork 3
/
M3JjGId0pcFgMze6h95el--WiiE.br.js.download
1 lines (1 loc) · 32 KB
/
M3JjGId0pcFgMze6h95el--WiiE.br.js.download
1
var __extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),ImageDetailSwipe,__assign,Multimedia;(function(n){var t;(function(t){var r=MmGeometry.Rectangle,f=n.ImageDetailUtils.setCropBoxAnimationProperty,e=n.ImageDetailUtils.isRTL,o=n.ImageDetailUtils.calculateRegionDifference,i=ImageDetailReducers,u="undefined",s=function(u){function s(t){var f=u.call(this,t)||this;return f.px="px",f.startAnimationClassName="start",f.endAnimationClassName="end",f.readyAnimationClassName="ready",f.cropboxHintShown="mm.detail.crophint",f.cropBoxContentAnimationTime=1e3,f.cropBoxHintAnimationTime=3500,f.lastCropCoordinates=null,f.cropBoxAnimationTime=null,f.shouldShowHint=!1,f.isCropping=!1,f.multiTouchMove=!1,f.containerHeight=null,f.containerWidth=null,f.hint=null,f.cropConfig=null,f.hasTouchStartTriggered=!1,f.enableLiveView=null,f.debounceDelay=100,f.cropboxArrowMovementStep=15,f.componentWillUnmount=function(){f.setSessionStorage();f.handleEventsSetting(!1)},f.isSessionStorageEnabled=function(){var n=!1;try{n="object"==typeof _w.sessionStorage}catch(t){}return n},f.setSessionStorage=function(){f.shouldShowHint&&f.isSessionStorageEnabled()&&(sessionStorage.setItem(f.cropboxHintShown,"1"),f.shouldShowHint=!1)},f.getViewRect=function(){if(!f.imageElement)return null;var n=f.imageElement.clientLeft,t=f.imageElement.clientTop,i=Math.min(f.imageElement.clientWidth,f.containerWidth),u=Math.min(f.imageElement.clientHeight,f.containerHeight),e={x:n,y:t},o={x:n+i,y:t+u};return new r(e,o)},f.getCropRect=function(n){if(!f.imageElement)return null;var o=f.imageElement.clientLeft,s=f.imageElement.clientTop,t=Math.min(f.imageElement.clientWidth,f.containerWidth),i=Math.min(f.imageElement.clientHeight,f.containerHeight),u=o+Math.round(t*n.left()),e=s+Math.round(i*n.top()),h=u+Math.round(t*n.width()),c=e+Math.round(i*n.height()),l={x:u,y:e},a={x:h,y:c};return new r(l,a)},f.start=function(n){f.overlayView!=null&&(f.startCropRect=f.overlayView.cropRect().clone(),f.overlayView.setStartPoint(n))},f.move=function(n){f.overlayView!=null&&f.startCropRect!=null&&(f.overlayView.setCurrPoint(n),f.overlayView.setCropRect(f.startCropRect.clone()),f.overlayView.update(),f.updateCropBoxStyle())},f.end=function(){f.throttleCropBoxChange()},f.cropBoxChange=function(){var n=f.getCropCoordinates(),t;n==null||f.isTinyChange(f.lastCropCoordinates,n)||(t={left:n.left(),top:n.top(),right:n.right(),bottom:n.bottom()},f.lastCropCoordinates=n,f.props.changeCropCoordinates(t))},f.setCropBoxState=function(n,t){f.startCropRect=new r(n,t);f.overlayView.setCropRect(f.startCropRect);f.overlayView.setStartPoint(n);f.overlayView.setCurrPoint(n);f.overlayView.update();f.updateCropBoxStyle()},f.updateCropBoxStyle=function(){if(f.overlayView!=null){var n=f.overlayView.cropRect();f.update(n)}},f.getCropCoordinates=function(){var i,t,n,u,e;return f.overlayView!=null&&(t=f.overlayView.cropRect(),n=f.overlayView.viewRect(),n.width()>0&&n.height()>0&&(u={x:t.left()/n.width(),y:t.top()/n.height()},e={x:t.right()/n.width(),y:t.bottom()/n.height()},i=new r(u,e))),i},f.isTinyChange=function(n,t){if(f.overlayView!=null&&f.overlayView.cropRect()!=null&&f.overlayView.cropRect().width()<=f.config.minDelta&&f.overlayView.cropRect().height()<=f.config.minDelta)return!0;if(n&&t){var i=o(n.transformToRegion(),t.transformToRegion());if(i<f.config.minDelta)return!0}return!1},f.throttle=function(n,t){var i,r;return function(){clearTimeout(r);var f=this,e=arguments,u=Number(new Date);i&&u<i+t?r=setTimeout(function(){i=u;n.apply(f,e)},i+t-u):(i=u,n.apply(f,e))}},f.cancelAnimation=function(n){n&&(n.classList.remove(f.startAnimationClassName),n.classList.add(f.endAnimationClassName))},f.startAnimation=function(n){n&&(n.classList.add(f.readyAnimationClassName),f.isAnimationEnabled()&&n.classList.add(f.startAnimationClassName))},f.endAnimation=function(n,t){if(n){var i=f.cancelAnimation;f.isAnimationEnabled()?setTimeout(function(){i(n)},t):f.cancelAnimation(n)}},f.setAnimations=function(){f.startAnimation(f.cropBox);f.startAnimation(f.cropBoxContent);f.startAnimation(f.cropBoxHint);f.endAnimation(f.cropBox,f.cropBoxAnimationTime);f.endAnimation(f.cropBoxContent,f.cropBoxContentAnimationTime);f.endAnimation(f.cropBoxHint,f.cropBoxHintAnimationTime)},f.update=function(n){if(f.cropBox&&n){var i=n.top(),t=n.left(),r=n.height(),u=n.width();e?f.cropBox.style.right=t+f.px:f.cropBox.style.left=t+f.px;f.cropBox.style.top=i+f.px;f.cropBox.style.width=u+f.px;f.cropBox.style.height=r+f.px;f.ImageCropBoxPin&&f.ImageCropBoxPin.setStyle(i,t,r,u)}},f.getOffsetPosition=function(n,t,i){var r=n.getBoundingClientRect(),u=t-r.left,f=i-r.top;return{x:u,y:f}},f.getTouchPosition=function(n,t){return n&&n.touches?f.getOffsetPosition(f.imageElement,n.touches[t].clientX,n.touches[t].clientY):null},f.getMousePosition=function(n){return f.getOffsetPosition(f.imageElement,n.clientX,n.clientY)},f.onTouchStart=function(n){if(f.hasTouchStartTriggered=!0,n&&n.touches)f.start(f.getTouchPosition(n,0));else f.onMouseDown(n);f.enableLiveView&&f.props.changeInsightsScrollPosition()},f.onMouseDown=function(n){if(f.isPositionWithinBoundary(f.imageElement,n.clientX,n.clientY)){f.isCropping=!0;var t=f.getMousePosition(n);f.start(t)}},f.onTouchMove=function(n){if(n&&n.touches)if(f.config.enableMultiTouchRedraw&&n.touches.length>=2){f.multiTouchMove=!0;var t=f.getTouchPosition(n,0),i=f.getTouchPosition(n,1);f.setCropBoxState(t,i);f.stopPropagation(n)}else!f.multiTouchMove&&f.overlayView.isTransforming()&&(f.move(f.getTouchPosition(n,0)),f.stopPropagation(n));else f.onMouseMove(n)},f.onMouseMove=function(t){var i,r,u;f.isCropping&&(i=f.getMousePosition(t),f.overlayView.isTransforming()?f.move(i):f.config.enableMouseRedraw&&(r={x:i.x,y:i.y},u={x:i.x+1,y:i.y+1},f.setCropBoxState(r,u)),f.props.inTextMode&&f.debouncedOCRIntersectionsChangeHandler(n.TextRecognitionUtils.getSelectedArea(f.overlayView.cropRect(),f.overlayView.viewRect())),f.stopPropagation(t))},f.onTouchEnd=function(n){if(n&&n.touches)f.end(),n.touches.length===0&&(f.multiTouchMove=!1),f.stopPropagation(n);else f.onMouseUp(n);f.hasTouchStartTriggered=!1},f.onDocumentTouchEnd=function(n){if(f.hasTouchStartTriggered)f.onTouchEnd(n)},f.onMouseUp=function(){if(f.isCropping=!1,typeof _w!="undefined"){var n=_w.getSelection();n&&n.type=="Range"&&n.removeAllRanges()}f.overlayView.verifyMinimumSize();f.end()},f.isPositionWithinBoundary=function(n,t,i){var r=n.getBoundingClientRect();return t<r.left||t>r.right||i<r.top||i>r.bottom?!1:!0},f.handleEventsSetting=function(n){var t=n?sj_be:sj_ue;"ontouchstart"in sb_de?(t(f.imageElement,"touchstart",f.onTouchStart,!0),t(f.imageElement,"touchmove",f.onTouchMove,!0),t(f.imageElement,"touchend",f.onTouchEnd,!0)):window.navigator.msPointerEnabled?(f.imageElement.style.msTouchAction="none",f.imageElement.style.touchAction="none",t(f.imageElement,"MSPointerDown",f.onTouchStart,!0),t(f.imageElement,"MSPointerMove",f.onTouchMove,!0),t(f.imageElement,"MSPointerUp",f.onTouchEnd,!0),t(_d,"MSPointerUp",f.onDocumentTouchEnd,!0)):"onpointermove"in sb_de&&(f.imageElement.style.msTouchAction="none",f.imageElement.style.touchAction="none",t(f.imageElement,"pointerdown",f.onTouchStart,!0),t(f.imageElement,"pointermove",f.onTouchMove,!0),t(f.imageElement,"pointerup",f.onTouchEnd,!0),t(_d,"pointerup",f.onDocumentTouchEnd,!0));t(f.imageElement,"mousedown",f.onMouseDown,!0);t(f.imageElement,"mousemove",f.onMouseMove,!0);t(f.imageElement,"mouseup",f.onMouseUp,!0)},f.handleKeyPress_leftTop=function(n){var t=f.overlayView.cropRect(),i={x:t.left(),y:t.top()};f.handleKeyPress(n,i)},f.handleKeyPress_rightTop=function(n){var t=f.overlayView.cropRect(),i={x:t.right(),y:t.top()};f.handleKeyPress(n,i)},f.handleKeyPress_leftBottom=function(n){var t=f.overlayView.cropRect(),i={x:t.left(),y:t.bottom()};f.handleKeyPress(n,i)},f.handleKeyPress_rightBottom=function(n){var t=f.overlayView.cropRect(),i={x:t.right(),y:t.bottom()};f.handleKeyPress(n,i)},f.handleKeyPress=function(n,t){var i=Object.assign({},t),r=!1;switch(n.keyCode){case 37:i.x-=f.cropboxArrowMovementStep;r=!0;break;case 39:i.x+=f.cropboxArrowMovementStep;r=!0;break;case 38:i.y-=f.cropboxArrowMovementStep;r=!0;break;case 40:i.y+=f.cropboxArrowMovementStep;r=!0}r&&(f.start(t),f.move(t),f.move(i),f.end(),f.stopPropagation(n))},f.enableLiveView=typeof i.ilv!="undefined"?i.ilv():!1,f.cropConfig=i.getCropConfig(),f.shouldShowHint=!f.cropConfig.eft&&f.isSessionStorageEnabled()&&sessionStorage.getItem(f.cropboxHintShown)!=="1",f.hint=f.cropConfig.hnt,f.debouncedOCRIntersectionsChangeHandler=n.ImageDetailUtils.debounce(f.props.changeIntersectedOCRRegions,f.debounceDelay),f}return __extends(s,u),s.prototype.componentWillMount=function(){this.props&&(this.config=new ImageVisualSearchCropBox.CropBoxClientConfig(this.cropConfig),this.isCropping=this.props.isDirectDrawing,this.cropBoxAnimationTime=this.config.animationDuration,this.containerWidth=this.props.containerWidth,this.containerHeight=this.props.containerHeight)},s.prototype.componentDidMount=function(){var t,i,u,n;this.throttleCropBoxChange=this.throttle(this.cropBoxChange,this.config.eventTimeThreshold);t=this.props.cropCoordinates?this.props.cropCoordinates:this.config;this.isCropping&&this.props.dragEvent?(u=this.getMousePosition(this.props.dragEvent),i=new r({x:u.x,y:u.y},{x:u.x+this.config.minDelta,y:u.y+this.config.minDelta}),this.overlayView=new VisualSearchCropBoxUtils.OverlayView(this.getViewRect(),i,this.config)):(i=new r({x:t.left,y:t.top},{x:t.right,y:t.bottom}),this.overlayView=new VisualSearchCropBoxUtils.OverlayView(this.getViewRect(),this.getCropRect(i),this.config));n=this.overlayView.cropRect();n&&f(n.width(),n.height(),n.left(),n.top());this.isAnimationEnabled()?setTimeout(this.updateCropBoxStyle,this.cropBoxAnimationTime):this.updateCropBoxStyle();this.setAnimations();this.props.cropCoordinates?this.lastCropCoordinates=i:this.throttleCropBoxChange();this.handleEventsSetting(!0)},s.prototype.componentWillReceiveProps=function(n){if(n.cropCoordinates&&this.overlayView!=null){var t=new r({x:n.cropCoordinates.left,y:n.cropCoordinates.top},{x:n.cropCoordinates.right,y:n.cropCoordinates.bottom});t.equals(this.lastCropCoordinates)&&this.containerHeight==n.containerHeight&&this.containerWidth==n.containerWidth||(this.overlayView.setViewRect(this.getViewRect()),this.overlayView.setCropRect(this.getCropRect(t)),this.lastCropCoordinates=t,this.updateCropBoxStyle(),this.containerHeight=n.containerHeight,this.containerWidth=n.containerWidth,this.setState({coordinates:t,containerHeight:n.containerHeight,containerWidth:n.containerWidth}))}},s.prototype.isAnimationEnabled=function(){return this.config.enableAnimations&&!this.props.isFromOverlayElement&&!this.props.isDirectDrawing},s.prototype.isCloseButtonEnabled=function(){return this.config.enableCloseButton},s.prototype.stopPropagation=function(n){n.preventDefault();n.stopPropagation()},s.prototype.render=function(){var i=this,r="cropRect";return(r+=this.isCloseButtonEnabled()?" rb":"",this.props)?React.createElement("div",{id:"overlay_view",className:"overlayView",ref:function(n){i.imageElement=n}},this.enableLiveView&&React.createElement(n.ImageDetail.ImageCropBoxPin,{setMainImageVerticalScroll:this.props.setMainImageVerticalScroll,ref:function(n){i.ImageCropBoxPin=n}}),React.createElement("div",{id:"crop_rect",className:r,ref:function(n){i.cropBox=n}},React.createElement("div",{className:"content",ref:function(n){i.cropBoxContent=n}},React.createElement("div",{className:"left"}),React.createElement("div",{className:"right"}),React.createElement("div",{className:"top"}),React.createElement("div",{className:"bottom"}),React.createElement(SharedComponent.AccessibleComponent,{className:"leftTop",onKeyDown:this.handleKeyPress_leftTop}),React.createElement(SharedComponent.AccessibleComponent,{className:"rightTop",onKeyDown:this.handleKeyPress_rightTop}),React.createElement(SharedComponent.AccessibleComponent,{className:"leftBottom",onKeyDown:this.handleKeyPress_leftBottom}),React.createElement(SharedComponent.AccessibleComponent,{className:"rightBottom",onKeyDown:this.handleKeyPress_rightBottom}),this.isCloseButtonEnabled()&&React.createElement(t.RemoveCropAction,{hideText:!0}))),this.shouldShowHint&&React.createElement("span",{className:"cropBoxHint",ref:function(n){i.cropBoxHint=n}},this.hint)):null},s}(React.Component),h=function(n){return{changeCropCoordinates:function(t){t&&n(ImageDetailActions.changeCropCoordinates(t))},changeInsightsScrollPosition:function(){n(ImageDetailActions.changeInsightsScrollPosition(ImageDetailActions.InsightsScrollPosition.Peek))},changeIntersectedOCRRegions:function(t){typeof ImageDetailActions.changeIntersectedTextRegions!=u&&n(ImageDetailActions.changeIntersectedTextRegions(t))}}},c=function(n){var r=i.getIsHotspotClick(n)||i.getClickedEntity(n),t=i.gdlc("gtrc");return{cropCoordinates:i.getCropCoordinates(n),isFromOverlayElement:!!r,inTextMode:t&&t.e?typeof i.itm!==u&&i.itm(n):!1}},l=ReactRedux.connect(c,h);t.ImageCropBox=l(s)})(t=n.ImageDetail||(n.ImageDetail={}))})(Multimedia||(Multimedia={}));__extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}();__assign=this&&this.__assign||function(){return __assign=Object.assign||function(n){for(var t,r,i=1,u=arguments.length;i<u;i++){t=arguments[i];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},__assign.apply(this,arguments)},function(n){var t;(function(t){var s=n.InstrumentationUtils.lac,h=ImageDetailReducers.getResourceString,c=ImageDetailActions.IImageDetailViewType,e=n.ImageDetailUtils.InsightsModuleType,l=ImageDetailActions.IImageDetailOverlayElement,o=ImageDetailActions.IClickTarget,u=ImageDetailActions.EventActionType,i=ImageDetailReducers,f=n.ImageDetailUtils,r="undefined",a=function(e){function c(c){var l=e.call(this,c)||this;return l.hotSpots=[],l.defaultHoverShown=!1,l.hotSpotTooltip=null,l.handleSyntheticClick=function(n){if(n.detectedObjects&&n.detectedObjects.length>0){var t=0;typeof f.ghtptla=="function"&&n.detectedObjects.length>1&&(t=f.ghtptla(n.detectedObjects));l.handleClickOnHotSpotElement(n.detectedObjects[t],t)}typeof u!==r&&n.changeEnableSyntheticHotspotClick(u.Completed)},l.changeCropCoordinatesAndLoadVisualSearch=function(n,t){if(n){l.props.changeCropCoordinates(n);l.enableClickChangeHiddenCrop&&l.props.changeHiddenCropCoordinates(n);l.props.changeSelectedModule(l.props.enableAllTabOnClick);l.props.changeSelectedObjectIndex(t);var i=ImageDetailActions.IImageDetailViewType.VisualSearch;l.enableClickChangeHiddenCrop||l.props.viewType===i||(l.props.addToDetailStateHistory(),l.props.changeInsightsStatus(l.props.ig),l.props.changePageView())}},l.stopPropagation=function(n){n.stopPropagation();n.preventDefault()},l.handleUserAction=function(n,t){l.stopPropagation(n);l.handleClickOnHotSpot(t)},l.handleClickOnHotSpot=function(n){var t=l.props.detectedObjects[n];l.handleClickOnHotSpotElement(t,n)},l.handleClickOnHotSpotElement=function(i,u){var e=i&&i.boundingBox,h,c,a,v;if(e){h=i.hotspot;c=h?"left:"+h.left+", top:"+h.top:"";l.props.imageData&&l.props.imageData.instInfo&&s("ObjectDetectionHotSpot",l.props.ig,{Info:c},l.props.imageData.instInfo);switch(l.clickTarget){case o.Requery:typeof t.ObjectDetectionRequery.getRequeryUrl!==r&&typeof t.ObjectDetectionRequery.getHotspotQuery!==r&&(a=t.ObjectDetectionRequery.getHotspotQuery(i.displayName),f.gecc(t.ObjectDetectionRequery.getRequeryUrl(a))());break;case o.External:v={result:l.props.imageData,insightsViewState:{viewType:ImageDetailActions.IImageDetailViewType.VisualSearch},cropcoordinates:{top:e.top,bottom:e.bottom,left:e.left,right:e.right}};f.gecc(n.ImageDetailLocationUtils.getSearchByImageUploadUrl(v,!0))();break;default:l.changeCropCoordinatesAndLoadVisualSearch(e,u)}}},l.hotSpotTooltip=h("HSTooltip"),l.enableClickChangeHiddenCrop=i.gpc().echcr,l.clickTarget=c.config?c.config.ClickTarget:o.DetailPage,l}return __extends(c,e),c.prototype.componentDidMount=function(){typeof u!==r&&this.props.syntheticClick===u.Requested&&this.handleSyntheticClick(this.props)},c.prototype.componentWillUpdate=function(){this.hotSpots=[]},c.prototype.componentWillReceiveProps=function(n){typeof u!==r&&n.syntheticClick===u.Requested&&this.props.syntheticClick===u.None&&this.handleSyntheticClick(n)},c.prototype.componentDidUpdate=function(){if(this.props.setMainImageVerticalScroll&&typeof f.getOverlap!=r&&this.hotSpots&&this.hotSpots.length>0&&this.props.selectedObjectIndex>=0){var n=f.getOverlap(this.hotSpots[this.props.selectedObjectIndex],_d.querySelector(".img_bop"));console.log("selectedObjectIndex: "+this.props.selectedObjectIndex);console.log("overlap with selectedOgject: "+n);n>0&&this.props.setMainImageVerticalScroll(-n)}},c.prototype.render=function(){var n=this;if(this.props&&this.props.config&&this.props.config.Enabled&&this.props.detectedObjects&&this.props.detectedObjects.length>0){var i=this.props.config.EnableTooltip?this.hotSpotTooltip:"",u=i?{"data-tooltip":i}:{},f=this.props.showHotspotWithoutHover?"obj_det_container show":"obj_det_container";return React.createElement("div",{className:f,id:"obj_det_container"},this.props.detectedObjects.map(function(i,f){var e,h,s;if(i.hotspot)return e=f==0&&n.props.config.EnableNotification&&!n.defaultHoverShown?"obj_det hover":"obj_det",e+=f===n.props.selectedObjectIndex?" selected":"",h={left:i.hotspot.left*100+"%",top:i.hotspot.top*100+"%"},s=void 0,n.clickTarget==o.Requery&&typeof t.ObjectDetectionRequery.getHotspotQuery!==r&&(s=t.ObjectDetectionRequery.getHotspotQuery(i.displayName)),React.createElement("span",__assign({},u,{className:e,key:f,style:h,onMouseDown:function(t){return n.handleUserAction(t,f)},onTouchEnd:function(t){return n.handleUserAction(t,f)},ref:function(t){t&&n.hotSpots.push(t)}}),React.createElement("span",{className:"core"},s))}))}return null},c}(React.Component),v=function(n){return{changeCropCoordinates:function(t){n(ImageDetailActions.changeCropCoordinates(t,!0))},changeHiddenCropCoordinates:function(t){typeof ImageDetailActions.changeHiddenCropCoordinates!=r&&n(ImageDetailActions.changeHiddenCropCoordinates(t))},addToDetailStateHistory:function(){n(ImageDetailActions.addToDetailStateHistory())},changePageView:function(){n(ImageDetailActions.changePageView(c.VisualSearch))},changeSelectedModule:function(t){var i=t?e[e.all]:e[e.productandads];n(ImageDetailActions.changeInsightsSelectedModule(i))},changeInsightsStatus:function(t){n(ImageDetailActions.changeInsightStatus(!0,t,"ObjectDetection"))},changeEnableSyntheticHotspotClick:function(t){n(ImageDetailActions.ChangeEnableSyntheticHotspotClick(t))},changeSelectedObjectIndex:function(t){typeof ImageDetailActions.changeSelectedObjectIndex!=r&&n(ImageDetailActions.changeSelectedObjectIndex(t))}}},y=function(n){var t=i.getCurrentResult(n),o=i.gpc().disAdltVs,s=o&&t&&t.isAdult?null:i.getDetectedObjects(n),f=i.getVisibleOverlayElements(n),h=f&&f.some(function(n){return n.type==l.Hotspot&&n.id==null}),e=i.getObjectDetectionConfig(n);return{detectedObjects:s,config:e,enableAllTabOnClick:e.EnableAllTabOnClick,detailScenario:i.getDetailScenario(n),showHotspotWithoutHover:h,imageData:t,viewType:i.getViewType(n),ig:i.getCurrentImpressionId(n),syntheticClick:typeof i.geshsc!=r?i.geshsc(n):u.None,selectedObjectIndex:typeof i.gsoi!=r?i.gsoi(n):-1}},p=ReactRedux.connect(y,v);n.ImageDetail.ObjectDetection=p(a);n.ImageDetail.ObjectDetection.displayName="ObjectDetection"})(t=n.ImageDetail||(n.ImageDetail={}))}(Multimedia||(Multimedia={})),function(n){var t=function(){function n(n,t,i,r,u,f,e,o,s){var h=this;if(e===void 0&&(e=!0),o===void 0&&(o=5),s===void 0&&(s=!1),this.utils=pMMUtils,this.moved=!1,this.doubletap=!1,this.touchStartPoint=null,this.touchStartElementLeft=0,this.nowtouchpid=0,this.swipeDelta=null,this.touchStartTime=0,this.timeDelta=0,this.captureEvent=!0,this.enableEndHandlerWithoutMove=!1,this.moveSensitivity=5,this.cleanUp=function(){h.handleEventsSetting(!1)},this.isMoved=function(){return h.moved},this.resetMoved=function(){h.moved=!1},this.handleEventsSetting=function(n){var t=n?sj_be:sj_ue;typeof sb_de!="undefined"&&("ontouchstart"in sb_de?(t(h.touchElement,"touchstart",h.touchStart,h.captureEvent),t(h.touchElement,"touchmove",h.touchMove,h.captureEvent),t(h.touchElement,"touchend",h.touchEnd,h.captureEvent)):window.navigator.msPointerEnabled?(h.touchElement.style.msTouchAction="none",h.touchElement.style.touchAction="none",t(h.touchElement,"MSPointerDown",h.touchStart,h.captureEvent),t(h.touchElement,"MSPointerMove",h.touchMove,h.captureEvent),t(h.touchElement,"MSPointerUp",h.touchEnd,h.captureEvent),t(_d,"MSPointerUp",h.touchEnd,h.captureEvent)):"onpointermove"in sb_de&&(h.touchElement.style.msTouchAction="none",h.touchElement.style.touchAction="none",t(h.touchElement,"pointerdown",h.touchStart,h.captureEvent),t(h.touchElement,"pointermove",h.touchMove,h.captureEvent),t(h.touchElement,"pointerup",h.touchEnd,h.captureEvent),t(_d,"pointerup",h.touchEnd,h.captureEvent)),t(_d,"mousedown",h.resetMoved,!0))},this.getHandlerOrEmpty=function(n){return n!=null?n:h.Empty},this.Empty=function(){},this.setMoved=function(n){n===void 0&&(n=!1);h.moved=n},this.checkIfDoubleTap=function(){return sb_gt()-h.touchStartTime<250&&!!h.doubleTapHandler&&!h.isMoved()},this.touchStart=function(n){if(h.isTouchEvent(n)&&(h.doubletap=h.checkIfDoubleTap(),!h.doubletap)){h.setMoved(!1);h.touchStartPoint=h.getTouchPointFromEvent(n);var t=h.utils.gcs(h.touchElement);h.touchStartElementLeft=parseInt(typeof _G!="undefined"&&_G.RTL?t.marginRight:t.marginLeft);h.touchStartTime=sb_gt();!n.pointerId||(h.nowtouchpid=n.pointerId);h.touchStartHandler(n)}},this.touchMove=function(n){if(h.isTouchEvent(n)&&h.isValidTouch(n)){var t=h.getTouchPointFromEvent(n);if(!h.touchStartPoint||!t)return;h.swipeDelta=h.getDistanceBetweenPoints(h.touchStartPoint,t);h.setMoved(Math.abs(h.swipeDelta.X)>h.moveSensitivity||Math.abs(h.swipeDelta.Y)>h.moveSensitivity);h.isMoved()&&!h.doubletap&&h.touchMoveHandler(h.touchStartElementLeft,h.swipeDelta)&&h.preventDefault(n)}},this.touchEnd=function(n){var t=h.isMoved(),i;h.isTouchEvent(n)&&(h.doubletap&&!h.isMoved()?(h.doubleTapHandler(n),h.preventDefault(n),h.doubletap=!1):(t||h.enableEndHandlerWithoutMove)&&h.isValidTouch(n)&&(h.timeDelta=sb_gt()-h.touchStartTime,i=t?h.swipeDelta:h.getNewPoint(),h.touchEndHandler(h.touchStartElementLeft,i,h.timeDelta)&&h.preventDefault(n)),sj_ue(_d,"mousedown",h.resetMoved,!0),sb_st(function(){sj_be(_d,"mousedown",this.resetMoved,!0)},150))},this.preventDefault=function(n){n.stopPropagation();n.preventDefault()},this.getTouchPointFromEvent=function(n){var t=h.getNewPoint();return t.X=n.touches?n.touches[0].pageX:n.pageX!=undefined&&n.pageX!=0?n.pageX:0,t.Y=n.touches?n.touches[0].pageY:n.pageY!=undefined&&n.pageY!=0?n.pageY:0,t},this.getDistanceBetweenPoints=function(n,t){var i=h.getNewPoint();return i.X=t.X-n.X,i.Y=t.Y-n.Y,i},this.getNewPoint=function(){return{X:0,Y:0}},this.isTouchEvent=function(n){return typeof n.pointerType=="undefined"||n.pointerType==2||n.pointerType=="touch"||n.pointerType=="pen"},this.isValidTouch=function(n){return!n.pointerId||n.pointerId==h.nowtouchpid},!n)throw"container cannot be null!";this.container=n;this.touchElement=!t?this.container:t;this.touchStartHandler=this.getHandlerOrEmpty(i);this.touchMoveHandler=this.getHandlerOrEmpty(r);this.touchEndHandler=this.getHandlerOrEmpty(u);this.doubleTapHandler=this.getHandlerOrEmpty(f);this.enableEndHandlerWithoutMove=s;this.captureEvent=e;this.moveSensitivity=o;this.handleEventsSetting(!0)}return n}();n.MmReactSwipe=t}(ImageDetailSwipe||(ImageDetailSwipe={}));__extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}();__assign=this&&this.__assign||function(){return __assign=Object.assign||function(n){for(var t,r,i=1,u=arguments.length;i<u;i++){t=arguments[i];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},__assign.apply(this,arguments)},function(n){var t;(function(t){var f=n.InstrumentationUtils.lac,e=ImageDetailActions.IImageDetailMode,i=ImageDetailReducers,r="undefined",o=" selected",u=" show",s=" hide",h=" pr",c=function(r){function e(u){var e=r.call(this,u)||this;return e.hotspotInfo=n.TextRecognitionUtils.hotspotInfo,e.bboxInfo=n.TextRecognitionUtils.bboxInfo,e.compareBbox=n.TextRecognitionUtils.compareBbox,e.OcrRenderLevel=n.TextRecognitionUtils.OcrRenderLevel,e.tooltipEnabled=!0,e.renderLevel=e.OcrRenderLevel.Line,e.renderSvg=!0,e.defaultHotspotLocation=.05,e.fontScale=.7,e.epsilon=.01,e.regionElements=[],e.lineElements=[],e.wordElements=[],e.handleDragStartEvent=function(n){e.props.inTextMode&&e.enableDragSelection&&e.props.dragStart(n)},e.resetSelectedElements=function(n){var t=!1;return n.forEach(function(n){var i=e.renderSvg?n.className.baseVal:n.className;i.indexOf(o)>0&&(n.setAttribute("class",i.replace(o,"")),t=!0)}),t},e.refreshDataElements=function(){var n=!1;e.regionElements&&e.resetSelectedElements(e.regionElements)&&(n=!0);e.lineElements&&e.resetSelectedElements(e.lineElements)&&(n=!0);e.wordElements&&e.resetSelectedElements(e.wordElements)&&(n=!0);n&&e.props.changeSelectedTextIndex(null)},e.toggleTextMode=function(){e.props.inTextMode&&e.refreshDataElements();var n=e.props.inTextMode?!e.props.inTextMode:!0,t=n?"Enter":"Exit";f("TextMode",e.props.ig,{Action:t,Source:n?"hotspot":"close"});e.props.changeTextMode(n)},e.toPercentage=function(n){return n*100+"%"},e.toPixel=function(n,t,i){return n*t*i+"px"},e.toRadian=function(n){return"rotate("+n+"rad)"},e.createBbox=function(n,t,i,r,u){if(e.renderSvg){var f=n*100+i/2,o=t*100+r/2;return{x:e.toPercentage(n),y:e.toPercentage(t),width:e.toPercentage(i),height:e.toPercentage(r),transform:e.toRadian(Math.round(u*1e3)/1e3),transformOrigin:f+"% "+o+"%"}}return{left:e.toPercentage(n),top:e.toPercentage(t),width:e.toPercentage(i),height:e.toPercentage(r),fontSize:e.toPixel(r,e.props.imageHeight,e.fontScale),transform:e.toRadian(Math.round(u*1e3)/1e3),transformOrigin:"left top"}},e.selectText=function(t,i){var r=e.getOcrData(i),u=e.bboxInfo(r.boundingBox,r.text),o="left:"+u.left+", top:"+u.top,s={Text:u.text,Selected:!r.selected,Info:o};f("TextBoundingBox",e.props.ig,s);e.props.changeSelectedTextIndex(i);n.ImageDetailUtils.sp(t)},e.renderTextBoxes=function(n){var i,r;switch(e.renderLevel){case e.OcrRenderLevel.Region:return e.props.ocrData.map(function(i,r){return React.createElement(t.TextRecognitionRegion,{key:r,region:i,dataIndex:{region:r},htmlElements:n=="mask"?null:e.regionElements,elementType:n,selected:i.selected,textEnabled:e.renderText,createBbox:e.createBbox,selectText:e.selectText})});case e.OcrRenderLevel.Line:return i=[],e.props.ocrData.map(function(r,u){r.lines.map(function(r,f){i.push(React.createElement(t.TextRecognitionLine,{key:u+"-"+f,line:r,dataIndex:{region:u,line:f},htmlElements:n=="mask"?null:e.lineElements,elementType:n,selected:r.selected,textEnabled:e.renderText,createBbox:e.createBbox,selectText:e.selectText}))})}),i;case e.OcrRenderLevel.Word:return r=[],e.props.ocrData.map(function(i,u){i.lines.map(function(i,f){i.words.map(function(i,o){r.push(React.createElement(t.TextRecognitionWord,{key:u+"-"+f+"-"+o,word:i,dataIndex:{region:u,line:f,word:o},htmlElements:n=="mask"?null:e.wordElements,elementType:n,selected:i.selected,textEnabled:e.renderText,createBbox:e.createBbox,selectText:e.selectText}))})})}),r}},e.props.ocrData||e.processOcrData(),e.enableMobileView=i.isMobileViewEnabled(),e.setConfigProps(u),e}return __extends(e,r),e.prototype.componentDidMount=function(){this.forceUpdate()},e.prototype.componentWillUpdate=function(){this.resetHtmlReferences()},e.prototype.componentDidUpdate=function(n){this.props.regions!=n.regions&&this.processOcrData()},e.prototype.componentWillReceiveProps=function(n){this.props.config!=n.config&&this.setConfigProps(n)},e.prototype.setConfigProps=function(n){n.config&&(this.showHotspotWithoutHover=n.config.shwoh,this.tooltipEnabled=n.config.te,this.renderLevel=n.config.rl,this.renderText=n.config.rt,this.renderSvg=n.config.rs,this.enableDragSelection=n.config.eds)},e.prototype.resetHtmlReferences=function(){this.regionElements=[];this.lineElements=[];this.wordElements=[]},e.prototype.processOcrData=function(){var n=this,t;this.props.regions&&(t=this.props.regions.map(function(t){return t.selected=!1,t.lines.sort(function(t,i){return n.compareBbox(t.boundingBox,i.boundingBox,n.epsilon)}),t.lines=t.lines.map(function(t){return t.selected=!1,t.words.sort(function(t,i){return n.compareBbox(t.boundingBox,i.boundingBox,n.epsilon)}),t.words=t.words.map(function(n){return n.selected=!1,n}),t}),t}),this.props.sortOcrData(t))},e.prototype.getOcrData=function(n){return n.region>=0&&n.line>=0&&n.word>=0?this.props.ocrData[n.region].lines[n.line].words[n.word]:n.region>=0&&n.line>=0?this.props.ocrData[n.region].lines[n.line]:n.region>=0?this.props.ocrData[n.region]:void 0},e.prototype.render=function(){var n=this;if(this.props&&this.props.config&&this.props.config.e&&this.props.ocrData&&this.props.ocrData.length>0){var i="text_recognition_cont",r="text_mode_hotspot",f="close_text_mode",c="mask_container";(this.showHotspotWithoutHover||this.props.inTextMode||this.props.inTextModePreview)&&(i+=u);(this.props.inTextMode||this.props.inTextModePreview)&&(c+=u,this.props.inTextMode?(r+=s,f+=u):(r+=u,f+=s,i+=h));var l=this.props.config.tt,a=this.props.config.extm,v=this.tooltipEnabled?{"data-tooltip":l}:{title:l},y=this.tooltipEnabled?{"data-tooltip":a}:{title:a},e=this.props.ocrData[0].lines&&this.props.ocrData[0].lines.length>0?this.props.ocrData[0].lines[0]:null,o=e&&e.boundingBox&&this.hotspotInfo?this.hotspotInfo(e.boundingBox,this.props.imageHeight):null,p=o?{left:this.toPercentage(o.left),top:this.toPercentage(o.top)}:{left:this.toPercentage(this.defaultHotspotLocation),top:this.toPercentage(this.defaultHotspotLocation)},t={width:this.props.imageWidth,height:this.props.imageHeight};return React.createElement("div",{className:i,draggable:!0,onDragStart:this.handleDragStartEvent},!this.enableMobileView&&React.createElement("span",__assign({},y,{className:f,onMouseDown:function(){return n.toggleTextMode()},onTouchEnd:function(){return n.toggleTextMode()}}),React.createElement("span",{className:"icon"})),!this.enableMobileView&&React.createElement("span",__assign({},v,{className:r,style:p,onMouseDown:function(){return n.toggleTextMode()},onTouchEnd:function(){return n.toggleTextMode()}}),React.createElement("span",{className:"core"})),this.renderSvg?React.createElement("svg",{className:c,style:t},React.createElement("defs",null,React.createElement("mask",{id:"text_mode_mask"},React.createElement("rect",{className:"text_mode_opaque",x:"0",y:"0",style:t}),React.createElement("g",{viewBox:"0 0 100 100"},this.renderTextBoxes("mask")))),React.createElement("rect",{className:"text_mode_bg",x:"0",y:"0",style:t,mask:"url(#text_mode_mask)"}),React.createElement("g",{id:"text_mode_borders",viewBox:"0 0 100 100"},this.renderTextBoxes("border"))):React.createElement("div",{style:t},this.renderTextBoxes()))}return null},e}(React.Component),l=function(n){return{changeTextMode:function(t){typeof ImageDetailActions.changeImageDetailMode!=r&&n(ImageDetailActions.changeImageDetailMode(t?e.Text:e.Default))},changeSelectedTextIndex:function(t){typeof ImageDetailActions.changeSelectedTextIndex!=r&&n(ImageDetailActions.changeSelectedTextIndex(t))},sortOcrData:function(t){typeof ImageDetailActions.sortOcrData!=r&&n(ImageDetailActions.sortOcrData(t))}}},a=function(n){return{config:i.gdlc("gtrc"),regions:i.getOcrText(n),inTextMode:typeof i.itm!==r?i.itm(n):!1,ocrData:i.getSortedOcrData(n),ig:i.getCurrentImpressionId(n),inTextModePreview:i.getInTextModePreview(n)}},v=ReactRedux.connect(a,l);n.ImageDetail.TextRecognition=v(c);n.ImageDetail.TextRecognition.displayName="TextRecognition"})(t=n.ImageDetail||(n.ImageDetail={}))}(Multimedia||(Multimedia={}))