!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["live/chat-panel-fit"]=t():e["live/chat-panel-fit"]=t()}(globalThis,(()=>(()=>{var e,t,n={519:(e,t,n)=>{"use strict";n.d(t,{W:()=>a,a:()=>i});var r=n(952),o=n(605);const i=190,a=(0,r.defineOptionsMetadata)({customWidth:{hidden:!0,defaultValue:0},maxWidth:{defaultValue:1e3,displayName:"侧边栏最大宽度 (px)",validator:(0,o.getNumberValidator)(i)}})},181:(e,t,n)=>{var r=n(218)((function(e){return e[1]}));r.push([e.id,"html.custom-width-dragging .player-full-win:not(.hide-aside-area) .player-ctnr {\n z-index: 1001 !important;\n}\nhtml.custom-width-dragging .player-full-win:not(.hide-aside-area) .player-ctnr .head-info-section {\n display: none !important;\n}\n.aside-area-toggle-btn {\n height: 90px;\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n}\n.chat-panel-fit-dragger {\n pointer-events: none;\n touch-action: none;\n height: 100%;\n width: 0;\n position: absolute;\n right: 0;\n top: 0;\n display: flex;\n align-items: stretch;\n flex-direction: column;\n}\n.player-full-win:not(.hide-aside-area) .chat-panel-fit-dragger {\n pointer-events: initial;\n}\n.chat-panel-fit-dragger-bar {\n opacity: 0;\n cursor: ew-resize;\n transition: opacity 0.2s ease-out;\n flex-grow: 1;\n width: 8px;\n height: 100%;\n background-color: var(--theme-color);\n transform: translateX(-8px);\n display: flex;\n align-items: center;\n flex-direction: column;\n}\nhtml.custom-width-dragging .chat-panel-fit-dragger-bar, .chat-panel-fit-dragger-bar:hover {\n opacity: 1;\n}\n.chat-panel-fit-dragger-preview-area {\n opacity: 0;\n display: flex;\n align-items: stretch;\n flex-direction: column;\n pointer-events: none;\n position: absolute;\n top: 0;\n height: 100%;\n font-size: 16px;\n background-color: #fff;\n color: #000;\n}\nbody.dark .chat-panel-fit-dragger-preview-area {\n background-color: #222;\n color: #eee;\n}\n.chat-panel-fit-dragger-preview-area-background {\n flex-grow: 1;\n background-color: var(--theme-color-10);\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.chat-panel-fit-dragger.dragging .chat-panel-fit-dragger-preview-area {\n opacity: 1;\n}",""]),e.exports=r},710:(e,t,n)=>{var r=n(218)((function(e){return e[1]}));r.push([e.id,".player-full-win:not(.hide-aside-area) .live-room-app .aside-area {\n width: var(--live-chat-panel-width, 302px) !important;\n}\n.player-full-win:not(.hide-aside-area) .live-room-app .player-section {\n width: calc(100% - var(--live-chat-panel-width, 302px)) !important;\n}",""]),e.exports=r},218:e=>{"use strict"; // eslint-disable-next-line func-names e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=e(t);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n})).join("")}, // eslint-disable-next-line func-names t.i=function(e,n,r){"string"==typeof e&&( // eslint-disable-next-line no-param-reassign e=[[null,e,""]]);var o={};if(r)for(var i=0;i{"use strict";var r,o=function(){return void 0===r&&( // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805 // @see https://github.com/webpack-contrib/style-loader/issues/177 r=Boolean(window&&document&&document.all&&!window.atob)),r},i=function(){var e={};return function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}e[t]=n}return e[t]}}(),a=[];function s(e){for(var t=-1,n=0;n{var r=n(710);r&&r.__esModule&&(r=r.default),e.exports="string"==typeof r?r:r.toString()},560:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>m});var r=function(){var e=this,t=e._self._c,n=e._self._setupProxy;return t("div",{ref:"draggerElement",staticClass:"chat-panel-fit-dragger",class:{dragging:n.isDragging},style:{transform:`translateX(${-n.movement}px)`},on:{pointerdown:n.startDragging,pointermove:n.handlePointerMove,dblclick:n.resetCustomWidth}},[t("div",{staticClass:"chat-panel-fit-dragger-bar"}),e._v(" "),t("div",{staticClass:"chat-panel-fit-dragger-preview-area",style:{width:`${n.previewWidth}px`}},[t("div",{staticClass:"chat-panel-fit-dragger-preview-area-background"},[e._v("\n "+e._s(n.previewWidth.toFixed(1))+"px\n ")])])])};r._withStripped=!0;const o=globalThis.Vue;var i=n(986),a=n(519);const s=(0,o.defineComponent)({__name:"ChatPanelFitDragger",setup(e){const t=(0,o.reactive)((0,i.getComponentSettings)("liveChatPanelFit").options);(0,o.onBeforeMount)((()=>{0!==t.customWidth&&document.documentElement.style.setProperty("--live-chat-panel-width",`${t.customWidth}px`)}));const n=()=>parseFloat(document.documentElement.style.getPropertyValue("--live-chat-panel-width")),r=(0,o.ref)(),s=(0,o.ref)(0),l=(0,o.ref)(0),d=(0,o.computed)((()=>t.customWidth?t.customWidth+l.value:n())),c=(0,o.ref)(!1);return{__sfc:!0,options:t,getAutoWidth:n,draggerElement:r,startPoint:s,movement:l,previewWidth:d,isDragging:c,resetCustomWidth:()=>{t.customWidth=0,window.dispatchEvent(new CustomEvent("customWidthReset"))},handlePointerMove:e=>{if(!c.value)return;const n=s.value-e.screenX;l.value=lodash.clamp(t.customWidth+n,a.a,t.maxWidth)-t.customWidth},startDragging:e=>{c.value=!0,s.value=e.screenX,0===t.customWidth&&(t.customWidth=n()),r.value.setPointerCapture(e.pointerId),document.documentElement.style.cursor="ew-resize",document.documentElement.classList.add("custom-width-dragging"),document.documentElement.addEventListener("pointerup",(()=>{if(document.documentElement.style.cursor="",document.documentElement.classList.remove("custom-width-dragging"),c.value=!1,s.value=0,!l.value)return;const e=d.value;t.customWidth=e,l.value=0,document.documentElement.style.setProperty("--live-chat-panel-width",`${e}px`)}),{once:!0})}}}}),l=s;var d=n(332),c=n.n(d),u=n(181),p=n.n(u),f={insert:"head",singleton:!1};c()(p(),f);p().locals;var h=function(e,t,n,r,o,i,a,s){var l,d="function"==typeof e?e.options:e;if(t&&(d.render=t,d.staticRenderFns=n,d._compiled=!0),r&&(d.functional=!0),i&&(d._scopeId="data-v-"+i),a?(l=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),o&&o.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(a)},d._ssrRegister=l):o&&(l=s?function(){o.call(this,(d.functional?this.parent:this).$root.$options.shadowRoot)}:o),l)if(d.functional){d._injectStyles=l;var c=d.render;d.render=function(e,t){return l.call(t),c(e,t)}}else{var u=d.beforeCreate;d.beforeCreate=u?[].concat(u,l):[l]}return{exports:e,options:d}}(l,r,[],!1,null,null,null);const m=h.exports},427:e=>{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=427,e.exports=t},513:e=>{"use strict";e.exports="在直播网页全屏时, 自动调整侧边栏的宽度, 使得视频区域的比例和视频源相匹配, 达到无黑边的效果.\n如果在侧边栏的边缘拖动, 可以自定义侧边栏的固定宽度, 双击边缘可以还原到自动宽度.\n\n- `侧边栏最大宽度 (px)`: 限制侧边栏可被拉伸到的最大宽度. (最小宽度固定为 190px, 再小的话布局就要出问题了)\n\n> 注意, 由于有最大宽度和最小宽度的限制, 部分窗口尺寸下仍然无法做到无黑边.\n"},952:e=>{"use strict";e.exports=coreApis.componentApis.define},986:e=>{"use strict";e.exports=coreApis.settings},605:e=>{"use strict";e.exports=coreApis.utils}},r={};function o(e){var t=r[e];if(void 0!==t)return t.exports;var i=r[e]={id:e,exports:{}};return n[e](i,i.exports,o),i.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,o.t=function(n,r){if(1&r&&(n=this(n)),8&r)return n;if("object"==typeof n&&n){if(4&r&&n.__esModule)return n;if(16&r&&"function"==typeof n.then)return n}var i=Object.create(null);o.r(i);var a={};e=e||[null,t({}),t([]),t(t)];for(var s=2&r&&n;"object"==typeof s&&!~e.indexOf(s);s=t(s))Object.getOwnPropertyNames(s).forEach((e=>a[e]=()=>n[e]));return a.default=()=>n,o.d(i,a),i},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{"use strict";o.d(i,{component:()=>m});var e=o(952),t=o(986);const n=coreApis.spinQuery;var r=o(605);const a=coreApis.utils.log,s=coreApis.utils.urls;var l=o(519);const d="liveChatPanelFit",c=(0,a.useScopedConsole)(d),u=()=>{const{maxWidth:e,customWidth:n}=(0,t.getComponentSettings)(d).options;if(0!==n)return;const r=dq(".live-player-ctnr video");if(!r)return;const o=r.videoWidth,i=r.videoHeight;if(0===o||0===i)return;const{innerWidth:a,innerHeight:s}=window,u=a-o*s/i;c.log({liveChatPanelWidth:u}),document.documentElement.style.setProperty("--live-chat-panel-width",`${lodash.clamp(u,l.a,e)}px`)},p=lodash.debounce(u,200);let f;const h=async()=>{(0,t.addComponentListener)("liveChatPanelFit.targetRatio",u),(0,t.addComponentListener)("liveChatPanelFit.maxWidth",u),window.addEventListener("customWidthReset",u),window.addEventListener("resize",p);if(!await(0,n.sq)((()=>dq(".live-player-ctnr video")),(e=>null!==e&&e.readyState!==HTMLMediaElement.HAVE_NOTHING)))return void c.log("未找到 video 元素");u();const e=await(0,n.select)(".aside-area-toggle-btn");if(!e)return void c.log("未找到侧边栏按钮");const{default:i}=await Promise.resolve().then(o.bind(o,560));f=(0,r.mountVueComponent)(i),e.insertAdjacentElement("afterend",f.$el)},m=(0,e.defineComponentMetadata)({name:d,displayName:"直播间网页全屏自适应",tags:[componentsTags.live,componentsTags.style],urlInclude:[...s.liveUrls],entry:h,reload:h,unload:()=>{(0,t.removeComponentListener)("liveChatPanelFit.targetRatio",u),(0,t.removeComponentListener)("liveChatPanelFit.maxWidth",u),window.removeEventListener("customWidthReset",u),window.removeEventListener("resize",p),document.documentElement.style.removeProperty("--live-chat-panel-width"),f&&(f.$el.remove(),f.$destroy(),f=void 0)},instantStyles:[{name:d,style:()=>Promise.resolve().then(o.t.bind(o,188,23)),important:!0}],options:l.W,commitHash:"09b014c4f2f58283d40acf9fa63d1f924abd0b13",coreVersion:"2.8.10",description:(()=>{const e=o(427);return{...Object.fromEntries(e.keys().map((t=>[t.match(/index\.(.+)\.md$/)[1],e(t)]))),"zh-CN":()=>Promise.resolve().then(o.t.bind(o,513,17)).then((e=>e.default))}})()})})(),i=i.component})()));