@netless/app-docs-viewer
Advanced tools
Comparing version 0.2.8 to 0.2.9
@@ -1,4 +0,4 @@ | ||
"use strict";var Tt=Object.defineProperty,Ct=Object.defineProperties;var $t=Object.getOwnPropertyDescriptors;var xe=Object.getOwnPropertySymbols;var _t=Object.prototype.hasOwnProperty,It=Object.prototype.propertyIsEnumerable;var ye=(t,e,s)=>e in t?Tt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,Z=(t,e)=>{for(var s in e||(e={}))_t.call(e,s)&&ye(t,s,e[s]);if(xe)for(var s of xe(e))It.call(e,s)&&ye(t,s,e[s]);return t},Q=(t,e)=>Ct(t,$t(e));Object.defineProperty(exports,"__esModule",{value:!0});exports[Symbol.toStringTag]="Module";var Nt=`.netless-app-docs-viewer-content{position:relative;height:100%;overflow:hidden}.netless-app-docs-viewer-preview-mask{display:none;position:absolute;z-index:200;top:0;left:0;width:100%;height:100%}.netless-app-docs-viewer-preview{display:flex;flex-direction:column;align-items:center;position:absolute;z-index:300;top:0;left:0;width:33%;max-width:200px;height:100%;padding-top:10px;transform:translate(-100%);background:rgba(237,237,240,.9);box-shadow:inset -1px 0 #0000001c;transition:transform .4s}.netless-app-docs-viewer-preview-active .netless-app-docs-viewer-preview-mask{display:block}.netless-app-docs-viewer-preview-active .netless-app-docs-viewer-preview{transform:translate(0)}.netless-app-docs-viewer-preview-page{position:relative;display:block;width:55%;margin-bottom:10px;font-size:0;color:transparent;outline:none;border:7px solid transparent;border-radius:4px;transition:border-color .3s;user-select:none}.netless-app-docs-viewer-preview-page:hover,.netless-app-docs-viewer-preview-page.netless-app-docs-viewer-preview-page-active{border-color:#444e601a}.netless-app-docs-viewer-preview-page>img{width:100%;height:auto;box-sizing:border-box;border:1px solid rgba(0,0,0,.5);border-radius:1px;background-color:#fff;box-shadow:0 2px 8px #0000004d}.netless-app-docs-viewer-preview-page-name{position:absolute;top:1px;left:-10px;transform:translate(-100%);text-align:right;font-size:12px;color:#5f5f5f;user-select:none}.netless-app-docs-viewer-footer{box-sizing:border-box;height:26px;display:flex;align-items:center;padding:0 16px;border-top:1px solid #eeeef7;color:#191919}.netless-app-docs-viewer-float-footer{width:100%;min-height:26px;position:absolute;left:0;bottom:0;z-index:2000;background:rgba(249,249,252,.9);transition:opacity .4s}.netless-app-docs-viewer-footer-btn{box-sizing:border-box;width:26px;height:26px;font-size:0;margin:0;padding:3px;border:none;border-radius:1px;outline:none;color:currentColor;background:transparent;transition:background .4s;cursor:pointer;user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}.netless-app-docs-viewer-footer-btn:hover{background:rgba(237,237,240,.9)}@media (hover: none){.netless-app-docs-viewer-footer-btn:hover{background:transparent!important}}.netless-app-docs-viewer-footer-btn>svg{width:100%;height:100%}.netless-app-docs-viewer-footer-btn>svg:nth-of-type(2){display:none}.netless-app-docs-viewer-footer-btn.netless-app-docs-viewer-footer-btn-playing>svg:nth-of-type(1){display:none}.netless-app-docs-viewer-footer-btn.netless-app-docs-viewer-footer-btn-playing>svg:nth-of-type(2){display:initial}.netless-app-docs-viewer-footer-btn~.netless-app-docs-viewer-footer-btn{margin-left:15px}.netless-app-docs-viewer-page-jumps{flex:1;display:flex;justify-content:center;align-items:center}.netless-app-docs-viewer-page-number{margin-left:auto;font-size:13px;user-select:none;white-space:nowrap;word-break:keep-all}.netless-app-docs-viewer-page-number-input{border:none;outline:none;width:3em;margin:0;padding:0 2px;text-align:right;font-size:13px;line-height:1;font-weight:400;font-family:inherit;border-radius:2px;color:currentColor;background:transparent;transition:background .4s;user-select:text;-webkit-tap-highlight-color:rgba(0,0,0,0)}.netless-app-docs-viewer-page-number-input:hover,.netless-app-docs-viewer-page-number-input:focus,.netless-app-docs-viewer-page-number-input:active{background:#fff;box-shadow:#63636333 0 2px 8px}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-footer-btn{cursor:not-allowed}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-footer-btn:hover{background:transparent}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input{cursor:not-allowed}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input:hover,.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input:focus,.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input:active{background:transparent;box-shadow:none}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input:disabled{color:inherit}.netless-app-docs-viewer-readonly.netless-app-docs-viewer-float-footer{display:none}.telebox-color-scheme-dark .netless-app-docs-viewer-page-number-input{color:#a6a6a8}.telebox-color-scheme-dark .netless-app-docs-viewer-page-number-input:active,.telebox-color-scheme-dark .netless-app-docs-viewer-page-number-input:focus,.telebox-color-scheme-dark .netless-app-docs-viewer-page-number-input:hover{color:#222}.telebox-color-scheme-dark .netless-app-docs-viewer-footer{color:#a6a6a8;background:#2d2d33;border-top:none}.telebox-color-scheme-dark .netless-app-docs-viewer-footer-btn:hover{background:#212126}.telebox-color-scheme-dark .netless-app-docs-viewer-preview{background:rgba(50,50,50,.9)}.netless-app-docs-viewer-static-scrollbar{position:absolute;top:0;right:0;z-index:2147483647;width:8px;min-height:30px;margin:0;padding:0;border:none;outline:none;border-radius:4px;background:rgba(68,78,96,.4);box-shadow:1px 1px 8px #ffffffb3;opacity:0;transition:background .4s,opacity .4s 3s,transform .2s;user-select:none}.netless-app-docs-viewer-static-scrollbar.netless-app-docs-viewer-static-scrollbar-dragging{background:rgba(68,78,96,.6);opacity:1;transition:background .4s,opacity .4s 3s!important}.netless-app-docs-viewer-static-scrollbar:hover,.netless-app-docs-viewer-static-scrollbar:focus{background:rgba(68,78,96,.5)}.netless-app-docs-viewer-static-scrollbar:active{background:rgba(68,78,96,.6)}.netless-app-docs-viewer-content:hover .netless-app-docs-viewer-static-scrollbar{opacity:1;transition:background .4s,opacity .4s,transform .2s}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-static-scrollbar{display:none}.netless-app-docs-viewer-static-pages:hover .netless-app-docs-viewer-static-scrollbar{opacity:1;transition:background .4s,opacity .4s,transform .2s}.page-renderer-pages-container{position:relative;overflow:hidden}.page-renderer-page{position:absolute;top:0;left:0;background-position:center;background-size:cover;background-repeat:no-repeat}.page-renderer-pages-container.is-hwa .page-renderer-page{will-change:transform}.page-renderer-page-img{display:block;width:100%;height:auto;user-select:none}.netless-app-docs-viewer-static-pages{overflow:hidden;position:relative;height:100%;user-select:none}.netless-app-docs-viewer-static-page{display:block;width:100%;height:auto;user-select:none}.netless-app-docs-viewer-static-wb-view,.netless-app-docs-viewer-dynamic-wb-view{position:absolute;top:0;left:0;width:100%;height:100%;z-index:100;overflow:hidden}.netless-app-docs-viewer-dynamic-wb-view .cursor-clicker .ppt-event-source{cursor:pointer} | ||
`;const kt=(t,e,s,i)=>{if(s==="length"||s==="prototype"||s==="arguments"||s==="caller")return;const r=Object.getOwnPropertyDescriptor(t,s),o=Object.getOwnPropertyDescriptor(e,s);!Rt(r,o)&&i||Object.defineProperty(t,s,o)},Rt=function(t,e){return t===void 0||t.configurable||t.writable===e.writable&&t.enumerable===e.enumerable&&t.configurable===e.configurable&&(t.writable||t.value===e.value)},Lt=(t,e)=>{const s=Object.getPrototypeOf(e);s!==Object.getPrototypeOf(t)&&Object.setPrototypeOf(t,s)},Ot=(t,e)=>`/* Wrapped ${t}*/ | ||
${e}`,Pt=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),zt=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),At=(t,e,s)=>{const i=s===""?"":`with ${s.trim()}() `,r=Ot.bind(null,i,e.toString());Object.defineProperty(r,"name",zt),Object.defineProperty(t,"toString",Q(Z({},Pt),{value:r}))};function Ht(t,e,{ignoreNonConfigurable:s=!1}={}){const{name:i}=t;for(const r of Reflect.ownKeys(e))kt(t,e,r,s);return Lt(t,e),At(t,e,i),t}const Mt=(t,e={})=>{if(typeof t!="function")throw new TypeError(`Expected the first argument to be a function, got \`${typeof t}\``);const{wait:s=0,maxWait:i=Number.Infinity,before:r=!1,after:o=!0}=e;if(!r&&!o)throw new Error("Both `before` and `after` are false, function wouldn't be called.");let n,a,c;const l=function(...h){const d=this,G=()=>{n=void 0,a&&(clearTimeout(a),a=void 0),o&&(c=t.apply(d,h))},X=()=>{a=void 0,n&&(clearTimeout(n),n=void 0),o&&(c=t.apply(d,h))},q=r&&!n;return clearTimeout(n),n=setTimeout(G,s),i>0&&i!==Number.Infinity&&!a&&(a=setTimeout(X,i)),q&&(c=t.apply(d,h)),c};return Ht(l,t),l.cancel=()=>{n&&(clearTimeout(n),n=void 0),a&&(clearTimeout(a),a=void 0)},l},Ve="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",Vt=Ve.length,Ee=Array(20),C=()=>{for(let t=0;t<20;t++)Ee[t]=Ve.charAt(Math.random()*Vt);return Ee.join("")};class W{constructor(){this.disposers=new Map}add(e,s=C()){return this.flush(s),this.disposers.set(s,e()),s}addDisposer(e,s=C()){return this.flush(s),this.disposers.set(s,e),s}addEventListener(e,s,i,r,o=C()){return this.add(()=>(e.addEventListener(s,i,r),()=>e.removeEventListener(s,i,r)),o),o}setTimeout(e,s,i=C()){return this.add(()=>{const r=window.setTimeout(()=>{this.remove(i),e()},s);return()=>window.clearTimeout(r)},i)}setInterval(e,s,i=C()){return this.add(()=>{const r=window.setInterval(e,s);return()=>window.clearInterval(r)},i)}remove(e){const s=this.disposers.get(e);return this.disposers.delete(e),s}flush(e){const s=this.remove(e);if(s)try{s()}catch(i){console.error(i)}}flushAll(){this.disposers.forEach(e=>{try{e()}catch(s){console.error(s)}}),this.disposers.clear()}}var w=[],Bt=function(){return w.some(function(t){return t.activeTargets.length>0})},Dt=function(){return w.some(function(t){return t.skippedTargets.length>0})},Te="ResizeObserver loop completed with undelivered notifications.",Wt=function(){var t;typeof ErrorEvent=="function"?t=new ErrorEvent("error",{message:Te}):(t=document.createEvent("Event"),t.initEvent("error",!1,!1),t.message=Te),window.dispatchEvent(t)},I;(function(t){t.BORDER_BOX="border-box",t.CONTENT_BOX="content-box",t.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(I||(I={}));var b=function(t){return Object.freeze(t)},Ft=function(){function t(e,s){this.inlineSize=e,this.blockSize=s,b(this)}return t}(),Be=function(){function t(e,s,i,r){return this.x=e,this.y=s,this.width=i,this.height=r,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,b(this)}return t.prototype.toJSON=function(){var e=this,s=e.x,i=e.y,r=e.top,o=e.right,n=e.bottom,a=e.left,c=e.width,l=e.height;return{x:s,y:i,top:r,right:o,bottom:n,left:a,width:c,height:l}},t.fromRect=function(e){return new t(e.x,e.y,e.width,e.height)},t}(),re=function(t){return t instanceof SVGElement&&"getBBox"in t},De=function(t){if(re(t)){var e=t.getBBox(),s=e.width,i=e.height;return!s&&!i}var r=t,o=r.offsetWidth,n=r.offsetHeight;return!(o||n||t.getClientRects().length)},Ce=function(t){var e,s;if(t instanceof Element)return!0;var i=(s=(e=t)===null||e===void 0?void 0:e.ownerDocument)===null||s===void 0?void 0:s.defaultView;return!!(i&&t instanceof i.Element)},Ut=function(t){switch(t.tagName){case"INPUT":if(t.type!=="image")break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1},_=typeof window!="undefined"?window:{},A=new WeakMap,$e=/auto|scroll/,Yt=/^tb|vertical/,jt=/msie|trident/i.test(_.navigator&&_.navigator.userAgent),u=function(t){return parseFloat(t||"0")},y=function(t,e,s){return t===void 0&&(t=0),e===void 0&&(e=0),s===void 0&&(s=!1),new Ft((s?e:t)||0,(s?t:e)||0)},_e=b({devicePixelContentBoxSize:y(),borderBoxSize:y(),contentBoxSize:y(),contentRect:new Be(0,0,0,0)}),We=function(t,e){if(e===void 0&&(e=!1),A.has(t)&&!e)return A.get(t);if(De(t))return A.set(t,_e),_e;var s=getComputedStyle(t),i=re(t)&&t.ownerSVGElement&&t.getBBox(),r=!jt&&s.boxSizing==="border-box",o=Yt.test(s.writingMode||""),n=!i&&$e.test(s.overflowY||""),a=!i&&$e.test(s.overflowX||""),c=i?0:u(s.paddingTop),l=i?0:u(s.paddingRight),h=i?0:u(s.paddingBottom),d=i?0:u(s.paddingLeft),G=i?0:u(s.borderTopWidth),X=i?0:u(s.borderRightWidth),q=i?0:u(s.borderBottomWidth),mt=i?0:u(s.borderLeftWidth),ve=d+l,we=c+h,J=mt+X,K=G+q,be=a?t.offsetHeight-K-t.clientHeight:0,me=n?t.offsetWidth-J-t.clientWidth:0,St=r?ve+J:0,xt=r?we+K:0,P=i?i.width:u(s.width)-St-me,z=i?i.height:u(s.height)-xt-be,yt=P+ve+me+J,Et=z+we+be+K,Se=b({devicePixelContentBoxSize:y(Math.round(P*devicePixelRatio),Math.round(z*devicePixelRatio),o),borderBoxSize:y(yt,Et,o),contentBoxSize:y(P,z,o),contentRect:new Be(d,c,P,z)});return A.set(t,Se),Se},Fe=function(t,e,s){var i=We(t,s),r=i.borderBoxSize,o=i.contentBoxSize,n=i.devicePixelContentBoxSize;switch(e){case I.DEVICE_PIXEL_CONTENT_BOX:return n;case I.BORDER_BOX:return r;default:return o}},Gt=function(){function t(e){var s=We(e);this.target=e,this.contentRect=s.contentRect,this.borderBoxSize=b([s.borderBoxSize]),this.contentBoxSize=b([s.contentBoxSize]),this.devicePixelContentBoxSize=b([s.devicePixelContentBoxSize])}return t}(),Ue=function(t){if(De(t))return 1/0;for(var e=0,s=t.parentNode;s;)e+=1,s=s.parentNode;return e},Xt=function(){var t=1/0,e=[];w.forEach(function(n){if(n.activeTargets.length!==0){var a=[];n.activeTargets.forEach(function(l){var h=new Gt(l.target),d=Ue(l.target);a.push(h),l.lastReportedSize=Fe(l.target,l.observedBox),d<t&&(t=d)}),e.push(function(){n.callback.call(n.observer,a,n.observer)}),n.activeTargets.splice(0,n.activeTargets.length)}});for(var s=0,i=e;s<i.length;s++){var r=i[s];r()}return t},Ie=function(t){w.forEach(function(s){s.activeTargets.splice(0,s.activeTargets.length),s.skippedTargets.splice(0,s.skippedTargets.length),s.observationTargets.forEach(function(r){r.isActive()&&(Ue(r.target)>t?s.activeTargets.push(r):s.skippedTargets.push(r))})})},qt=function(){var t=0;for(Ie(t);Bt();)t=Xt(),Ie(t);return Dt()&&Wt(),t>0},ee,Ye=[],Jt=function(){return Ye.splice(0).forEach(function(t){return t()})},Kt=function(t){if(!ee){var e=0,s=document.createTextNode(""),i={characterData:!0};new MutationObserver(function(){return Jt()}).observe(s,i),ee=function(){s.textContent=""+(e?e--:e++)}}Ye.push(t),ee()},Zt=function(t){Kt(function(){requestAnimationFrame(t)})},V=0,Qt=function(){return!!V},es=250,ts={attributes:!0,characterData:!0,childList:!0,subtree:!0},Ne=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],ke=function(t){return t===void 0&&(t=0),Date.now()+t},te=!1,ss=function(){function t(){var e=this;this.stopped=!0,this.listener=function(){return e.schedule()}}return t.prototype.run=function(e){var s=this;if(e===void 0&&(e=es),!te){te=!0;var i=ke(e);Zt(function(){var r=!1;try{r=qt()}finally{if(te=!1,e=i-ke(),!Qt())return;r?s.run(1e3):e>0?s.run(e):s.start()}})}},t.prototype.schedule=function(){this.stop(),this.run()},t.prototype.observe=function(){var e=this,s=function(){return e.observer&&e.observer.observe(document.body,ts)};document.body?s():_.addEventListener("DOMContentLoaded",s)},t.prototype.start=function(){var e=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),Ne.forEach(function(s){return _.addEventListener(s,e.listener,!0)}))},t.prototype.stop=function(){var e=this;this.stopped||(this.observer&&this.observer.disconnect(),Ne.forEach(function(s){return _.removeEventListener(s,e.listener,!0)}),this.stopped=!0)},t}(),se=new ss,Re=function(t){!V&&t>0&&se.start(),V+=t,!V&&se.stop()},is=function(t){return!re(t)&&!Ut(t)&&getComputedStyle(t).display==="inline"},rs=function(){function t(e,s){this.target=e,this.observedBox=s||I.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return t.prototype.isActive=function(){var e=Fe(this.target,this.observedBox,!0);return is(this.target)&&(this.lastReportedSize=e),this.lastReportedSize.inlineSize!==e.inlineSize||this.lastReportedSize.blockSize!==e.blockSize},t}(),os=function(){function t(e,s){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=e,this.callback=s}return t}(),H=new WeakMap,Le=function(t,e){for(var s=0;s<t.length;s+=1)if(t[s].target===e)return s;return-1},M=function(){function t(){}return t.connect=function(e,s){var i=new os(e,s);H.set(e,i)},t.observe=function(e,s,i){var r=H.get(e),o=r.observationTargets.length===0;Le(r.observationTargets,s)<0&&(o&&w.push(r),r.observationTargets.push(new rs(s,i&&i.box)),Re(1),se.schedule())},t.unobserve=function(e,s){var i=H.get(e),r=Le(i.observationTargets,s),o=i.observationTargets.length===1;r>=0&&(o&&w.splice(w.indexOf(i),1),i.observationTargets.splice(r,1),Re(-1))},t.disconnect=function(e){var s=this,i=H.get(e);i.observationTargets.slice().forEach(function(r){return s.unobserve(e,r.target)}),i.activeTargets.splice(0,i.activeTargets.length)},t}(),ns=function(){function t(e){if(arguments.length===0)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if(typeof e!="function")throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");M.connect(this,e)}return t.prototype.observe=function(e,s){if(arguments.length===0)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!Ce(e))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");M.observe(this,e,s)},t.prototype.unobserve=function(e){if(arguments.length===0)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!Ce(e))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");M.unobserve(this,e)},t.prototype.disconnect=function(){M.disconnect(this)},t.toString=function(){return"function ResizeObserver () { [polyfill code] }"},t}();function as(t){const e="http://www.w3.org/2000/svg",s=document.createElementNS(e,"svg");s.setAttribute("class",`${t}-footer-icon-sidebar`),s.setAttribute("viewBox","0 0 64 64");const i=document.createElementNS(e,"path");return i.setAttribute("fill","currentColor"),i.setAttribute("d","M50 8H14c-3.309 0-6 2.691-6 6v36c0 3.309 2.691 6 6 6h36c3.309 0 6-2.691 6-6V14c0-3.309-2.691-6-6-6zM12 50V14c0-1.103.897-2 2-2h8v40h-8c-1.103 0-2-.897-2-2zm40 0c0 1.103-.897 2-2 2H26V12h24c1.103 0 2 .897 2 2z"),s.appendChild(i),s}function cs(t){const e="http://www.w3.org/2000/svg",s=document.createElementNS(e,"svg");s.setAttribute("class",`${t}-footer-icon-arrow-left`),s.setAttribute("viewBox","0 0 500 500");const i=document.createElementNS(e,"path");return i.setAttribute("fill","currentColor"),i.setAttribute("d","M177.81 249.959L337.473 90.295c2.722-2.865 2.651-7.378-.143-10.1-2.793-2.65-7.163-2.65-9.956 0l-164.75 164.75c-2.793 2.793-2.793 7.306 0 10.1l164.75 164.75c2.865 2.722 7.378 2.65 10.099-.143 2.651-2.794 2.651-7.163 0-9.957L177.809 249.959z"),s.appendChild(i),s}function ls(t){const e="http://www.w3.org/2000/svg",s=document.createElementNS(e,"svg");s.setAttribute("class",`${t}-footer-icon-arrow-right`),s.setAttribute("viewBox","0 0 500 500");const i=document.createElementNS(e,"path");return i.setAttribute("fill","currentColor"),i.setAttribute("d","M322.19 250.041L162.527 409.705c-2.722 2.865-2.651 7.378.143 10.1 2.793 2.65 7.163 2.65 9.956 0l164.75-164.75c2.793-2.793 2.793-7.306 0-10.1l-164.75-164.75c-2.865-2.722-7.378-2.65-10.099.143-2.651 2.794-2.651 7.163 0 9.957l159.664 159.736z"),s.appendChild(i),s}function hs(t){const e="http://www.w3.org/2000/svg",s=document.createElementNS(e,"svg");s.setAttribute("class",`${t}-footer-icon-play`),s.setAttribute("viewBox","0 0 500 500");const i=document.createElementNS(e,"path");return i.setAttribute("fill","currentColor"),i.setAttribute("d","M418.158 257.419L174.663 413.33c-6.017 3.919-15.708 3.772-21.291-.29-2.791-2.018-4.295-4.483-4.295-7.084V94.109c0-5.65 6.883-10.289 15.271-10.289 4.298 0 8.391 1.307 11.181 3.332l242.629 155.484c6.016 3.917 6.451 10.292.649 14.491-.216.154-.432.154-.649.292zM170.621 391.288l223.116-141.301L170.71 107.753l-.089 283.535z"),s.appendChild(i),s}function ds(t){const e="http://www.w3.org/2000/svg",s=document.createElementNS(e,"svg");s.setAttribute("class",`${t}-footer-icon-pause`),s.setAttribute("viewBox","0 0 500 500");const i=document.createElementNS(e,"path");return i.setAttribute("fill","currentColor"),i.setAttribute("d","M312.491 78.261c0-6.159 4.893-11.213 11.04-11.213 6.158 0 11.211 5.054 11.211 11.213v343.478c0 6.159-5.053 11.213-11.211 11.213-6.147 0-11.04-5.054-11.04-11.213V78.261zM165.257 78.261c0-6.159 4.893-11.213 11.04-11.213 6.158 0 11.211 5.054 11.211 11.213v343.478c0 6.159-5.053 11.213-11.211 11.213-6.147 0-11.04-5.054-11.04-11.213V78.261z"),s.appendChild(i),s}const S=typeof window!="undefined",je=S&&!("onscroll"in window)||typeof navigator!="undefined"&&/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),Ge=S&&"IntersectionObserver"in window,Xe=S&&"classList"in document.createElement("p"),qe=S&&window.devicePixelRatio>1,ps={elements_selector:".lazy",container:je||S?document:null,threshold:300,thresholds:null,data_src:"src",data_srcset:"srcset",data_sizes:"sizes",data_bg:"bg",data_bg_hidpi:"bg-hidpi",data_bg_multi:"bg-multi",data_bg_multi_hidpi:"bg-multi-hidpi",data_poster:"poster",class_applied:"applied",class_loading:"loading",class_loaded:"loaded",class_error:"error",class_entered:"entered",class_exited:"exited",unobserve_completed:!0,unobserve_entered:!1,cancel_on_exit:!0,callback_enter:null,callback_exit:null,callback_applied:null,callback_loading:null,callback_loaded:null,callback_error:null,callback_finish:null,callback_cancel:null,use_native:!1},Je=t=>Object.assign({},ps,t),Oe=function(t,e){let s;const i="LazyLoad::Initialized",r=new t(e);try{s=new CustomEvent(i,{detail:{instance:r}})}catch{s=document.createEvent("CustomEvent"),s.initCustomEvent(i,!1,!1,{instance:r})}window.dispatchEvent(s)},us=(t,e)=>{if(!!e)if(!e.length)Oe(t,e);else for(let s=0,i;i=e[s];s+=1)Oe(t,i)},f="src",oe="srcset",ne="sizes",Ke="poster",R="llOriginalAttrs",ae="loading",Ze="loaded",Qe="applied",gs="entered",ce="error",et="native",tt="data-",st="ll-status",p=(t,e)=>t.getAttribute(tt+e),fs=(t,e,s)=>{var i=tt+e;if(s===null){t.removeAttribute(i);return}t.setAttribute(i,s)},L=t=>p(t,st),x=(t,e)=>fs(t,st,e),F=t=>x(t,null),le=t=>L(t)===null,vs=t=>L(t)===ae,ws=t=>L(t)===ce,he=t=>L(t)===et,bs=[ae,Ze,Qe,ce],ms=t=>bs.indexOf(L(t))>=0,v=(t,e,s,i)=>{if(!!t){if(i!==void 0){t(e,s,i);return}if(s!==void 0){t(e,s);return}t(e)}},T=(t,e)=>{if(Xe){t.classList.add(e);return}t.className+=(t.className?" ":"")+e},g=(t,e)=>{if(Xe){t.classList.remove(e);return}t.className=t.className.replace(new RegExp("(^|\\s+)"+e+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},Ss=t=>{t.llTempImage=document.createElement("IMG")},xs=t=>{delete t.llTempImage},it=t=>t.llTempImage,U=(t,e)=>{if(!e)return;const s=e._observer;!s||s.unobserve(t)},ys=t=>{t.disconnect()},Es=(t,e,s)=>{e.unobserve_entered&&U(t,s)},de=(t,e)=>{!t||(t.loadingCount+=e)},Ts=t=>{!t||(t.toLoadCount-=1)},rt=(t,e)=>{!t||(t.toLoadCount=e)},Cs=t=>t.loadingCount>0,$s=t=>t.toLoadCount>0,ot=t=>{let e=[];for(let s=0,i;i=t.children[s];s+=1)i.tagName==="SOURCE"&&e.push(i);return e},pe=(t,e)=>{const s=t.parentNode;if(!s||s.tagName!=="PICTURE")return;ot(s).forEach(e)},nt=(t,e)=>{ot(t).forEach(e)},Y=[f],at=[f,Ke],B=[f,oe,ne],j=t=>!!t[R],ct=t=>t[R],lt=t=>delete t[R],N=(t,e)=>{if(j(t))return;const s={};e.forEach(i=>{s[i]=t.getAttribute(i)}),t[R]=s},_s=t=>{j(t)||(t[R]={backgroundImage:t.style.backgroundImage})},Is=(t,e,s)=>{if(!s){t.removeAttribute(e);return}t.setAttribute(e,s)},k=(t,e)=>{if(!j(t))return;const s=ct(t);e.forEach(i=>{Is(t,i,s[i])})},Ns=t=>{if(!j(t))return;const e=ct(t);t.style.backgroundImage=e.backgroundImage},ks=(t,e,s)=>{T(t,e.class_applied),x(t,Qe),!!s&&(e.unobserve_completed&&U(t,e),v(e.callback_applied,t,s))},ht=(t,e,s)=>{T(t,e.class_loading),x(t,ae),!!s&&(de(s,1),v(e.callback_loading,t,s))},m=(t,e,s)=>{!s||t.setAttribute(e,s)},Pe=(t,e)=>{m(t,ne,p(t,e.data_sizes)),m(t,oe,p(t,e.data_srcset)),m(t,f,p(t,e.data_src))},Rs=(t,e)=>{pe(t,s=>{N(s,B),Pe(s,e)}),N(t,B),Pe(t,e)},Ls=(t,e)=>{N(t,Y),m(t,f,p(t,e.data_src))},Os=(t,e)=>{nt(t,s=>{N(s,Y),m(s,f,p(s,e.data_src))}),N(t,at),m(t,Ke,p(t,e.data_poster)),m(t,f,p(t,e.data_src)),t.load()},Ps=(t,e,s)=>{const i=p(t,e.data_bg),r=p(t,e.data_bg_hidpi),o=qe&&r?r:i;!o||(t.style.backgroundImage=`url("${o}")`,it(t).setAttribute(f,o),ht(t,e,s))},zs=(t,e,s)=>{const i=p(t,e.data_bg_multi),r=p(t,e.data_bg_multi_hidpi),o=qe&&r?r:i;!o||(t.style.backgroundImage=o,ks(t,e,s))},dt={IMG:Rs,IFRAME:Ls,VIDEO:Os},As=(t,e)=>{const s=dt[t.tagName];!s||s(t,e)},Hs=(t,e,s)=>{const i=dt[t.tagName];!i||(i(t,e),ht(t,e,s))},Ms=["IMG","IFRAME","VIDEO"],Vs=t=>Ms.indexOf(t.tagName)>-1,pt=(t,e)=>{e&&!Cs(e)&&!$s(e)&&v(t.callback_finish,e)},ze=(t,e,s)=>{t.addEventListener(e,s),t.llEvLisnrs[e]=s},Bs=(t,e,s)=>{t.removeEventListener(e,s)},ue=t=>!!t.llEvLisnrs,Ds=(t,e,s)=>{ue(t)||(t.llEvLisnrs={});const i=t.tagName==="VIDEO"?"loadeddata":"load";ze(t,i,e),ze(t,"error",s)},ie=t=>{if(!ue(t))return;const e=t.llEvLisnrs;for(let s in e){const i=e[s];Bs(t,s,i)}delete t.llEvLisnrs},ut=(t,e,s)=>{xs(t),de(s,-1),Ts(s),g(t,e.class_loading),e.unobserve_completed&&U(t,s)},Ws=(t,e,s,i)=>{const r=he(e);ut(e,s,i),T(e,s.class_loaded),x(e,Ze),v(s.callback_loaded,e,i),r||pt(s,i)},Fs=(t,e,s,i)=>{const r=he(e);ut(e,s,i),T(e,s.class_error),x(e,ce),v(s.callback_error,e,i),r||pt(s,i)},ge=(t,e,s)=>{const i=it(t)||t;if(ue(i))return;Ds(i,n=>{Ws(n,t,e,s),ie(i)},n=>{Fs(n,t,e,s),ie(i)})},Us=(t,e,s)=>{Ss(t),ge(t,e,s),_s(t),Ps(t,e,s),zs(t,e,s)},Ys=(t,e,s)=>{ge(t,e,s),Hs(t,e,s)},fe=(t,e,s)=>{Vs(t)?Ys(t,e,s):Us(t,e,s)},js=(t,e,s)=>{t.setAttribute("loading","lazy"),ge(t,e,s),As(t,e),x(t,et)},Ae=t=>{t.removeAttribute(f),t.removeAttribute(oe),t.removeAttribute(ne)},Gs=t=>{pe(t,e=>{Ae(e)}),Ae(t)},gt=t=>{pe(t,e=>{k(e,B)}),k(t,B)},Xs=t=>{nt(t,e=>{k(e,Y)}),k(t,at),t.load()},qs=t=>{k(t,Y)},Js={IMG:gt,IFRAME:qs,VIDEO:Xs},Ks=t=>{const e=Js[t.tagName];if(!e){Ns(t);return}e(t)},Zs=(t,e)=>{le(t)||he(t)||(g(t,e.class_entered),g(t,e.class_exited),g(t,e.class_applied),g(t,e.class_loading),g(t,e.class_loaded),g(t,e.class_error))},Qs=(t,e)=>{Ks(t),Zs(t,e),F(t),lt(t)},ei=(t,e,s,i)=>{!s.cancel_on_exit||!vs(t)||t.tagName==="IMG"&&(ie(t),Gs(t),gt(t),g(t,s.class_loading),de(i,-1),F(t),v(s.callback_cancel,t,e,i))},ti=(t,e,s,i)=>{const r=ms(t);x(t,gs),T(t,s.class_entered),g(t,s.class_exited),Es(t,s,i),v(s.callback_enter,t,e,i),!r&&fe(t,s,i)},si=(t,e,s,i)=>{le(t)||(T(t,s.class_exited),ei(t,e,s,i),v(s.callback_exit,t,e,i))},ii=["IMG","IFRAME","VIDEO"],ft=t=>t.use_native&&"loading"in HTMLImageElement.prototype,ri=(t,e,s)=>{t.forEach(i=>{ii.indexOf(i.tagName)!==-1&&js(i,e,s)}),rt(s,0)},oi=t=>t.isIntersecting||t.intersectionRatio>0,ni=t=>({root:t.container===document?null:t.container,rootMargin:t.thresholds||t.threshold+"px"}),ai=(t,e,s)=>{t.forEach(i=>oi(i)?ti(i.target,i,e,s):si(i.target,i,e,s))},ci=(t,e)=>{e.forEach(s=>{t.observe(s)})},li=(t,e)=>{ys(t),ci(t,e)},hi=(t,e)=>{!Ge||ft(t)||(e._observer=new IntersectionObserver(s=>{ai(s,t,e)},ni(t)))},vt=t=>Array.prototype.slice.call(t),D=t=>t.container.querySelectorAll(t.elements_selector),di=t=>vt(t).filter(le),pi=t=>ws(t),ui=t=>vt(t).filter(pi),He=(t,e)=>di(t||D(e)),gi=(t,e)=>{ui(D(t)).forEach(i=>{g(i,t.class_error),F(i)}),e.update()},fi=(t,e)=>{!S||window.addEventListener("online",()=>{gi(t,e)})},O=function(t,e){const s=Je(t);this._settings=s,this.loadingCount=0,hi(s,this),fi(s,this),this.update(e)};O.prototype={update:function(t){const e=this._settings,s=He(t,e);if(rt(this,s.length),je||!Ge){this.loadAll(s);return}if(ft(e)){ri(s,e,this);return}li(this._observer,s)},destroy:function(){this._observer&&this._observer.disconnect(),D(this._settings).forEach(t=>{lt(t)}),delete this._observer,delete this._settings,delete this.loadingCount,delete this.toLoadCount},loadAll:function(t){const e=this._settings;He(t,e).forEach(i=>{U(i,this),fe(i,e,this)})},restoreAll:function(){const t=this._settings;D(t).forEach(e=>{Qs(e,t)})}};O.load=(t,e)=>{const s=Je(e);fe(t,s)};O.resetStatus=t=>{F(t)};S&&us(O,window.lazyLoadOptions);class wt{constructor({readonly:e,box:s,pages:i,onNewPageIndex:r,onPlay:o}){if(this.pageIndex=0,this.namespace="netless-app-docs-viewer",this.isShowPreview=!1,this.isSmallBox=!1,this.sideEffect=new W,i.length<=0)throw new Error("[DocsViewer] Empty pages.");this.readonly=e,this.box=s,this.pages=i,this.onNewPageIndex=r,this.onPlay=o,this.render()}mount(){this.box.mountContent(this.$content),this.box.mountFooter(this.$footer),this.sideEffect.add(()=>{const e=new O({container:this.$preview,elements_selector:`.${this.wrapClassName("preview-page>img")}`});return()=>e.destroy()},"preview-lazyload")}unmount(){this.$content.remove(),this.$footer.remove()}setReadonly(e){this.readonly!==e&&(this.readonly=e,this.$content.classList.toggle(this.wrapClassName("readonly"),e),this.$footer.classList.toggle(this.wrapClassName("readonly"),e),this.$pageNumberInput.disabled=e)}destroy(){this.sideEffect.flushAll(),this.unmount()}setPageIndex(e){Number.isNaN(e)||(this.pageIndex=e,this.$pageNumberInput.value=String(e+1))}setSmallBox(e){this.isSmallBox!==e&&(this.isSmallBox=e,this.$footer.classList.toggle(this.wrapClassName("float-footer"),e))}render(){return this.renderContent(),this.renderFooter(),this.$content}renderContent(){if(!this.$content){const e=document.createElement("div");e.className=this.wrapClassName("content"),this.$content=e,this.readonly&&e.classList.add(this.wrapClassName("readonly")),e.appendChild(this.renderPreviewMask()),e.appendChild(this.renderPreview())}return this.$content}renderPreview(){if(!this.$preview){const e=document.createElement("div");e.className=this.wrapClassName("preview")+" tele-fancy-scrollbar",this.$preview=e;const s=this.wrapClassName("preview-page"),i=this.wrapClassName("preview-page-name");this.pages.forEach((r,o)=>{var d;const n=(d=r.thumbnail)!=null?d:r.src.startsWith("ppt")?void 0:r.src;if(!n)return;const a=String(o),c=document.createElement("a");c.className=s+" "+this.wrapClassName(`preview-page-${o}`),c.setAttribute("href","#"),c.dataset.pageIndex=a;const l=document.createElement("span");l.className=i,l.textContent=String(o+1),l.dataset.pageIndex=a;const h=document.createElement("img");h.width=r.width,h.height=r.height,h.dataset.src=n,h.dataset.pageIndex=a,c.appendChild(h),c.appendChild(l),e.appendChild(c)}),this.sideEffect.addEventListener(e,"click",r=>{var n;if(this.readonly)return;const o=(n=r.target.dataset)==null?void 0:n.pageIndex;o&&(r.preventDefault(),r.stopPropagation(),r.stopImmediatePropagation(),this.onNewPageIndex(Number(o)),this.togglePreview(!1))})}return this.$preview}renderPreviewMask(){return this.$previewMask||(this.$previewMask=document.createElement("div"),this.$previewMask.className=this.wrapClassName("preview-mask"),this.sideEffect.addEventListener(this.$previewMask,"click",e=>{this.readonly||e.target===this.$previewMask&&this.togglePreview(!1)})),this.$previewMask}renderFooter(){if(!this.$footer){const e=document.createElement("div");if(e.className=this.wrapClassName("footer"),this.$footer=e,this.readonly&&e.classList.add(this.wrapClassName("readonly")),this.isSmallBox&&e.classList.add(this.wrapClassName("float-footer")),this.pages.some(c=>c.thumbnail||!c.src.startsWith("ppt"))){const c=this.renderFooterBtn("btn-sidebar",as(this.namespace));this.sideEffect.addEventListener(c,"click",()=>{this.readonly||this.togglePreview()}),this.$footer.appendChild(c)}const s=document.createElement("div");s.className=this.wrapClassName("page-jumps");const i=this.renderFooterBtn("btn-page-back",cs(this.namespace));if(this.sideEffect.addEventListener(i,"click",()=>{this.readonly||this.onNewPageIndex(this.pageIndex-1)}),s.appendChild(i),this.onPlay){const c=this.renderFooterBtn("btn-page-play",hs(this.namespace),ds(this.namespace)),l=()=>{this.sideEffect.setTimeout(()=>{c.classList.toggle(this.wrapClassName("footer-btn-playing"),!1)},500,"returnPlay")};this.sideEffect.addEventListener(c,"click",()=>{this.readonly||(c.classList.toggle(this.wrapClassName("footer-btn-playing"),!0),this.onPlay&&this.onPlay(),l())}),s.appendChild(c)}const r=this.renderFooterBtn("btn-page-next",ls(this.namespace));this.sideEffect.addEventListener(r,"click",()=>{this.readonly||this.onNewPageIndex(this.pageIndex+1)}),s.appendChild(r);const o=document.createElement("div");o.className=this.wrapClassName("page-number");const n=document.createElement("input");n.className=this.wrapClassName("page-number-input"),n.value=String(this.pageIndex+1),this.readonly&&(n.disabled=!0),this.$pageNumberInput=n,this.sideEffect.addEventListener(n,"focus",()=>{n.select()}),this.sideEffect.addEventListener(n,"change",()=>{this.readonly||n.value&&this.onNewPageIndex(Number(n.value)-1)});const a=document.createElement("span");a.textContent=" / "+this.pages.length,o.appendChild(n),o.appendChild(a),this.$footer.appendChild(s),this.$footer.appendChild(o)}return this.$footer}renderFooterBtn(e,s,i){const r=document.createElement("button");return r.className=this.wrapClassName("footer-btn")+" "+this.wrapClassName(e),r.appendChild(s),i&&r.appendChild(i),r}togglePreview(e){if(this.isShowPreview=e!=null?e:!this.isShowPreview,this.$content.classList.toggle(this.wrapClassName("preview-active"),this.isShowPreview),this.isShowPreview){const s=this.$preview.querySelector("."+this.wrapClassName(`preview-page-${this.pageIndex}`));s&&this.$preview.scrollTo({top:s.offsetTop-16})}}wrapClassName(e){return`${this.namespace}-${e}`}}function E(t,e,s){return Math.min(Math.max(t,e),s)}function Me(t){return t.touches?t.touches[0]:t}function bt(t){t.stopPropagation(),t.cancelable&&t.preventDefault()}class vi{constructor(e){var s,i,r;this.velocity=0,this.paused=!0,this._animationFrameID=null,this._loopTimestamp=0,this.looper=o=>{if(this.paused)return;let n=Math.floor((o-this._loopTimestamp)/1e3*60)+1;for(this._loopTimestamp=o;n-- >0;)this.stepper();this.onStep(this.current,this),!this.paused&&this.current!==this.target&&window.requestAnimationFrame(this.looper)},this.current=(s=e.start)!=null?s:0,this.target=this.current,this.stiffness=(i=e.stiffness)!=null?i:170,this.damping=(r=e.damping)!=null?r:26,this.onStep=e.onStep}stepTo(e,s){this.paused&&s!=null&&(this.current=s),this.paused=!1,this.target=e,this.onStep(this.current,this),this._loopTimestamp=Date.now(),window.requestAnimationFrame(this.looper)}pause(){this.paused=!0}destroy(){this.pause()}stepper(){const e=-this.stiffness*(this.current-this.target),s=-this.damping*this.velocity,i=this.velocity+(e+s)/60,r=this.current+i/60;Math.abs(i-0)<.01&&Math.abs(r-this.target)<.01?(this.current=this.target,this.velocity=0):(this.current=r,this.velocity=i)}}class wi{constructor(e,s,i,r){this.scale=1,this.lastVisit=Date.now(),this.pageOffsetY=0,this.pageOffsetX=0,this.visible=!0,this.index=e,this.page=s,this.scale=i,this.pageOffsetX=(r-s.width)/2;const o=document.createElement("div");o.className="page-renderer-page",o.dataset.index=`${e}`,o.style.width=`${s.width*i}px`,o.style.height=`${s.height*i}px`,s.thumbnail&&(o.style.backgroundImage=`url("${s.thumbnail}")`);const n=document.createElement("img");n.className="page-renderer-page-img",n.width=s.width,n.height=s.height,n.src=s.src,o.appendChild(n),this.$page=o}translateY(e){Math.abs(e-this.pageOffsetY)>=.001&&(this.pageOffsetY=e,this.$page.style.transform=`translate(${this.pageOffsetX*this.scale}px, ${this.pageOffsetY*this.scale}px)`)}setScale(e){Math.abs(e-this.scale)>=.001&&(this.scale=e,this.$page.style.width=`${this.page.width*this.scale}px`,this.$page.style.height=`${this.page.height*this.scale}px`,this.$page.style.transform=`translate(${this.pageOffsetX*this.scale}px, ${this.pageOffsetY*this.scale}px)`)}setVisible(e){e!==this.visible&&(this.visible=e,this.$page.style.opacity=e?"1":"0")}}const bi=window.requestIdleCallback||(t=>window.setTimeout(t,5e3)),mi=window.cancelIdleCallback||window.clearTimeout;class Si{constructor(e,s,i){this.pages=e,this.pagesIntrinsicWidth=s,this.scale=i,this.els=new Map,this.maxElCount=200,this.gcTimer=null,this.gc=()=>{if(this.gcTimer=null,this.els.size>this.maxElCount){const r=[...this.els.values()].sort((o,n)=>n.lastVisit-o.lastVisit);for(let o=Math.floor(this.maxElCount/4);o<r.length;o++)this.els.delete(r[o].index)}}}getEl(e){let s=this.els.get(e);return s||(s=new wi(e,this.pages[e],this.scale,this.pagesIntrinsicWidth),this.els.set(e,s)),s.lastVisit=Date.now(),this.els.size>this.maxElCount&&this.gcTimer===null&&(this.gcTimer=bi(this.gc)),s}setScale(e){e!==this.scale&&(this.scale=e,this.els.forEach(s=>s.setScale(e)))}destroy(){this.els.clear(),this.gcTimer!==null&&(mi(this.gcTimer),this.gcTimer=null)}}class xi{constructor(e){this._hwaTimeout=NaN,this._turnOffHWA=()=>{window.clearTimeout(this._hwaTimeout),this._hwaTimeout=NaN,this.$pages.classList.toggle("is-hwa",!1)},this.pagesScrollTop=e.pagesScrollTop||0,this.containerWidth=e.containerWidth||1,this.containerHeight=e.containerHeight||1,this.pages=e.pages.map(o=>{if(o.thumbnail)return o;try{const n=new URL(o.src);return n.searchParams.set("x-oss-process","image/resize,l_50"),Q(Z({},o),{thumbnail:n.toString()})}catch(n){return console.error(n),o}});const s=Array(this.pages.length);let i=1/0,r=0;this.pagesIntrinsicHeight=this.pages.reduce((o,n,a)=>(s[a]=o,n.width>r&&(r=n.width),n.height<=i&&(i=n.height),o+n.height),0),this.pagesIntrinsicWidth=r,this.pagesMinHeight=i,this.pagesIntrinsicYs=s,this.scale=this._calcScale(),this.threshold=this._calcThreshold(),this.onPageIndexChanged=e.onPageIndexChanged,this.pageScrollIndex=0,this.pagesScrollTop!==0&&(this.pageScrollIndex=this.findScrollPageIndex(),this.onPageIndexChanged&&this.pageScrollIndex>0&&this.onPageIndexChanged(this.pageScrollIndex)),this.pageElManager=new Si(this.pages,r,this.scale),this.$pages=this.renderPages()}setContainerSize(e,s){e>0&&s>0&&(e!==this.containerWidth||s!==this.containerHeight)&&(this.containerWidth=e,this.containerHeight=s,this.$pages.style.width=`${this.containerWidth}px`,this.$pages.style.height=`${this.containerHeight}px`,this.scale=this._calcScale(),this.threshold=this._calcThreshold(),this.pageElManager.setScale(this.scale),this.$pages.parentElement&&this.pagesScrollTo(this.pagesScrollTop,!0))}renderPages(){const e=document.createElement("div");return e.className="page-renderer-pages-container",e.style.width=`${this.containerWidth}px`,e.style.height=`${this.containerHeight}px`,e}pagesScrollTo(e,s){if(e=E(e,0,this.pagesIntrinsicHeight-this.containerHeight/this.scale),s||Math.abs(e-this.pagesScrollTop)>=.001){this._turnOnHWA(),this.pagesScrollTop=e;const i=this.findScrollPageIndex(),r=Math.max(i-this.threshold,0),o=Math.min(i+this.threshold,this.pages.length-1);for(let n=0;n<this.$pages.children.length;n++){const a=this.$pages.children[n],c=Number(a.dataset.index);c>=r&&c<=o||(a.remove(),n--)}for(let n=r;n<=o;n++){const a=this.pageElManager.getEl(n);a.$page.parentElement!==this.$pages&&this.$pages.appendChild(a.$page),a.translateY(this.pagesIntrinsicYs[n]-this.pagesScrollTop)}i!==this.pageScrollIndex&&(this.pageScrollIndex=i,this.onPageIndexChanged&&this.onPageIndexChanged(i))}}findScrollPageIndex(){for(let e=0;e<this.pagesIntrinsicYs.length;e++)if(this.pagesIntrinsicYs[e]+this.pages[e].height-this.pagesScrollTop>=.001)return e;return this.pagesIntrinsicYs.length-1}mount(e){e.appendChild(this.$pages),this.pagesScrollTo(this.pagesScrollTop,!0)}unmount(){this.$pages.remove()}destroy(){this.unmount(),this.onPageIndexChanged=void 0,this.pageElManager.destroy(),this._hwaTimeout&&(window.clearTimeout(this._hwaTimeout),this._hwaTimeout=NaN)}_calcScale(){return this.containerWidth/this.pagesIntrinsicWidth||1}_calcThreshold(){return E(Math.ceil(this.containerHeight/this.scale/this.pagesMinHeight/2),1,this.pages.length)}_turnOnHWA(){this._hwaTimeout?window.clearTimeout(this._hwaTimeout):this.$pages.classList.toggle("is-hwa",!0),this._hwaTimeout=window.setTimeout(this._turnOffHWA,1e3)}}const yi=30;class Ei{constructor(e){this.sideEffect=new W,this.pagesScrollTop=e.pagesScrollTop||0,this.containerWidth=e.containerWidth||1,this.containerHeight=e.containerHeight||1,this.pagesWidth=e.pagesWidth||1,this.pagesHeight=e.pagesHeight||1,this.scale=this._calcScale(),this.scrollbarMinHeight=e.scrollbarMinHeight||yi,this.scrollbarHeight=this._calcScrollbarHeight(),this.readonly=e.readonly,this.wrapClassName=e.wrapClassName,this.onDragScroll=e.onDragScroll,this.$scrollbar=this.renderScrollbar()}mount(e){e.appendChild(this.$scrollbar),this.pagesScrollTo(this.pagesScrollTop,!0)}unmount(){this.$scrollbar.remove()}setReadonly(e){this.readonly=e}setContainerSize(e,s){e>0&&s>0&&(e!==this.containerWidth||s!==this.containerHeight)&&(this.containerWidth=e,this.containerHeight=s,this.scale=this._calcScale(),this._updateScrollbarHeight(),this.$scrollbar.parentElement&&this.pagesScrollTo(this.pagesScrollTop,!0))}pagesScrollTo(e,s){if(e=E(e,0,this.pagesHeight-this.containerHeight/this.scale),s||Math.abs(e-this.pagesScrollTop)>=.001){this.pagesScrollTop=e;const i=this.pagesScrollTop*this.scale,r=this.pagesHeight*this.scale,o=i/(r-this.containerHeight)*(this.containerHeight-this.scrollbarHeight);window.requestAnimationFrame?window.requestAnimationFrame(()=>{this.$scrollbar.style.transform=`translateY(${o}px)`}):this.$scrollbar.style.transform=`translateY(${o}px)`}}destroy(){this.unmount(),this.onDragScroll=void 0,this.sideEffect.flushAll()}renderScrollbar(){const e=document.createElement("button");e.className=this.wrapClassName("scrollbar"),e.style.minHeight=`${this.scrollbarMinHeight}px`,e.style.height=`${this.scrollbarHeight}px`;const s=i=>{if(this.readonly||i.button!=null&&i.button!==0)return;bt(i);const r=this.wrapClassName("scrollbar-dragging");e.classList.toggle(r,!0);const o=this.pagesScrollTop,{clientY:n}=Me(i),a=l=>{if(this.readonly)return;const{clientY:h}=Me(l),d=(h-n)/this.scale;Math.abs(d)>0&&this.onDragScroll&&this.onDragScroll(o+d*(this.pagesHeight*this.scale/this.containerHeight))},c=()=>{e.classList.toggle(r,!1),window.removeEventListener("mousemove",a,!0),window.removeEventListener("touchmove",a,!0),window.removeEventListener("mouseup",c,!0),window.removeEventListener("touchend",c,!0),window.removeEventListener("touchcancel",c,!0)};window.addEventListener("mousemove",a,!0),window.addEventListener("touchmove",a,!0),window.addEventListener("mouseup",c,!0),window.addEventListener("touchend",c,!0),window.addEventListener("touchcancel",c,!0)};return this.sideEffect.addEventListener(e,"mousedown",s),this.sideEffect.addEventListener(e,"touchstart",s),e}_calcScale(){return this.containerWidth/this.pagesWidth||1}_calcScrollbarHeight(){return E(this.containerHeight/(this.pagesHeight*this.scale)*this.containerHeight,this.scrollbarMinHeight,this.containerHeight)}_updateScrollbarHeight(){const e=this._calcScrollbarHeight();Math.abs(e-this.scrollbarHeight)>.001&&(this.scrollbarHeight=e,this.$scrollbar.style.height=`${e}px`)}}const Ti=window.ResizeObserver||ns,$=640;class Ci{constructor({whiteboardView:e,readonly:s,box:i,pages:r,pageScrollTop:o=0,mountWhiteboard:n,onUserScroll:a}){this.sideEffect=new W,this.userScrolling=!1,this.onNewPageIndex=d=>{this.scrollToPage(d)},this.whiteboardView=e,this.readonly=s,this.box=i,this.pages=r,this.mountWhiteboard=n,this._onUserScroll=a;const c=this.debounce(()=>{this.userScrolling=!1,this._onUserScroll&&this._onUserScroll(this.pageRenderer.pagesScrollTop)},{wait:80},"debounce-updateUserScroll");this.updateUserScroll=()=>{this.userScrolling=!0,c()},this.viewer=new wt({readonly:s,box:i,pages:r,onNewPageIndex:this.onNewPageIndex});const{width:l,height:h}=this.whiteboardView.size;this.pageRenderer=new xi({pagesScrollTop:o,pages:this.pages,containerWidth:l,containerHeight:h,onPageIndexChanged:this.viewer.setPageIndex.bind(this.viewer)}),this.scrollbar=new Ei({pagesScrollTop:this.pageRenderer.pagesScrollTop,containerWidth:l,containerHeight:h,pagesWidth:this.pageRenderer.pagesIntrinsicWidth,pagesHeight:this.pageRenderer.pagesIntrinsicHeight,readonly:this.readonly,wrapClassName:this.wrapClassName.bind(this),onDragScroll:d=>{this.pageScrollTo(d),this.updateUserScroll()}}),this.pageScrollStepper=new vi({start:this.pageRenderer.pagesScrollTop,onStep:d=>{this.pageScrollTo(d)}}),this.render()}mount(){this.viewer.mount(),this.setupScrollListener();const e=this.debounce(this.renderRatioHeight.bind(this),{wait:80});return this.sideEffect.add(()=>{const s=new Ti(e);return s.observe(this.viewer.$content),()=>s.disconnect()}),this.sideEffect.setTimeout(()=>{this.userScrolling||this.pageScrollTo(this.pageRenderer.pagesScrollTop)},100),this}unmount(){return this.viewer.unmount(),this}setReadonly(e){this.readonly!==e&&(this.readonly=e,this.viewer.setReadonly(e),this.scrollbar.setReadonly(e))}destroy(){this.sideEffect.flushAll(),this.pageScrollStepper.destroy(),this._onUserScroll=void 0,this.unmount(),this.viewer.destroy(),this.pageRenderer.destroy(),this.scrollbar.destroy()}syncPageScrollTop(e){!this.userScrolling&&e>=0&&Math.abs(this.pageRenderer.pagesScrollTop-e)>.01&&this.pageScrollStepper.stepTo(e,this.pageRenderer.pagesScrollTop)}render(){this.pageRenderer.mount(this.viewer.$content),this.viewer.$content.appendChild(this.renderWhiteboardView()),this.scrollbar.mount(this.viewer.$content),this.renderRatioHeight()}renderRatioHeight(){const e=this.box.absoluteHeight,s=e<=$;if(this.viewer.setSmallBox(s),s){const i=26/$,r=26/e,o=26/$,n=0,a=Math.max((i+o-(r+n))/2,0);if(this.box.$titleBar){const c=r+a;this.box.$titleBar.style.height=`${c*100}%`}if(this.box.$footer){const c=n+a;this.box.$footer.style.height=`${c*100}%`}}else{if(this.box.$titleBar){const i=Math.max(26/$,26/e);this.box.$titleBar.style.height=`${i*100}%`}if(this.box.$footer){const i=Math.max(26/$,26/e);this.box.$footer.style.height=`${i*100}%`}}}renderWhiteboardView(){return this.$whiteboardView||(this.$whiteboardView=document.createElement("div"),this.$whiteboardView.className=this.wrapClassName("wb-view"),this.mountWhiteboard(this.$whiteboardView),this.sideEffect.addEventListener(this.$whiteboardView,"wheel",e=>{bt(e),this.readonly||(this.pageScrollTo(this.pageRenderer.pagesScrollTop+e.deltaY),this.updateUserScroll())},{passive:!1,capture:!0}),this.sideEffect.addEventListener(this.$whiteboardView,"touchmove",e=>{this.readonly||e.touches.length<=1||this.updateUserScroll()},{passive:!0,capture:!0})),this.$whiteboardView}scrollTopPageToEl(e){return e*this.pageRenderer.scale}scrollTopElToPage(e){return e/this.pageRenderer.scale}elScrollTo(e){this.pageScrollTo(this.scrollTopElToPage(e))}pageScrollTo(e){const s=this.scrollTopElToPage(this.whiteboardView.size.height/2);this.whiteboardView.moveCamera({centerY:E(e+s,s,this.pageRenderer.pagesIntrinsicHeight-s),animationMode:"immediately"})}scrollToPage(e){if(!this.readonly&&!Number.isNaN(e)){const s=this.pageRenderer.pagesIntrinsicYs[e];s>=0&&(this.pageScrollTo(s+5/this.pageRenderer.scale),this.updateUserScroll())}}setupScrollListener(){this.sideEffect.add(()=>{const e=s=>{const{width:i,height:r}=this.whiteboardView.size;if(i<=0||r<=0)return;const o=s.centerY-this.pageRenderer.containerHeight/this.pageRenderer.scale/2;this.pageRenderer.pagesScrollTo(o),this.scrollbar.pagesScrollTo(o)};return this.whiteboardView.callbacks.on("onCameraUpdated",e),()=>this.whiteboardView.callbacks.off("onCameraUpdated",e)}),this.sideEffect.add(()=>{const e=({width:s,height:i})=>{if(s<=0||i<=0)return;this.pageRenderer.setContainerSize(s,i),this.scrollbar.setContainerSize(s,i);const{pagesIntrinsicWidth:r,pagesIntrinsicHeight:o}=this.pageRenderer;this.whiteboardView.moveCameraToContain({originX:0,originY:this.pageRenderer.pagesScrollTop,width:r,height:i/this.pageRenderer.scale,animationMode:"immediately"}),this.whiteboardView.setCameraBound({damping:1,maxContentMode:()=>this.pageRenderer.scale,minContentMode:()=>this.pageRenderer.scale,centerX:r/2,centerY:o/2,width:r,height:o})};return this.whiteboardView.callbacks.on("onSizeUpdated",e),()=>{this.whiteboardView.callbacks.off("onSizeUpdated",e)}},"whiteboard-size-update"),this.sideEffect.addEventListener(window,"keyup",e=>{if(this.readonly||!this.box.focus||this.box.minimized)return;let s=null;switch(e.key){case"PageDown":{s=this.pageRenderer.pagesScrollTop+this.pageRenderer.containerHeight/this.pageRenderer.scale;break}case"PageUp":{s=this.pageRenderer.pagesScrollTop-this.pageRenderer.containerHeight/this.pageRenderer.scale;break}case"ArrowDown":{s=this.pageRenderer.pagesScrollTop+this.pageRenderer.containerHeight/4/this.pageRenderer.scale;break}case"ArrowUp":{s=this.pageRenderer.pagesScrollTop-this.pageRenderer.containerHeight/4/this.pageRenderer.scale;break}}s!==null&&(this._onUserScroll?this._onUserScroll(s):(this.pageScrollTo(s),this.updateUserScroll()))},{capture:!0})}debounce(e,s,i){const r=Mt(e,s);return this.sideEffect.addDisposer(()=>r.cancel(),i),r}wrapClassName(e){return"netless-app-docs-viewer-static-"+e}}class $i{constructor({context:e,whiteboardView:s,box:i,pages:r}){this.sideEffect=new W,this.onPlayPPT=()=>{const o=this.context.getRoom();o&&o.pptNextStep()},this._scaleDocsToFitImpl=()=>{const o=this.pages[this.getPageIndex()];o&&this.whiteboardView.moveCameraToContain({originX:-o.width/2,originY:-o.height/2,width:o.width,height:o.height,animationMode:"immediately"})},this._scaleDocsToFitDebounced=()=>{this.sideEffect.setTimeout(this._scaleDocsToFitImpl,1e3,"_scaleDocsToFitDebounced")},this.scaleDocsToFit=()=>{this._scaleDocsToFitImpl(),this._scaleDocsToFitDebounced()},this.onNewPageIndex=o=>{this.jumpToPage(o,!0)},this.context=e,this.whiteboardView=s,this.box=i,this.pages=r,this.displayer=e.getDisplayer(),this.viewer=new wt({readonly:!e.getIsWritable(),box:i,pages:r,onNewPageIndex:this.onNewPageIndex,onPlay:this.onPlayPPT}),this.render(),this.sideEffect.add(()=>{const o=n=>{this.viewer.setReadonly(!n)};return this.context.emitter.on("writableChange",o),()=>this.context.emitter.off("writableChange",o)}),this.sideEffect.add(()=>{const o=n=>{this.jumpToPage(n.index)};return this.context.emitter.on("sceneStateChange",o),()=>this.context.emitter.off("sceneStateChange",o)})}mount(){this.viewer.mount();const e=this.getPageIndex();return e!==0&&this.jumpToPage(e),this.scaleDocsToFit(),this.sideEffect.add(()=>(this.whiteboardView.callbacks.on("onSizeUpdated",this.scaleDocsToFit),()=>{this.whiteboardView.callbacks.off("onSizeUpdated",this.scaleDocsToFit)})),this}unmount(){return this.viewer.unmount(),this}destroy(){this.sideEffect.flushAll(),this.unmount(),this.viewer.destroy()}getPageIndex(){return this.displayer.state.sceneState.index}jumpToPage(e,s){var i,r;if(e=E(e,0,this.pages.length-1),e!==this.getPageIndex()&&this.context.getIsWritable()){const o=this.context.getInitScenePath(),n=(r=(i=this.context.getScenes())==null?void 0:i[e])==null?void 0:r.name;o&&n&&this.context.setScenePath(`${o}/${n}`),this.scaleDocsToFit()}if(e!==this.viewer.pageIndex&&this.viewer.setPageIndex(e),s){const o=this.context.getRoom();if(o){const n=o.state.globalState.__pptState;o.setGlobalState({__pptState:n&&{uuid:n.uuid,pageIndex:e,disableAutoPlay:n.disableAutoPlay}})}}}render(){this.viewer.$content.appendChild(this.renderMask()),this.viewer.$content.appendChild(this.renderWhiteboardView()),this.sideEffect.addEventListener(window,"keydown",e=>{var s;if(this.box.focus)switch(e.key){case"ArrowUp":case"ArrowLeft":{this.jumpToPage(this.getPageIndex()-1,!0);break}case"ArrowRight":case"ArrowDown":{(s=this.context.getRoom())==null||s.pptNextStep();break}}})}renderMask(){if(!this.$mask){const e=document.createElement("div");e.className=this.wrapClassName("mask"),this.$mask=e;const s=document.createElement("button");s.className=this.wrapClassName("back");const i=document.createElement("button");i.className=this.wrapClassName("next")}return this.$mask}renderWhiteboardView(){return this.$whiteboardView||(this.$whiteboardView=document.createElement("div"),this.$whiteboardView.className=this.wrapClassName("wb-view"),this.sideEffect.addEventListener(this.$whiteboardView,"click",e=>{var i;const s=this.context.getRoom();if(s&&s.state.memberState.currentApplianceName==="clicker"){for(let r=e.target;r;r=r.parentElement)if((i=r.classList)==null?void 0:i.contains("ppt-event-source"))return;s.pptNextStep()}}),this.context.mountView(this.$whiteboardView)),this.$whiteboardView}wrapClassName(e){return"netless-app-docs-viewer-dynamic-"+e}}const _i="DocsViewer",Ii={kind:_i,setup(t){const e=t.getBox(),s=t.getScenes();if(!s)throw new Error("[Docs Viewer]: scenes not found.");const i=t.getView();if(!i)throw new Error("[Docs Viewer]: no whiteboard view.");const r=s.map(({ppt:o})=>o?{width:o.width,height:o.height,src:o.src,thumbnail:o.previewURL}:null).filter(o=>Boolean(o));if(r.length<=0)throw new Error("[Docs Viewer]: empty scenes.");e.mountStyles(Nt),r[0].src.startsWith("ppt")?ki(t,i,e,r):Ni(t,i,e,r)}};function Ni(t,e,s,i){var o;e.disableCameraTransform=!t.getIsWritable();const r=new Ci({whiteboardView:e,readonly:!t.getIsWritable(),box:s,pages:i,pageScrollTop:(o=t.getAttributes())==null?void 0:o.pageScrollTop,mountWhiteboard:t.mountView.bind(t),onUserScroll:n=>{var a;((a=t.getAttributes())==null?void 0:a.pageScrollTop)!==n&&!s.readonly&&t.updateAttributes(["pageScrollTop"],n)}}).mount();t.emitter.on("attributesUpdate",n=>{n&&n.pageScrollTop!=null&&r.syncPageScrollTop(n.pageScrollTop)}),t.emitter.on("writableChange",n=>{r.setReadonly(!n),e.disableCameraTransform=!n})}function ki(t,e,s,i){e.disableCameraTransform=!0;const r=new $i({context:t,whiteboardView:e,box:s,pages:i}).mount();t.mountView(r.$whiteboardView),t.isAddApp&&e.callbacks.once("onSizeUpdated",({width:o,height:n})=>{if(i.length>0&&s.state!=="maximized"){const{width:a,height:c}=i[0],h=c/a*o-n;h!==0&&t.getIsWritable()&&t.emitter.emit("setBoxSize",{width:s.width,height:s.height+h/s.containerRect.height})}})}exports.default=Ii; | ||
"use strict";var _t=Object.defineProperty,$t=Object.defineProperties;var It=Object.getOwnPropertyDescriptors;var xe=Object.getOwnPropertySymbols;var Nt=Object.prototype.hasOwnProperty,kt=Object.prototype.propertyIsEnumerable;var ye=(t,e,s)=>e in t?_t(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,Z=(t,e)=>{for(var s in e||(e={}))Nt.call(e,s)&&ye(t,s,e[s]);if(xe)for(var s of xe(e))kt.call(e,s)&&ye(t,s,e[s]);return t},Q=(t,e)=>$t(t,It(e));Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var Rt=`.netless-app-docs-viewer-content{position:relative;height:100%;overflow:hidden}.netless-app-docs-viewer-preview-mask{display:none;position:absolute;z-index:200;top:0;left:0;width:100%;height:100%}.netless-app-docs-viewer-preview{display:flex;flex-direction:column;align-items:center;position:absolute;z-index:300;top:0;left:0;width:33%;max-width:200px;height:100%;padding-top:10px;transform:translate(-100%);background:rgba(237,237,240,.9);box-shadow:inset -1px 0 #0000001c;transition:transform .4s}.netless-app-docs-viewer-preview-active .netless-app-docs-viewer-preview-mask{display:block}.netless-app-docs-viewer-preview-active .netless-app-docs-viewer-preview{transform:translate(0)}.netless-app-docs-viewer-preview-page{position:relative;display:block;width:55%;margin-bottom:10px;font-size:0;color:transparent;outline:none;border:7px solid transparent;border-radius:4px;transition:border-color .3s;user-select:none}.netless-app-docs-viewer-preview-page:hover,.netless-app-docs-viewer-preview-page.netless-app-docs-viewer-preview-page-active{border-color:#444e601a}.netless-app-docs-viewer-preview-page>img{width:100%;height:auto;box-sizing:border-box;border:1px solid rgba(0,0,0,.5);border-radius:1px;background-color:#fff;box-shadow:0 2px 8px #0000004d}.netless-app-docs-viewer-preview-page-name{position:absolute;top:1px;left:-10px;transform:translate(-100%);text-align:right;font-size:12px;color:#5f5f5f;user-select:none}.netless-app-docs-viewer-footer{box-sizing:border-box;height:26px;display:flex;align-items:center;padding:0 16px;border-top:1px solid #eeeef7;color:#191919}.netless-app-docs-viewer-float-footer{width:100%;min-height:26px;position:absolute;left:0;bottom:0;z-index:2000;background:rgba(249,249,252,.9);transition:opacity .4s}.netless-app-docs-viewer-footer-btn{box-sizing:border-box;width:26px;height:26px;font-size:0;margin:0;padding:3px;border:none;border-radius:1px;outline:none;color:currentColor;background:transparent;transition:background .4s;cursor:pointer;user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}.netless-app-docs-viewer-footer-btn:hover{background:rgba(237,237,240,.9)}@media (hover: none){.netless-app-docs-viewer-footer-btn:hover{background:transparent!important}}.netless-app-docs-viewer-footer-btn>svg{width:100%;height:100%}.netless-app-docs-viewer-footer-btn>svg:nth-of-type(2){display:none}.netless-app-docs-viewer-footer-btn.netless-app-docs-viewer-footer-btn-playing>svg:nth-of-type(1){display:none}.netless-app-docs-viewer-footer-btn.netless-app-docs-viewer-footer-btn-playing>svg:nth-of-type(2){display:initial}.netless-app-docs-viewer-footer-btn~.netless-app-docs-viewer-footer-btn{margin-left:15px}.netless-app-docs-viewer-page-jumps{flex:1;display:flex;justify-content:center;align-items:center}.netless-app-docs-viewer-page-number{margin-left:auto;font-size:13px;user-select:none;white-space:nowrap;word-break:keep-all}.netless-app-docs-viewer-page-number-input{border:none;outline:none;width:3em;margin:0;padding:0 2px;text-align:right;font-size:13px;line-height:1;font-weight:400;font-family:inherit;border-radius:2px;color:currentColor;background:transparent;transition:background .4s;user-select:text;-webkit-tap-highlight-color:rgba(0,0,0,0)}.netless-app-docs-viewer-page-number-input:hover,.netless-app-docs-viewer-page-number-input:focus,.netless-app-docs-viewer-page-number-input:active{background:#fff;box-shadow:#63636333 0 2px 8px}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-footer-btn{cursor:not-allowed}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-footer-btn:hover{background:transparent}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input{cursor:not-allowed}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input:hover,.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input:focus,.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input:active{background:transparent;box-shadow:none}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input:disabled{color:inherit}.netless-app-docs-viewer-readonly.netless-app-docs-viewer-float-footer{display:none}.telebox-color-scheme-dark .netless-app-docs-viewer-page-number-input{color:#a6a6a8}.telebox-color-scheme-dark .netless-app-docs-viewer-page-number-input:active,.telebox-color-scheme-dark .netless-app-docs-viewer-page-number-input:focus,.telebox-color-scheme-dark .netless-app-docs-viewer-page-number-input:hover{color:#222}.telebox-color-scheme-dark .netless-app-docs-viewer-footer{color:#a6a6a8;background:#2d2d33;border-top:none}.telebox-color-scheme-dark .netless-app-docs-viewer-footer-btn:hover{background:#212126}.telebox-color-scheme-dark .netless-app-docs-viewer-preview{background:rgba(50,50,50,.9)}.netless-app-docs-viewer-static-scrollbar{position:absolute;top:0;right:0;z-index:2147483647;width:8px;min-height:30px;margin:0;padding:0;border:none;outline:none;border-radius:4px;background:rgba(68,78,96,.4);box-shadow:1px 1px 8px #ffffffb3;opacity:0;transition:background .4s,opacity .4s 3s,transform .2s;user-select:none}.netless-app-docs-viewer-static-scrollbar.netless-app-docs-viewer-static-scrollbar-dragging{background:rgba(68,78,96,.6);opacity:1;transition:background .4s,opacity .4s 3s!important}.netless-app-docs-viewer-static-scrollbar:hover,.netless-app-docs-viewer-static-scrollbar:focus{background:rgba(68,78,96,.5)}.netless-app-docs-viewer-static-scrollbar:active{background:rgba(68,78,96,.6)}.netless-app-docs-viewer-content:hover .netless-app-docs-viewer-static-scrollbar{opacity:1;transition:background .4s,opacity .4s,transform .2s}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-static-scrollbar{display:none}.netless-app-docs-viewer-static-pages:hover .netless-app-docs-viewer-static-scrollbar{opacity:1;transition:background .4s,opacity .4s,transform .2s}.page-renderer-pages-container{position:relative;overflow:hidden}.page-renderer-page{position:absolute;top:0;left:0;background-position:center;background-size:cover;background-repeat:no-repeat}.page-renderer-pages-container.is-hwa .page-renderer-page{will-change:transform}.page-renderer-page-img{display:block;width:100%;height:auto;user-select:none}.netless-app-docs-viewer-static-pages{overflow:hidden;position:relative;height:100%;user-select:none}.netless-app-docs-viewer-static-page{display:block;width:100%;height:auto;user-select:none}.netless-app-docs-viewer-static-wb-view,.netless-app-docs-viewer-dynamic-wb-view{position:absolute;top:0;left:0;width:100%;height:100%;z-index:100;overflow:hidden}.netless-app-docs-viewer-dynamic-wb-view .cursor-clicker .ppt-event-source{cursor:pointer} | ||
`;const Ot=(t,e,s,i)=>{if(s==="length"||s==="prototype"||s==="arguments"||s==="caller")return;const r=Object.getOwnPropertyDescriptor(t,s),o=Object.getOwnPropertyDescriptor(e,s);!Lt(r,o)&&i||Object.defineProperty(t,s,o)},Lt=function(t,e){return t===void 0||t.configurable||t.writable===e.writable&&t.enumerable===e.enumerable&&t.configurable===e.configurable&&(t.writable||t.value===e.value)},Pt=(t,e)=>{const s=Object.getPrototypeOf(e);s!==Object.getPrototypeOf(t)&&Object.setPrototypeOf(t,s)},zt=(t,e)=>`/* Wrapped ${t}*/ | ||
${e}`,At=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Ht=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Mt=(t,e,s)=>{const i=s===""?"":`with ${s.trim()}() `,r=zt.bind(null,i,e.toString());Object.defineProperty(r,"name",Ht),Object.defineProperty(t,"toString",Q(Z({},At),{value:r}))};function Vt(t,e,{ignoreNonConfigurable:s=!1}={}){const{name:i}=t;for(const r of Reflect.ownKeys(e))Ot(t,e,r,s);return Pt(t,e),Mt(t,e,i),t}const Bt=(t,e={})=>{if(typeof t!="function")throw new TypeError(`Expected the first argument to be a function, got \`${typeof t}\``);const{wait:s=0,maxWait:i=Number.Infinity,before:r=!1,after:o=!0}=e;if(!r&&!o)throw new Error("Both `before` and `after` are false, function wouldn't be called.");let n,a,c;const l=function(...h){const d=this,G=()=>{n=void 0,a&&(clearTimeout(a),a=void 0),o&&(c=t.apply(d,h))},X=()=>{a=void 0,n&&(clearTimeout(n),n=void 0),o&&(c=t.apply(d,h))},q=r&&!n;return clearTimeout(n),n=setTimeout(G,s),i>0&&i!==Number.Infinity&&!a&&(a=setTimeout(X,i)),q&&(c=t.apply(d,h)),c};return Vt(l,t),l.cancel=()=>{n&&(clearTimeout(n),n=void 0),a&&(clearTimeout(a),a=void 0)},l},Ve="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",Dt=Ve.length,Ee=Array(20),$=()=>{for(let t=0;t<20;t++)Ee[t]=Ve.charAt(Math.random()*Dt);return Ee.join("")};class W{constructor(){this.disposers=new Map}add(e,s=$()){return this.flush(s),this.disposers.set(s,e()),s}addDisposer(e,s=$()){return this.flush(s),this.disposers.set(s,e),s}addEventListener(e,s,i,r,o=$()){return this.add(()=>(e.addEventListener(s,i,r),()=>e.removeEventListener(s,i,r)),o),o}setTimeout(e,s,i=$()){return this.add(()=>{const r=window.setTimeout(()=>{this.remove(i),e()},s);return()=>window.clearTimeout(r)},i)}setInterval(e,s,i=$()){return this.add(()=>{const r=window.setInterval(e,s);return()=>window.clearInterval(r)},i)}remove(e){const s=this.disposers.get(e);return this.disposers.delete(e),s}flush(e){const s=this.remove(e);if(s)try{s()}catch(i){console.error(i)}}flushAll(){this.disposers.forEach(e=>{try{e()}catch(s){console.error(s)}}),this.disposers.clear()}}var b=[],Wt=function(){return b.some(function(t){return t.activeTargets.length>0})},Ft=function(){return b.some(function(t){return t.skippedTargets.length>0})},Te="ResizeObserver loop completed with undelivered notifications.",Ut=function(){var t;typeof ErrorEvent=="function"?t=new ErrorEvent("error",{message:Te}):(t=document.createEvent("Event"),t.initEvent("error",!1,!1),t.message=Te),window.dispatchEvent(t)},k;(function(t){t.BORDER_BOX="border-box",t.CONTENT_BOX="content-box",t.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(k||(k={}));var m=function(t){return Object.freeze(t)},Yt=function(){function t(e,s){this.inlineSize=e,this.blockSize=s,m(this)}return t}(),Be=function(){function t(e,s,i,r){return this.x=e,this.y=s,this.width=i,this.height=r,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,m(this)}return t.prototype.toJSON=function(){var e=this,s=e.x,i=e.y,r=e.top,o=e.right,n=e.bottom,a=e.left,c=e.width,l=e.height;return{x:s,y:i,top:r,right:o,bottom:n,left:a,width:c,height:l}},t.fromRect=function(e){return new t(e.x,e.y,e.width,e.height)},t}(),re=function(t){return t instanceof SVGElement&&"getBBox"in t},De=function(t){if(re(t)){var e=t.getBBox(),s=e.width,i=e.height;return!s&&!i}var r=t,o=r.offsetWidth,n=r.offsetHeight;return!(o||n||t.getClientRects().length)},Ce=function(t){var e,s;if(t instanceof Element)return!0;var i=(s=(e=t)===null||e===void 0?void 0:e.ownerDocument)===null||s===void 0?void 0:s.defaultView;return!!(i&&t instanceof i.Element)},jt=function(t){switch(t.tagName){case"INPUT":if(t.type!=="image")break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1},N=typeof window!="undefined"?window:{},A=new WeakMap,_e=/auto|scroll/,Gt=/^tb|vertical/,Xt=/msie|trident/i.test(N.navigator&&N.navigator.userAgent),u=function(t){return parseFloat(t||"0")},y=function(t,e,s){return t===void 0&&(t=0),e===void 0&&(e=0),s===void 0&&(s=!1),new Yt((s?e:t)||0,(s?t:e)||0)},$e=m({devicePixelContentBoxSize:y(),borderBoxSize:y(),contentBoxSize:y(),contentRect:new Be(0,0,0,0)}),We=function(t,e){if(e===void 0&&(e=!1),A.has(t)&&!e)return A.get(t);if(De(t))return A.set(t,$e),$e;var s=getComputedStyle(t),i=re(t)&&t.ownerSVGElement&&t.getBBox(),r=!Xt&&s.boxSizing==="border-box",o=Gt.test(s.writingMode||""),n=!i&&_e.test(s.overflowY||""),a=!i&&_e.test(s.overflowX||""),c=i?0:u(s.paddingTop),l=i?0:u(s.paddingRight),h=i?0:u(s.paddingBottom),d=i?0:u(s.paddingLeft),G=i?0:u(s.borderTopWidth),X=i?0:u(s.borderRightWidth),q=i?0:u(s.borderBottomWidth),xt=i?0:u(s.borderLeftWidth),ve=d+l,we=c+h,J=xt+X,K=G+q,be=a?t.offsetHeight-K-t.clientHeight:0,me=n?t.offsetWidth-J-t.clientWidth:0,yt=r?ve+J:0,Et=r?we+K:0,P=i?i.width:u(s.width)-yt-me,z=i?i.height:u(s.height)-Et-be,Tt=P+ve+me+J,Ct=z+we+be+K,Se=m({devicePixelContentBoxSize:y(Math.round(P*devicePixelRatio),Math.round(z*devicePixelRatio),o),borderBoxSize:y(Tt,Ct,o),contentBoxSize:y(P,z,o),contentRect:new Be(d,c,P,z)});return A.set(t,Se),Se},Fe=function(t,e,s){var i=We(t,s),r=i.borderBoxSize,o=i.contentBoxSize,n=i.devicePixelContentBoxSize;switch(e){case k.DEVICE_PIXEL_CONTENT_BOX:return n;case k.BORDER_BOX:return r;default:return o}},qt=function(){function t(e){var s=We(e);this.target=e,this.contentRect=s.contentRect,this.borderBoxSize=m([s.borderBoxSize]),this.contentBoxSize=m([s.contentBoxSize]),this.devicePixelContentBoxSize=m([s.devicePixelContentBoxSize])}return t}(),Ue=function(t){if(De(t))return 1/0;for(var e=0,s=t.parentNode;s;)e+=1,s=s.parentNode;return e},Jt=function(){var t=1/0,e=[];b.forEach(function(n){if(n.activeTargets.length!==0){var a=[];n.activeTargets.forEach(function(l){var h=new qt(l.target),d=Ue(l.target);a.push(h),l.lastReportedSize=Fe(l.target,l.observedBox),d<t&&(t=d)}),e.push(function(){n.callback.call(n.observer,a,n.observer)}),n.activeTargets.splice(0,n.activeTargets.length)}});for(var s=0,i=e;s<i.length;s++){var r=i[s];r()}return t},Ie=function(t){b.forEach(function(s){s.activeTargets.splice(0,s.activeTargets.length),s.skippedTargets.splice(0,s.skippedTargets.length),s.observationTargets.forEach(function(r){r.isActive()&&(Ue(r.target)>t?s.activeTargets.push(r):s.skippedTargets.push(r))})})},Kt=function(){var t=0;for(Ie(t);Wt();)t=Jt(),Ie(t);return Ft()&&Ut(),t>0},ee,Ye=[],Zt=function(){return Ye.splice(0).forEach(function(t){return t()})},Qt=function(t){if(!ee){var e=0,s=document.createTextNode(""),i={characterData:!0};new MutationObserver(function(){return Zt()}).observe(s,i),ee=function(){s.textContent=""+(e?e--:e++)}}Ye.push(t),ee()},es=function(t){Qt(function(){requestAnimationFrame(t)})},V=0,ts=function(){return!!V},ss=250,is={attributes:!0,characterData:!0,childList:!0,subtree:!0},Ne=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],ke=function(t){return t===void 0&&(t=0),Date.now()+t},te=!1,rs=function(){function t(){var e=this;this.stopped=!0,this.listener=function(){return e.schedule()}}return t.prototype.run=function(e){var s=this;if(e===void 0&&(e=ss),!te){te=!0;var i=ke(e);es(function(){var r=!1;try{r=Kt()}finally{if(te=!1,e=i-ke(),!ts())return;r?s.run(1e3):e>0?s.run(e):s.start()}})}},t.prototype.schedule=function(){this.stop(),this.run()},t.prototype.observe=function(){var e=this,s=function(){return e.observer&&e.observer.observe(document.body,is)};document.body?s():N.addEventListener("DOMContentLoaded",s)},t.prototype.start=function(){var e=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),Ne.forEach(function(s){return N.addEventListener(s,e.listener,!0)}))},t.prototype.stop=function(){var e=this;this.stopped||(this.observer&&this.observer.disconnect(),Ne.forEach(function(s){return N.removeEventListener(s,e.listener,!0)}),this.stopped=!0)},t}(),se=new rs,Re=function(t){!V&&t>0&&se.start(),V+=t,!V&&se.stop()},os=function(t){return!re(t)&&!jt(t)&&getComputedStyle(t).display==="inline"},ns=function(){function t(e,s){this.target=e,this.observedBox=s||k.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return t.prototype.isActive=function(){var e=Fe(this.target,this.observedBox,!0);return os(this.target)&&(this.lastReportedSize=e),this.lastReportedSize.inlineSize!==e.inlineSize||this.lastReportedSize.blockSize!==e.blockSize},t}(),as=function(){function t(e,s){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=e,this.callback=s}return t}(),H=new WeakMap,Oe=function(t,e){for(var s=0;s<t.length;s+=1)if(t[s].target===e)return s;return-1},M=function(){function t(){}return t.connect=function(e,s){var i=new as(e,s);H.set(e,i)},t.observe=function(e,s,i){var r=H.get(e),o=r.observationTargets.length===0;Oe(r.observationTargets,s)<0&&(o&&b.push(r),r.observationTargets.push(new ns(s,i&&i.box)),Re(1),se.schedule())},t.unobserve=function(e,s){var i=H.get(e),r=Oe(i.observationTargets,s),o=i.observationTargets.length===1;r>=0&&(o&&b.splice(b.indexOf(i),1),i.observationTargets.splice(r,1),Re(-1))},t.disconnect=function(e){var s=this,i=H.get(e);i.observationTargets.slice().forEach(function(r){return s.unobserve(e,r.target)}),i.activeTargets.splice(0,i.activeTargets.length)},t}(),cs=function(){function t(e){if(arguments.length===0)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if(typeof e!="function")throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");M.connect(this,e)}return t.prototype.observe=function(e,s){if(arguments.length===0)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!Ce(e))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");M.observe(this,e,s)},t.prototype.unobserve=function(e){if(arguments.length===0)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!Ce(e))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");M.unobserve(this,e)},t.prototype.disconnect=function(){M.disconnect(this)},t.toString=function(){return"function ResizeObserver () { [polyfill code] }"},t}();function ls(t){const e="http://www.w3.org/2000/svg",s=document.createElementNS(e,"svg");s.setAttribute("class",`${t}-footer-icon-sidebar`),s.setAttribute("viewBox","0 0 64 64");const i=document.createElementNS(e,"path");return i.setAttribute("fill","currentColor"),i.setAttribute("d","M50 8H14c-3.309 0-6 2.691-6 6v36c0 3.309 2.691 6 6 6h36c3.309 0 6-2.691 6-6V14c0-3.309-2.691-6-6-6zM12 50V14c0-1.103.897-2 2-2h8v40h-8c-1.103 0-2-.897-2-2zm40 0c0 1.103-.897 2-2 2H26V12h24c1.103 0 2 .897 2 2z"),s.appendChild(i),s}function hs(t){const e="http://www.w3.org/2000/svg",s=document.createElementNS(e,"svg");s.setAttribute("class",`${t}-footer-icon-arrow-left`),s.setAttribute("viewBox","0 0 500 500");const i=document.createElementNS(e,"path");return i.setAttribute("fill","currentColor"),i.setAttribute("d","M177.81 249.959L337.473 90.295c2.722-2.865 2.651-7.378-.143-10.1-2.793-2.65-7.163-2.65-9.956 0l-164.75 164.75c-2.793 2.793-2.793 7.306 0 10.1l164.75 164.75c2.865 2.722 7.378 2.65 10.099-.143 2.651-2.794 2.651-7.163 0-9.957L177.809 249.959z"),s.appendChild(i),s}function ds(t){const e="http://www.w3.org/2000/svg",s=document.createElementNS(e,"svg");s.setAttribute("class",`${t}-footer-icon-arrow-right`),s.setAttribute("viewBox","0 0 500 500");const i=document.createElementNS(e,"path");return i.setAttribute("fill","currentColor"),i.setAttribute("d","M322.19 250.041L162.527 409.705c-2.722 2.865-2.651 7.378.143 10.1 2.793 2.65 7.163 2.65 9.956 0l164.75-164.75c2.793-2.793 2.793-7.306 0-10.1l-164.75-164.75c-2.865-2.722-7.378-2.65-10.099.143-2.651 2.794-2.651 7.163 0 9.957l159.664 159.736z"),s.appendChild(i),s}function ps(t){const e="http://www.w3.org/2000/svg",s=document.createElementNS(e,"svg");s.setAttribute("class",`${t}-footer-icon-play`),s.setAttribute("viewBox","0 0 500 500");const i=document.createElementNS(e,"path");return i.setAttribute("fill","currentColor"),i.setAttribute("d","M418.158 257.419L174.663 413.33c-6.017 3.919-15.708 3.772-21.291-.29-2.791-2.018-4.295-4.483-4.295-7.084V94.109c0-5.65 6.883-10.289 15.271-10.289 4.298 0 8.391 1.307 11.181 3.332l242.629 155.484c6.016 3.917 6.451 10.292.649 14.491-.216.154-.432.154-.649.292zM170.621 391.288l223.116-141.301L170.71 107.753l-.089 283.535z"),s.appendChild(i),s}function us(t){const e="http://www.w3.org/2000/svg",s=document.createElementNS(e,"svg");s.setAttribute("class",`${t}-footer-icon-pause`),s.setAttribute("viewBox","0 0 500 500");const i=document.createElementNS(e,"path");return i.setAttribute("fill","currentColor"),i.setAttribute("d","M312.491 78.261c0-6.159 4.893-11.213 11.04-11.213 6.158 0 11.211 5.054 11.211 11.213v343.478c0 6.159-5.053 11.213-11.211 11.213-6.147 0-11.04-5.054-11.04-11.213V78.261zM165.257 78.261c0-6.159 4.893-11.213 11.04-11.213 6.158 0 11.211 5.054 11.211 11.213v343.478c0 6.159-5.053 11.213-11.211 11.213-6.147 0-11.04-5.054-11.04-11.213V78.261z"),s.appendChild(i),s}const S=typeof window!="undefined",je=S&&!("onscroll"in window)||typeof navigator!="undefined"&&/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),Ge=S&&"IntersectionObserver"in window,Xe=S&&"classList"in document.createElement("p"),qe=S&&window.devicePixelRatio>1,gs={elements_selector:".lazy",container:je||S?document:null,threshold:300,thresholds:null,data_src:"src",data_srcset:"srcset",data_sizes:"sizes",data_bg:"bg",data_bg_hidpi:"bg-hidpi",data_bg_multi:"bg-multi",data_bg_multi_hidpi:"bg-multi-hidpi",data_poster:"poster",class_applied:"applied",class_loading:"loading",class_loaded:"loaded",class_error:"error",class_entered:"entered",class_exited:"exited",unobserve_completed:!0,unobserve_entered:!1,cancel_on_exit:!0,callback_enter:null,callback_exit:null,callback_applied:null,callback_loading:null,callback_loaded:null,callback_error:null,callback_finish:null,callback_cancel:null,use_native:!1},Je=t=>Object.assign({},gs,t),Le=function(t,e){let s;const i="LazyLoad::Initialized",r=new t(e);try{s=new CustomEvent(i,{detail:{instance:r}})}catch{s=document.createEvent("CustomEvent"),s.initCustomEvent(i,!1,!1,{instance:r})}window.dispatchEvent(s)},fs=(t,e)=>{if(!!e)if(!e.length)Le(t,e);else for(let s=0,i;i=e[s];s+=1)Le(t,i)},f="src",oe="srcset",ne="sizes",Ke="poster",R="llOriginalAttrs",Ze="data",ae="loading",Qe="loaded",et="applied",vs="entered",ce="error",tt="native",st="data-",it="ll-status",p=(t,e)=>t.getAttribute(st+e),ws=(t,e,s)=>{var i=st+e;if(s===null){t.removeAttribute(i);return}t.setAttribute(i,s)},O=t=>p(t,it),x=(t,e)=>ws(t,it,e),F=t=>x(t,null),le=t=>O(t)===null,bs=t=>O(t)===ae,ms=t=>O(t)===ce,he=t=>O(t)===tt,Ss=[ae,Qe,et,ce],xs=t=>Ss.indexOf(O(t))>=0,w=(t,e,s,i)=>{if(!!t){if(i!==void 0){t(e,s,i);return}if(s!==void 0){t(e,s);return}t(e)}},_=(t,e)=>{if(Xe){t.classList.add(e);return}t.className+=(t.className?" ":"")+e},g=(t,e)=>{if(Xe){t.classList.remove(e);return}t.className=t.className.replace(new RegExp("(^|\\s+)"+e+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},ys=t=>{t.llTempImage=document.createElement("IMG")},Es=t=>{delete t.llTempImage},rt=t=>t.llTempImage,U=(t,e)=>{if(!e)return;const s=e._observer;!s||s.unobserve(t)},Ts=t=>{t.disconnect()},Cs=(t,e,s)=>{e.unobserve_entered&&U(t,s)},de=(t,e)=>{!t||(t.loadingCount+=e)},_s=t=>{!t||(t.toLoadCount-=1)},ot=(t,e)=>{!t||(t.toLoadCount=e)},$s=t=>t.loadingCount>0,Is=t=>t.toLoadCount>0,nt=t=>{let e=[];for(let s=0,i;i=t.children[s];s+=1)i.tagName==="SOURCE"&&e.push(i);return e},pe=(t,e)=>{const s=t.parentNode;if(!s||s.tagName!=="PICTURE")return;nt(s).forEach(e)},at=(t,e)=>{nt(t).forEach(e)},Y=[f],ct=[f,Ke],B=[f,oe,ne],lt=[Ze],j=t=>!!t[R],ht=t=>t[R],dt=t=>delete t[R],E=(t,e)=>{if(j(t))return;const s={};e.forEach(i=>{s[i]=t.getAttribute(i)}),t[R]=s},Ns=t=>{j(t)||(t[R]={backgroundImage:t.style.backgroundImage})},ks=(t,e,s)=>{if(!s){t.removeAttribute(e);return}t.setAttribute(e,s)},T=(t,e)=>{if(!j(t))return;const s=ht(t);e.forEach(i=>{ks(t,i,s[i])})},Rs=t=>{if(!j(t))return;const e=ht(t);t.style.backgroundImage=e.backgroundImage},Os=(t,e,s)=>{_(t,e.class_applied),x(t,et),s&&(e.unobserve_completed&&U(t,e),w(e.callback_applied,t,s))},pt=(t,e,s)=>{_(t,e.class_loading),x(t,ae),s&&(de(s,1),w(e.callback_loading,t,s))},v=(t,e,s)=>{!s||t.setAttribute(e,s)},Pe=(t,e)=>{v(t,ne,p(t,e.data_sizes)),v(t,oe,p(t,e.data_srcset)),v(t,f,p(t,e.data_src))},Ls=(t,e)=>{pe(t,s=>{E(s,B),Pe(s,e)}),E(t,B),Pe(t,e)},Ps=(t,e)=>{E(t,Y),v(t,f,p(t,e.data_src))},zs=(t,e)=>{at(t,s=>{E(s,Y),v(s,f,p(s,e.data_src))}),E(t,ct),v(t,Ke,p(t,e.data_poster)),v(t,f,p(t,e.data_src)),t.load()},As=(t,e)=>{E(t,lt),v(t,Ze,p(t,e.data_src))},Hs=(t,e,s)=>{const i=p(t,e.data_bg),r=p(t,e.data_bg_hidpi),o=qe&&r?r:i;!o||(t.style.backgroundImage=`url("${o}")`,rt(t).setAttribute(f,o),pt(t,e,s))},Ms=(t,e,s)=>{const i=p(t,e.data_bg_multi),r=p(t,e.data_bg_multi_hidpi),o=qe&&r?r:i;!o||(t.style.backgroundImage=o,Os(t,e,s))},ut={IMG:Ls,IFRAME:Ps,VIDEO:zs,OBJECT:As},Vs=(t,e)=>{const s=ut[t.tagName];!s||s(t,e)},Bs=(t,e,s)=>{const i=ut[t.tagName];!i||(i(t,e),pt(t,e,s))},Ds=["IMG","IFRAME","VIDEO","OBJECT"],Ws=t=>Ds.indexOf(t.tagName)>-1,gt=(t,e)=>{e&&!$s(e)&&!Is(e)&&w(t.callback_finish,e)},ze=(t,e,s)=>{t.addEventListener(e,s),t.llEvLisnrs[e]=s},Fs=(t,e,s)=>{t.removeEventListener(e,s)},ue=t=>!!t.llEvLisnrs,Us=(t,e,s)=>{ue(t)||(t.llEvLisnrs={});const i=t.tagName==="VIDEO"?"loadeddata":"load";ze(t,i,e),ze(t,"error",s)},ie=t=>{if(!ue(t))return;const e=t.llEvLisnrs;for(let s in e){const i=e[s];Fs(t,s,i)}delete t.llEvLisnrs},ft=(t,e,s)=>{Es(t),de(s,-1),_s(s),g(t,e.class_loading),e.unobserve_completed&&U(t,s)},Ys=(t,e,s,i)=>{const r=he(e);ft(e,s,i),_(e,s.class_loaded),x(e,Qe),w(s.callback_loaded,e,i),r||gt(s,i)},js=(t,e,s,i)=>{const r=he(e);ft(e,s,i),_(e,s.class_error),x(e,ce),w(s.callback_error,e,i),r||gt(s,i)},ge=(t,e,s)=>{const i=rt(t)||t;if(ue(i))return;Us(i,n=>{Ys(n,t,e,s),ie(i)},n=>{js(n,t,e,s),ie(i)})},Gs=(t,e,s)=>{ys(t),ge(t,e,s),Ns(t),Hs(t,e,s),Ms(t,e,s)},Xs=(t,e,s)=>{ge(t,e,s),Bs(t,e,s)},fe=(t,e,s)=>{Ws(t)?Xs(t,e,s):Gs(t,e,s)},qs=(t,e,s)=>{t.setAttribute("loading","lazy"),ge(t,e,s),Vs(t,e),x(t,tt)},Ae=t=>{t.removeAttribute(f),t.removeAttribute(oe),t.removeAttribute(ne)},Js=t=>{pe(t,e=>{Ae(e)}),Ae(t)},vt=t=>{pe(t,e=>{T(e,B)}),T(t,B)},Ks=t=>{at(t,e=>{T(e,Y)}),T(t,ct),t.load()},Zs=t=>{T(t,Y)},Qs=t=>{T(t,lt)},ei={IMG:vt,IFRAME:Zs,VIDEO:Ks,OBJECT:Qs},ti=t=>{const e=ei[t.tagName];if(!e){Rs(t);return}e(t)},si=(t,e)=>{le(t)||he(t)||(g(t,e.class_entered),g(t,e.class_exited),g(t,e.class_applied),g(t,e.class_loading),g(t,e.class_loaded),g(t,e.class_error))},ii=(t,e)=>{ti(t),si(t,e),F(t),dt(t)},ri=(t,e,s,i)=>{!s.cancel_on_exit||!bs(t)||t.tagName==="IMG"&&(ie(t),Js(t),vt(t),g(t,s.class_loading),de(i,-1),F(t),w(s.callback_cancel,t,e,i))},oi=(t,e,s,i)=>{const r=xs(t);x(t,vs),_(t,s.class_entered),g(t,s.class_exited),Cs(t,s,i),w(s.callback_enter,t,e,i),!r&&fe(t,s,i)},ni=(t,e,s,i)=>{le(t)||(_(t,s.class_exited),ri(t,e,s,i),w(s.callback_exit,t,e,i))},ai=["IMG","IFRAME","VIDEO"],wt=t=>t.use_native&&"loading"in HTMLImageElement.prototype,ci=(t,e,s)=>{t.forEach(i=>{ai.indexOf(i.tagName)!==-1&&qs(i,e,s)}),ot(s,0)},li=t=>t.isIntersecting||t.intersectionRatio>0,hi=t=>({root:t.container===document?null:t.container,rootMargin:t.thresholds||t.threshold+"px"}),di=(t,e,s)=>{t.forEach(i=>li(i)?oi(i.target,i,e,s):ni(i.target,i,e,s))},pi=(t,e)=>{e.forEach(s=>{t.observe(s)})},ui=(t,e)=>{Ts(t),pi(t,e)},gi=(t,e)=>{!Ge||wt(t)||(e._observer=new IntersectionObserver(s=>{di(s,t,e)},hi(t)))},bt=t=>Array.prototype.slice.call(t),D=t=>t.container.querySelectorAll(t.elements_selector),fi=t=>bt(t).filter(le),vi=t=>ms(t),wi=t=>bt(t).filter(vi),He=(t,e)=>fi(t||D(e)),bi=(t,e)=>{wi(D(t)).forEach(i=>{g(i,t.class_error),F(i)}),e.update()},mi=(t,e)=>{!S||window.addEventListener("online",()=>{bi(t,e)})},L=function(t,e){const s=Je(t);this._settings=s,this.loadingCount=0,gi(s,this),mi(s,this),this.update(e)};L.prototype={update:function(t){const e=this._settings,s=He(t,e);if(ot(this,s.length),je||!Ge){this.loadAll(s);return}if(wt(e)){ci(s,e,this);return}ui(this._observer,s)},destroy:function(){this._observer&&this._observer.disconnect(),D(this._settings).forEach(t=>{dt(t)}),delete this._observer,delete this._settings,delete this.loadingCount,delete this.toLoadCount},loadAll:function(t){const e=this._settings;He(t,e).forEach(i=>{U(i,this),fe(i,e,this)})},restoreAll:function(){const t=this._settings;D(t).forEach(e=>{ii(e,t)})}};L.load=(t,e)=>{const s=Je(e);fe(t,s)};L.resetStatus=t=>{F(t)};S&&fs(L,window.lazyLoadOptions);class mt{constructor({readonly:e,box:s,pages:i,onNewPageIndex:r,onPlay:o}){if(this.pageIndex=0,this.namespace="netless-app-docs-viewer",this.isShowPreview=!1,this.isSmallBox=!1,this.sideEffect=new W,i.length<=0)throw new Error("[DocsViewer] Empty pages.");this.readonly=e,this.box=s,this.pages=i,this.onNewPageIndex=r,this.onPlay=o,this.render()}mount(){this.box.mountContent(this.$content),this.box.mountFooter(this.$footer),this.sideEffect.add(()=>{const e=new L({container:this.$preview,elements_selector:`.${this.wrapClassName("preview-page>img")}`});return()=>e.destroy()},"preview-lazyload")}unmount(){this.$content.remove(),this.$footer.remove()}setReadonly(e){this.readonly!==e&&(this.readonly=e,this.$content.classList.toggle(this.wrapClassName("readonly"),e),this.$footer.classList.toggle(this.wrapClassName("readonly"),e),this.$pageNumberInput.disabled=e)}destroy(){this.sideEffect.flushAll(),this.unmount()}setPageIndex(e){Number.isNaN(e)||(this.pageIndex=e,this.$pageNumberInput.value=String(e+1))}setSmallBox(e){this.isSmallBox!==e&&(this.isSmallBox=e,this.$footer.classList.toggle(this.wrapClassName("float-footer"),e))}render(){return this.renderContent(),this.renderFooter(),this.$content}renderContent(){if(!this.$content){const e=document.createElement("div");e.className=this.wrapClassName("content"),this.$content=e,this.readonly&&e.classList.add(this.wrapClassName("readonly")),e.appendChild(this.renderPreviewMask()),e.appendChild(this.renderPreview())}return this.$content}renderPreview(){if(!this.$preview){const e=document.createElement("div");e.className=this.wrapClassName("preview")+" tele-fancy-scrollbar",this.$preview=e;const s=this.wrapClassName("preview-page"),i=this.wrapClassName("preview-page-name");this.pages.forEach((r,o)=>{var d;const n=(d=r.thumbnail)!=null?d:r.src.startsWith("ppt")?void 0:r.src;if(!n)return;const a=String(o),c=document.createElement("a");c.className=s+" "+this.wrapClassName(`preview-page-${o}`),c.setAttribute("href","#"),c.dataset.pageIndex=a;const l=document.createElement("span");l.className=i,l.textContent=String(o+1),l.dataset.pageIndex=a;const h=document.createElement("img");h.width=r.width,h.height=r.height,h.dataset.src=n,h.dataset.pageIndex=a,c.appendChild(h),c.appendChild(l),e.appendChild(c)}),this.sideEffect.addEventListener(e,"click",r=>{var n;if(this.readonly)return;const o=(n=r.target.dataset)==null?void 0:n.pageIndex;o&&(r.preventDefault(),r.stopPropagation(),r.stopImmediatePropagation(),this.onNewPageIndex(Number(o)),this.togglePreview(!1))})}return this.$preview}renderPreviewMask(){return this.$previewMask||(this.$previewMask=document.createElement("div"),this.$previewMask.className=this.wrapClassName("preview-mask"),this.sideEffect.addEventListener(this.$previewMask,"click",e=>{this.readonly||e.target===this.$previewMask&&this.togglePreview(!1)})),this.$previewMask}renderFooter(){if(!this.$footer){const e=document.createElement("div");if(e.className=this.wrapClassName("footer"),this.$footer=e,this.readonly&&e.classList.add(this.wrapClassName("readonly")),this.isSmallBox&&e.classList.add(this.wrapClassName("float-footer")),this.pages.some(c=>c.thumbnail||!c.src.startsWith("ppt"))){const c=this.renderFooterBtn("btn-sidebar",ls(this.namespace));this.sideEffect.addEventListener(c,"click",()=>{this.readonly||this.togglePreview()}),this.$footer.appendChild(c)}const s=document.createElement("div");s.className=this.wrapClassName("page-jumps");const i=this.renderFooterBtn("btn-page-back",hs(this.namespace));if(this.sideEffect.addEventListener(i,"click",()=>{this.readonly||this.onNewPageIndex(this.pageIndex-1)}),s.appendChild(i),this.onPlay){const c=this.renderFooterBtn("btn-page-play",ps(this.namespace),us(this.namespace)),l=()=>{this.sideEffect.setTimeout(()=>{c.classList.toggle(this.wrapClassName("footer-btn-playing"),!1)},500,"returnPlay")};this.sideEffect.addEventListener(c,"click",()=>{this.readonly||(c.classList.toggle(this.wrapClassName("footer-btn-playing"),!0),this.onPlay&&this.onPlay(),l())}),s.appendChild(c)}const r=this.renderFooterBtn("btn-page-next",ds(this.namespace));this.sideEffect.addEventListener(r,"click",()=>{this.readonly||this.onNewPageIndex(this.pageIndex+1)}),s.appendChild(r);const o=document.createElement("div");o.className=this.wrapClassName("page-number");const n=document.createElement("input");n.className=this.wrapClassName("page-number-input"),n.value=String(this.pageIndex+1),this.readonly&&(n.disabled=!0),this.$pageNumberInput=n,this.sideEffect.addEventListener(n,"focus",()=>{n.select()}),this.sideEffect.addEventListener(n,"change",()=>{this.readonly||n.value&&this.onNewPageIndex(Number(n.value)-1)});const a=document.createElement("span");a.textContent=" / "+this.pages.length,o.appendChild(n),o.appendChild(a),this.$footer.appendChild(s),this.$footer.appendChild(o)}return this.$footer}renderFooterBtn(e,s,i){const r=document.createElement("button");return r.className=this.wrapClassName("footer-btn")+" "+this.wrapClassName(e),r.appendChild(s),i&&r.appendChild(i),r}togglePreview(e){if(this.isShowPreview=e!=null?e:!this.isShowPreview,this.$content.classList.toggle(this.wrapClassName("preview-active"),this.isShowPreview),this.isShowPreview){const s=this.$preview.querySelector("."+this.wrapClassName(`preview-page-${this.pageIndex}`));s&&this.$preview.scrollTo({top:s.offsetTop-16})}}wrapClassName(e){return`${this.namespace}-${e}`}}function C(t,e,s){return Math.min(Math.max(t,e),s)}function Me(t){return t.touches?t.touches[0]:t}function St(t){t.stopPropagation(),t.cancelable&&t.preventDefault()}class Si{constructor(e){var s,i,r;this.velocity=0,this.paused=!0,this._animationFrameID=null,this._loopTimestamp=0,this.looper=o=>{if(this.paused)return;let n=Math.floor((o-this._loopTimestamp)/1e3*60)+1;for(this._loopTimestamp=o;n-- >0;)this.stepper();this.onStep(this.current,this),!this.paused&&this.current!==this.target&&window.requestAnimationFrame(this.looper)},this.current=(s=e.start)!=null?s:0,this.target=this.current,this.stiffness=(i=e.stiffness)!=null?i:170,this.damping=(r=e.damping)!=null?r:26,this.onStep=e.onStep}stepTo(e,s){this.paused&&s!=null&&(this.current=s),this.paused=!1,this.target=e,this.onStep(this.current,this),this._loopTimestamp=Date.now(),window.requestAnimationFrame(this.looper)}pause(){this.paused=!0}destroy(){this.pause()}stepper(){const e=-this.stiffness*(this.current-this.target),s=-this.damping*this.velocity,i=this.velocity+(e+s)/60,r=this.current+i/60;Math.abs(i-0)<.01&&Math.abs(r-this.target)<.01?(this.current=this.target,this.velocity=0):(this.current=r,this.velocity=i)}}class xi{constructor(e,s,i,r){this.scale=1,this.lastVisit=Date.now(),this.pageOffsetY=0,this.pageOffsetX=0,this.visible=!0,this.index=e,this.page=s,this.scale=i,this.pageOffsetX=(r-s.width)/2;const o=document.createElement("div");o.className="page-renderer-page",o.dataset.index=`${e}`,o.style.width=`${s.width*i}px`,o.style.height=`${s.height*i}px`,s.thumbnail&&(o.style.backgroundImage=`url("${s.thumbnail}")`);const n=document.createElement("img");n.className="page-renderer-page-img",n.width=s.width,n.height=s.height,n.src=s.src,o.appendChild(n),this.$page=o}translateY(e){Math.abs(e-this.pageOffsetY)>=.001&&(this.pageOffsetY=e,this.$page.style.transform=`translate(${this.pageOffsetX*this.scale}px, ${this.pageOffsetY*this.scale}px)`)}setScale(e){Math.abs(e-this.scale)>=.001&&(this.scale=e,this.$page.style.width=`${this.page.width*this.scale}px`,this.$page.style.height=`${this.page.height*this.scale}px`,this.$page.style.transform=`translate(${this.pageOffsetX*this.scale}px, ${this.pageOffsetY*this.scale}px)`)}setVisible(e){e!==this.visible&&(this.visible=e,this.$page.style.opacity=e?"1":"0")}}const yi=window.requestIdleCallback||(t=>window.setTimeout(t,5e3)),Ei=window.cancelIdleCallback||window.clearTimeout;class Ti{constructor(e,s,i){this.pages=e,this.pagesIntrinsicWidth=s,this.scale=i,this.els=new Map,this.maxElCount=200,this.gcTimer=null,this.gc=()=>{if(this.gcTimer=null,this.els.size>this.maxElCount){const r=[...this.els.values()].sort((o,n)=>n.lastVisit-o.lastVisit);for(let o=Math.floor(this.maxElCount/4);o<r.length;o++)this.els.delete(r[o].index)}}}getEl(e){let s=this.els.get(e);return s||(s=new xi(e,this.pages[e],this.scale,this.pagesIntrinsicWidth),this.els.set(e,s)),s.lastVisit=Date.now(),this.els.size>this.maxElCount&&this.gcTimer===null&&(this.gcTimer=yi(this.gc)),s}setScale(e){e!==this.scale&&(this.scale=e,this.els.forEach(s=>s.setScale(e)))}destroy(){this.els.clear(),this.gcTimer!==null&&(Ei(this.gcTimer),this.gcTimer=null)}}class Ci{constructor(e){this._hwaTimeout=NaN,this._turnOffHWA=()=>{window.clearTimeout(this._hwaTimeout),this._hwaTimeout=NaN,this.$pages.classList.toggle("is-hwa",!1)},this.pagesScrollTop=e.pagesScrollTop||0,this.containerWidth=e.containerWidth||1,this.containerHeight=e.containerHeight||1,this.pages=e.pages.map(o=>{if(o.thumbnail)return o;try{const n=new URL(o.src);return n.searchParams.set("x-oss-process","image/resize,l_50"),Q(Z({},o),{thumbnail:n.toString()})}catch(n){return console.error(n),o}});const s=Array(this.pages.length);let i=1/0,r=0;this.pagesIntrinsicHeight=this.pages.reduce((o,n,a)=>(s[a]=o,n.width>r&&(r=n.width),n.height<=i&&(i=n.height),o+n.height),0),this.pagesIntrinsicWidth=r,this.pagesMinHeight=i,this.pagesIntrinsicYs=s,this.scale=this._calcScale(),this.threshold=this._calcThreshold(),this.onPageIndexChanged=e.onPageIndexChanged,this.pageScrollIndex=0,this.pagesScrollTop!==0&&(this.pageScrollIndex=this.findScrollPageIndex(),this.onPageIndexChanged&&this.pageScrollIndex>0&&this.onPageIndexChanged(this.pageScrollIndex)),this.pageElManager=new Ti(this.pages,r,this.scale),this.$pages=this.renderPages()}setContainerSize(e,s){e>0&&s>0&&(e!==this.containerWidth||s!==this.containerHeight)&&(this.containerWidth=e,this.containerHeight=s,this.$pages.style.width=`${this.containerWidth}px`,this.$pages.style.height=`${this.containerHeight}px`,this.scale=this._calcScale(),this.threshold=this._calcThreshold(),this.pageElManager.setScale(this.scale),this.$pages.parentElement&&this.pagesScrollTo(this.pagesScrollTop,!0))}renderPages(){const e=document.createElement("div");return e.className="page-renderer-pages-container",e.style.width=`${this.containerWidth}px`,e.style.height=`${this.containerHeight}px`,e}pagesScrollTo(e,s){if(e=C(e,0,this.pagesIntrinsicHeight-this.containerHeight/this.scale),s||Math.abs(e-this.pagesScrollTop)>=.001){this._turnOnHWA(),this.pagesScrollTop=e;const i=this.findScrollPageIndex(),r=Math.max(i-this.threshold,0),o=Math.min(i+this.threshold,this.pages.length-1);for(let n=0;n<this.$pages.children.length;n++){const a=this.$pages.children[n],c=Number(a.dataset.index);c>=r&&c<=o||(a.remove(),n--)}for(let n=r;n<=o;n++){const a=this.pageElManager.getEl(n);a.$page.parentElement!==this.$pages&&this.$pages.appendChild(a.$page),a.translateY(this.pagesIntrinsicYs[n]-this.pagesScrollTop)}i!==this.pageScrollIndex&&(this.pageScrollIndex=i,this.onPageIndexChanged&&this.onPageIndexChanged(i))}}findScrollPageIndex(){for(let e=0;e<this.pagesIntrinsicYs.length;e++)if(this.pagesIntrinsicYs[e]+this.pages[e].height-this.pagesScrollTop>=.001)return e;return this.pagesIntrinsicYs.length-1}mount(e){e.appendChild(this.$pages),this.pagesScrollTo(this.pagesScrollTop,!0)}unmount(){this.$pages.remove()}destroy(){this.unmount(),this.onPageIndexChanged=void 0,this.pageElManager.destroy(),this._hwaTimeout&&(window.clearTimeout(this._hwaTimeout),this._hwaTimeout=NaN)}_calcScale(){return this.containerWidth/this.pagesIntrinsicWidth||1}_calcThreshold(){return C(Math.ceil(this.containerHeight/this.scale/this.pagesMinHeight/2),1,this.pages.length)}_turnOnHWA(){this._hwaTimeout?window.clearTimeout(this._hwaTimeout):this.$pages.classList.toggle("is-hwa",!0),this._hwaTimeout=window.setTimeout(this._turnOffHWA,1e3)}}const _i=30;class $i{constructor(e){this.sideEffect=new W,this.pagesScrollTop=e.pagesScrollTop||0,this.containerWidth=e.containerWidth||1,this.containerHeight=e.containerHeight||1,this.pagesWidth=e.pagesWidth||1,this.pagesHeight=e.pagesHeight||1,this.scale=this._calcScale(),this.scrollbarMinHeight=e.scrollbarMinHeight||_i,this.scrollbarHeight=this._calcScrollbarHeight(),this.readonly=e.readonly,this.wrapClassName=e.wrapClassName,this.onDragScroll=e.onDragScroll,this.$scrollbar=this.renderScrollbar()}mount(e){e.appendChild(this.$scrollbar),this.pagesScrollTo(this.pagesScrollTop,!0)}unmount(){this.$scrollbar.remove()}setReadonly(e){this.readonly=e}setContainerSize(e,s){e>0&&s>0&&(e!==this.containerWidth||s!==this.containerHeight)&&(this.containerWidth=e,this.containerHeight=s,this.scale=this._calcScale(),this._updateScrollbarHeight(),this.$scrollbar.parentElement&&this.pagesScrollTo(this.pagesScrollTop,!0))}pagesScrollTo(e,s){if(e=C(e,0,this.pagesHeight-this.containerHeight/this.scale),s||Math.abs(e-this.pagesScrollTop)>=.001){this.pagesScrollTop=e;const i=this.pagesScrollTop*this.scale,r=this.pagesHeight*this.scale,o=i/(r-this.containerHeight)*(this.containerHeight-this.scrollbarHeight);window.requestAnimationFrame?window.requestAnimationFrame(()=>{this.$scrollbar.style.transform=`translateY(${o}px)`}):this.$scrollbar.style.transform=`translateY(${o}px)`}}destroy(){this.unmount(),this.onDragScroll=void 0,this.sideEffect.flushAll()}renderScrollbar(){const e=document.createElement("button");e.className=this.wrapClassName("scrollbar"),e.style.minHeight=`${this.scrollbarMinHeight}px`,e.style.height=`${this.scrollbarHeight}px`;const s=i=>{if(this.readonly||i.button!=null&&i.button!==0)return;St(i);const r=this.wrapClassName("scrollbar-dragging");e.classList.toggle(r,!0);const o=this.pagesScrollTop,{clientY:n}=Me(i),a=l=>{if(this.readonly)return;const{clientY:h}=Me(l),d=(h-n)/this.scale;Math.abs(d)>0&&this.onDragScroll&&this.onDragScroll(o+d*(this.pagesHeight*this.scale/this.containerHeight))},c=()=>{e.classList.toggle(r,!1),window.removeEventListener("mousemove",a,!0),window.removeEventListener("touchmove",a,!0),window.removeEventListener("mouseup",c,!0),window.removeEventListener("touchend",c,!0),window.removeEventListener("touchcancel",c,!0)};window.addEventListener("mousemove",a,!0),window.addEventListener("touchmove",a,!0),window.addEventListener("mouseup",c,!0),window.addEventListener("touchend",c,!0),window.addEventListener("touchcancel",c,!0)};return this.sideEffect.addEventListener(e,"mousedown",s),this.sideEffect.addEventListener(e,"touchstart",s),e}_calcScale(){return this.containerWidth/this.pagesWidth||1}_calcScrollbarHeight(){return C(this.containerHeight/(this.pagesHeight*this.scale)*this.containerHeight,this.scrollbarMinHeight,this.containerHeight)}_updateScrollbarHeight(){const e=this._calcScrollbarHeight();Math.abs(e-this.scrollbarHeight)>.001&&(this.scrollbarHeight=e,this.$scrollbar.style.height=`${e}px`)}}const Ii=window.ResizeObserver||cs,I=640;class Ni{constructor({whiteboardView:e,readonly:s,box:i,pages:r,pageScrollTop:o=0,mountWhiteboard:n,onUserScroll:a}){this.sideEffect=new W,this.userScrolling=!1,this.onNewPageIndex=d=>{this.scrollToPage(d)},this.whiteboardView=e,this.readonly=s,this.box=i,this.pages=r,this.mountWhiteboard=n,this._onUserScroll=a;const c=this.debounce(()=>{this.userScrolling=!1,this._onUserScroll&&this._onUserScroll(this.pageRenderer.pagesScrollTop)},{wait:80},"debounce-updateUserScroll");this.updateUserScroll=()=>{this.userScrolling=!0,c()},this.viewer=new mt({readonly:s,box:i,pages:r,onNewPageIndex:this.onNewPageIndex});const{width:l,height:h}=this.whiteboardView.size;this.pageRenderer=new Ci({pagesScrollTop:o,pages:this.pages,containerWidth:l,containerHeight:h,onPageIndexChanged:this.viewer.setPageIndex.bind(this.viewer)}),this.scrollbar=new $i({pagesScrollTop:this.pageRenderer.pagesScrollTop,containerWidth:l,containerHeight:h,pagesWidth:this.pageRenderer.pagesIntrinsicWidth,pagesHeight:this.pageRenderer.pagesIntrinsicHeight,readonly:this.readonly,wrapClassName:this.wrapClassName.bind(this),onDragScroll:d=>{this.pageScrollTo(d),this.updateUserScroll()}}),this.pageScrollStepper=new Si({start:this.pageRenderer.pagesScrollTop,onStep:d=>{this.pageScrollTo(d)}}),this.render()}mount(){this.viewer.mount(),this.setupScrollListener();const e=this.debounce(this.renderRatioHeight.bind(this),{wait:80});return this.sideEffect.add(()=>{const s=new Ii(e);return s.observe(this.viewer.$content),()=>s.disconnect()}),this.sideEffect.setTimeout(()=>{this.userScrolling||this.pageScrollTo(this.pageRenderer.pagesScrollTop)},100),this}unmount(){return this.viewer.unmount(),this}setReadonly(e){this.readonly!==e&&(this.readonly=e,this.viewer.setReadonly(e),this.scrollbar.setReadonly(e))}destroy(){this.sideEffect.flushAll(),this.pageScrollStepper.destroy(),this._onUserScroll=void 0,this.unmount(),this.viewer.destroy(),this.pageRenderer.destroy(),this.scrollbar.destroy()}syncPageScrollTop(e){!this.userScrolling&&e>=0&&Math.abs(this.pageRenderer.pagesScrollTop-e)>.01&&this.pageScrollStepper.stepTo(e,this.pageRenderer.pagesScrollTop)}render(){this.pageRenderer.mount(this.viewer.$content),this.viewer.$content.appendChild(this.renderWhiteboardView()),this.scrollbar.mount(this.viewer.$content),this.renderRatioHeight()}renderRatioHeight(){const e=this.box.absoluteHeight,s=e<=I;if(this.viewer.setSmallBox(s),s){const i=26/I,r=26/e,o=26/I,n=0,a=Math.max((i+o-(r+n))/2,0);if(this.box.$titleBar){const c=r+a;this.box.$titleBar.style.height=`${c*100}%`}if(this.box.$footer){const c=n+a;this.box.$footer.style.height=`${c*100}%`}}else{if(this.box.$titleBar){const i=Math.max(26/I,26/e);this.box.$titleBar.style.height=`${i*100}%`}if(this.box.$footer){const i=Math.max(26/I,26/e);this.box.$footer.style.height=`${i*100}%`}}}renderWhiteboardView(){return this.$whiteboardView||(this.$whiteboardView=document.createElement("div"),this.$whiteboardView.className=this.wrapClassName("wb-view"),this.mountWhiteboard(this.$whiteboardView),this.sideEffect.addEventListener(this.$whiteboardView,"wheel",e=>{St(e),this.readonly||(this.pageScrollTo(this.pageRenderer.pagesScrollTop+e.deltaY),this.updateUserScroll())},{passive:!1,capture:!0}),this.sideEffect.addEventListener(this.$whiteboardView,"touchmove",e=>{this.readonly||e.touches.length<=1||this.updateUserScroll()},{passive:!0,capture:!0})),this.$whiteboardView}scrollTopPageToEl(e){return e*this.pageRenderer.scale}scrollTopElToPage(e){return e/this.pageRenderer.scale}elScrollTo(e){this.pageScrollTo(this.scrollTopElToPage(e))}pageScrollTo(e){const s=this.scrollTopElToPage(this.whiteboardView.size.height/2);this.whiteboardView.moveCamera({centerY:C(e+s,s,this.pageRenderer.pagesIntrinsicHeight-s),animationMode:"immediately"})}scrollToPage(e){if(!this.readonly&&!Number.isNaN(e)){const s=this.pageRenderer.pagesIntrinsicYs[e];s>=0&&(this.pageScrollTo(s+5/this.pageRenderer.scale),this.updateUserScroll())}}setupScrollListener(){this.sideEffect.add(()=>{const e=s=>{const{width:i,height:r}=this.whiteboardView.size;if(i<=0||r<=0)return;const o=s.centerY-this.pageRenderer.containerHeight/this.pageRenderer.scale/2;this.pageRenderer.pagesScrollTo(o),this.scrollbar.pagesScrollTo(o)};return this.whiteboardView.callbacks.on("onCameraUpdated",e),()=>this.whiteboardView.callbacks.off("onCameraUpdated",e)}),this.sideEffect.add(()=>{const e=({width:s,height:i})=>{if(s<=0||i<=0)return;this.pageRenderer.setContainerSize(s,i),this.scrollbar.setContainerSize(s,i);const{pagesIntrinsicWidth:r,pagesIntrinsicHeight:o}=this.pageRenderer;this.whiteboardView.moveCameraToContain({originX:0,originY:this.pageRenderer.pagesScrollTop,width:r,height:i/this.pageRenderer.scale,animationMode:"immediately"}),this.whiteboardView.setCameraBound({damping:1,maxContentMode:()=>this.pageRenderer.scale,minContentMode:()=>this.pageRenderer.scale,centerX:r/2,centerY:o/2,width:r,height:o})};return this.whiteboardView.callbacks.on("onSizeUpdated",e),()=>{this.whiteboardView.callbacks.off("onSizeUpdated",e)}},"whiteboard-size-update"),this.sideEffect.addEventListener(window,"keyup",e=>{if(this.readonly||!this.box.focus||this.box.minimized)return;let s=null;switch(e.key){case"PageDown":{s=this.pageRenderer.pagesScrollTop+this.pageRenderer.containerHeight/this.pageRenderer.scale;break}case"PageUp":{s=this.pageRenderer.pagesScrollTop-this.pageRenderer.containerHeight/this.pageRenderer.scale;break}case"ArrowDown":{s=this.pageRenderer.pagesScrollTop+this.pageRenderer.containerHeight/4/this.pageRenderer.scale;break}case"ArrowUp":{s=this.pageRenderer.pagesScrollTop-this.pageRenderer.containerHeight/4/this.pageRenderer.scale;break}}s!==null&&(this._onUserScroll?this._onUserScroll(s):(this.pageScrollTo(s),this.updateUserScroll()))},{capture:!0})}debounce(e,s,i){const r=Bt(e,s);return this.sideEffect.addDisposer(()=>r.cancel(),i),r}wrapClassName(e){return"netless-app-docs-viewer-static-"+e}}class ki{constructor({context:e,whiteboardView:s,box:i,pages:r}){this.sideEffect=new W,this.onPlayPPT=()=>{const o=this.context.getRoom();o&&o.pptNextStep()},this._scaleDocsToFitImpl=()=>{const o=this.pages[this.getPageIndex()];o&&(this.whiteboardView.moveCameraToContain({originX:-o.width/2,originY:-o.height/2,width:o.width,height:o.height,animationMode:"immediately"}),this.whiteboardView.setCameraBound({damping:1,maxContentMode:()=>this.whiteboardView.camera.scale,minContentMode:()=>this.whiteboardView.camera.scale,centerX:0,centerY:0,width:o.width,height:o.height}))},this._scaleDocsToFitDebounced=()=>{this.sideEffect.setTimeout(this._scaleDocsToFitImpl,1e3,"_scaleDocsToFitDebounced")},this.scaleDocsToFit=()=>{this._scaleDocsToFitImpl(),this._scaleDocsToFitDebounced()},this.onNewPageIndex=o=>{this.jumpToPage(o,!0)},this.context=e,this.whiteboardView=s,this.box=i,this.pages=r,this.displayer=e.getDisplayer(),this.viewer=new mt({readonly:!e.getIsWritable(),box:i,pages:r,onNewPageIndex:this.onNewPageIndex,onPlay:this.onPlayPPT}),this.render(),this.sideEffect.add(()=>{const o=n=>{this.viewer.setReadonly(!n)};return this.context.emitter.on("writableChange",o),()=>this.context.emitter.off("writableChange",o)}),this.sideEffect.add(()=>{const o=n=>{this.jumpToPage(n.index)};return this.context.emitter.on("sceneStateChange",o),()=>this.context.emitter.off("sceneStateChange",o)})}mount(){this.viewer.mount();const e=this.getPageIndex();return e!==0&&this.jumpToPage(e),this.scaleDocsToFit(),this.sideEffect.add(()=>(this.whiteboardView.callbacks.on("onSizeUpdated",this.scaleDocsToFit),()=>{this.whiteboardView.callbacks.off("onSizeUpdated",this.scaleDocsToFit)})),this}unmount(){return this.viewer.unmount(),this}destroy(){this.sideEffect.flushAll(),this.unmount(),this.viewer.destroy()}getPageIndex(){return this.displayer.state.sceneState.index}jumpToPage(e,s){var i,r;if(e=C(e,0,this.pages.length-1),e!==this.getPageIndex()&&this.context.getIsWritable()){const o=this.context.getInitScenePath(),n=(r=(i=this.context.getScenes())==null?void 0:i[e])==null?void 0:r.name;o&&n&&this.context.setScenePath(`${o}/${n}`),this.scaleDocsToFit()}if(e!==this.viewer.pageIndex&&this.viewer.setPageIndex(e),s){const o=this.context.getRoom();if(o){const n=o.state.globalState.__pptState;o.setGlobalState({__pptState:n&&{uuid:n.uuid,pageIndex:e,disableAutoPlay:n.disableAutoPlay}})}}}render(){this.viewer.$content.appendChild(this.renderMask()),this.viewer.$content.appendChild(this.renderWhiteboardView()),this.sideEffect.addEventListener(window,"keydown",e=>{var s;if(this.box.focus)switch(e.key){case"ArrowUp":case"ArrowLeft":{this.jumpToPage(this.getPageIndex()-1,!0);break}case"ArrowRight":case"ArrowDown":{(s=this.context.getRoom())==null||s.pptNextStep();break}}})}renderMask(){if(!this.$mask){const e=document.createElement("div");e.className=this.wrapClassName("mask"),this.$mask=e;const s=document.createElement("button");s.className=this.wrapClassName("back");const i=document.createElement("button");i.className=this.wrapClassName("next")}return this.$mask}renderWhiteboardView(){return this.$whiteboardView||(this.$whiteboardView=document.createElement("div"),this.$whiteboardView.className=this.wrapClassName("wb-view"),this.sideEffect.addEventListener(this.$whiteboardView,"click",e=>{var i;const s=this.context.getRoom();if(s&&s.state.memberState.currentApplianceName==="clicker"){for(let r=e.target;r;r=r.parentElement)if((i=r.classList)!=null&&i.contains("ppt-event-source"))return;s.pptNextStep()}}),this.context.mountView(this.$whiteboardView)),this.$whiteboardView}wrapClassName(e){return"netless-app-docs-viewer-dynamic-"+e}}const Ri="DocsViewer",Oi={kind:Ri,setup(t){const e=t.getBox(),s=t.getScenes();if(!s)throw new Error("[Docs Viewer]: scenes not found.");const i=t.getView();if(!i)throw new Error("[Docs Viewer]: no whiteboard view.");const r=s.map(({ppt:o})=>o?{width:o.width,height:o.height,src:o.src,thumbnail:o.previewURL}:null).filter(o=>Boolean(o));if(r.length<=0)throw new Error("[Docs Viewer]: empty scenes.");e.mountStyles(Rt),r[0].src.startsWith("ppt")?Pi(t,i,e,r):Li(t,i,e,r)}};function Li(t,e,s,i){var o;e.disableCameraTransform=!t.getIsWritable();const r=new Ni({whiteboardView:e,readonly:!t.getIsWritable(),box:s,pages:i,pageScrollTop:(o=t.getAttributes())==null?void 0:o.pageScrollTop,mountWhiteboard:t.mountView.bind(t),onUserScroll:n=>{var a;((a=t.getAttributes())==null?void 0:a.pageScrollTop)!==n&&!s.readonly&&t.updateAttributes(["pageScrollTop"],n)}}).mount();t.emitter.on("attributesUpdate",n=>{n&&n.pageScrollTop!=null&&r.syncPageScrollTop(n.pageScrollTop)}),t.emitter.on("writableChange",n=>{r.setReadonly(!n),e.disableCameraTransform=!n})}function Pi(t,e,s,i){e.disableCameraTransform=!0;const r=new ki({context:t,whiteboardView:e,box:s,pages:i}).mount();t.mountView(r.$whiteboardView),t.isAddApp&&e.callbacks.once("onSizeUpdated",({width:o,height:n})=>{if(i.length>0&&s.state!=="maximized"){const{width:a,height:c}=i[0],h=c/a*o-n;h!==0&&t.getIsWritable()&&t.emitter.emit("setBoxSize",{width:s.width,height:s.height+h/s.containerRect.height})}})}exports.default=Oi; | ||
//# sourceMappingURL=main.cjs.js.map |
@@ -1,4 +0,4 @@ | ||
var Ti=Object.defineProperty,Ci=Object.defineProperties;var $i=Object.getOwnPropertyDescriptors;var St=Object.getOwnPropertySymbols;var Ii=Object.prototype.hasOwnProperty,_i=Object.prototype.propertyIsEnumerable;var yt=(p,u,g)=>u in p?Ti(p,u,{enumerable:!0,configurable:!0,writable:!0,value:g}):p[u]=g,we=(p,u)=>{for(var g in u||(u={}))Ii.call(u,g)&&yt(p,g,u[g]);if(St)for(var g of St(u))_i.call(u,g)&&yt(p,g,u[g]);return p},be=(p,u)=>Ci(p,$i(u));var NetlessAppDocsViewer=function(p){"use strict";var u=`.netless-app-docs-viewer-content{position:relative;height:100%;overflow:hidden}.netless-app-docs-viewer-preview-mask{display:none;position:absolute;z-index:200;top:0;left:0;width:100%;height:100%}.netless-app-docs-viewer-preview{display:flex;flex-direction:column;align-items:center;position:absolute;z-index:300;top:0;left:0;width:33%;max-width:200px;height:100%;padding-top:10px;transform:translate(-100%);background:rgba(237,237,240,.9);box-shadow:inset -1px 0 #0000001c;transition:transform .4s}.netless-app-docs-viewer-preview-active .netless-app-docs-viewer-preview-mask{display:block}.netless-app-docs-viewer-preview-active .netless-app-docs-viewer-preview{transform:translate(0)}.netless-app-docs-viewer-preview-page{position:relative;display:block;width:55%;margin-bottom:10px;font-size:0;color:transparent;outline:none;border:7px solid transparent;border-radius:4px;transition:border-color .3s;user-select:none}.netless-app-docs-viewer-preview-page:hover,.netless-app-docs-viewer-preview-page.netless-app-docs-viewer-preview-page-active{border-color:#444e601a}.netless-app-docs-viewer-preview-page>img{width:100%;height:auto;box-sizing:border-box;border:1px solid rgba(0,0,0,.5);border-radius:1px;background-color:#fff;box-shadow:0 2px 8px #0000004d}.netless-app-docs-viewer-preview-page-name{position:absolute;top:1px;left:-10px;transform:translate(-100%);text-align:right;font-size:12px;color:#5f5f5f;user-select:none}.netless-app-docs-viewer-footer{box-sizing:border-box;height:26px;display:flex;align-items:center;padding:0 16px;border-top:1px solid #eeeef7;color:#191919}.netless-app-docs-viewer-float-footer{width:100%;min-height:26px;position:absolute;left:0;bottom:0;z-index:2000;background:rgba(249,249,252,.9);transition:opacity .4s}.netless-app-docs-viewer-footer-btn{box-sizing:border-box;width:26px;height:26px;font-size:0;margin:0;padding:3px;border:none;border-radius:1px;outline:none;color:currentColor;background:transparent;transition:background .4s;cursor:pointer;user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}.netless-app-docs-viewer-footer-btn:hover{background:rgba(237,237,240,.9)}@media (hover: none){.netless-app-docs-viewer-footer-btn:hover{background:transparent!important}}.netless-app-docs-viewer-footer-btn>svg{width:100%;height:100%}.netless-app-docs-viewer-footer-btn>svg:nth-of-type(2){display:none}.netless-app-docs-viewer-footer-btn.netless-app-docs-viewer-footer-btn-playing>svg:nth-of-type(1){display:none}.netless-app-docs-viewer-footer-btn.netless-app-docs-viewer-footer-btn-playing>svg:nth-of-type(2){display:initial}.netless-app-docs-viewer-footer-btn~.netless-app-docs-viewer-footer-btn{margin-left:15px}.netless-app-docs-viewer-page-jumps{flex:1;display:flex;justify-content:center;align-items:center}.netless-app-docs-viewer-page-number{margin-left:auto;font-size:13px;user-select:none;white-space:nowrap;word-break:keep-all}.netless-app-docs-viewer-page-number-input{border:none;outline:none;width:3em;margin:0;padding:0 2px;text-align:right;font-size:13px;line-height:1;font-weight:400;font-family:inherit;border-radius:2px;color:currentColor;background:transparent;transition:background .4s;user-select:text;-webkit-tap-highlight-color:rgba(0,0,0,0)}.netless-app-docs-viewer-page-number-input:hover,.netless-app-docs-viewer-page-number-input:focus,.netless-app-docs-viewer-page-number-input:active{background:#fff;box-shadow:#63636333 0 2px 8px}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-footer-btn{cursor:not-allowed}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-footer-btn:hover{background:transparent}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input{cursor:not-allowed}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input:hover,.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input:focus,.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input:active{background:transparent;box-shadow:none}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input:disabled{color:inherit}.netless-app-docs-viewer-readonly.netless-app-docs-viewer-float-footer{display:none}.telebox-color-scheme-dark .netless-app-docs-viewer-page-number-input{color:#a6a6a8}.telebox-color-scheme-dark .netless-app-docs-viewer-page-number-input:active,.telebox-color-scheme-dark .netless-app-docs-viewer-page-number-input:focus,.telebox-color-scheme-dark .netless-app-docs-viewer-page-number-input:hover{color:#222}.telebox-color-scheme-dark .netless-app-docs-viewer-footer{color:#a6a6a8;background:#2d2d33;border-top:none}.telebox-color-scheme-dark .netless-app-docs-viewer-footer-btn:hover{background:#212126}.telebox-color-scheme-dark .netless-app-docs-viewer-preview{background:rgba(50,50,50,.9)}.netless-app-docs-viewer-static-scrollbar{position:absolute;top:0;right:0;z-index:2147483647;width:8px;min-height:30px;margin:0;padding:0;border:none;outline:none;border-radius:4px;background:rgba(68,78,96,.4);box-shadow:1px 1px 8px #ffffffb3;opacity:0;transition:background .4s,opacity .4s 3s,transform .2s;user-select:none}.netless-app-docs-viewer-static-scrollbar.netless-app-docs-viewer-static-scrollbar-dragging{background:rgba(68,78,96,.6);opacity:1;transition:background .4s,opacity .4s 3s!important}.netless-app-docs-viewer-static-scrollbar:hover,.netless-app-docs-viewer-static-scrollbar:focus{background:rgba(68,78,96,.5)}.netless-app-docs-viewer-static-scrollbar:active{background:rgba(68,78,96,.6)}.netless-app-docs-viewer-content:hover .netless-app-docs-viewer-static-scrollbar{opacity:1;transition:background .4s,opacity .4s,transform .2s}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-static-scrollbar{display:none}.netless-app-docs-viewer-static-pages:hover .netless-app-docs-viewer-static-scrollbar{opacity:1;transition:background .4s,opacity .4s,transform .2s}.page-renderer-pages-container{position:relative;overflow:hidden}.page-renderer-page{position:absolute;top:0;left:0;background-position:center;background-size:cover;background-repeat:no-repeat}.page-renderer-pages-container.is-hwa .page-renderer-page{will-change:transform}.page-renderer-page-img{display:block;width:100%;height:auto;user-select:none}.netless-app-docs-viewer-static-pages{overflow:hidden;position:relative;height:100%;user-select:none}.netless-app-docs-viewer-static-page{display:block;width:100%;height:auto;user-select:none}.netless-app-docs-viewer-static-wb-view,.netless-app-docs-viewer-dynamic-wb-view{position:absolute;top:0;left:0;width:100%;height:100%;z-index:100;overflow:hidden}.netless-app-docs-viewer-dynamic-wb-view .cursor-clicker .ppt-event-source{cursor:pointer} | ||
`;const g=(t,e,s,i)=>{if(s==="length"||s==="prototype"||s==="arguments"||s==="caller")return;const r=Object.getOwnPropertyDescriptor(t,s),o=Object.getOwnPropertyDescriptor(e,s);!xt(r,o)&&i||Object.defineProperty(t,s,o)},xt=function(t,e){return t===void 0||t.configurable||t.writable===e.writable&&t.enumerable===e.enumerable&&t.configurable===e.configurable&&(t.writable||t.value===e.value)},Et=(t,e)=>{const s=Object.getPrototypeOf(e);s!==Object.getPrototypeOf(t)&&Object.setPrototypeOf(t,s)},Tt=(t,e)=>`/* Wrapped ${t}*/ | ||
${e}`,Ct=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),$t=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),It=(t,e,s)=>{const i=s===""?"":`with ${s.trim()}() `,r=Tt.bind(null,i,e.toString());Object.defineProperty(r,"name",$t),Object.defineProperty(t,"toString",be(we({},Ct),{value:r}))};function _t(t,e,{ignoreNonConfigurable:s=!1}={}){const{name:i}=t;for(const r of Reflect.ownKeys(e))g(t,e,r,s);return Et(t,e),It(t,e,i),t}const Nt=(t,e={})=>{if(typeof t!="function")throw new TypeError(`Expected the first argument to be a function, got \`${typeof t}\``);const{wait:s=0,maxWait:i=Number.Infinity,before:r=!1,after:o=!0}=e;if(!r&&!o)throw new Error("Both `before` and `after` are false, function wouldn't be called.");let n,a,c;const l=function(...h){const d=this,pe=()=>{n=void 0,a&&(clearTimeout(a),a=void 0),o&&(c=t.apply(d,h))},ue=()=>{a=void 0,n&&(clearTimeout(n),n=void 0),o&&(c=t.apply(d,h))},ge=r&&!n;return clearTimeout(n),n=setTimeout(pe,s),i>0&&i!==Number.Infinity&&!a&&(a=setTimeout(ue,i)),ge&&(c=t.apply(d,h)),c};return _t(l,t),l.cancel=()=>{n&&(clearTimeout(n),n=void 0),a&&(clearTimeout(a),a=void 0)},l},me="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",kt=me.length,Se=Array(20),_=()=>{for(let t=0;t<20;t++)Se[t]=me.charAt(Math.random()*kt);return Se.join("")};class H{constructor(){this.disposers=new Map}add(e,s=_()){return this.flush(s),this.disposers.set(s,e()),s}addDisposer(e,s=_()){return this.flush(s),this.disposers.set(s,e),s}addEventListener(e,s,i,r,o=_()){return this.add(()=>(e.addEventListener(s,i,r),()=>e.removeEventListener(s,i,r)),o),o}setTimeout(e,s,i=_()){return this.add(()=>{const r=window.setTimeout(()=>{this.remove(i),e()},s);return()=>window.clearTimeout(r)},i)}setInterval(e,s,i=_()){return this.add(()=>{const r=window.setInterval(e,s);return()=>window.clearInterval(r)},i)}remove(e){const s=this.disposers.get(e);return this.disposers.delete(e),s}flush(e){const s=this.remove(e);if(s)try{s()}catch(i){console.error(i)}}flushAll(){this.disposers.forEach(e=>{try{e()}catch(s){console.error(s)}}),this.disposers.clear()}}var S=[],Rt=function(){return S.some(function(t){return t.activeTargets.length>0})},Lt=function(){return S.some(function(t){return t.skippedTargets.length>0})},ye="ResizeObserver loop completed with undelivered notifications.",Ot=function(){var t;typeof ErrorEvent=="function"?t=new ErrorEvent("error",{message:ye}):(t=document.createEvent("Event"),t.initEvent("error",!1,!1),t.message=ye),window.dispatchEvent(t)},N;(function(t){t.BORDER_BOX="border-box",t.CONTENT_BOX="content-box",t.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(N||(N={}));var y=function(t){return Object.freeze(t)},Pt=function(){function t(e,s){this.inlineSize=e,this.blockSize=s,y(this)}return t}(),xe=function(){function t(e,s,i,r){return this.x=e,this.y=s,this.width=i,this.height=r,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,y(this)}return t.prototype.toJSON=function(){var e=this,s=e.x,i=e.y,r=e.top,o=e.right,n=e.bottom,a=e.left,c=e.width,l=e.height;return{x:s,y:i,top:r,right:o,bottom:n,left:a,width:c,height:l}},t.fromRect=function(e){return new t(e.x,e.y,e.width,e.height)},t}(),J=function(t){return t instanceof SVGElement&&"getBBox"in t},Ee=function(t){if(J(t)){var e=t.getBBox(),s=e.width,i=e.height;return!s&&!i}var r=t,o=r.offsetWidth,n=r.offsetHeight;return!(o||n||t.getClientRects().length)},Te=function(t){var e,s;if(t instanceof Element)return!0;var i=(s=(e=t)===null||e===void 0?void 0:e.ownerDocument)===null||s===void 0?void 0:s.defaultView;return!!(i&&t instanceof i.Element)},zt=function(t){switch(t.tagName){case"INPUT":if(t.type!=="image")break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1},k=typeof window!="undefined"?window:{},V=new WeakMap,Ce=/auto|scroll/,At=/^tb|vertical/,Ht=/msie|trident/i.test(k.navigator&&k.navigator.userAgent),v=function(t){return parseFloat(t||"0")},C=function(t,e,s){return t===void 0&&(t=0),e===void 0&&(e=0),s===void 0&&(s=!1),new Pt((s?e:t)||0,(s?t:e)||0)},$e=y({devicePixelContentBoxSize:C(),borderBoxSize:C(),contentBoxSize:C(),contentRect:new xe(0,0,0,0)}),Ie=function(t,e){if(e===void 0&&(e=!1),V.has(t)&&!e)return V.get(t);if(Ee(t))return V.set(t,$e),$e;var s=getComputedStyle(t),i=J(t)&&t.ownerSVGElement&&t.getBBox(),r=!Ht&&s.boxSizing==="border-box",o=At.test(s.writingMode||""),n=!i&&Ce.test(s.overflowY||""),a=!i&&Ce.test(s.overflowX||""),c=i?0:v(s.paddingTop),l=i?0:v(s.paddingRight),h=i?0:v(s.paddingBottom),d=i?0:v(s.paddingLeft),pe=i?0:v(s.borderTopWidth),ue=i?0:v(s.borderRightWidth),ge=i?0:v(s.borderBottomWidth),mi=i?0:v(s.borderLeftWidth),ft=d+l,vt=c+h,fe=mi+ue,ve=pe+ge,wt=a?t.offsetHeight-ve-t.clientHeight:0,bt=n?t.offsetWidth-fe-t.clientWidth:0,Si=r?ft+fe:0,yi=r?vt+ve:0,X=i?i.width:v(s.width)-Si-bt,q=i?i.height:v(s.height)-yi-wt,xi=X+ft+bt+fe,Ei=q+vt+wt+ve,mt=y({devicePixelContentBoxSize:C(Math.round(X*devicePixelRatio),Math.round(q*devicePixelRatio),o),borderBoxSize:C(xi,Ei,o),contentBoxSize:C(X,q,o),contentRect:new xe(d,c,X,q)});return V.set(t,mt),mt},_e=function(t,e,s){var i=Ie(t,s),r=i.borderBoxSize,o=i.contentBoxSize,n=i.devicePixelContentBoxSize;switch(e){case N.DEVICE_PIXEL_CONTENT_BOX:return n;case N.BORDER_BOX:return r;default:return o}},Vt=function(){function t(e){var s=Ie(e);this.target=e,this.contentRect=s.contentRect,this.borderBoxSize=y([s.borderBoxSize]),this.contentBoxSize=y([s.contentBoxSize]),this.devicePixelContentBoxSize=y([s.devicePixelContentBoxSize])}return t}(),Ne=function(t){if(Ee(t))return 1/0;for(var e=0,s=t.parentNode;s;)e+=1,s=s.parentNode;return e},Mt=function(){var t=1/0,e=[];S.forEach(function(n){if(n.activeTargets.length!==0){var a=[];n.activeTargets.forEach(function(l){var h=new Vt(l.target),d=Ne(l.target);a.push(h),l.lastReportedSize=_e(l.target,l.observedBox),d<t&&(t=d)}),e.push(function(){n.callback.call(n.observer,a,n.observer)}),n.activeTargets.splice(0,n.activeTargets.length)}});for(var s=0,i=e;s<i.length;s++){var r=i[s];r()}return t},ke=function(t){S.forEach(function(s){s.activeTargets.splice(0,s.activeTargets.length),s.skippedTargets.splice(0,s.skippedTargets.length),s.observationTargets.forEach(function(r){r.isActive()&&(Ne(r.target)>t?s.activeTargets.push(r):s.skippedTargets.push(r))})})},Bt=function(){var t=0;for(ke(t);Rt();)t=Mt(),ke(t);return Lt()&&Ot(),t>0},K,Re=[],Dt=function(){return Re.splice(0).forEach(function(t){return t()})},Wt=function(t){if(!K){var e=0,s=document.createTextNode(""),i={characterData:!0};new MutationObserver(function(){return Dt()}).observe(s,i),K=function(){s.textContent=""+(e?e--:e++)}}Re.push(t),K()},Ft=function(t){Wt(function(){requestAnimationFrame(t)})},M=0,Ut=function(){return!!M},Yt=250,jt={attributes:!0,characterData:!0,childList:!0,subtree:!0},Le=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],Oe=function(t){return t===void 0&&(t=0),Date.now()+t},Z=!1,Gt=function(){function t(){var e=this;this.stopped=!0,this.listener=function(){return e.schedule()}}return t.prototype.run=function(e){var s=this;if(e===void 0&&(e=Yt),!Z){Z=!0;var i=Oe(e);Ft(function(){var r=!1;try{r=Bt()}finally{if(Z=!1,e=i-Oe(),!Ut())return;r?s.run(1e3):e>0?s.run(e):s.start()}})}},t.prototype.schedule=function(){this.stop(),this.run()},t.prototype.observe=function(){var e=this,s=function(){return e.observer&&e.observer.observe(document.body,jt)};document.body?s():k.addEventListener("DOMContentLoaded",s)},t.prototype.start=function(){var e=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),Le.forEach(function(s){return k.addEventListener(s,e.listener,!0)}))},t.prototype.stop=function(){var e=this;this.stopped||(this.observer&&this.observer.disconnect(),Le.forEach(function(s){return k.removeEventListener(s,e.listener,!0)}),this.stopped=!0)},t}(),Q=new Gt,Pe=function(t){!M&&t>0&&Q.start(),M+=t,!M&&Q.stop()},Xt=function(t){return!J(t)&&!zt(t)&&getComputedStyle(t).display==="inline"},qt=function(){function t(e,s){this.target=e,this.observedBox=s||N.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return t.prototype.isActive=function(){var e=_e(this.target,this.observedBox,!0);return Xt(this.target)&&(this.lastReportedSize=e),this.lastReportedSize.inlineSize!==e.inlineSize||this.lastReportedSize.blockSize!==e.blockSize},t}(),Jt=function(){function t(e,s){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=e,this.callback=s}return t}(),B=new WeakMap,ze=function(t,e){for(var s=0;s<t.length;s+=1)if(t[s].target===e)return s;return-1},D=function(){function t(){}return t.connect=function(e,s){var i=new Jt(e,s);B.set(e,i)},t.observe=function(e,s,i){var r=B.get(e),o=r.observationTargets.length===0;ze(r.observationTargets,s)<0&&(o&&S.push(r),r.observationTargets.push(new qt(s,i&&i.box)),Pe(1),Q.schedule())},t.unobserve=function(e,s){var i=B.get(e),r=ze(i.observationTargets,s),o=i.observationTargets.length===1;r>=0&&(o&&S.splice(S.indexOf(i),1),i.observationTargets.splice(r,1),Pe(-1))},t.disconnect=function(e){var s=this,i=B.get(e);i.observationTargets.slice().forEach(function(r){return s.unobserve(e,r.target)}),i.activeTargets.splice(0,i.activeTargets.length)},t}(),Kt=function(){function t(e){if(arguments.length===0)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if(typeof e!="function")throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");D.connect(this,e)}return t.prototype.observe=function(e,s){if(arguments.length===0)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!Te(e))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");D.observe(this,e,s)},t.prototype.unobserve=function(e){if(arguments.length===0)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!Te(e))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");D.unobserve(this,e)},t.prototype.disconnect=function(){D.disconnect(this)},t.toString=function(){return"function ResizeObserver () { [polyfill code] }"},t}();function Zt(t){const e="http://www.w3.org/2000/svg",s=document.createElementNS(e,"svg");s.setAttribute("class",`${t}-footer-icon-sidebar`),s.setAttribute("viewBox","0 0 64 64");const i=document.createElementNS(e,"path");return i.setAttribute("fill","currentColor"),i.setAttribute("d","M50 8H14c-3.309 0-6 2.691-6 6v36c0 3.309 2.691 6 6 6h36c3.309 0 6-2.691 6-6V14c0-3.309-2.691-6-6-6zM12 50V14c0-1.103.897-2 2-2h8v40h-8c-1.103 0-2-.897-2-2zm40 0c0 1.103-.897 2-2 2H26V12h24c1.103 0 2 .897 2 2z"),s.appendChild(i),s}function Qt(t){const e="http://www.w3.org/2000/svg",s=document.createElementNS(e,"svg");s.setAttribute("class",`${t}-footer-icon-arrow-left`),s.setAttribute("viewBox","0 0 500 500");const i=document.createElementNS(e,"path");return i.setAttribute("fill","currentColor"),i.setAttribute("d","M177.81 249.959L337.473 90.295c2.722-2.865 2.651-7.378-.143-10.1-2.793-2.65-7.163-2.65-9.956 0l-164.75 164.75c-2.793 2.793-2.793 7.306 0 10.1l164.75 164.75c2.865 2.722 7.378 2.65 10.099-.143 2.651-2.794 2.651-7.163 0-9.957L177.809 249.959z"),s.appendChild(i),s}function es(t){const e="http://www.w3.org/2000/svg",s=document.createElementNS(e,"svg");s.setAttribute("class",`${t}-footer-icon-arrow-right`),s.setAttribute("viewBox","0 0 500 500");const i=document.createElementNS(e,"path");return i.setAttribute("fill","currentColor"),i.setAttribute("d","M322.19 250.041L162.527 409.705c-2.722 2.865-2.651 7.378.143 10.1 2.793 2.65 7.163 2.65 9.956 0l164.75-164.75c2.793-2.793 2.793-7.306 0-10.1l-164.75-164.75c-2.865-2.722-7.378-2.65-10.099.143-2.651 2.794-2.651 7.163 0 9.957l159.664 159.736z"),s.appendChild(i),s}function ts(t){const e="http://www.w3.org/2000/svg",s=document.createElementNS(e,"svg");s.setAttribute("class",`${t}-footer-icon-play`),s.setAttribute("viewBox","0 0 500 500");const i=document.createElementNS(e,"path");return i.setAttribute("fill","currentColor"),i.setAttribute("d","M418.158 257.419L174.663 413.33c-6.017 3.919-15.708 3.772-21.291-.29-2.791-2.018-4.295-4.483-4.295-7.084V94.109c0-5.65 6.883-10.289 15.271-10.289 4.298 0 8.391 1.307 11.181 3.332l242.629 155.484c6.016 3.917 6.451 10.292.649 14.491-.216.154-.432.154-.649.292zM170.621 391.288l223.116-141.301L170.71 107.753l-.089 283.535z"),s.appendChild(i),s}function ss(t){const e="http://www.w3.org/2000/svg",s=document.createElementNS(e,"svg");s.setAttribute("class",`${t}-footer-icon-pause`),s.setAttribute("viewBox","0 0 500 500");const i=document.createElementNS(e,"path");return i.setAttribute("fill","currentColor"),i.setAttribute("d","M312.491 78.261c0-6.159 4.893-11.213 11.04-11.213 6.158 0 11.211 5.054 11.211 11.213v343.478c0 6.159-5.053 11.213-11.211 11.213-6.147 0-11.04-5.054-11.04-11.213V78.261zM165.257 78.261c0-6.159 4.893-11.213 11.04-11.213 6.158 0 11.211 5.054 11.211 11.213v343.478c0 6.159-5.053 11.213-11.211 11.213-6.147 0-11.04-5.054-11.04-11.213V78.261z"),s.appendChild(i),s}const x=typeof window!="undefined",Ae=x&&!("onscroll"in window)||typeof navigator!="undefined"&&/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),He=x&&"IntersectionObserver"in window,Ve=x&&"classList"in document.createElement("p"),Me=x&&window.devicePixelRatio>1,is={elements_selector:".lazy",container:Ae||x?document:null,threshold:300,thresholds:null,data_src:"src",data_srcset:"srcset",data_sizes:"sizes",data_bg:"bg",data_bg_hidpi:"bg-hidpi",data_bg_multi:"bg-multi",data_bg_multi_hidpi:"bg-multi-hidpi",data_poster:"poster",class_applied:"applied",class_loading:"loading",class_loaded:"loaded",class_error:"error",class_entered:"entered",class_exited:"exited",unobserve_completed:!0,unobserve_entered:!1,cancel_on_exit:!0,callback_enter:null,callback_exit:null,callback_applied:null,callback_loading:null,callback_loaded:null,callback_error:null,callback_finish:null,callback_cancel:null,use_native:!1},Be=t=>Object.assign({},is,t),De=function(t,e){let s;const i="LazyLoad::Initialized",r=new t(e);try{s=new CustomEvent(i,{detail:{instance:r}})}catch{s=document.createEvent("CustomEvent"),s.initCustomEvent(i,!1,!1,{instance:r})}window.dispatchEvent(s)},rs=(t,e)=>{if(!!e)if(!e.length)De(t,e);else for(let s=0,i;i=e[s];s+=1)De(t,i)},b="src",ee="srcset",te="sizes",We="poster",R="llOriginalAttrs",se="loading",Fe="loaded",Ue="applied",os="entered",ie="error",Ye="native",je="data-",Ge="ll-status",f=(t,e)=>t.getAttribute(je+e),ns=(t,e,s)=>{var i=je+e;if(s===null){t.removeAttribute(i);return}t.setAttribute(i,s)},L=t=>f(t,Ge),E=(t,e)=>ns(t,Ge,e),W=t=>E(t,null),re=t=>L(t)===null,as=t=>L(t)===se,cs=t=>L(t)===ie,oe=t=>L(t)===Ye,ls=[se,Fe,Ue,ie],hs=t=>ls.indexOf(L(t))>=0,m=(t,e,s,i)=>{if(!!t){if(i!==void 0){t(e,s,i);return}if(s!==void 0){t(e,s);return}t(e)}},$=(t,e)=>{if(Ve){t.classList.add(e);return}t.className+=(t.className?" ":"")+e},w=(t,e)=>{if(Ve){t.classList.remove(e);return}t.className=t.className.replace(new RegExp("(^|\\s+)"+e+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},ds=t=>{t.llTempImage=document.createElement("IMG")},ps=t=>{delete t.llTempImage},Xe=t=>t.llTempImage,F=(t,e)=>{if(!e)return;const s=e._observer;!s||s.unobserve(t)},us=t=>{t.disconnect()},gs=(t,e,s)=>{e.unobserve_entered&&F(t,s)},ne=(t,e)=>{!t||(t.loadingCount+=e)},fs=t=>{!t||(t.toLoadCount-=1)},qe=(t,e)=>{!t||(t.toLoadCount=e)},vs=t=>t.loadingCount>0,ws=t=>t.toLoadCount>0,Je=t=>{let e=[];for(let s=0,i;i=t.children[s];s+=1)i.tagName==="SOURCE"&&e.push(i);return e},ae=(t,e)=>{const s=t.parentNode;if(!s||s.tagName!=="PICTURE")return;Je(s).forEach(e)},Ke=(t,e)=>{Je(t).forEach(e)},U=[b],Ze=[b,We],Y=[b,ee,te],j=t=>!!t[R],Qe=t=>t[R],et=t=>delete t[R],O=(t,e)=>{if(j(t))return;const s={};e.forEach(i=>{s[i]=t.getAttribute(i)}),t[R]=s},bs=t=>{j(t)||(t[R]={backgroundImage:t.style.backgroundImage})},ms=(t,e,s)=>{if(!s){t.removeAttribute(e);return}t.setAttribute(e,s)},P=(t,e)=>{if(!j(t))return;const s=Qe(t);e.forEach(i=>{ms(t,i,s[i])})},Ss=t=>{if(!j(t))return;const e=Qe(t);t.style.backgroundImage=e.backgroundImage},ys=(t,e,s)=>{$(t,e.class_applied),E(t,Ue),!!s&&(e.unobserve_completed&&F(t,e),m(e.callback_applied,t,s))},tt=(t,e,s)=>{$(t,e.class_loading),E(t,se),!!s&&(ne(s,1),m(e.callback_loading,t,s))},T=(t,e,s)=>{!s||t.setAttribute(e,s)},st=(t,e)=>{T(t,te,f(t,e.data_sizes)),T(t,ee,f(t,e.data_srcset)),T(t,b,f(t,e.data_src))},xs=(t,e)=>{ae(t,s=>{O(s,Y),st(s,e)}),O(t,Y),st(t,e)},Es=(t,e)=>{O(t,U),T(t,b,f(t,e.data_src))},Ts=(t,e)=>{Ke(t,s=>{O(s,U),T(s,b,f(s,e.data_src))}),O(t,Ze),T(t,We,f(t,e.data_poster)),T(t,b,f(t,e.data_src)),t.load()},Cs=(t,e,s)=>{const i=f(t,e.data_bg),r=f(t,e.data_bg_hidpi),o=Me&&r?r:i;!o||(t.style.backgroundImage=`url("${o}")`,Xe(t).setAttribute(b,o),tt(t,e,s))},$s=(t,e,s)=>{const i=f(t,e.data_bg_multi),r=f(t,e.data_bg_multi_hidpi),o=Me&&r?r:i;!o||(t.style.backgroundImage=o,ys(t,e,s))},it={IMG:xs,IFRAME:Es,VIDEO:Ts},Is=(t,e)=>{const s=it[t.tagName];!s||s(t,e)},_s=(t,e,s)=>{const i=it[t.tagName];!i||(i(t,e),tt(t,e,s))},Ns=["IMG","IFRAME","VIDEO"],ks=t=>Ns.indexOf(t.tagName)>-1,rt=(t,e)=>{e&&!vs(e)&&!ws(e)&&m(t.callback_finish,e)},ot=(t,e,s)=>{t.addEventListener(e,s),t.llEvLisnrs[e]=s},Rs=(t,e,s)=>{t.removeEventListener(e,s)},ce=t=>!!t.llEvLisnrs,Ls=(t,e,s)=>{ce(t)||(t.llEvLisnrs={});const i=t.tagName==="VIDEO"?"loadeddata":"load";ot(t,i,e),ot(t,"error",s)},le=t=>{if(!ce(t))return;const e=t.llEvLisnrs;for(let s in e){const i=e[s];Rs(t,s,i)}delete t.llEvLisnrs},nt=(t,e,s)=>{ps(t),ne(s,-1),fs(s),w(t,e.class_loading),e.unobserve_completed&&F(t,s)},Os=(t,e,s,i)=>{const r=oe(e);nt(e,s,i),$(e,s.class_loaded),E(e,Fe),m(s.callback_loaded,e,i),r||rt(s,i)},Ps=(t,e,s,i)=>{const r=oe(e);nt(e,s,i),$(e,s.class_error),E(e,ie),m(s.callback_error,e,i),r||rt(s,i)},he=(t,e,s)=>{const i=Xe(t)||t;if(ce(i))return;Ls(i,n=>{Os(n,t,e,s),le(i)},n=>{Ps(n,t,e,s),le(i)})},zs=(t,e,s)=>{ds(t),he(t,e,s),bs(t),Cs(t,e,s),$s(t,e,s)},As=(t,e,s)=>{he(t,e,s),_s(t,e,s)},de=(t,e,s)=>{ks(t)?As(t,e,s):zs(t,e,s)},Hs=(t,e,s)=>{t.setAttribute("loading","lazy"),he(t,e,s),Is(t,e),E(t,Ye)},at=t=>{t.removeAttribute(b),t.removeAttribute(ee),t.removeAttribute(te)},Vs=t=>{ae(t,e=>{at(e)}),at(t)},ct=t=>{ae(t,e=>{P(e,Y)}),P(t,Y)},Ms={IMG:ct,IFRAME:t=>{P(t,U)},VIDEO:t=>{Ke(t,e=>{P(e,U)}),P(t,Ze),t.load()}},Bs=t=>{const e=Ms[t.tagName];if(!e){Ss(t);return}e(t)},Ds=(t,e)=>{re(t)||oe(t)||(w(t,e.class_entered),w(t,e.class_exited),w(t,e.class_applied),w(t,e.class_loading),w(t,e.class_loaded),w(t,e.class_error))},Ws=(t,e)=>{Bs(t),Ds(t,e),W(t),et(t)},Fs=(t,e,s,i)=>{!s.cancel_on_exit||!as(t)||t.tagName==="IMG"&&(le(t),Vs(t),ct(t),w(t,s.class_loading),ne(i,-1),W(t),m(s.callback_cancel,t,e,i))},Us=(t,e,s,i)=>{const r=hs(t);E(t,os),$(t,s.class_entered),w(t,s.class_exited),gs(t,s,i),m(s.callback_enter,t,e,i),!r&&de(t,s,i)},Ys=(t,e,s,i)=>{re(t)||($(t,s.class_exited),Fs(t,e,s,i),m(s.callback_exit,t,e,i))},js=["IMG","IFRAME","VIDEO"],lt=t=>t.use_native&&"loading"in HTMLImageElement.prototype,Gs=(t,e,s)=>{t.forEach(i=>{js.indexOf(i.tagName)!==-1&&Hs(i,e,s)}),qe(s,0)},Xs=t=>t.isIntersecting||t.intersectionRatio>0,qs=t=>({root:t.container===document?null:t.container,rootMargin:t.thresholds||t.threshold+"px"}),Js=(t,e,s)=>{t.forEach(i=>Xs(i)?Us(i.target,i,e,s):Ys(i.target,i,e,s))},Ks=(t,e)=>{e.forEach(s=>{t.observe(s)})},Zs=(t,e)=>{us(t),Ks(t,e)},Qs=(t,e)=>{!He||lt(t)||(e._observer=new IntersectionObserver(s=>{Js(s,t,e)},qs(t)))},ht=t=>Array.prototype.slice.call(t),G=t=>t.container.querySelectorAll(t.elements_selector),ei=t=>ht(t).filter(re),ti=t=>cs(t),si=t=>ht(t).filter(ti),dt=(t,e)=>ei(t||G(e)),ii=(t,e)=>{si(G(t)).forEach(i=>{w(i,t.class_error),W(i)}),e.update()},ri=(t,e)=>{!x||window.addEventListener("online",()=>{ii(t,e)})},z=function(t,e){const s=Be(t);this._settings=s,this.loadingCount=0,Qs(s,this),ri(s,this),this.update(e)};z.prototype={update:function(t){const e=this._settings,s=dt(t,e);if(qe(this,s.length),Ae||!He){this.loadAll(s);return}if(lt(e)){Gs(s,e,this);return}Zs(this._observer,s)},destroy:function(){this._observer&&this._observer.disconnect(),G(this._settings).forEach(t=>{et(t)}),delete this._observer,delete this._settings,delete this.loadingCount,delete this.toLoadCount},loadAll:function(t){const e=this._settings;dt(t,e).forEach(i=>{F(i,this),de(i,e,this)})},restoreAll:function(){const t=this._settings;G(t).forEach(e=>{Ws(e,t)})}},z.load=(t,e)=>{const s=Be(e);de(t,s)},z.resetStatus=t=>{W(t)},x&&rs(z,window.lazyLoadOptions);class pt{constructor({readonly:e,box:s,pages:i,onNewPageIndex:r,onPlay:o}){if(this.pageIndex=0,this.namespace="netless-app-docs-viewer",this.isShowPreview=!1,this.isSmallBox=!1,this.sideEffect=new H,i.length<=0)throw new Error("[DocsViewer] Empty pages.");this.readonly=e,this.box=s,this.pages=i,this.onNewPageIndex=r,this.onPlay=o,this.render()}mount(){this.box.mountContent(this.$content),this.box.mountFooter(this.$footer),this.sideEffect.add(()=>{const e=new z({container:this.$preview,elements_selector:`.${this.wrapClassName("preview-page>img")}`});return()=>e.destroy()},"preview-lazyload")}unmount(){this.$content.remove(),this.$footer.remove()}setReadonly(e){this.readonly!==e&&(this.readonly=e,this.$content.classList.toggle(this.wrapClassName("readonly"),e),this.$footer.classList.toggle(this.wrapClassName("readonly"),e),this.$pageNumberInput.disabled=e)}destroy(){this.sideEffect.flushAll(),this.unmount()}setPageIndex(e){Number.isNaN(e)||(this.pageIndex=e,this.$pageNumberInput.value=String(e+1))}setSmallBox(e){this.isSmallBox!==e&&(this.isSmallBox=e,this.$footer.classList.toggle(this.wrapClassName("float-footer"),e))}render(){return this.renderContent(),this.renderFooter(),this.$content}renderContent(){if(!this.$content){const e=document.createElement("div");e.className=this.wrapClassName("content"),this.$content=e,this.readonly&&e.classList.add(this.wrapClassName("readonly")),e.appendChild(this.renderPreviewMask()),e.appendChild(this.renderPreview())}return this.$content}renderPreview(){if(!this.$preview){const e=document.createElement("div");e.className=this.wrapClassName("preview")+" tele-fancy-scrollbar",this.$preview=e;const s=this.wrapClassName("preview-page"),i=this.wrapClassName("preview-page-name");this.pages.forEach((r,o)=>{var d;const n=(d=r.thumbnail)!=null?d:r.src.startsWith("ppt")?void 0:r.src;if(!n)return;const a=String(o),c=document.createElement("a");c.className=s+" "+this.wrapClassName(`preview-page-${o}`),c.setAttribute("href","#"),c.dataset.pageIndex=a;const l=document.createElement("span");l.className=i,l.textContent=String(o+1),l.dataset.pageIndex=a;const h=document.createElement("img");h.width=r.width,h.height=r.height,h.dataset.src=n,h.dataset.pageIndex=a,c.appendChild(h),c.appendChild(l),e.appendChild(c)}),this.sideEffect.addEventListener(e,"click",r=>{var n;if(this.readonly)return;const o=(n=r.target.dataset)==null?void 0:n.pageIndex;o&&(r.preventDefault(),r.stopPropagation(),r.stopImmediatePropagation(),this.onNewPageIndex(Number(o)),this.togglePreview(!1))})}return this.$preview}renderPreviewMask(){return this.$previewMask||(this.$previewMask=document.createElement("div"),this.$previewMask.className=this.wrapClassName("preview-mask"),this.sideEffect.addEventListener(this.$previewMask,"click",e=>{this.readonly||e.target===this.$previewMask&&this.togglePreview(!1)})),this.$previewMask}renderFooter(){if(!this.$footer){const e=document.createElement("div");if(e.className=this.wrapClassName("footer"),this.$footer=e,this.readonly&&e.classList.add(this.wrapClassName("readonly")),this.isSmallBox&&e.classList.add(this.wrapClassName("float-footer")),this.pages.some(c=>c.thumbnail||!c.src.startsWith("ppt"))){const c=this.renderFooterBtn("btn-sidebar",Zt(this.namespace));this.sideEffect.addEventListener(c,"click",()=>{this.readonly||this.togglePreview()}),this.$footer.appendChild(c)}const s=document.createElement("div");s.className=this.wrapClassName("page-jumps");const i=this.renderFooterBtn("btn-page-back",Qt(this.namespace));if(this.sideEffect.addEventListener(i,"click",()=>{this.readonly||this.onNewPageIndex(this.pageIndex-1)}),s.appendChild(i),this.onPlay){const c=this.renderFooterBtn("btn-page-play",ts(this.namespace),ss(this.namespace)),l=()=>{this.sideEffect.setTimeout(()=>{c.classList.toggle(this.wrapClassName("footer-btn-playing"),!1)},500,"returnPlay")};this.sideEffect.addEventListener(c,"click",()=>{this.readonly||(c.classList.toggle(this.wrapClassName("footer-btn-playing"),!0),this.onPlay&&this.onPlay(),l())}),s.appendChild(c)}const r=this.renderFooterBtn("btn-page-next",es(this.namespace));this.sideEffect.addEventListener(r,"click",()=>{this.readonly||this.onNewPageIndex(this.pageIndex+1)}),s.appendChild(r);const o=document.createElement("div");o.className=this.wrapClassName("page-number");const n=document.createElement("input");n.className=this.wrapClassName("page-number-input"),n.value=String(this.pageIndex+1),this.readonly&&(n.disabled=!0),this.$pageNumberInput=n,this.sideEffect.addEventListener(n,"focus",()=>{n.select()}),this.sideEffect.addEventListener(n,"change",()=>{this.readonly||n.value&&this.onNewPageIndex(Number(n.value)-1)});const a=document.createElement("span");a.textContent=" / "+this.pages.length,o.appendChild(n),o.appendChild(a),this.$footer.appendChild(s),this.$footer.appendChild(o)}return this.$footer}renderFooterBtn(e,s,i){const r=document.createElement("button");return r.className=this.wrapClassName("footer-btn")+" "+this.wrapClassName(e),r.appendChild(s),i&&r.appendChild(i),r}togglePreview(e){if(this.isShowPreview=e!=null?e:!this.isShowPreview,this.$content.classList.toggle(this.wrapClassName("preview-active"),this.isShowPreview),this.isShowPreview){const s=this.$preview.querySelector("."+this.wrapClassName(`preview-page-${this.pageIndex}`));s&&this.$preview.scrollTo({top:s.offsetTop-16})}}wrapClassName(e){return`${this.namespace}-${e}`}}function I(t,e,s){return Math.min(Math.max(t,e),s)}function ut(t){return t.touches?t.touches[0]:t}function gt(t){t.stopPropagation(),t.cancelable&&t.preventDefault()}class oi{constructor(e){var s,i,r;this.velocity=0,this.paused=!0,this._animationFrameID=null,this._loopTimestamp=0,this.looper=o=>{if(this.paused)return;let n=Math.floor((o-this._loopTimestamp)/1e3*60)+1;for(this._loopTimestamp=o;n-- >0;)this.stepper();this.onStep(this.current,this),!this.paused&&this.current!==this.target&&window.requestAnimationFrame(this.looper)},this.current=(s=e.start)!=null?s:0,this.target=this.current,this.stiffness=(i=e.stiffness)!=null?i:170,this.damping=(r=e.damping)!=null?r:26,this.onStep=e.onStep}stepTo(e,s){this.paused&&s!=null&&(this.current=s),this.paused=!1,this.target=e,this.onStep(this.current,this),this._loopTimestamp=Date.now(),window.requestAnimationFrame(this.looper)}pause(){this.paused=!0}destroy(){this.pause()}stepper(){const e=-this.stiffness*(this.current-this.target),s=-this.damping*this.velocity,i=this.velocity+(e+s)/60,r=this.current+i/60;Math.abs(i-0)<.01&&Math.abs(r-this.target)<.01?(this.current=this.target,this.velocity=0):(this.current=r,this.velocity=i)}}class ni{constructor(e,s,i,r){this.scale=1,this.lastVisit=Date.now(),this.pageOffsetY=0,this.pageOffsetX=0,this.visible=!0,this.index=e,this.page=s,this.scale=i,this.pageOffsetX=(r-s.width)/2;const o=document.createElement("div");o.className="page-renderer-page",o.dataset.index=`${e}`,o.style.width=`${s.width*i}px`,o.style.height=`${s.height*i}px`,s.thumbnail&&(o.style.backgroundImage=`url("${s.thumbnail}")`);const n=document.createElement("img");n.className="page-renderer-page-img",n.width=s.width,n.height=s.height,n.src=s.src,o.appendChild(n),this.$page=o}translateY(e){Math.abs(e-this.pageOffsetY)>=.001&&(this.pageOffsetY=e,this.$page.style.transform=`translate(${this.pageOffsetX*this.scale}px, ${this.pageOffsetY*this.scale}px)`)}setScale(e){Math.abs(e-this.scale)>=.001&&(this.scale=e,this.$page.style.width=`${this.page.width*this.scale}px`,this.$page.style.height=`${this.page.height*this.scale}px`,this.$page.style.transform=`translate(${this.pageOffsetX*this.scale}px, ${this.pageOffsetY*this.scale}px)`)}setVisible(e){e!==this.visible&&(this.visible=e,this.$page.style.opacity=e?"1":"0")}}const ai=window.requestIdleCallback||(t=>window.setTimeout(t,5e3)),ci=window.cancelIdleCallback||window.clearTimeout;class li{constructor(e,s,i){this.pages=e,this.pagesIntrinsicWidth=s,this.scale=i,this.els=new Map,this.maxElCount=200,this.gcTimer=null,this.gc=()=>{if(this.gcTimer=null,this.els.size>this.maxElCount){const r=[...this.els.values()].sort((o,n)=>n.lastVisit-o.lastVisit);for(let o=Math.floor(this.maxElCount/4);o<r.length;o++)this.els.delete(r[o].index)}}}getEl(e){let s=this.els.get(e);return s||(s=new ni(e,this.pages[e],this.scale,this.pagesIntrinsicWidth),this.els.set(e,s)),s.lastVisit=Date.now(),this.els.size>this.maxElCount&&this.gcTimer===null&&(this.gcTimer=ai(this.gc)),s}setScale(e){e!==this.scale&&(this.scale=e,this.els.forEach(s=>s.setScale(e)))}destroy(){this.els.clear(),this.gcTimer!==null&&(ci(this.gcTimer),this.gcTimer=null)}}class hi{constructor(e){this._hwaTimeout=NaN,this._turnOffHWA=()=>{window.clearTimeout(this._hwaTimeout),this._hwaTimeout=NaN,this.$pages.classList.toggle("is-hwa",!1)},this.pagesScrollTop=e.pagesScrollTop||0,this.containerWidth=e.containerWidth||1,this.containerHeight=e.containerHeight||1,this.pages=e.pages.map(o=>{if(o.thumbnail)return o;try{const n=new URL(o.src);return n.searchParams.set("x-oss-process","image/resize,l_50"),be(we({},o),{thumbnail:n.toString()})}catch(n){return console.error(n),o}});const s=Array(this.pages.length);let i=1/0,r=0;this.pagesIntrinsicHeight=this.pages.reduce((o,n,a)=>(s[a]=o,n.width>r&&(r=n.width),n.height<=i&&(i=n.height),o+n.height),0),this.pagesIntrinsicWidth=r,this.pagesMinHeight=i,this.pagesIntrinsicYs=s,this.scale=this._calcScale(),this.threshold=this._calcThreshold(),this.onPageIndexChanged=e.onPageIndexChanged,this.pageScrollIndex=0,this.pagesScrollTop!==0&&(this.pageScrollIndex=this.findScrollPageIndex(),this.onPageIndexChanged&&this.pageScrollIndex>0&&this.onPageIndexChanged(this.pageScrollIndex)),this.pageElManager=new li(this.pages,r,this.scale),this.$pages=this.renderPages()}setContainerSize(e,s){e>0&&s>0&&(e!==this.containerWidth||s!==this.containerHeight)&&(this.containerWidth=e,this.containerHeight=s,this.$pages.style.width=`${this.containerWidth}px`,this.$pages.style.height=`${this.containerHeight}px`,this.scale=this._calcScale(),this.threshold=this._calcThreshold(),this.pageElManager.setScale(this.scale),this.$pages.parentElement&&this.pagesScrollTo(this.pagesScrollTop,!0))}renderPages(){const e=document.createElement("div");return e.className="page-renderer-pages-container",e.style.width=`${this.containerWidth}px`,e.style.height=`${this.containerHeight}px`,e}pagesScrollTo(e,s){if(e=I(e,0,this.pagesIntrinsicHeight-this.containerHeight/this.scale),s||Math.abs(e-this.pagesScrollTop)>=.001){this._turnOnHWA(),this.pagesScrollTop=e;const i=this.findScrollPageIndex(),r=Math.max(i-this.threshold,0),o=Math.min(i+this.threshold,this.pages.length-1);for(let n=0;n<this.$pages.children.length;n++){const a=this.$pages.children[n],c=Number(a.dataset.index);c>=r&&c<=o||(a.remove(),n--)}for(let n=r;n<=o;n++){const a=this.pageElManager.getEl(n);a.$page.parentElement!==this.$pages&&this.$pages.appendChild(a.$page),a.translateY(this.pagesIntrinsicYs[n]-this.pagesScrollTop)}i!==this.pageScrollIndex&&(this.pageScrollIndex=i,this.onPageIndexChanged&&this.onPageIndexChanged(i))}}findScrollPageIndex(){for(let e=0;e<this.pagesIntrinsicYs.length;e++)if(this.pagesIntrinsicYs[e]+this.pages[e].height-this.pagesScrollTop>=.001)return e;return this.pagesIntrinsicYs.length-1}mount(e){e.appendChild(this.$pages),this.pagesScrollTo(this.pagesScrollTop,!0)}unmount(){this.$pages.remove()}destroy(){this.unmount(),this.onPageIndexChanged=void 0,this.pageElManager.destroy(),this._hwaTimeout&&(window.clearTimeout(this._hwaTimeout),this._hwaTimeout=NaN)}_calcScale(){return this.containerWidth/this.pagesIntrinsicWidth||1}_calcThreshold(){return I(Math.ceil(this.containerHeight/this.scale/this.pagesMinHeight/2),1,this.pages.length)}_turnOnHWA(){this._hwaTimeout?window.clearTimeout(this._hwaTimeout):this.$pages.classList.toggle("is-hwa",!0),this._hwaTimeout=window.setTimeout(this._turnOffHWA,1e3)}}const di=30;class pi{constructor(e){this.sideEffect=new H,this.pagesScrollTop=e.pagesScrollTop||0,this.containerWidth=e.containerWidth||1,this.containerHeight=e.containerHeight||1,this.pagesWidth=e.pagesWidth||1,this.pagesHeight=e.pagesHeight||1,this.scale=this._calcScale(),this.scrollbarMinHeight=e.scrollbarMinHeight||di,this.scrollbarHeight=this._calcScrollbarHeight(),this.readonly=e.readonly,this.wrapClassName=e.wrapClassName,this.onDragScroll=e.onDragScroll,this.$scrollbar=this.renderScrollbar()}mount(e){e.appendChild(this.$scrollbar),this.pagesScrollTo(this.pagesScrollTop,!0)}unmount(){this.$scrollbar.remove()}setReadonly(e){this.readonly=e}setContainerSize(e,s){e>0&&s>0&&(e!==this.containerWidth||s!==this.containerHeight)&&(this.containerWidth=e,this.containerHeight=s,this.scale=this._calcScale(),this._updateScrollbarHeight(),this.$scrollbar.parentElement&&this.pagesScrollTo(this.pagesScrollTop,!0))}pagesScrollTo(e,s){if(e=I(e,0,this.pagesHeight-this.containerHeight/this.scale),s||Math.abs(e-this.pagesScrollTop)>=.001){this.pagesScrollTop=e;const i=this.pagesScrollTop*this.scale,r=this.pagesHeight*this.scale,o=i/(r-this.containerHeight)*(this.containerHeight-this.scrollbarHeight);window.requestAnimationFrame?window.requestAnimationFrame(()=>{this.$scrollbar.style.transform=`translateY(${o}px)`}):this.$scrollbar.style.transform=`translateY(${o}px)`}}destroy(){this.unmount(),this.onDragScroll=void 0,this.sideEffect.flushAll()}renderScrollbar(){const e=document.createElement("button");e.className=this.wrapClassName("scrollbar"),e.style.minHeight=`${this.scrollbarMinHeight}px`,e.style.height=`${this.scrollbarHeight}px`;const s=i=>{if(this.readonly||i.button!=null&&i.button!==0)return;gt(i);const r=this.wrapClassName("scrollbar-dragging");e.classList.toggle(r,!0);const o=this.pagesScrollTop,{clientY:n}=ut(i),a=l=>{if(this.readonly)return;const{clientY:h}=ut(l),d=(h-n)/this.scale;Math.abs(d)>0&&this.onDragScroll&&this.onDragScroll(o+d*(this.pagesHeight*this.scale/this.containerHeight))},c=()=>{e.classList.toggle(r,!1),window.removeEventListener("mousemove",a,!0),window.removeEventListener("touchmove",a,!0),window.removeEventListener("mouseup",c,!0),window.removeEventListener("touchend",c,!0),window.removeEventListener("touchcancel",c,!0)};window.addEventListener("mousemove",a,!0),window.addEventListener("touchmove",a,!0),window.addEventListener("mouseup",c,!0),window.addEventListener("touchend",c,!0),window.addEventListener("touchcancel",c,!0)};return this.sideEffect.addEventListener(e,"mousedown",s),this.sideEffect.addEventListener(e,"touchstart",s),e}_calcScale(){return this.containerWidth/this.pagesWidth||1}_calcScrollbarHeight(){return I(this.containerHeight/(this.pagesHeight*this.scale)*this.containerHeight,this.scrollbarMinHeight,this.containerHeight)}_updateScrollbarHeight(){const e=this._calcScrollbarHeight();Math.abs(e-this.scrollbarHeight)>.001&&(this.scrollbarHeight=e,this.$scrollbar.style.height=`${e}px`)}}const ui=window.ResizeObserver||Kt,A=640;class gi{constructor({whiteboardView:e,readonly:s,box:i,pages:r,pageScrollTop:o=0,mountWhiteboard:n,onUserScroll:a}){this.sideEffect=new H,this.userScrolling=!1,this.onNewPageIndex=d=>{this.scrollToPage(d)},this.whiteboardView=e,this.readonly=s,this.box=i,this.pages=r,this.mountWhiteboard=n,this._onUserScroll=a;const c=this.debounce(()=>{this.userScrolling=!1,this._onUserScroll&&this._onUserScroll(this.pageRenderer.pagesScrollTop)},{wait:80},"debounce-updateUserScroll");this.updateUserScroll=()=>{this.userScrolling=!0,c()},this.viewer=new pt({readonly:s,box:i,pages:r,onNewPageIndex:this.onNewPageIndex});const{width:l,height:h}=this.whiteboardView.size;this.pageRenderer=new hi({pagesScrollTop:o,pages:this.pages,containerWidth:l,containerHeight:h,onPageIndexChanged:this.viewer.setPageIndex.bind(this.viewer)}),this.scrollbar=new pi({pagesScrollTop:this.pageRenderer.pagesScrollTop,containerWidth:l,containerHeight:h,pagesWidth:this.pageRenderer.pagesIntrinsicWidth,pagesHeight:this.pageRenderer.pagesIntrinsicHeight,readonly:this.readonly,wrapClassName:this.wrapClassName.bind(this),onDragScroll:d=>{this.pageScrollTo(d),this.updateUserScroll()}}),this.pageScrollStepper=new oi({start:this.pageRenderer.pagesScrollTop,onStep:d=>{this.pageScrollTo(d)}}),this.render()}mount(){this.viewer.mount(),this.setupScrollListener();const e=this.debounce(this.renderRatioHeight.bind(this),{wait:80});return this.sideEffect.add(()=>{const s=new ui(e);return s.observe(this.viewer.$content),()=>s.disconnect()}),this.sideEffect.setTimeout(()=>{this.userScrolling||this.pageScrollTo(this.pageRenderer.pagesScrollTop)},100),this}unmount(){return this.viewer.unmount(),this}setReadonly(e){this.readonly!==e&&(this.readonly=e,this.viewer.setReadonly(e),this.scrollbar.setReadonly(e))}destroy(){this.sideEffect.flushAll(),this.pageScrollStepper.destroy(),this._onUserScroll=void 0,this.unmount(),this.viewer.destroy(),this.pageRenderer.destroy(),this.scrollbar.destroy()}syncPageScrollTop(e){!this.userScrolling&&e>=0&&Math.abs(this.pageRenderer.pagesScrollTop-e)>.01&&this.pageScrollStepper.stepTo(e,this.pageRenderer.pagesScrollTop)}render(){this.pageRenderer.mount(this.viewer.$content),this.viewer.$content.appendChild(this.renderWhiteboardView()),this.scrollbar.mount(this.viewer.$content),this.renderRatioHeight()}renderRatioHeight(){const e=this.box.absoluteHeight,s=e<=A;if(this.viewer.setSmallBox(s),s){const i=26/A,r=26/e,o=26/A,n=0,a=Math.max((i+o-(r+n))/2,0);if(this.box.$titleBar){const c=r+a;this.box.$titleBar.style.height=`${c*100}%`}if(this.box.$footer){const c=n+a;this.box.$footer.style.height=`${c*100}%`}}else{if(this.box.$titleBar){const i=Math.max(26/A,26/e);this.box.$titleBar.style.height=`${i*100}%`}if(this.box.$footer){const i=Math.max(26/A,26/e);this.box.$footer.style.height=`${i*100}%`}}}renderWhiteboardView(){return this.$whiteboardView||(this.$whiteboardView=document.createElement("div"),this.$whiteboardView.className=this.wrapClassName("wb-view"),this.mountWhiteboard(this.$whiteboardView),this.sideEffect.addEventListener(this.$whiteboardView,"wheel",e=>{gt(e),this.readonly||(this.pageScrollTo(this.pageRenderer.pagesScrollTop+e.deltaY),this.updateUserScroll())},{passive:!1,capture:!0}),this.sideEffect.addEventListener(this.$whiteboardView,"touchmove",e=>{this.readonly||e.touches.length<=1||this.updateUserScroll()},{passive:!0,capture:!0})),this.$whiteboardView}scrollTopPageToEl(e){return e*this.pageRenderer.scale}scrollTopElToPage(e){return e/this.pageRenderer.scale}elScrollTo(e){this.pageScrollTo(this.scrollTopElToPage(e))}pageScrollTo(e){const s=this.scrollTopElToPage(this.whiteboardView.size.height/2);this.whiteboardView.moveCamera({centerY:I(e+s,s,this.pageRenderer.pagesIntrinsicHeight-s),animationMode:"immediately"})}scrollToPage(e){if(!this.readonly&&!Number.isNaN(e)){const s=this.pageRenderer.pagesIntrinsicYs[e];s>=0&&(this.pageScrollTo(s+5/this.pageRenderer.scale),this.updateUserScroll())}}setupScrollListener(){this.sideEffect.add(()=>{const e=s=>{const{width:i,height:r}=this.whiteboardView.size;if(i<=0||r<=0)return;const o=s.centerY-this.pageRenderer.containerHeight/this.pageRenderer.scale/2;this.pageRenderer.pagesScrollTo(o),this.scrollbar.pagesScrollTo(o)};return this.whiteboardView.callbacks.on("onCameraUpdated",e),()=>this.whiteboardView.callbacks.off("onCameraUpdated",e)}),this.sideEffect.add(()=>{const e=({width:s,height:i})=>{if(s<=0||i<=0)return;this.pageRenderer.setContainerSize(s,i),this.scrollbar.setContainerSize(s,i);const{pagesIntrinsicWidth:r,pagesIntrinsicHeight:o}=this.pageRenderer;this.whiteboardView.moveCameraToContain({originX:0,originY:this.pageRenderer.pagesScrollTop,width:r,height:i/this.pageRenderer.scale,animationMode:"immediately"}),this.whiteboardView.setCameraBound({damping:1,maxContentMode:()=>this.pageRenderer.scale,minContentMode:()=>this.pageRenderer.scale,centerX:r/2,centerY:o/2,width:r,height:o})};return this.whiteboardView.callbacks.on("onSizeUpdated",e),()=>{this.whiteboardView.callbacks.off("onSizeUpdated",e)}},"whiteboard-size-update"),this.sideEffect.addEventListener(window,"keyup",e=>{if(this.readonly||!this.box.focus||this.box.minimized)return;let s=null;switch(e.key){case"PageDown":{s=this.pageRenderer.pagesScrollTop+this.pageRenderer.containerHeight/this.pageRenderer.scale;break}case"PageUp":{s=this.pageRenderer.pagesScrollTop-this.pageRenderer.containerHeight/this.pageRenderer.scale;break}case"ArrowDown":{s=this.pageRenderer.pagesScrollTop+this.pageRenderer.containerHeight/4/this.pageRenderer.scale;break}case"ArrowUp":{s=this.pageRenderer.pagesScrollTop-this.pageRenderer.containerHeight/4/this.pageRenderer.scale;break}}s!==null&&(this._onUserScroll?this._onUserScroll(s):(this.pageScrollTo(s),this.updateUserScroll()))},{capture:!0})}debounce(e,s,i){const r=Nt(e,s);return this.sideEffect.addDisposer(()=>r.cancel(),i),r}wrapClassName(e){return"netless-app-docs-viewer-static-"+e}}class fi{constructor({context:e,whiteboardView:s,box:i,pages:r}){this.sideEffect=new H,this.onPlayPPT=()=>{const o=this.context.getRoom();o&&o.pptNextStep()},this._scaleDocsToFitImpl=()=>{const o=this.pages[this.getPageIndex()];o&&this.whiteboardView.moveCameraToContain({originX:-o.width/2,originY:-o.height/2,width:o.width,height:o.height,animationMode:"immediately"})},this._scaleDocsToFitDebounced=()=>{this.sideEffect.setTimeout(this._scaleDocsToFitImpl,1e3,"_scaleDocsToFitDebounced")},this.scaleDocsToFit=()=>{this._scaleDocsToFitImpl(),this._scaleDocsToFitDebounced()},this.onNewPageIndex=o=>{this.jumpToPage(o,!0)},this.context=e,this.whiteboardView=s,this.box=i,this.pages=r,this.displayer=e.getDisplayer(),this.viewer=new pt({readonly:!e.getIsWritable(),box:i,pages:r,onNewPageIndex:this.onNewPageIndex,onPlay:this.onPlayPPT}),this.render(),this.sideEffect.add(()=>{const o=n=>{this.viewer.setReadonly(!n)};return this.context.emitter.on("writableChange",o),()=>this.context.emitter.off("writableChange",o)}),this.sideEffect.add(()=>{const o=n=>{this.jumpToPage(n.index)};return this.context.emitter.on("sceneStateChange",o),()=>this.context.emitter.off("sceneStateChange",o)})}mount(){this.viewer.mount();const e=this.getPageIndex();return e!==0&&this.jumpToPage(e),this.scaleDocsToFit(),this.sideEffect.add(()=>(this.whiteboardView.callbacks.on("onSizeUpdated",this.scaleDocsToFit),()=>{this.whiteboardView.callbacks.off("onSizeUpdated",this.scaleDocsToFit)})),this}unmount(){return this.viewer.unmount(),this}destroy(){this.sideEffect.flushAll(),this.unmount(),this.viewer.destroy()}getPageIndex(){return this.displayer.state.sceneState.index}jumpToPage(e,s){var i,r;if(e=I(e,0,this.pages.length-1),e!==this.getPageIndex()&&this.context.getIsWritable()){const o=this.context.getInitScenePath(),n=(r=(i=this.context.getScenes())==null?void 0:i[e])==null?void 0:r.name;o&&n&&this.context.setScenePath(`${o}/${n}`),this.scaleDocsToFit()}if(e!==this.viewer.pageIndex&&this.viewer.setPageIndex(e),s){const o=this.context.getRoom();if(o){const n=o.state.globalState.__pptState;o.setGlobalState({__pptState:n&&{uuid:n.uuid,pageIndex:e,disableAutoPlay:n.disableAutoPlay}})}}}render(){this.viewer.$content.appendChild(this.renderMask()),this.viewer.$content.appendChild(this.renderWhiteboardView()),this.sideEffect.addEventListener(window,"keydown",e=>{var s;if(this.box.focus)switch(e.key){case"ArrowUp":case"ArrowLeft":{this.jumpToPage(this.getPageIndex()-1,!0);break}case"ArrowRight":case"ArrowDown":{(s=this.context.getRoom())==null||s.pptNextStep();break}}})}renderMask(){if(!this.$mask){const e=document.createElement("div");e.className=this.wrapClassName("mask"),this.$mask=e;const s=document.createElement("button");s.className=this.wrapClassName("back");const i=document.createElement("button");i.className=this.wrapClassName("next")}return this.$mask}renderWhiteboardView(){return this.$whiteboardView||(this.$whiteboardView=document.createElement("div"),this.$whiteboardView.className=this.wrapClassName("wb-view"),this.sideEffect.addEventListener(this.$whiteboardView,"click",e=>{var i;const s=this.context.getRoom();if(s&&s.state.memberState.currentApplianceName==="clicker"){for(let r=e.target;r;r=r.parentElement)if((i=r.classList)==null?void 0:i.contains("ppt-event-source"))return;s.pptNextStep()}}),this.context.mountView(this.$whiteboardView)),this.$whiteboardView}wrapClassName(e){return"netless-app-docs-viewer-dynamic-"+e}}const vi={kind:"DocsViewer",setup(t){const e=t.getBox(),s=t.getScenes();if(!s)throw new Error("[Docs Viewer]: scenes not found.");const i=t.getView();if(!i)throw new Error("[Docs Viewer]: no whiteboard view.");const r=s.map(({ppt:o})=>o?{width:o.width,height:o.height,src:o.src,thumbnail:o.previewURL}:null).filter(o=>Boolean(o));if(r.length<=0)throw new Error("[Docs Viewer]: empty scenes.");e.mountStyles(u),r[0].src.startsWith("ppt")?bi(t,i,e,r):wi(t,i,e,r)}};function wi(t,e,s,i){var o;e.disableCameraTransform=!t.getIsWritable();const r=new gi({whiteboardView:e,readonly:!t.getIsWritable(),box:s,pages:i,pageScrollTop:(o=t.getAttributes())==null?void 0:o.pageScrollTop,mountWhiteboard:t.mountView.bind(t),onUserScroll:n=>{var a;((a=t.getAttributes())==null?void 0:a.pageScrollTop)!==n&&!s.readonly&&t.updateAttributes(["pageScrollTop"],n)}}).mount();t.emitter.on("attributesUpdate",n=>{n&&n.pageScrollTop!=null&&r.syncPageScrollTop(n.pageScrollTop)}),t.emitter.on("writableChange",n=>{r.setReadonly(!n),e.disableCameraTransform=!n})}function bi(t,e,s,i){e.disableCameraTransform=!0;const r=new fi({context:t,whiteboardView:e,box:s,pages:i}).mount();t.mountView(r.$whiteboardView),t.isAddApp&&e.callbacks.once("onSizeUpdated",({width:o,height:n})=>{if(i.length>0&&s.state!=="maximized"){const{width:a,height:c}=i[0],h=c/a*o-n;h!==0&&t.getIsWritable()&&t.emitter.emit("setBoxSize",{width:s.width,height:s.height+h/s.containerRect.height})}})}return p.default=vi,Object.defineProperty(p,"__esModule",{value:!0}),p[Symbol.toStringTag]="Module",p}({}); | ||
var $i=Object.defineProperty,Ii=Object.defineProperties;var Ni=Object.getOwnPropertyDescriptors;var yt=Object.getOwnPropertySymbols;var ki=Object.prototype.hasOwnProperty,Ri=Object.prototype.propertyIsEnumerable;var Et=(u,p,f)=>p in u?$i(u,p,{enumerable:!0,configurable:!0,writable:!0,value:f}):u[p]=f,we=(u,p)=>{for(var f in p||(p={}))ki.call(p,f)&&Et(u,f,p[f]);if(yt)for(var f of yt(p))Ri.call(p,f)&&Et(u,f,p[f]);return u},be=(u,p)=>Ii(u,Ni(p));var NetlessAppDocsViewer=function(u){"use strict";var p=`.netless-app-docs-viewer-content{position:relative;height:100%;overflow:hidden}.netless-app-docs-viewer-preview-mask{display:none;position:absolute;z-index:200;top:0;left:0;width:100%;height:100%}.netless-app-docs-viewer-preview{display:flex;flex-direction:column;align-items:center;position:absolute;z-index:300;top:0;left:0;width:33%;max-width:200px;height:100%;padding-top:10px;transform:translate(-100%);background:rgba(237,237,240,.9);box-shadow:inset -1px 0 #0000001c;transition:transform .4s}.netless-app-docs-viewer-preview-active .netless-app-docs-viewer-preview-mask{display:block}.netless-app-docs-viewer-preview-active .netless-app-docs-viewer-preview{transform:translate(0)}.netless-app-docs-viewer-preview-page{position:relative;display:block;width:55%;margin-bottom:10px;font-size:0;color:transparent;outline:none;border:7px solid transparent;border-radius:4px;transition:border-color .3s;user-select:none}.netless-app-docs-viewer-preview-page:hover,.netless-app-docs-viewer-preview-page.netless-app-docs-viewer-preview-page-active{border-color:#444e601a}.netless-app-docs-viewer-preview-page>img{width:100%;height:auto;box-sizing:border-box;border:1px solid rgba(0,0,0,.5);border-radius:1px;background-color:#fff;box-shadow:0 2px 8px #0000004d}.netless-app-docs-viewer-preview-page-name{position:absolute;top:1px;left:-10px;transform:translate(-100%);text-align:right;font-size:12px;color:#5f5f5f;user-select:none}.netless-app-docs-viewer-footer{box-sizing:border-box;height:26px;display:flex;align-items:center;padding:0 16px;border-top:1px solid #eeeef7;color:#191919}.netless-app-docs-viewer-float-footer{width:100%;min-height:26px;position:absolute;left:0;bottom:0;z-index:2000;background:rgba(249,249,252,.9);transition:opacity .4s}.netless-app-docs-viewer-footer-btn{box-sizing:border-box;width:26px;height:26px;font-size:0;margin:0;padding:3px;border:none;border-radius:1px;outline:none;color:currentColor;background:transparent;transition:background .4s;cursor:pointer;user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}.netless-app-docs-viewer-footer-btn:hover{background:rgba(237,237,240,.9)}@media (hover: none){.netless-app-docs-viewer-footer-btn:hover{background:transparent!important}}.netless-app-docs-viewer-footer-btn>svg{width:100%;height:100%}.netless-app-docs-viewer-footer-btn>svg:nth-of-type(2){display:none}.netless-app-docs-viewer-footer-btn.netless-app-docs-viewer-footer-btn-playing>svg:nth-of-type(1){display:none}.netless-app-docs-viewer-footer-btn.netless-app-docs-viewer-footer-btn-playing>svg:nth-of-type(2){display:initial}.netless-app-docs-viewer-footer-btn~.netless-app-docs-viewer-footer-btn{margin-left:15px}.netless-app-docs-viewer-page-jumps{flex:1;display:flex;justify-content:center;align-items:center}.netless-app-docs-viewer-page-number{margin-left:auto;font-size:13px;user-select:none;white-space:nowrap;word-break:keep-all}.netless-app-docs-viewer-page-number-input{border:none;outline:none;width:3em;margin:0;padding:0 2px;text-align:right;font-size:13px;line-height:1;font-weight:400;font-family:inherit;border-radius:2px;color:currentColor;background:transparent;transition:background .4s;user-select:text;-webkit-tap-highlight-color:rgba(0,0,0,0)}.netless-app-docs-viewer-page-number-input:hover,.netless-app-docs-viewer-page-number-input:focus,.netless-app-docs-viewer-page-number-input:active{background:#fff;box-shadow:#63636333 0 2px 8px}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-footer-btn{cursor:not-allowed}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-footer-btn:hover{background:transparent}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input{cursor:not-allowed}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input:hover,.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input:focus,.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input:active{background:transparent;box-shadow:none}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input:disabled{color:inherit}.netless-app-docs-viewer-readonly.netless-app-docs-viewer-float-footer{display:none}.telebox-color-scheme-dark .netless-app-docs-viewer-page-number-input{color:#a6a6a8}.telebox-color-scheme-dark .netless-app-docs-viewer-page-number-input:active,.telebox-color-scheme-dark .netless-app-docs-viewer-page-number-input:focus,.telebox-color-scheme-dark .netless-app-docs-viewer-page-number-input:hover{color:#222}.telebox-color-scheme-dark .netless-app-docs-viewer-footer{color:#a6a6a8;background:#2d2d33;border-top:none}.telebox-color-scheme-dark .netless-app-docs-viewer-footer-btn:hover{background:#212126}.telebox-color-scheme-dark .netless-app-docs-viewer-preview{background:rgba(50,50,50,.9)}.netless-app-docs-viewer-static-scrollbar{position:absolute;top:0;right:0;z-index:2147483647;width:8px;min-height:30px;margin:0;padding:0;border:none;outline:none;border-radius:4px;background:rgba(68,78,96,.4);box-shadow:1px 1px 8px #ffffffb3;opacity:0;transition:background .4s,opacity .4s 3s,transform .2s;user-select:none}.netless-app-docs-viewer-static-scrollbar.netless-app-docs-viewer-static-scrollbar-dragging{background:rgba(68,78,96,.6);opacity:1;transition:background .4s,opacity .4s 3s!important}.netless-app-docs-viewer-static-scrollbar:hover,.netless-app-docs-viewer-static-scrollbar:focus{background:rgba(68,78,96,.5)}.netless-app-docs-viewer-static-scrollbar:active{background:rgba(68,78,96,.6)}.netless-app-docs-viewer-content:hover .netless-app-docs-viewer-static-scrollbar{opacity:1;transition:background .4s,opacity .4s,transform .2s}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-static-scrollbar{display:none}.netless-app-docs-viewer-static-pages:hover .netless-app-docs-viewer-static-scrollbar{opacity:1;transition:background .4s,opacity .4s,transform .2s}.page-renderer-pages-container{position:relative;overflow:hidden}.page-renderer-page{position:absolute;top:0;left:0;background-position:center;background-size:cover;background-repeat:no-repeat}.page-renderer-pages-container.is-hwa .page-renderer-page{will-change:transform}.page-renderer-page-img{display:block;width:100%;height:auto;user-select:none}.netless-app-docs-viewer-static-pages{overflow:hidden;position:relative;height:100%;user-select:none}.netless-app-docs-viewer-static-page{display:block;width:100%;height:auto;user-select:none}.netless-app-docs-viewer-static-wb-view,.netless-app-docs-viewer-dynamic-wb-view{position:absolute;top:0;left:0;width:100%;height:100%;z-index:100;overflow:hidden}.netless-app-docs-viewer-dynamic-wb-view .cursor-clicker .ppt-event-source{cursor:pointer} | ||
`;const f=(t,e,s,i)=>{if(s==="length"||s==="prototype"||s==="arguments"||s==="caller")return;const r=Object.getOwnPropertyDescriptor(t,s),o=Object.getOwnPropertyDescriptor(e,s);!Tt(r,o)&&i||Object.defineProperty(t,s,o)},Tt=function(t,e){return t===void 0||t.configurable||t.writable===e.writable&&t.enumerable===e.enumerable&&t.configurable===e.configurable&&(t.writable||t.value===e.value)},Ct=(t,e)=>{const s=Object.getPrototypeOf(e);s!==Object.getPrototypeOf(t)&&Object.setPrototypeOf(t,s)},_t=(t,e)=>`/* Wrapped ${t}*/ | ||
${e}`,$t=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),It=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Nt=(t,e,s)=>{const i=s===""?"":`with ${s.trim()}() `,r=_t.bind(null,i,e.toString());Object.defineProperty(r,"name",It),Object.defineProperty(t,"toString",be(we({},$t),{value:r}))};function kt(t,e,{ignoreNonConfigurable:s=!1}={}){const{name:i}=t;for(const r of Reflect.ownKeys(e))f(t,e,r,s);return Ct(t,e),Nt(t,e,i),t}const Rt=(t,e={})=>{if(typeof t!="function")throw new TypeError(`Expected the first argument to be a function, got \`${typeof t}\``);const{wait:s=0,maxWait:i=Number.Infinity,before:r=!1,after:o=!0}=e;if(!r&&!o)throw new Error("Both `before` and `after` are false, function wouldn't be called.");let n,a,c;const l=function(...h){const d=this,pe=()=>{n=void 0,a&&(clearTimeout(a),a=void 0),o&&(c=t.apply(d,h))},ue=()=>{a=void 0,n&&(clearTimeout(n),n=void 0),o&&(c=t.apply(d,h))},ge=r&&!n;return clearTimeout(n),n=setTimeout(pe,s),i>0&&i!==Number.Infinity&&!a&&(a=setTimeout(ue,i)),ge&&(c=t.apply(d,h)),c};return kt(l,t),l.cancel=()=>{n&&(clearTimeout(n),n=void 0),a&&(clearTimeout(a),a=void 0)},l},me="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",Ot=me.length,Se=Array(20),k=()=>{for(let t=0;t<20;t++)Se[t]=me.charAt(Math.random()*Ot);return Se.join("")};class H{constructor(){this.disposers=new Map}add(e,s=k()){return this.flush(s),this.disposers.set(s,e()),s}addDisposer(e,s=k()){return this.flush(s),this.disposers.set(s,e),s}addEventListener(e,s,i,r,o=k()){return this.add(()=>(e.addEventListener(s,i,r),()=>e.removeEventListener(s,i,r)),o),o}setTimeout(e,s,i=k()){return this.add(()=>{const r=window.setTimeout(()=>{this.remove(i),e()},s);return()=>window.clearTimeout(r)},i)}setInterval(e,s,i=k()){return this.add(()=>{const r=window.setInterval(e,s);return()=>window.clearInterval(r)},i)}remove(e){const s=this.disposers.get(e);return this.disposers.delete(e),s}flush(e){const s=this.remove(e);if(s)try{s()}catch(i){console.error(i)}}flushAll(){this.disposers.forEach(e=>{try{e()}catch(s){console.error(s)}}),this.disposers.clear()}}var x=[],Lt=function(){return x.some(function(t){return t.activeTargets.length>0})},Pt=function(){return x.some(function(t){return t.skippedTargets.length>0})},xe="ResizeObserver loop completed with undelivered notifications.",zt=function(){var t;typeof ErrorEvent=="function"?t=new ErrorEvent("error",{message:xe}):(t=document.createEvent("Event"),t.initEvent("error",!1,!1),t.message=xe),window.dispatchEvent(t)},R;(function(t){t.BORDER_BOX="border-box",t.CONTENT_BOX="content-box",t.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(R||(R={}));var y=function(t){return Object.freeze(t)},At=function(){function t(e,s){this.inlineSize=e,this.blockSize=s,y(this)}return t}(),ye=function(){function t(e,s,i,r){return this.x=e,this.y=s,this.width=i,this.height=r,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,y(this)}return t.prototype.toJSON=function(){var e=this,s=e.x,i=e.y,r=e.top,o=e.right,n=e.bottom,a=e.left,c=e.width,l=e.height;return{x:s,y:i,top:r,right:o,bottom:n,left:a,width:c,height:l}},t.fromRect=function(e){return new t(e.x,e.y,e.width,e.height)},t}(),J=function(t){return t instanceof SVGElement&&"getBBox"in t},Ee=function(t){if(J(t)){var e=t.getBBox(),s=e.width,i=e.height;return!s&&!i}var r=t,o=r.offsetWidth,n=r.offsetHeight;return!(o||n||t.getClientRects().length)},Te=function(t){var e,s;if(t instanceof Element)return!0;var i=(s=(e=t)===null||e===void 0?void 0:e.ownerDocument)===null||s===void 0?void 0:s.defaultView;return!!(i&&t instanceof i.Element)},Ht=function(t){switch(t.tagName){case"INPUT":if(t.type!=="image")break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1},O=typeof window!="undefined"?window:{},V=new WeakMap,Ce=/auto|scroll/,Vt=/^tb|vertical/,Mt=/msie|trident/i.test(O.navigator&&O.navigator.userAgent),v=function(t){return parseFloat(t||"0")},C=function(t,e,s){return t===void 0&&(t=0),e===void 0&&(e=0),s===void 0&&(s=!1),new At((s?e:t)||0,(s?t:e)||0)},_e=y({devicePixelContentBoxSize:C(),borderBoxSize:C(),contentBoxSize:C(),contentRect:new ye(0,0,0,0)}),$e=function(t,e){if(e===void 0&&(e=!1),V.has(t)&&!e)return V.get(t);if(Ee(t))return V.set(t,_e),_e;var s=getComputedStyle(t),i=J(t)&&t.ownerSVGElement&&t.getBBox(),r=!Mt&&s.boxSizing==="border-box",o=Vt.test(s.writingMode||""),n=!i&&Ce.test(s.overflowY||""),a=!i&&Ce.test(s.overflowX||""),c=i?0:v(s.paddingTop),l=i?0:v(s.paddingRight),h=i?0:v(s.paddingBottom),d=i?0:v(s.paddingLeft),pe=i?0:v(s.borderTopWidth),ue=i?0:v(s.borderRightWidth),ge=i?0:v(s.borderBottomWidth),yi=i?0:v(s.borderLeftWidth),wt=d+l,bt=c+h,fe=yi+ue,ve=pe+ge,mt=a?t.offsetHeight-ve-t.clientHeight:0,St=n?t.offsetWidth-fe-t.clientWidth:0,Ei=r?wt+fe:0,Ti=r?bt+ve:0,X=i?i.width:v(s.width)-Ei-St,q=i?i.height:v(s.height)-Ti-mt,Ci=X+wt+St+fe,_i=q+bt+mt+ve,xt=y({devicePixelContentBoxSize:C(Math.round(X*devicePixelRatio),Math.round(q*devicePixelRatio),o),borderBoxSize:C(Ci,_i,o),contentBoxSize:C(X,q,o),contentRect:new ye(d,c,X,q)});return V.set(t,xt),xt},Ie=function(t,e,s){var i=$e(t,s),r=i.borderBoxSize,o=i.contentBoxSize,n=i.devicePixelContentBoxSize;switch(e){case R.DEVICE_PIXEL_CONTENT_BOX:return n;case R.BORDER_BOX:return r;default:return o}},Bt=function(){function t(e){var s=$e(e);this.target=e,this.contentRect=s.contentRect,this.borderBoxSize=y([s.borderBoxSize]),this.contentBoxSize=y([s.contentBoxSize]),this.devicePixelContentBoxSize=y([s.devicePixelContentBoxSize])}return t}(),Ne=function(t){if(Ee(t))return 1/0;for(var e=0,s=t.parentNode;s;)e+=1,s=s.parentNode;return e},Dt=function(){var t=1/0,e=[];x.forEach(function(n){if(n.activeTargets.length!==0){var a=[];n.activeTargets.forEach(function(l){var h=new Bt(l.target),d=Ne(l.target);a.push(h),l.lastReportedSize=Ie(l.target,l.observedBox),d<t&&(t=d)}),e.push(function(){n.callback.call(n.observer,a,n.observer)}),n.activeTargets.splice(0,n.activeTargets.length)}});for(var s=0,i=e;s<i.length;s++){var r=i[s];r()}return t},ke=function(t){x.forEach(function(s){s.activeTargets.splice(0,s.activeTargets.length),s.skippedTargets.splice(0,s.skippedTargets.length),s.observationTargets.forEach(function(r){r.isActive()&&(Ne(r.target)>t?s.activeTargets.push(r):s.skippedTargets.push(r))})})},Wt=function(){var t=0;for(ke(t);Lt();)t=Dt(),ke(t);return Pt()&&zt(),t>0},K,Re=[],Ft=function(){return Re.splice(0).forEach(function(t){return t()})},Ut=function(t){if(!K){var e=0,s=document.createTextNode(""),i={characterData:!0};new MutationObserver(function(){return Ft()}).observe(s,i),K=function(){s.textContent=""+(e?e--:e++)}}Re.push(t),K()},Yt=function(t){Ut(function(){requestAnimationFrame(t)})},M=0,jt=function(){return!!M},Gt=250,Xt={attributes:!0,characterData:!0,childList:!0,subtree:!0},Oe=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],Le=function(t){return t===void 0&&(t=0),Date.now()+t},Z=!1,qt=function(){function t(){var e=this;this.stopped=!0,this.listener=function(){return e.schedule()}}return t.prototype.run=function(e){var s=this;if(e===void 0&&(e=Gt),!Z){Z=!0;var i=Le(e);Yt(function(){var r=!1;try{r=Wt()}finally{if(Z=!1,e=i-Le(),!jt())return;r?s.run(1e3):e>0?s.run(e):s.start()}})}},t.prototype.schedule=function(){this.stop(),this.run()},t.prototype.observe=function(){var e=this,s=function(){return e.observer&&e.observer.observe(document.body,Xt)};document.body?s():O.addEventListener("DOMContentLoaded",s)},t.prototype.start=function(){var e=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),Oe.forEach(function(s){return O.addEventListener(s,e.listener,!0)}))},t.prototype.stop=function(){var e=this;this.stopped||(this.observer&&this.observer.disconnect(),Oe.forEach(function(s){return O.removeEventListener(s,e.listener,!0)}),this.stopped=!0)},t}(),Q=new qt,Pe=function(t){!M&&t>0&&Q.start(),M+=t,!M&&Q.stop()},Jt=function(t){return!J(t)&&!Ht(t)&&getComputedStyle(t).display==="inline"},Kt=function(){function t(e,s){this.target=e,this.observedBox=s||R.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return t.prototype.isActive=function(){var e=Ie(this.target,this.observedBox,!0);return Jt(this.target)&&(this.lastReportedSize=e),this.lastReportedSize.inlineSize!==e.inlineSize||this.lastReportedSize.blockSize!==e.blockSize},t}(),Zt=function(){function t(e,s){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=e,this.callback=s}return t}(),B=new WeakMap,ze=function(t,e){for(var s=0;s<t.length;s+=1)if(t[s].target===e)return s;return-1},D=function(){function t(){}return t.connect=function(e,s){var i=new Zt(e,s);B.set(e,i)},t.observe=function(e,s,i){var r=B.get(e),o=r.observationTargets.length===0;ze(r.observationTargets,s)<0&&(o&&x.push(r),r.observationTargets.push(new Kt(s,i&&i.box)),Pe(1),Q.schedule())},t.unobserve=function(e,s){var i=B.get(e),r=ze(i.observationTargets,s),o=i.observationTargets.length===1;r>=0&&(o&&x.splice(x.indexOf(i),1),i.observationTargets.splice(r,1),Pe(-1))},t.disconnect=function(e){var s=this,i=B.get(e);i.observationTargets.slice().forEach(function(r){return s.unobserve(e,r.target)}),i.activeTargets.splice(0,i.activeTargets.length)},t}(),Qt=function(){function t(e){if(arguments.length===0)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if(typeof e!="function")throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");D.connect(this,e)}return t.prototype.observe=function(e,s){if(arguments.length===0)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!Te(e))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");D.observe(this,e,s)},t.prototype.unobserve=function(e){if(arguments.length===0)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!Te(e))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");D.unobserve(this,e)},t.prototype.disconnect=function(){D.disconnect(this)},t.toString=function(){return"function ResizeObserver () { [polyfill code] }"},t}();function es(t){const e="http://www.w3.org/2000/svg",s=document.createElementNS(e,"svg");s.setAttribute("class",`${t}-footer-icon-sidebar`),s.setAttribute("viewBox","0 0 64 64");const i=document.createElementNS(e,"path");return i.setAttribute("fill","currentColor"),i.setAttribute("d","M50 8H14c-3.309 0-6 2.691-6 6v36c0 3.309 2.691 6 6 6h36c3.309 0 6-2.691 6-6V14c0-3.309-2.691-6-6-6zM12 50V14c0-1.103.897-2 2-2h8v40h-8c-1.103 0-2-.897-2-2zm40 0c0 1.103-.897 2-2 2H26V12h24c1.103 0 2 .897 2 2z"),s.appendChild(i),s}function ts(t){const e="http://www.w3.org/2000/svg",s=document.createElementNS(e,"svg");s.setAttribute("class",`${t}-footer-icon-arrow-left`),s.setAttribute("viewBox","0 0 500 500");const i=document.createElementNS(e,"path");return i.setAttribute("fill","currentColor"),i.setAttribute("d","M177.81 249.959L337.473 90.295c2.722-2.865 2.651-7.378-.143-10.1-2.793-2.65-7.163-2.65-9.956 0l-164.75 164.75c-2.793 2.793-2.793 7.306 0 10.1l164.75 164.75c2.865 2.722 7.378 2.65 10.099-.143 2.651-2.794 2.651-7.163 0-9.957L177.809 249.959z"),s.appendChild(i),s}function ss(t){const e="http://www.w3.org/2000/svg",s=document.createElementNS(e,"svg");s.setAttribute("class",`${t}-footer-icon-arrow-right`),s.setAttribute("viewBox","0 0 500 500");const i=document.createElementNS(e,"path");return i.setAttribute("fill","currentColor"),i.setAttribute("d","M322.19 250.041L162.527 409.705c-2.722 2.865-2.651 7.378.143 10.1 2.793 2.65 7.163 2.65 9.956 0l164.75-164.75c2.793-2.793 2.793-7.306 0-10.1l-164.75-164.75c-2.865-2.722-7.378-2.65-10.099.143-2.651 2.794-2.651 7.163 0 9.957l159.664 159.736z"),s.appendChild(i),s}function is(t){const e="http://www.w3.org/2000/svg",s=document.createElementNS(e,"svg");s.setAttribute("class",`${t}-footer-icon-play`),s.setAttribute("viewBox","0 0 500 500");const i=document.createElementNS(e,"path");return i.setAttribute("fill","currentColor"),i.setAttribute("d","M418.158 257.419L174.663 413.33c-6.017 3.919-15.708 3.772-21.291-.29-2.791-2.018-4.295-4.483-4.295-7.084V94.109c0-5.65 6.883-10.289 15.271-10.289 4.298 0 8.391 1.307 11.181 3.332l242.629 155.484c6.016 3.917 6.451 10.292.649 14.491-.216.154-.432.154-.649.292zM170.621 391.288l223.116-141.301L170.71 107.753l-.089 283.535z"),s.appendChild(i),s}function rs(t){const e="http://www.w3.org/2000/svg",s=document.createElementNS(e,"svg");s.setAttribute("class",`${t}-footer-icon-pause`),s.setAttribute("viewBox","0 0 500 500");const i=document.createElementNS(e,"path");return i.setAttribute("fill","currentColor"),i.setAttribute("d","M312.491 78.261c0-6.159 4.893-11.213 11.04-11.213 6.158 0 11.211 5.054 11.211 11.213v343.478c0 6.159-5.053 11.213-11.211 11.213-6.147 0-11.04-5.054-11.04-11.213V78.261zM165.257 78.261c0-6.159 4.893-11.213 11.04-11.213 6.158 0 11.211 5.054 11.211 11.213v343.478c0 6.159-5.053 11.213-11.211 11.213-6.147 0-11.04-5.054-11.04-11.213V78.261z"),s.appendChild(i),s}const E=typeof window!="undefined",Ae=E&&!("onscroll"in window)||typeof navigator!="undefined"&&/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),He=E&&"IntersectionObserver"in window,Ve=E&&"classList"in document.createElement("p"),Me=E&&window.devicePixelRatio>1,os={elements_selector:".lazy",container:Ae||E?document:null,threshold:300,thresholds:null,data_src:"src",data_srcset:"srcset",data_sizes:"sizes",data_bg:"bg",data_bg_hidpi:"bg-hidpi",data_bg_multi:"bg-multi",data_bg_multi_hidpi:"bg-multi-hidpi",data_poster:"poster",class_applied:"applied",class_loading:"loading",class_loaded:"loaded",class_error:"error",class_entered:"entered",class_exited:"exited",unobserve_completed:!0,unobserve_entered:!1,cancel_on_exit:!0,callback_enter:null,callback_exit:null,callback_applied:null,callback_loading:null,callback_loaded:null,callback_error:null,callback_finish:null,callback_cancel:null,use_native:!1},Be=t=>Object.assign({},os,t),De=function(t,e){let s;const i="LazyLoad::Initialized",r=new t(e);try{s=new CustomEvent(i,{detail:{instance:r}})}catch{s=document.createEvent("CustomEvent"),s.initCustomEvent(i,!1,!1,{instance:r})}window.dispatchEvent(s)},ns=(t,e)=>{if(!!e)if(!e.length)De(t,e);else for(let s=0,i;i=e[s];s+=1)De(t,i)},b="src",ee="srcset",te="sizes",We="poster",L="llOriginalAttrs",Fe="data",se="loading",Ue="loaded",Ye="applied",as="entered",ie="error",je="native",Ge="data-",Xe="ll-status",g=(t,e)=>t.getAttribute(Ge+e),cs=(t,e,s)=>{var i=Ge+e;if(s===null){t.removeAttribute(i);return}t.setAttribute(i,s)},P=t=>g(t,Xe),T=(t,e)=>cs(t,Xe,e),W=t=>T(t,null),re=t=>P(t)===null,ls=t=>P(t)===se,hs=t=>P(t)===ie,oe=t=>P(t)===je,ds=[se,Ue,Ye,ie],ps=t=>ds.indexOf(P(t))>=0,m=(t,e,s,i)=>{if(!!t){if(i!==void 0){t(e,s,i);return}if(s!==void 0){t(e,s);return}t(e)}},_=(t,e)=>{if(Ve){t.classList.add(e);return}t.className+=(t.className?" ":"")+e},w=(t,e)=>{if(Ve){t.classList.remove(e);return}t.className=t.className.replace(new RegExp("(^|\\s+)"+e+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},us=t=>{t.llTempImage=document.createElement("IMG")},gs=t=>{delete t.llTempImage},qe=t=>t.llTempImage,F=(t,e)=>{if(!e)return;const s=e._observer;!s||s.unobserve(t)},fs=t=>{t.disconnect()},vs=(t,e,s)=>{e.unobserve_entered&&F(t,s)},ne=(t,e)=>{!t||(t.loadingCount+=e)},ws=t=>{!t||(t.toLoadCount-=1)},Je=(t,e)=>{!t||(t.toLoadCount=e)},bs=t=>t.loadingCount>0,ms=t=>t.toLoadCount>0,Ke=t=>{let e=[];for(let s=0,i;i=t.children[s];s+=1)i.tagName==="SOURCE"&&e.push(i);return e},ae=(t,e)=>{const s=t.parentNode;if(!s||s.tagName!=="PICTURE")return;Ke(s).forEach(e)},Ze=(t,e)=>{Ke(t).forEach(e)},U=[b],Qe=[b,We],Y=[b,ee,te],et=[Fe],j=t=>!!t[L],tt=t=>t[L],st=t=>delete t[L],$=(t,e)=>{if(j(t))return;const s={};e.forEach(i=>{s[i]=t.getAttribute(i)}),t[L]=s},Ss=t=>{j(t)||(t[L]={backgroundImage:t.style.backgroundImage})},xs=(t,e,s)=>{if(!s){t.removeAttribute(e);return}t.setAttribute(e,s)},I=(t,e)=>{if(!j(t))return;const s=tt(t);e.forEach(i=>{xs(t,i,s[i])})},ys=t=>{if(!j(t))return;const e=tt(t);t.style.backgroundImage=e.backgroundImage},Es=(t,e,s)=>{_(t,e.class_applied),T(t,Ye),s&&(e.unobserve_completed&&F(t,e),m(e.callback_applied,t,s))},it=(t,e,s)=>{_(t,e.class_loading),T(t,se),s&&(ne(s,1),m(e.callback_loading,t,s))},S=(t,e,s)=>{!s||t.setAttribute(e,s)},rt=(t,e)=>{S(t,te,g(t,e.data_sizes)),S(t,ee,g(t,e.data_srcset)),S(t,b,g(t,e.data_src))},Ts=(t,e)=>{ae(t,s=>{$(s,Y),rt(s,e)}),$(t,Y),rt(t,e)},Cs=(t,e)=>{$(t,U),S(t,b,g(t,e.data_src))},_s=(t,e)=>{Ze(t,s=>{$(s,U),S(s,b,g(s,e.data_src))}),$(t,Qe),S(t,We,g(t,e.data_poster)),S(t,b,g(t,e.data_src)),t.load()},$s=(t,e)=>{$(t,et),S(t,Fe,g(t,e.data_src))},Is=(t,e,s)=>{const i=g(t,e.data_bg),r=g(t,e.data_bg_hidpi),o=Me&&r?r:i;!o||(t.style.backgroundImage=`url("${o}")`,qe(t).setAttribute(b,o),it(t,e,s))},Ns=(t,e,s)=>{const i=g(t,e.data_bg_multi),r=g(t,e.data_bg_multi_hidpi),o=Me&&r?r:i;!o||(t.style.backgroundImage=o,Es(t,e,s))},ot={IMG:Ts,IFRAME:Cs,VIDEO:_s,OBJECT:$s},ks=(t,e)=>{const s=ot[t.tagName];!s||s(t,e)},Rs=(t,e,s)=>{const i=ot[t.tagName];!i||(i(t,e),it(t,e,s))},Os=["IMG","IFRAME","VIDEO","OBJECT"],Ls=t=>Os.indexOf(t.tagName)>-1,nt=(t,e)=>{e&&!bs(e)&&!ms(e)&&m(t.callback_finish,e)},at=(t,e,s)=>{t.addEventListener(e,s),t.llEvLisnrs[e]=s},Ps=(t,e,s)=>{t.removeEventListener(e,s)},ce=t=>!!t.llEvLisnrs,zs=(t,e,s)=>{ce(t)||(t.llEvLisnrs={});const i=t.tagName==="VIDEO"?"loadeddata":"load";at(t,i,e),at(t,"error",s)},le=t=>{if(!ce(t))return;const e=t.llEvLisnrs;for(let s in e){const i=e[s];Ps(t,s,i)}delete t.llEvLisnrs},ct=(t,e,s)=>{gs(t),ne(s,-1),ws(s),w(t,e.class_loading),e.unobserve_completed&&F(t,s)},As=(t,e,s,i)=>{const r=oe(e);ct(e,s,i),_(e,s.class_loaded),T(e,Ue),m(s.callback_loaded,e,i),r||nt(s,i)},Hs=(t,e,s,i)=>{const r=oe(e);ct(e,s,i),_(e,s.class_error),T(e,ie),m(s.callback_error,e,i),r||nt(s,i)},he=(t,e,s)=>{const i=qe(t)||t;if(ce(i))return;zs(i,n=>{As(n,t,e,s),le(i)},n=>{Hs(n,t,e,s),le(i)})},Vs=(t,e,s)=>{us(t),he(t,e,s),Ss(t),Is(t,e,s),Ns(t,e,s)},Ms=(t,e,s)=>{he(t,e,s),Rs(t,e,s)},de=(t,e,s)=>{Ls(t)?Ms(t,e,s):Vs(t,e,s)},Bs=(t,e,s)=>{t.setAttribute("loading","lazy"),he(t,e,s),ks(t,e),T(t,je)},lt=t=>{t.removeAttribute(b),t.removeAttribute(ee),t.removeAttribute(te)},Ds=t=>{ae(t,e=>{lt(e)}),lt(t)},ht=t=>{ae(t,e=>{I(e,Y)}),I(t,Y)},Ws={IMG:ht,IFRAME:t=>{I(t,U)},VIDEO:t=>{Ze(t,e=>{I(e,U)}),I(t,Qe),t.load()},OBJECT:t=>{I(t,et)}},Fs=t=>{const e=Ws[t.tagName];if(!e){ys(t);return}e(t)},Us=(t,e)=>{re(t)||oe(t)||(w(t,e.class_entered),w(t,e.class_exited),w(t,e.class_applied),w(t,e.class_loading),w(t,e.class_loaded),w(t,e.class_error))},Ys=(t,e)=>{Fs(t),Us(t,e),W(t),st(t)},js=(t,e,s,i)=>{!s.cancel_on_exit||!ls(t)||t.tagName==="IMG"&&(le(t),Ds(t),ht(t),w(t,s.class_loading),ne(i,-1),W(t),m(s.callback_cancel,t,e,i))},Gs=(t,e,s,i)=>{const r=ps(t);T(t,as),_(t,s.class_entered),w(t,s.class_exited),vs(t,s,i),m(s.callback_enter,t,e,i),!r&&de(t,s,i)},Xs=(t,e,s,i)=>{re(t)||(_(t,s.class_exited),js(t,e,s,i),m(s.callback_exit,t,e,i))},qs=["IMG","IFRAME","VIDEO"],dt=t=>t.use_native&&"loading"in HTMLImageElement.prototype,Js=(t,e,s)=>{t.forEach(i=>{qs.indexOf(i.tagName)!==-1&&Bs(i,e,s)}),Je(s,0)},Ks=t=>t.isIntersecting||t.intersectionRatio>0,Zs=t=>({root:t.container===document?null:t.container,rootMargin:t.thresholds||t.threshold+"px"}),Qs=(t,e,s)=>{t.forEach(i=>Ks(i)?Gs(i.target,i,e,s):Xs(i.target,i,e,s))},ei=(t,e)=>{e.forEach(s=>{t.observe(s)})},ti=(t,e)=>{fs(t),ei(t,e)},si=(t,e)=>{!He||dt(t)||(e._observer=new IntersectionObserver(s=>{Qs(s,t,e)},Zs(t)))},pt=t=>Array.prototype.slice.call(t),G=t=>t.container.querySelectorAll(t.elements_selector),ii=t=>pt(t).filter(re),ri=t=>hs(t),oi=t=>pt(t).filter(ri),ut=(t,e)=>ii(t||G(e)),ni=(t,e)=>{oi(G(t)).forEach(i=>{w(i,t.class_error),W(i)}),e.update()},ai=(t,e)=>{!E||window.addEventListener("online",()=>{ni(t,e)})},z=function(t,e){const s=Be(t);this._settings=s,this.loadingCount=0,si(s,this),ai(s,this),this.update(e)};z.prototype={update:function(t){const e=this._settings,s=ut(t,e);if(Je(this,s.length),Ae||!He){this.loadAll(s);return}if(dt(e)){Js(s,e,this);return}ti(this._observer,s)},destroy:function(){this._observer&&this._observer.disconnect(),G(this._settings).forEach(t=>{st(t)}),delete this._observer,delete this._settings,delete this.loadingCount,delete this.toLoadCount},loadAll:function(t){const e=this._settings;ut(t,e).forEach(i=>{F(i,this),de(i,e,this)})},restoreAll:function(){const t=this._settings;G(t).forEach(e=>{Ys(e,t)})}},z.load=(t,e)=>{const s=Be(e);de(t,s)},z.resetStatus=t=>{W(t)},E&&ns(z,window.lazyLoadOptions);class gt{constructor({readonly:e,box:s,pages:i,onNewPageIndex:r,onPlay:o}){if(this.pageIndex=0,this.namespace="netless-app-docs-viewer",this.isShowPreview=!1,this.isSmallBox=!1,this.sideEffect=new H,i.length<=0)throw new Error("[DocsViewer] Empty pages.");this.readonly=e,this.box=s,this.pages=i,this.onNewPageIndex=r,this.onPlay=o,this.render()}mount(){this.box.mountContent(this.$content),this.box.mountFooter(this.$footer),this.sideEffect.add(()=>{const e=new z({container:this.$preview,elements_selector:`.${this.wrapClassName("preview-page>img")}`});return()=>e.destroy()},"preview-lazyload")}unmount(){this.$content.remove(),this.$footer.remove()}setReadonly(e){this.readonly!==e&&(this.readonly=e,this.$content.classList.toggle(this.wrapClassName("readonly"),e),this.$footer.classList.toggle(this.wrapClassName("readonly"),e),this.$pageNumberInput.disabled=e)}destroy(){this.sideEffect.flushAll(),this.unmount()}setPageIndex(e){Number.isNaN(e)||(this.pageIndex=e,this.$pageNumberInput.value=String(e+1))}setSmallBox(e){this.isSmallBox!==e&&(this.isSmallBox=e,this.$footer.classList.toggle(this.wrapClassName("float-footer"),e))}render(){return this.renderContent(),this.renderFooter(),this.$content}renderContent(){if(!this.$content){const e=document.createElement("div");e.className=this.wrapClassName("content"),this.$content=e,this.readonly&&e.classList.add(this.wrapClassName("readonly")),e.appendChild(this.renderPreviewMask()),e.appendChild(this.renderPreview())}return this.$content}renderPreview(){if(!this.$preview){const e=document.createElement("div");e.className=this.wrapClassName("preview")+" tele-fancy-scrollbar",this.$preview=e;const s=this.wrapClassName("preview-page"),i=this.wrapClassName("preview-page-name");this.pages.forEach((r,o)=>{var d;const n=(d=r.thumbnail)!=null?d:r.src.startsWith("ppt")?void 0:r.src;if(!n)return;const a=String(o),c=document.createElement("a");c.className=s+" "+this.wrapClassName(`preview-page-${o}`),c.setAttribute("href","#"),c.dataset.pageIndex=a;const l=document.createElement("span");l.className=i,l.textContent=String(o+1),l.dataset.pageIndex=a;const h=document.createElement("img");h.width=r.width,h.height=r.height,h.dataset.src=n,h.dataset.pageIndex=a,c.appendChild(h),c.appendChild(l),e.appendChild(c)}),this.sideEffect.addEventListener(e,"click",r=>{var n;if(this.readonly)return;const o=(n=r.target.dataset)==null?void 0:n.pageIndex;o&&(r.preventDefault(),r.stopPropagation(),r.stopImmediatePropagation(),this.onNewPageIndex(Number(o)),this.togglePreview(!1))})}return this.$preview}renderPreviewMask(){return this.$previewMask||(this.$previewMask=document.createElement("div"),this.$previewMask.className=this.wrapClassName("preview-mask"),this.sideEffect.addEventListener(this.$previewMask,"click",e=>{this.readonly||e.target===this.$previewMask&&this.togglePreview(!1)})),this.$previewMask}renderFooter(){if(!this.$footer){const e=document.createElement("div");if(e.className=this.wrapClassName("footer"),this.$footer=e,this.readonly&&e.classList.add(this.wrapClassName("readonly")),this.isSmallBox&&e.classList.add(this.wrapClassName("float-footer")),this.pages.some(c=>c.thumbnail||!c.src.startsWith("ppt"))){const c=this.renderFooterBtn("btn-sidebar",es(this.namespace));this.sideEffect.addEventListener(c,"click",()=>{this.readonly||this.togglePreview()}),this.$footer.appendChild(c)}const s=document.createElement("div");s.className=this.wrapClassName("page-jumps");const i=this.renderFooterBtn("btn-page-back",ts(this.namespace));if(this.sideEffect.addEventListener(i,"click",()=>{this.readonly||this.onNewPageIndex(this.pageIndex-1)}),s.appendChild(i),this.onPlay){const c=this.renderFooterBtn("btn-page-play",is(this.namespace),rs(this.namespace)),l=()=>{this.sideEffect.setTimeout(()=>{c.classList.toggle(this.wrapClassName("footer-btn-playing"),!1)},500,"returnPlay")};this.sideEffect.addEventListener(c,"click",()=>{this.readonly||(c.classList.toggle(this.wrapClassName("footer-btn-playing"),!0),this.onPlay&&this.onPlay(),l())}),s.appendChild(c)}const r=this.renderFooterBtn("btn-page-next",ss(this.namespace));this.sideEffect.addEventListener(r,"click",()=>{this.readonly||this.onNewPageIndex(this.pageIndex+1)}),s.appendChild(r);const o=document.createElement("div");o.className=this.wrapClassName("page-number");const n=document.createElement("input");n.className=this.wrapClassName("page-number-input"),n.value=String(this.pageIndex+1),this.readonly&&(n.disabled=!0),this.$pageNumberInput=n,this.sideEffect.addEventListener(n,"focus",()=>{n.select()}),this.sideEffect.addEventListener(n,"change",()=>{this.readonly||n.value&&this.onNewPageIndex(Number(n.value)-1)});const a=document.createElement("span");a.textContent=" / "+this.pages.length,o.appendChild(n),o.appendChild(a),this.$footer.appendChild(s),this.$footer.appendChild(o)}return this.$footer}renderFooterBtn(e,s,i){const r=document.createElement("button");return r.className=this.wrapClassName("footer-btn")+" "+this.wrapClassName(e),r.appendChild(s),i&&r.appendChild(i),r}togglePreview(e){if(this.isShowPreview=e!=null?e:!this.isShowPreview,this.$content.classList.toggle(this.wrapClassName("preview-active"),this.isShowPreview),this.isShowPreview){const s=this.$preview.querySelector("."+this.wrapClassName(`preview-page-${this.pageIndex}`));s&&this.$preview.scrollTo({top:s.offsetTop-16})}}wrapClassName(e){return`${this.namespace}-${e}`}}function N(t,e,s){return Math.min(Math.max(t,e),s)}function ft(t){return t.touches?t.touches[0]:t}function vt(t){t.stopPropagation(),t.cancelable&&t.preventDefault()}class ci{constructor(e){var s,i,r;this.velocity=0,this.paused=!0,this._animationFrameID=null,this._loopTimestamp=0,this.looper=o=>{if(this.paused)return;let n=Math.floor((o-this._loopTimestamp)/1e3*60)+1;for(this._loopTimestamp=o;n-- >0;)this.stepper();this.onStep(this.current,this),!this.paused&&this.current!==this.target&&window.requestAnimationFrame(this.looper)},this.current=(s=e.start)!=null?s:0,this.target=this.current,this.stiffness=(i=e.stiffness)!=null?i:170,this.damping=(r=e.damping)!=null?r:26,this.onStep=e.onStep}stepTo(e,s){this.paused&&s!=null&&(this.current=s),this.paused=!1,this.target=e,this.onStep(this.current,this),this._loopTimestamp=Date.now(),window.requestAnimationFrame(this.looper)}pause(){this.paused=!0}destroy(){this.pause()}stepper(){const e=-this.stiffness*(this.current-this.target),s=-this.damping*this.velocity,i=this.velocity+(e+s)/60,r=this.current+i/60;Math.abs(i-0)<.01&&Math.abs(r-this.target)<.01?(this.current=this.target,this.velocity=0):(this.current=r,this.velocity=i)}}class li{constructor(e,s,i,r){this.scale=1,this.lastVisit=Date.now(),this.pageOffsetY=0,this.pageOffsetX=0,this.visible=!0,this.index=e,this.page=s,this.scale=i,this.pageOffsetX=(r-s.width)/2;const o=document.createElement("div");o.className="page-renderer-page",o.dataset.index=`${e}`,o.style.width=`${s.width*i}px`,o.style.height=`${s.height*i}px`,s.thumbnail&&(o.style.backgroundImage=`url("${s.thumbnail}")`);const n=document.createElement("img");n.className="page-renderer-page-img",n.width=s.width,n.height=s.height,n.src=s.src,o.appendChild(n),this.$page=o}translateY(e){Math.abs(e-this.pageOffsetY)>=.001&&(this.pageOffsetY=e,this.$page.style.transform=`translate(${this.pageOffsetX*this.scale}px, ${this.pageOffsetY*this.scale}px)`)}setScale(e){Math.abs(e-this.scale)>=.001&&(this.scale=e,this.$page.style.width=`${this.page.width*this.scale}px`,this.$page.style.height=`${this.page.height*this.scale}px`,this.$page.style.transform=`translate(${this.pageOffsetX*this.scale}px, ${this.pageOffsetY*this.scale}px)`)}setVisible(e){e!==this.visible&&(this.visible=e,this.$page.style.opacity=e?"1":"0")}}const hi=window.requestIdleCallback||(t=>window.setTimeout(t,5e3)),di=window.cancelIdleCallback||window.clearTimeout;class pi{constructor(e,s,i){this.pages=e,this.pagesIntrinsicWidth=s,this.scale=i,this.els=new Map,this.maxElCount=200,this.gcTimer=null,this.gc=()=>{if(this.gcTimer=null,this.els.size>this.maxElCount){const r=[...this.els.values()].sort((o,n)=>n.lastVisit-o.lastVisit);for(let o=Math.floor(this.maxElCount/4);o<r.length;o++)this.els.delete(r[o].index)}}}getEl(e){let s=this.els.get(e);return s||(s=new li(e,this.pages[e],this.scale,this.pagesIntrinsicWidth),this.els.set(e,s)),s.lastVisit=Date.now(),this.els.size>this.maxElCount&&this.gcTimer===null&&(this.gcTimer=hi(this.gc)),s}setScale(e){e!==this.scale&&(this.scale=e,this.els.forEach(s=>s.setScale(e)))}destroy(){this.els.clear(),this.gcTimer!==null&&(di(this.gcTimer),this.gcTimer=null)}}class ui{constructor(e){this._hwaTimeout=NaN,this._turnOffHWA=()=>{window.clearTimeout(this._hwaTimeout),this._hwaTimeout=NaN,this.$pages.classList.toggle("is-hwa",!1)},this.pagesScrollTop=e.pagesScrollTop||0,this.containerWidth=e.containerWidth||1,this.containerHeight=e.containerHeight||1,this.pages=e.pages.map(o=>{if(o.thumbnail)return o;try{const n=new URL(o.src);return n.searchParams.set("x-oss-process","image/resize,l_50"),be(we({},o),{thumbnail:n.toString()})}catch(n){return console.error(n),o}});const s=Array(this.pages.length);let i=1/0,r=0;this.pagesIntrinsicHeight=this.pages.reduce((o,n,a)=>(s[a]=o,n.width>r&&(r=n.width),n.height<=i&&(i=n.height),o+n.height),0),this.pagesIntrinsicWidth=r,this.pagesMinHeight=i,this.pagesIntrinsicYs=s,this.scale=this._calcScale(),this.threshold=this._calcThreshold(),this.onPageIndexChanged=e.onPageIndexChanged,this.pageScrollIndex=0,this.pagesScrollTop!==0&&(this.pageScrollIndex=this.findScrollPageIndex(),this.onPageIndexChanged&&this.pageScrollIndex>0&&this.onPageIndexChanged(this.pageScrollIndex)),this.pageElManager=new pi(this.pages,r,this.scale),this.$pages=this.renderPages()}setContainerSize(e,s){e>0&&s>0&&(e!==this.containerWidth||s!==this.containerHeight)&&(this.containerWidth=e,this.containerHeight=s,this.$pages.style.width=`${this.containerWidth}px`,this.$pages.style.height=`${this.containerHeight}px`,this.scale=this._calcScale(),this.threshold=this._calcThreshold(),this.pageElManager.setScale(this.scale),this.$pages.parentElement&&this.pagesScrollTo(this.pagesScrollTop,!0))}renderPages(){const e=document.createElement("div");return e.className="page-renderer-pages-container",e.style.width=`${this.containerWidth}px`,e.style.height=`${this.containerHeight}px`,e}pagesScrollTo(e,s){if(e=N(e,0,this.pagesIntrinsicHeight-this.containerHeight/this.scale),s||Math.abs(e-this.pagesScrollTop)>=.001){this._turnOnHWA(),this.pagesScrollTop=e;const i=this.findScrollPageIndex(),r=Math.max(i-this.threshold,0),o=Math.min(i+this.threshold,this.pages.length-1);for(let n=0;n<this.$pages.children.length;n++){const a=this.$pages.children[n],c=Number(a.dataset.index);c>=r&&c<=o||(a.remove(),n--)}for(let n=r;n<=o;n++){const a=this.pageElManager.getEl(n);a.$page.parentElement!==this.$pages&&this.$pages.appendChild(a.$page),a.translateY(this.pagesIntrinsicYs[n]-this.pagesScrollTop)}i!==this.pageScrollIndex&&(this.pageScrollIndex=i,this.onPageIndexChanged&&this.onPageIndexChanged(i))}}findScrollPageIndex(){for(let e=0;e<this.pagesIntrinsicYs.length;e++)if(this.pagesIntrinsicYs[e]+this.pages[e].height-this.pagesScrollTop>=.001)return e;return this.pagesIntrinsicYs.length-1}mount(e){e.appendChild(this.$pages),this.pagesScrollTo(this.pagesScrollTop,!0)}unmount(){this.$pages.remove()}destroy(){this.unmount(),this.onPageIndexChanged=void 0,this.pageElManager.destroy(),this._hwaTimeout&&(window.clearTimeout(this._hwaTimeout),this._hwaTimeout=NaN)}_calcScale(){return this.containerWidth/this.pagesIntrinsicWidth||1}_calcThreshold(){return N(Math.ceil(this.containerHeight/this.scale/this.pagesMinHeight/2),1,this.pages.length)}_turnOnHWA(){this._hwaTimeout?window.clearTimeout(this._hwaTimeout):this.$pages.classList.toggle("is-hwa",!0),this._hwaTimeout=window.setTimeout(this._turnOffHWA,1e3)}}const gi=30;class fi{constructor(e){this.sideEffect=new H,this.pagesScrollTop=e.pagesScrollTop||0,this.containerWidth=e.containerWidth||1,this.containerHeight=e.containerHeight||1,this.pagesWidth=e.pagesWidth||1,this.pagesHeight=e.pagesHeight||1,this.scale=this._calcScale(),this.scrollbarMinHeight=e.scrollbarMinHeight||gi,this.scrollbarHeight=this._calcScrollbarHeight(),this.readonly=e.readonly,this.wrapClassName=e.wrapClassName,this.onDragScroll=e.onDragScroll,this.$scrollbar=this.renderScrollbar()}mount(e){e.appendChild(this.$scrollbar),this.pagesScrollTo(this.pagesScrollTop,!0)}unmount(){this.$scrollbar.remove()}setReadonly(e){this.readonly=e}setContainerSize(e,s){e>0&&s>0&&(e!==this.containerWidth||s!==this.containerHeight)&&(this.containerWidth=e,this.containerHeight=s,this.scale=this._calcScale(),this._updateScrollbarHeight(),this.$scrollbar.parentElement&&this.pagesScrollTo(this.pagesScrollTop,!0))}pagesScrollTo(e,s){if(e=N(e,0,this.pagesHeight-this.containerHeight/this.scale),s||Math.abs(e-this.pagesScrollTop)>=.001){this.pagesScrollTop=e;const i=this.pagesScrollTop*this.scale,r=this.pagesHeight*this.scale,o=i/(r-this.containerHeight)*(this.containerHeight-this.scrollbarHeight);window.requestAnimationFrame?window.requestAnimationFrame(()=>{this.$scrollbar.style.transform=`translateY(${o}px)`}):this.$scrollbar.style.transform=`translateY(${o}px)`}}destroy(){this.unmount(),this.onDragScroll=void 0,this.sideEffect.flushAll()}renderScrollbar(){const e=document.createElement("button");e.className=this.wrapClassName("scrollbar"),e.style.minHeight=`${this.scrollbarMinHeight}px`,e.style.height=`${this.scrollbarHeight}px`;const s=i=>{if(this.readonly||i.button!=null&&i.button!==0)return;vt(i);const r=this.wrapClassName("scrollbar-dragging");e.classList.toggle(r,!0);const o=this.pagesScrollTop,{clientY:n}=ft(i),a=l=>{if(this.readonly)return;const{clientY:h}=ft(l),d=(h-n)/this.scale;Math.abs(d)>0&&this.onDragScroll&&this.onDragScroll(o+d*(this.pagesHeight*this.scale/this.containerHeight))},c=()=>{e.classList.toggle(r,!1),window.removeEventListener("mousemove",a,!0),window.removeEventListener("touchmove",a,!0),window.removeEventListener("mouseup",c,!0),window.removeEventListener("touchend",c,!0),window.removeEventListener("touchcancel",c,!0)};window.addEventListener("mousemove",a,!0),window.addEventListener("touchmove",a,!0),window.addEventListener("mouseup",c,!0),window.addEventListener("touchend",c,!0),window.addEventListener("touchcancel",c,!0)};return this.sideEffect.addEventListener(e,"mousedown",s),this.sideEffect.addEventListener(e,"touchstart",s),e}_calcScale(){return this.containerWidth/this.pagesWidth||1}_calcScrollbarHeight(){return N(this.containerHeight/(this.pagesHeight*this.scale)*this.containerHeight,this.scrollbarMinHeight,this.containerHeight)}_updateScrollbarHeight(){const e=this._calcScrollbarHeight();Math.abs(e-this.scrollbarHeight)>.001&&(this.scrollbarHeight=e,this.$scrollbar.style.height=`${e}px`)}}const vi=window.ResizeObserver||Qt,A=640;class wi{constructor({whiteboardView:e,readonly:s,box:i,pages:r,pageScrollTop:o=0,mountWhiteboard:n,onUserScroll:a}){this.sideEffect=new H,this.userScrolling=!1,this.onNewPageIndex=d=>{this.scrollToPage(d)},this.whiteboardView=e,this.readonly=s,this.box=i,this.pages=r,this.mountWhiteboard=n,this._onUserScroll=a;const c=this.debounce(()=>{this.userScrolling=!1,this._onUserScroll&&this._onUserScroll(this.pageRenderer.pagesScrollTop)},{wait:80},"debounce-updateUserScroll");this.updateUserScroll=()=>{this.userScrolling=!0,c()},this.viewer=new gt({readonly:s,box:i,pages:r,onNewPageIndex:this.onNewPageIndex});const{width:l,height:h}=this.whiteboardView.size;this.pageRenderer=new ui({pagesScrollTop:o,pages:this.pages,containerWidth:l,containerHeight:h,onPageIndexChanged:this.viewer.setPageIndex.bind(this.viewer)}),this.scrollbar=new fi({pagesScrollTop:this.pageRenderer.pagesScrollTop,containerWidth:l,containerHeight:h,pagesWidth:this.pageRenderer.pagesIntrinsicWidth,pagesHeight:this.pageRenderer.pagesIntrinsicHeight,readonly:this.readonly,wrapClassName:this.wrapClassName.bind(this),onDragScroll:d=>{this.pageScrollTo(d),this.updateUserScroll()}}),this.pageScrollStepper=new ci({start:this.pageRenderer.pagesScrollTop,onStep:d=>{this.pageScrollTo(d)}}),this.render()}mount(){this.viewer.mount(),this.setupScrollListener();const e=this.debounce(this.renderRatioHeight.bind(this),{wait:80});return this.sideEffect.add(()=>{const s=new vi(e);return s.observe(this.viewer.$content),()=>s.disconnect()}),this.sideEffect.setTimeout(()=>{this.userScrolling||this.pageScrollTo(this.pageRenderer.pagesScrollTop)},100),this}unmount(){return this.viewer.unmount(),this}setReadonly(e){this.readonly!==e&&(this.readonly=e,this.viewer.setReadonly(e),this.scrollbar.setReadonly(e))}destroy(){this.sideEffect.flushAll(),this.pageScrollStepper.destroy(),this._onUserScroll=void 0,this.unmount(),this.viewer.destroy(),this.pageRenderer.destroy(),this.scrollbar.destroy()}syncPageScrollTop(e){!this.userScrolling&&e>=0&&Math.abs(this.pageRenderer.pagesScrollTop-e)>.01&&this.pageScrollStepper.stepTo(e,this.pageRenderer.pagesScrollTop)}render(){this.pageRenderer.mount(this.viewer.$content),this.viewer.$content.appendChild(this.renderWhiteboardView()),this.scrollbar.mount(this.viewer.$content),this.renderRatioHeight()}renderRatioHeight(){const e=this.box.absoluteHeight,s=e<=A;if(this.viewer.setSmallBox(s),s){const i=26/A,r=26/e,o=26/A,n=0,a=Math.max((i+o-(r+n))/2,0);if(this.box.$titleBar){const c=r+a;this.box.$titleBar.style.height=`${c*100}%`}if(this.box.$footer){const c=n+a;this.box.$footer.style.height=`${c*100}%`}}else{if(this.box.$titleBar){const i=Math.max(26/A,26/e);this.box.$titleBar.style.height=`${i*100}%`}if(this.box.$footer){const i=Math.max(26/A,26/e);this.box.$footer.style.height=`${i*100}%`}}}renderWhiteboardView(){return this.$whiteboardView||(this.$whiteboardView=document.createElement("div"),this.$whiteboardView.className=this.wrapClassName("wb-view"),this.mountWhiteboard(this.$whiteboardView),this.sideEffect.addEventListener(this.$whiteboardView,"wheel",e=>{vt(e),this.readonly||(this.pageScrollTo(this.pageRenderer.pagesScrollTop+e.deltaY),this.updateUserScroll())},{passive:!1,capture:!0}),this.sideEffect.addEventListener(this.$whiteboardView,"touchmove",e=>{this.readonly||e.touches.length<=1||this.updateUserScroll()},{passive:!0,capture:!0})),this.$whiteboardView}scrollTopPageToEl(e){return e*this.pageRenderer.scale}scrollTopElToPage(e){return e/this.pageRenderer.scale}elScrollTo(e){this.pageScrollTo(this.scrollTopElToPage(e))}pageScrollTo(e){const s=this.scrollTopElToPage(this.whiteboardView.size.height/2);this.whiteboardView.moveCamera({centerY:N(e+s,s,this.pageRenderer.pagesIntrinsicHeight-s),animationMode:"immediately"})}scrollToPage(e){if(!this.readonly&&!Number.isNaN(e)){const s=this.pageRenderer.pagesIntrinsicYs[e];s>=0&&(this.pageScrollTo(s+5/this.pageRenderer.scale),this.updateUserScroll())}}setupScrollListener(){this.sideEffect.add(()=>{const e=s=>{const{width:i,height:r}=this.whiteboardView.size;if(i<=0||r<=0)return;const o=s.centerY-this.pageRenderer.containerHeight/this.pageRenderer.scale/2;this.pageRenderer.pagesScrollTo(o),this.scrollbar.pagesScrollTo(o)};return this.whiteboardView.callbacks.on("onCameraUpdated",e),()=>this.whiteboardView.callbacks.off("onCameraUpdated",e)}),this.sideEffect.add(()=>{const e=({width:s,height:i})=>{if(s<=0||i<=0)return;this.pageRenderer.setContainerSize(s,i),this.scrollbar.setContainerSize(s,i);const{pagesIntrinsicWidth:r,pagesIntrinsicHeight:o}=this.pageRenderer;this.whiteboardView.moveCameraToContain({originX:0,originY:this.pageRenderer.pagesScrollTop,width:r,height:i/this.pageRenderer.scale,animationMode:"immediately"}),this.whiteboardView.setCameraBound({damping:1,maxContentMode:()=>this.pageRenderer.scale,minContentMode:()=>this.pageRenderer.scale,centerX:r/2,centerY:o/2,width:r,height:o})};return this.whiteboardView.callbacks.on("onSizeUpdated",e),()=>{this.whiteboardView.callbacks.off("onSizeUpdated",e)}},"whiteboard-size-update"),this.sideEffect.addEventListener(window,"keyup",e=>{if(this.readonly||!this.box.focus||this.box.minimized)return;let s=null;switch(e.key){case"PageDown":{s=this.pageRenderer.pagesScrollTop+this.pageRenderer.containerHeight/this.pageRenderer.scale;break}case"PageUp":{s=this.pageRenderer.pagesScrollTop-this.pageRenderer.containerHeight/this.pageRenderer.scale;break}case"ArrowDown":{s=this.pageRenderer.pagesScrollTop+this.pageRenderer.containerHeight/4/this.pageRenderer.scale;break}case"ArrowUp":{s=this.pageRenderer.pagesScrollTop-this.pageRenderer.containerHeight/4/this.pageRenderer.scale;break}}s!==null&&(this._onUserScroll?this._onUserScroll(s):(this.pageScrollTo(s),this.updateUserScroll()))},{capture:!0})}debounce(e,s,i){const r=Rt(e,s);return this.sideEffect.addDisposer(()=>r.cancel(),i),r}wrapClassName(e){return"netless-app-docs-viewer-static-"+e}}class bi{constructor({context:e,whiteboardView:s,box:i,pages:r}){this.sideEffect=new H,this.onPlayPPT=()=>{const o=this.context.getRoom();o&&o.pptNextStep()},this._scaleDocsToFitImpl=()=>{const o=this.pages[this.getPageIndex()];o&&(this.whiteboardView.moveCameraToContain({originX:-o.width/2,originY:-o.height/2,width:o.width,height:o.height,animationMode:"immediately"}),this.whiteboardView.setCameraBound({damping:1,maxContentMode:()=>this.whiteboardView.camera.scale,minContentMode:()=>this.whiteboardView.camera.scale,centerX:0,centerY:0,width:o.width,height:o.height}))},this._scaleDocsToFitDebounced=()=>{this.sideEffect.setTimeout(this._scaleDocsToFitImpl,1e3,"_scaleDocsToFitDebounced")},this.scaleDocsToFit=()=>{this._scaleDocsToFitImpl(),this._scaleDocsToFitDebounced()},this.onNewPageIndex=o=>{this.jumpToPage(o,!0)},this.context=e,this.whiteboardView=s,this.box=i,this.pages=r,this.displayer=e.getDisplayer(),this.viewer=new gt({readonly:!e.getIsWritable(),box:i,pages:r,onNewPageIndex:this.onNewPageIndex,onPlay:this.onPlayPPT}),this.render(),this.sideEffect.add(()=>{const o=n=>{this.viewer.setReadonly(!n)};return this.context.emitter.on("writableChange",o),()=>this.context.emitter.off("writableChange",o)}),this.sideEffect.add(()=>{const o=n=>{this.jumpToPage(n.index)};return this.context.emitter.on("sceneStateChange",o),()=>this.context.emitter.off("sceneStateChange",o)})}mount(){this.viewer.mount();const e=this.getPageIndex();return e!==0&&this.jumpToPage(e),this.scaleDocsToFit(),this.sideEffect.add(()=>(this.whiteboardView.callbacks.on("onSizeUpdated",this.scaleDocsToFit),()=>{this.whiteboardView.callbacks.off("onSizeUpdated",this.scaleDocsToFit)})),this}unmount(){return this.viewer.unmount(),this}destroy(){this.sideEffect.flushAll(),this.unmount(),this.viewer.destroy()}getPageIndex(){return this.displayer.state.sceneState.index}jumpToPage(e,s){var i,r;if(e=N(e,0,this.pages.length-1),e!==this.getPageIndex()&&this.context.getIsWritable()){const o=this.context.getInitScenePath(),n=(r=(i=this.context.getScenes())==null?void 0:i[e])==null?void 0:r.name;o&&n&&this.context.setScenePath(`${o}/${n}`),this.scaleDocsToFit()}if(e!==this.viewer.pageIndex&&this.viewer.setPageIndex(e),s){const o=this.context.getRoom();if(o){const n=o.state.globalState.__pptState;o.setGlobalState({__pptState:n&&{uuid:n.uuid,pageIndex:e,disableAutoPlay:n.disableAutoPlay}})}}}render(){this.viewer.$content.appendChild(this.renderMask()),this.viewer.$content.appendChild(this.renderWhiteboardView()),this.sideEffect.addEventListener(window,"keydown",e=>{var s;if(this.box.focus)switch(e.key){case"ArrowUp":case"ArrowLeft":{this.jumpToPage(this.getPageIndex()-1,!0);break}case"ArrowRight":case"ArrowDown":{(s=this.context.getRoom())==null||s.pptNextStep();break}}})}renderMask(){if(!this.$mask){const e=document.createElement("div");e.className=this.wrapClassName("mask"),this.$mask=e;const s=document.createElement("button");s.className=this.wrapClassName("back");const i=document.createElement("button");i.className=this.wrapClassName("next")}return this.$mask}renderWhiteboardView(){return this.$whiteboardView||(this.$whiteboardView=document.createElement("div"),this.$whiteboardView.className=this.wrapClassName("wb-view"),this.sideEffect.addEventListener(this.$whiteboardView,"click",e=>{var i;const s=this.context.getRoom();if(s&&s.state.memberState.currentApplianceName==="clicker"){for(let r=e.target;r;r=r.parentElement)if((i=r.classList)!=null&&i.contains("ppt-event-source"))return;s.pptNextStep()}}),this.context.mountView(this.$whiteboardView)),this.$whiteboardView}wrapClassName(e){return"netless-app-docs-viewer-dynamic-"+e}}const mi={kind:"DocsViewer",setup(t){const e=t.getBox(),s=t.getScenes();if(!s)throw new Error("[Docs Viewer]: scenes not found.");const i=t.getView();if(!i)throw new Error("[Docs Viewer]: no whiteboard view.");const r=s.map(({ppt:o})=>o?{width:o.width,height:o.height,src:o.src,thumbnail:o.previewURL}:null).filter(o=>Boolean(o));if(r.length<=0)throw new Error("[Docs Viewer]: empty scenes.");e.mountStyles(p),r[0].src.startsWith("ppt")?xi(t,i,e,r):Si(t,i,e,r)}};function Si(t,e,s,i){var o;e.disableCameraTransform=!t.getIsWritable();const r=new wi({whiteboardView:e,readonly:!t.getIsWritable(),box:s,pages:i,pageScrollTop:(o=t.getAttributes())==null?void 0:o.pageScrollTop,mountWhiteboard:t.mountView.bind(t),onUserScroll:n=>{var a;((a=t.getAttributes())==null?void 0:a.pageScrollTop)!==n&&!s.readonly&&t.updateAttributes(["pageScrollTop"],n)}}).mount();t.emitter.on("attributesUpdate",n=>{n&&n.pageScrollTop!=null&&r.syncPageScrollTop(n.pageScrollTop)}),t.emitter.on("writableChange",n=>{r.setReadonly(!n),e.disableCameraTransform=!n})}function xi(t,e,s,i){e.disableCameraTransform=!0;const r=new bi({context:t,whiteboardView:e,box:s,pages:i}).mount();t.mountView(r.$whiteboardView),t.isAddApp&&e.callbacks.once("onSizeUpdated",({width:o,height:n})=>{if(i.length>0&&s.state!=="maximized"){const{width:a,height:c}=i[0],h=c/a*o-n;h!==0&&t.getIsWritable()&&t.emitter.emit("setBoxSize",{width:s.width,height:s.height+h/s.containerRect.height})}})}return u.default=mi,Object.defineProperties(u,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),u}({}); | ||
//# sourceMappingURL=main.iife.js.map |
{ | ||
"name": "@netless/app-docs-viewer", | ||
"version": "0.2.8", | ||
"version": "0.2.9", | ||
"description": "Netless App Docs Viewer", | ||
@@ -21,3 +21,3 @@ "repository": "netless-io/netless-app", | ||
"debounce-fn": "^5.1.0", | ||
"vanilla-lazyload": "^17.5.0" | ||
"vanilla-lazyload": "^17.6.1" | ||
}, | ||
@@ -24,0 +24,0 @@ "devDependencies": { |
@@ -213,2 +213,11 @@ import type { | ||
}); | ||
this.whiteboardView.setCameraBound({ | ||
damping: 1, | ||
maxContentMode: () => this.whiteboardView.camera.scale, | ||
minContentMode: () => this.whiteboardView.camera.scale, | ||
centerX: 0, | ||
centerY: 0, | ||
width: page.width, | ||
height: page.height, | ||
}); | ||
} | ||
@@ -215,0 +224,0 @@ }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
788751
53
4949
Updatedvanilla-lazyload@^17.6.1