1
0
Fork 0
pixelfed/public/js/vendor.js

2 lines
3.0 MiB
JavaScript
Raw Normal View History

2022-02-18 05:31:41 +00:00
/*! For license information please see vendor.js.LICENSE.txt */
2022-06-27 01:12:50 +00:00
(self.webpackChunkpixelfed=self.webpackChunkpixelfed||[]).push([[898],{29655:(e,t,n)=>{"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}n.r(t),n.d(t,{default:()=>g});var s=function(e,t){return e.matches?e.matches(t):e.msMatchesSelector?e.msMatchesSelector(t):e.webkitMatchesSelector?e.webkitMatchesSelector(t):null},l=function(e,t){return e.closest?e.closest(t):function(e,t){for(var n=e;n&&1===n.nodeType;){if(s(n,t))return n;n=n.parentNode}return null}(e,t)},c=function(e){return Boolean(e&&"function"==typeof e.then)},u=function e(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=n.search,o=n.autoSelect,s=void 0!==o&&o,u=n.setValue,d=void 0===u?function(){}:u,h=n.setAttribute,f=void 0===h?function(){}:h,p=n.onUpdate,m=void 0===p?function(){}:p,v=n.onSubmit,g=void 0===v?function(){}:v,_=n.onShow,y=void 0===_?function(){}:_,b=n.onHide,I=void 0===b?function(){}:b,T=n.onLoading,M=void 0===T?function(){}:T,k=n.onLoaded,E=void 0===k?function(){}:k;r(this,e),a(this,"value",""),a(this,"searchCounter",0),a(this,"results",[]),a(this,"selectedIndex",-1),a(this,"handleInput",(function(e){var n=e.target.value;t.updateResults(n),t.value=n})),a(this,"handleKeyDown",(function(e){var n=e.key;switch(n){case"Up":case"Down":case"ArrowUp":case"ArrowDown":var r="ArrowUp"===n||"Up"===n?t.selectedIndex-1:t.selectedIndex+1;e.preventDefault(),t.handleArrows(r);break;case"Tab":t.selectResult();break;case"Enter":var a=t.results[t.selectedIndex];t.selectResult(),t.onSubmit(a);break;case"Esc":case"Escape":t.hideResults(),t.setValue();break;default:return}})),a(this,"handleFocus",(function(e){var n=e.target.value;t.updateResults(n),t.value=n})),a(this,"handleBlur",(function(){t.hideResults()})),a(this,"handleResultMouseDown",(function(e){e.preventDefault()})),a(this,"handleResultClick",(function(e){var n=e.target,r=l(n,"[data-result-index]");if(r){t.selectedIndex=parseInt(r.dataset.resultIndex,10);var a=t.results[t.selectedIndex];t.selectResult(),t.onSubmit(a)}})),a(this,"handleArrows",(function(e){var n=t.results.length;t.selectedIndex=(e%n+n)%n,t.onUpdate(t.results,t.selectedIndex)})),a(this,"selectResult",(function(){var e=t.results[t.selectedIndex];e&&t.setValue(e),t.hideResults()})),a(this,"updateResults",(function(e){var n=++t.searchCounter;t.onLoading(),t.search(e).then((function(e){n===t.searchCounter&&(t.results=e,t.onLoaded(),0!==t.results.length?(t.selectedIndex=t.autoSelect?0:-1,t.onUpdate(t.results,t.selectedIndex),t.showResults()):t.hideResults())}))})),a(this,"showResults",(function(){t.setAttribute("aria-expanded",!0),t.onShow()})),a(this,"hideResults",(function(){t.selectedIndex=-1,t.results=[],t.setAttribute("aria-expanded",!1),t.setAttribute("aria-activedescendant",""),t.onUpdate(t.results,t.selectedIndex),t.onHide()})),a(this,"checkSelectedResultVisible",(function(e){var n=e.querySelector('[data-result-index="'.concat(t.selectedIndex,'"]'));if(n){var r=e.getBoundingClientRect(),a=n.getBoundingClientRect();a.top<r.top?e.scrollTop-=r.top-a.top:a.bottom>r.bottom&&(e.scrollTop+=a.bottom-r.bottom)}})),this.search=c(i)?i:function(e){return Promise.resolve(i(e))},this.autoSelect=s,this.setValue=d,this.setAttribute=f,this.onUpdate=m,this.onSubmit=g,this.onShow=y,this.onHide=I,this.onLoading=M,this.onLoaded=E},d=0,h=function(){var e=arguments.length>0&&void 0!==arguments[0]?argum