1"use strict";(self.webpackChunksketchfab=self.webpackChunksketchfab||[]).push([[2177],{"+uiz":(t,e,i)=>{i.r(e),i.d(e,{default:()=>p});var s=i("Hjnd"),n=i.n(s),o=i("HPk7"),a=i("Wuy/"),r=i("bvKJ"),h=i("R2Pi"),u=i("1nxQ"),m=i("uo4Z"),c=i("O56b"),l=i("rX1A"),d=i("hrlB").Z.shortcuts;const p=l.Z.extend({mixins:[(0,m.Z)(".js-scrollable")],events:{"mousedown .track":"onTrackMouseDown","touchstart .track":"onTrackMouseDown",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",wheel:"onMouseWheel","click .play:not(.pause)":"onPlayClick","touchstart .play:not(.pause)":"onPlayClick","click .pause":"onPauseClick","touchstart .pause":"onPauseClick","click .animation-list .animation-item ":"onSelectAnimationItemClick","touchstart .animation-list .animation-item ":"onSelectAnimationItemClick","touchstart .animation-list .handle":"onSelectAnimationListClick","click .loop-mode":"onLoopModeClick","touchstart .loop-mode":"onLoopModeClick","click .progress":"onProgressClick","touchstart .progress":"onProgressClick","click .next":"onNextClick","touchstart .next":"onNextClick",'click [name="animation-speed"]':"setSpeed",'click [name="animation-cycle"]':"setCycle","keypress .editing-field":"onFrameFieldKeypress","keydown .editing-field":"onFrameFieldKeydown","keyup .editing-field":"onFrameFieldKeyup"},constructor:function(){this.onDocumentMouseMove=(0,o.Z)(this.onDocumentMouseMove.bind(this),16),this.onDocumentTouchMove=(0,o.Z)(this.onDocumentTouchMove.bind(this),16),this.onDocumentTouchStart=this.onDocumentTouchStart.bind(this),this.onDocumentTouchEnd=this.onDocumentTouchEnd.bind(this),this.onDocumentMouseUp=this.onDocumentMouseUp.bind(this),this.onDocumentMouseEnter=this.onDocumentMouseEnter.bind(this),this.onDocumentMouseLeave=this.onDocumentMouseLeave.bind(this),this.onDocumentMouseDown=this.onDocumentMouseDown.bind(this),this.toggleTextEdition=this.toggleTextEdition.bind(this),this.updateTimestampText=this.updateTimestampText.bind(this),this.onViewerResize=this.onViewerResize.bind(this),this.getInitialPointerPosition=this.getInitialPointerPosition.bind(this),l.Z.prototype.constructor.apply(this,arguments)},initialize:function(t){if((0,a.Z)(t,{autohide:!1,progressDisplayUnit:"time"}),l.Z.prototype.initialize.apply(this,arguments),h.default.any&&this.$el.addClass("mobile"),this.$el.length)return this.currentModel=this.options.currentModel,this.$bar=this.$(".bar"),this.barStyle=this.$bar[0].style,this.$timeline=this.$(".timeline"),this.$track=this.$(".track"),this.$progress=this.$(".progress"),this.$loopMode=this.$(".loop-mode"),this.$knob=this.$(".knob"),this.$currentAnimationLabel=this.$(".animation-name"),this.knobStyle=this.$knob[0].style,this._pointerInside=!0,this._visible=!0,this._userHasTypedFrame=!1,this.updateBarWidth(),this.updateNumericProgress=window.innerWidth>480,this.buildAnimationList(),this.setTimestampMarkup(),this.renderSettings(),this.initializeShortcuts(),this.onPlayingChanged(),this.onCurrentAnimationChange(),this.on("idle",(function(t){t?(this.oldUpdateNumericProgress=this.updateNumericProgress,this.updateNumericProgress=!1):this.updateNumericProgress=void 0===this.oldUpdateNumericProgress||this.oldUpdateNumericProgress})),!1===this.options.enabled?this.disable():this.enable(),this},remove:function(){l.Z.prototype.remove.apply(this,arguments),this.unbindEvents()},disable:function(){this._enabled=!1,this.unbindEvents()},enable:function(){this._enabled=!0,this.bindEvents()},bindEvents:function(){this.model.on("change:progress",this.onProgressChange,this),this.model.on("change:animations",this.buildAnimationList,this),this.model.on("change:currentUID",this.onCurrentAnimationChange,this),this.model.on("change:playing",this.onPlayingChanged,this),this.model.on("change:cycleMode",this.updateUI,this),this.model.on("change:speed",this.updateUI,this),this.model.on("change:fps",this.onFpsChange,this),this.model.get("animations").on("sort remove change",this.buildAnimationList,this),n()(document).on("touchstart",this.onDocumentTouchStart),n()(document).on("touchend",this.onDocumentTouchEnd),n()(document).on("mouseup",this.onDocumentMouseUp),n()(document).on("mouseenter",this.onDocumentMouseEnter),n()(document).on("mouseleave",this.onDocumentMouseLeave),n()(document).on("mousedown",this.onDocumentMouseDown),n()(document).one("mousemove",this.getInitialPointerPosition),this.viewer.scene.on("resizeCanvas",this.onViewerResize)},unbindEvents:function(){this.model.off(null,null,this),this.model.get("animations").off(null,null,this),n()(document).off("touchstart",this.onDocumentTouchStart),n()(document).off("touchend",this.onDocumentTouchEnd),n()(document).off("mouseup",this.onDocumentMouseUp),n()(document).off("mouseenter",this.onDocumentMouseEnter),n()(document).off("mouseleave",this.onDocumentMouseLeave),n()(document).off("mousedown",this.onDocumentMouseDown),this.viewer.scene.off("resizeCanvas",this.onViewerResize)},initializeShortcuts:function(){var t=new c.Z(d.animationControl);t.on("toggleAnimation",this.toggleAnimation.bind(this)),t.on("prevFrame",this.handleSkipping.bind(this,-1)),t.on("nextFrame",this.handleSkipping.bind(this,1)),t.on("toggleTextEdition",this.toggleTextEdition),t.listen()}
1,handleSkipping:function(t,e,i){var s,n=Math.sign(t);this.pause(),this._needsUpdate=!0,"frames"===this.getProgressUnit()?(s=1*n,i.shiftKey&&(s+=10*n),this.skip(s)):(s=2*n,i.ctrlKey?s*=.5:i.shiftKey&&(s*=2.5),this.skip(s))},getTrackWidth:function(){return this.$track.outerWidth(!0)},getBarWidth:function(){return this._barWidth},render:function(){if(this._visible&&this._enabled){if(this._needsUpdate&&this._currentAnimation&&!this._seeking){var t=this.getBarWidth(),e=this._shortAnimation?1:this._percentage/100,i=t*e,s=(this._currentDuration-this._currentDuration*e)/this.model.get("speed");if(!this.model.get("playing")&&0===e)return this.showKnobAt(0),void this.renderTimestamp(0);if(this.setKnobTransition("none"),this.setKnobTransform("translateX("+i+"px)"),this.$knob.width(),this._needsUpdate=!1,!this.model.get("playing"))return;this.setKnobTransition("transform "+s+"ms linear"),this.setKnobTransform("translateX("+t+"px)")}this.updateNumericProgress&&this._enabled&&this.renderTimestamp()}},renderTimestamp:function(t){if("frames"===this.getProgressUnit()){var e=t,i=(this._currentTotalFrames+"").length,s=void 0!==e?e:this.getFrameForPercent(),n=this.$(".current-frame-field")[0],o=this.$(".total-frames")[0];n&&o&&(n.firstChild.data=this.formatFrames(s,i),o.textContent!==this._currentTotalFrames+""&&(o.firstChild?o.firstChild.data=this._currentTotalFrames:o.textContent=this._currentTotalFrames),n===document.activeElement&&this.setFramesCaretPosition())}else this._updatedTimestampValue=t,setTimeout(this.updateTimestampText,0)},updateTimestampText:function(){var t=(this._updatedTimestampValue||this._percentage)/100*this._currentDuration;this._$progressText[0].firstChild.data=this.formatTimestamp(t.toFixed(0))},setKnobTransition:function(t){this.knobStyle.transition=t,this.knobStyle.oTransition=t,this.knobStyle.webkitTransition=t,this.knobStyle.mozTransition=t},setKnobTransform:function(t){this.knobStyle.transform=t,this.knobStyle.oTransform=t,this.knobStyle.webkitTransform=t,this.knobStyle.mozTransform=t},showKnobTimestamp:function(){var t="";t="frames"===this.getProgressUnit()?this.getFrameForPercent():this.formatTimestamp(this._percentage/100*this._currentDuration),this.$knob.attr("data-frame",t),this.$knob.addClass("frame-visible"),clearTimeout(this.knobFrameTimeout),this.knobFrameTimeout=setTimeout(function(){this.$knob.removeClass("frame-visible")}.bind(this),2e3)},selectTimestampText:function(){var t,e,i=this.$(".editing-field");window.getSelection&&document.createRange?((e=document.createRange()).selectNodeContents(i[0]),(t=window.getSelection()).removeAllRanges(),t.addRange(e)):document.body.createTextRange&&((e=document.body.createTextRange()).moveToElementText(i[0]),e.select())},setFramesCaretPosition:function(t){var e,i,s=this.$(".current-frame-field")[0];window.getSelection&&document.createRange?(e=document.createRange(),void 0!==t?(e.setStart(s.firstChild,t),e.setEnd(s.lastChild,t)):(e.selectNodeContents(s),e.collapse(!1)),(i=window.getSelection()).removeAllRanges(),i.addRange(e)):document.body.createTextRange&&((e=document.body.createTextRange()).moveToElementText(s),e.select())},renderSettings:function(){var t=this.model.get("speed").toString(),e=this.model.get("cycleMode");this.setToggleUI("animation-speed",t),this.setToggleUI("animation-cycle",e),this.$("input[checked]").removeAttr("checked")},setToggleUI:function(t,e){this.$('[name="'+t+'"]').each((function(){var t=n()(this)[0];t.dataset.value===e?t.checked=!0:t.checked=!1}))},pauseTimeline:function(){var t=this._percentage/100,e=this.getBarWidth()*t;this.knobStyle.transition="none",this.knobStyle.transform="translateX("+e+"px)"},buildAnimationList:function(){var t=this.$(".animation-list ul"),e=this.getCurrentAnimation(),i=this.model.get("animations").filter((function(t){return t.get("isEnabled")}));t.empty(),t.append(n()('<li data-uid="-1" class="animation-item">Static Pose</li>')),i.forEach((function(i){var s=e&&e.get("uid")===i.get("uid")?"selected":"",o=n()('<li data-uid="'+i.get("uid")+'" class="animation-item '+s+'">'+(0,u.r)(i.get("name"))+"</li>");o.attr("title",i.get("name")),t.append(o)})),this.$(".control.next").toggle(i.length>1||!e)},formatTimestamp:function(t){var e,i,s,n;if("time"===this.getProgressUnit())return n=((n=(e=Math.floor(t/10))%100||0)>=10?"":"0")+n,s=((s=(e=Math.floor(e/100))%60||0)>=10?"":"0")+s,i=((i=(e=Math.floor(e/60))%60||0)>
1=10?"":"0")+i,(this._currentDuration>6e4?i+":":"")+s+":"+n},getFrameForPercent:function(t){var e=(t||this._percentage)/100*this._currentDuration;return Math.round(e/1e3*this.model.get("fps"))},getPercentForFrame:function(t){return t/this._currentTotalFrames*100},formatFrames:function(t,e){for(var i=t+"",s=e||4;i.length<s;)i="0"+i;return i},getProgressUnit:function(){return-1===this.model.get("fps")?"time":"frames"},skip:function(t){var e;(e="frames"===this.getProgressUnit()?this.getPercentForFrame(this.getFrameForPercent()+t):this._percentage+t)>100&&(e=0),e<0&&(e=100),this.pause(),this.seek(e)},show:function(){clearTimeout(this._hideTimer),this.$el.removeClass("hidden"),this._visible=!0},hide:function(t,e){clearTimeout(this._hideTimer);var i="number"==typeof e?e:2e3,s="boolean"==typeof t&&t,n=this.$(".animation-list").hasClass("active");!s&&(this._seeking||this._pointerInside||n&&this._touchMode)||this.options.autohide&&(this._hideTimer=setTimeout(function(){this.$el.addClass("hidden"),this.toggleAnimationList(!1),this._visible=!1}.bind(this),i))},showKnob:function(){this.$(".knob").show()},hideKnob:function(){this.$(".knob").hide()},showKnobAt:function(t){var e="translateX("+this.getBarWidth()*Math.min(t/100,1)+"px)";this.knobStyle.transform=e,this.knobStyle.oTransform=e,this.knobStyle.webkitTransform=e,this.knobStyle.mozTransform=e,this.knobStyle.webkitTransform=e},toggleAnimationList:function(t){this.$(".animation-list").toggleClass("active",t)},play:function(){this._needsUpdate=!0,this.$(".play").addClass("pause"),this.$knob.removeClass("frame-visible"),this.model.set("playing",!0)},pause:function(){this.$(".play").removeClass("pause"),this.model.set("playing",!1),this.pauseTimeline()},toggleAnimation:function(){this.model.set("playing",!this.model.get("playing"))},seek:function(t){this.model.get("playing")||(this._percentage=Math.max(Math.min(t,100),0),this.render(),this.model.trigger("seek",this._percentage),this.showKnobTimestamp(),this.showKnobAt(this._percentage))},start:function(){this._percentage=0,this.$(".play").addClass("pause"),this.model.set("playing",!0),this.model.trigger("start")},getCurrentAnimation:function(){return this.model.getCurrentAnimation()},updateUI:function(){this._needsUpdate=!0,this.renderSettings(),this.render()},onProgressChange:function(t,e){this.setProgress(e)},setProgress:function(t){this._percentage=t,0===t?this.updateUI():this.render()},setIsShortAnimation:function(){var t=1e3*(this.getCurrentAnimation().get("duration")||2.5)/this.model.get("speed");this._shortAnimation=t<this.minAnimationDuration},setTimestampMarkup:function(){var t;if("frames"===this.getProgressUnit())t='<div class="tooltip tooltip-up">Click to switch to seconds.</div>',this.$progress.html(t+'<span class="current-frame-field">123</span> / <span class="total-frames"></span>'),this.renderTimestamp();else{var e=this._percentage/100*this._currentDuration;t='<div class="tooltip tooltip-up">Click to switch to frames.</div>',this.$progress[0].innerHTML=t+'<p class="time">'+this.formatTimestamp(e.toFixed(0))+"</p>",this._$progressText=this.$progress.find(".time")}},commitTextEdition:function(){var t,e=this.$(".editing-field").html();if(clearTimeout(this._commitTextEditionTimeout),"frames"===this.getProgressUnit()){var i,s=parseInt(e,10);i=s>this._currentTotalFrames?this._currentTotalFrames:s<0||isNaN(s)?0:parseInt(e,10),t=this.getPercentForFrame(i)}else{e=(e=(e=e.replace(/[\.:\s]/gi,"")).split("").reverse().join("")).match(/.{1,2}/g);var n=0;t=(n=n+10*parseInt((e[0]||"0").split("").reverse().join(""))+1e3*parseInt((e[1]||"0").split("").reverse().join(""))+6e4*parseInt((e[2]||"0").split("").reverse().join("")))?n/this._currentDuration*100:this._percentage}this.seek(t),this.toggleTextEdition()},toggleTextEdition:function(){var t,e=this._editingTimestamp;t="frames"===this.getProgressUnit()?this.$(".current-frame-field"):this._$progressText,e?t.removeClass("editing-field").prop("contenteditable",!1).blur():(t.addClass("editing-field").prop("contenteditable",!0).focus(),this.selectTimestampText()),this.pause(),t.focus(),this._editingTimestamp=!e},toggleFps:function(){var t=this.model.get("fps");-1===t?this.model.set("fps",this._previousFps||30):(this._previousFps=t,this.model.set("fps",-1))},onCurrentAnimationChange:function(){var t=this.getCurrentAnimation(),e=t?t.get("uid"):"-1",i=t?t.get("name"):"Static pose";this._currentAnimation=t,this._needsUpdate=!0,this.$(".list .animation-item").removeClass("selected"),this.$('.list [data-uid="'+e+'"]').addClass("selected"),this.$currentAnimationLabel.text(i),clearTimeout(this._stillAnimationTimer),"-1"===e?(this.$(".play").addClass("stopped"),this.$timeline.addClass("disabled"),this.$progress.addClass("disabled"),this.setProgress(0)):(this.$(".play").removeClass("stopped"),this.$timeline.removeClass("disabled"),this.$progress.removeClass("disabled"),this._currentDuration=1e3*(this.getCurrentAnimation().get("duration")||2.5),this._currentTotalFrames=Math.round(this._currentDuration/1e3*this.model.get("fps")),this.setIsShortAnimation())},onFpsChange:function(){this._currentTotalFrames=Math.round(this._currentDuration/1e3*this.model.get("fps"));var t="",e=this.getProgressUnit();t="frames"===e?"Frames (at "+this.model.get("fps")+"fps)":"Timestamp (in seconds)",this.$progress.attr("data-unit",e),this.viewer.subviews.osd.show(t,{duration:5e3,position:"top"}),this.model.get("playing")||this.render()},onPlayingChanged:function(){this.model.get("playing")?this.play():this.pause()},onFrameFieldKeydown:function(t){var e=t.keyCode;this._userHasTypedFrame=!1,clearTimeout(this._commitTextEditionTimeout),13===e&&(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),clearTimeout(this._commitTextEditionTimeout),this._userHasTypedFrame=!0,this.commitTextEdition())},onFrameFieldKeypress:function(t){var e=String.fromCharCode(t.which);/[\d\.:]/.test(e)?(this._userHasTypedFrame=!0,this.pause()):t.preventDefault()},onFrameFieldKeyup:function(t){clearTimeout(this._commitTextEditionTimeout),13!==t.which&&(this._commitTextEditionTimeout=setTimeout(this.commitTextEdition.bind(this),2e3))},onSelectAnimationListClick:function(){clearTimeout(this._hideTimer),!this.$(".animation-list").hasClass("active")||this.hide()},onMouseEnter:function(){this._touchMode||(this._pointerInside=!0)},onMouseLeave:function(){this._pointerInside=!1},onDocumentTouchStart:function(t){this._touchMode=!0,this._moved=!1,this._touchStartPosition=t.originalEvent.changedTouches[0],this._touchStarted=Date.now(),n()(document).on("touchmove",this.onDocumentTouchMove)},onDocumentTouchMove:function(t){var e=this.$(".track"),i=t.originalEvent?t.originalEvent:t,s=i&&i.changedTouches&&i.changedTouches[0];if(s&&this._seeking){s.clientX-this._touchStartPosition.clientX&&(this._moved=!0),clearTimeout(this._hideTimer);var n=Math.max(0,s.pageX-e.offset().left-10),o=Math.max(Math.min(n/this.$bar.width()*100,100),0);"frames"===this.getProgressUnit()&&(o=this.getPercentForFrame(this.getFrameForPercent(o))),this.seek(o)}},onDocumentTouchEnd:function(t){if(this._seeking&&(this._seeking=!1,this._moved=!1,n()(document).off("touchmove",this.onDocumentTouchMove),this.hide(),this._playingBeforeSeeking&&this.play()),!n().contains(this.el,t.target)&&!this._moved&&Date.now()-this._touchStarted<400){var e=this.$(".animation-list").hasClass("active");this._visible?e&&(this.toggleAnimationList(!1),this.hide()):(this.show(),this._hideTimer=setTimeout(function(){this.hide()}.bind(this),2e3))}},onDocumentMouseEnter:function(){this._touchMode||this.show()},onDocumentMouseLeave:function(){this._touchMode||(this.onDocumentMouseUp(),this.hide())},onDocumentMouseDown:function(){this._touchMode=!1},onDocumentMouseMove:function(t){if(!this._touchMode){var e=this.$track,i=t.pageX-e.offset().left-10,s=Math.max(Math.min(i/this.$bar.width()*100,100),0);t.preventDefault(),"frames"===this.getProgressUnit()&&(s=this.getPercentForFrame(this.getFrameForPercent(s))),this.seek(s)}},onTrackMouseDown:function(t){t.preventDefault(),t.stopPropagation(),this._seeking=!0,this._playingBeforeSeeking=this.model.get("playing"),n()(document).on("mousemove",this.onDocumentMouseMove),this.pause(),"touchstart"===t.type&&this.onDocumentTouchStart(t),this._touchMode?this.onDocumentTouchMove(t):this.onDocumentMouseMove(t)},onDocumentMouseUp:function(){this._seeking&&(this._seeking=!1,n()(document).off("mousemove",this.onDocumentMouseMove),this.hide(),this._playingBeforeSeeking&&this.play())},onPlayClick:function(t){t.preventDefault(),this.play()},onPauseClick:function(t){t.preventDefault(),this.pause()},onSelectAnimationItemClick:function(t){var e=n()(t.target).attr("data-uid");("-1"===e||!!this.model.get("animations").find((function(t){return t&&t.get("uid")===e})))&&this.model.set("currentUID",e),t.stopPropagation()},onNextClick:function(t){t.preventDefault(),t.stopPropagation();var e=this.getCurrentAnimation(),i=this.model.get("animations").indexOf(e)+1;i>=this.model.get("animations").length&&(i=0);var s=this.model.get("animations").at(i);this.model.set("currentUID",s.get("uid"))},onProgressClick:function(t){"touchstart"===t.type&&t.preventDefault(),this._editingTimestamp||(this.toggleFps(),this.setTimestampMarkup())},onMouseWheel:function(t){if(!n()(t.target).parents(".list").length){var e=.5*(t.originalEvent.deltaY<0?-1:1);this._mousewheelPlay||(this._playingBeforeSeeking=this.model.get("playing")),this.pause(),this.seek(this._percentage+e),t.preventDefault(),t.stopPropagation(),this._mousewheelPlay&&(clearTimeout(this._mousewheelPlay),this._mousewheelPlay=null),this._mousewheelPlay=setTimeout(function(){this._playingBeforeSeeking?this.play():this._mousewheelPlay=null}.bind(this),300)}},updateBarWidth:function(){this._barWidth=this.$bar.outerWidth(!0)},onViewerResize:function(){this.updateBarWidth(),this.updateNumericProgress=window.innerWidth>480;var t=this._shortAnimation?1:this._percentage/100,e=(this._currentDuration-this._currentDuration*t)/this.model.get("speed");this.pauseTimeline(),(0,r.Z)(function(){this.setKnobTransition("transform "+e+"ms linear"),this.model.get("playing")&&this.setKnobTransform("translateX("+this.getBarWidth()+"px)")}.bind(this))},getInitialPointerPosition:function(t){document.elementFromPoint(t.pageX,t.pageY)===this.el&&(this._pointerInside=!0)},setSpeed:function(t){var e=parseFloat(t.currentTarget.dataset.value);this.model.set("speed",e),t.stopPropagation()},setCycle:function(t){var e=t.currentTarget.dataset.value;this.model.set("cycleMode",e),t.stopPropagation()}})}}]); 2//# sourceMappingURL=1d2138d04af6038a3ff29742536e03db-v2.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.