Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@netless/app-docs-viewer

Package Overview
Dependencies
Maintainers
10
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@netless/app-docs-viewer - npm Package Compare versions

Comparing version 0.1.23 to 0.1.24

2

dist/main.cjs.js
"use strict";var Oe=Object.defineProperty,Me=Object.defineProperties;var De=Object.getOwnPropertyDescriptors;var q=Object.getOwnPropertySymbols;var He=Object.prototype.hasOwnProperty,Re=Object.prototype.propertyIsEnumerable;var X=(e,t,s)=>t in e?Oe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,J=(e,t)=>{for(var s in t||(t={}))He.call(t,s)&&X(e,s,t[s]);if(q)for(var s of q(t))Re.call(t,s)&&X(e,s,t[s]);return e},K=(e,t)=>Me(e,De(t));Object.defineProperty(exports,"__esModule",{value:!0});exports[Symbol.toStringTag]="Module";var Be=`.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:1.5em;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-pages{overflow:hidden;position:relative;height:100%;user-select:none}.netless-app-docs-viewer-static-pages:hover .netless-app-docs-viewer-static-scrollbar{opacity:1}.netless-app-docs-viewer-static-page{display:block;width:100%;height:auto;user-select:none}.netless-app-docs-viewer-static-wb-view{position:absolute;top:0;left:0;width:100%;height:100%;z-index:100;overflow:hidden}.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,.1);opacity:0;transition:background .4s,opacity .4s,transform .2s;will-change:transform,height;user-select:none}.netless-app-docs-viewer-static-scrollbar.netless-app-docs-viewer-static-scrollbar-dragging{background:rgba(68,78,96,.2);opacity:1;transition:background .4s,opacity .4s}.netless-app-docs-viewer-static-scrollbar:hover,.netless-app-docs-viewer-static-scrollbar:focus{background:rgba(68,78,96,.2)}.netless-app-docs-viewer-static-scrollbar:active{background:rgba(68,78,96,.2)}.netless-app-docs-viewer-content:hover .netless-app-docs-viewer-static-scrollbar{opacity:1}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-static-scrollbar{display:none}.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=typeof window!="undefined",Z=f&&!("onscroll"in window)||typeof navigator!="undefined"&&/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),Q=f&&"IntersectionObserver"in window,ee=f&&"classList"in document.createElement("p"),te=f&&window.devicePixelRatio>1,We={elements_selector:".lazy",container:Z||f?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},se=e=>Object.assign({},We,e),oe=function(e,t){let s;const o="LazyLoad::Initialized",r=new e(t);try{s=new CustomEvent(o,{detail:{instance:r}})}catch{s=document.createEvent("CustomEvent"),s.initCustomEvent(o,!1,!1,{instance:r})}window.dispatchEvent(s)},Fe=(e,t)=>{if(!!t)if(!t.length)oe(e,t);else for(let s=0,o;o=t[s];s+=1)oe(e,o)},g="src",V="srcset",z="sizes",re="poster",E="llOriginalAttrs",O="loading",ie="loaded",ae="applied",Ue="entered",M="error",ne="native",ce="data-",le="ll-status",h=(e,t)=>e.getAttribute(ce+t),je=(e,t,s)=>{var o=ce+t;if(s===null){e.removeAttribute(o);return}e.setAttribute(o,s)},S=e=>h(e,le),b=(e,t)=>je(e,le,t),T=e=>b(e,null),D=e=>S(e)===null,Ge=e=>S(e)===O,Ye=e=>S(e)===M,H=e=>S(e)===ne,qe=[O,ie,ae,M],Xe=e=>qe.indexOf(S(e))>=0,w=(e,t,s,o)=>{if(!!e){if(o!==void 0){e(t,s,o);return}if(s!==void 0){e(t,s);return}e(t)}},v=(e,t)=>{if(ee){e.classList.add(t);return}e.className+=(e.className?" ":"")+t},u=(e,t)=>{if(ee){e.classList.remove(t);return}e.className=e.className.replace(new RegExp("(^|\\s+)"+t+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},Je=e=>{e.llTempImage=document.createElement("IMG")},Ke=e=>{delete e.llTempImage},de=e=>e.llTempImage,_=(e,t)=>{if(!t)return;const s=t._observer;!s||s.unobserve(e)},Ze=e=>{e.disconnect()},Qe=(e,t,s)=>{t.unobserve_entered&&_(e,s)},R=(e,t)=>{!e||(e.loadingCount+=t)},et=e=>{!e||(e.toLoadCount-=1)},he=(e,t)=>{!e||(e.toLoadCount=t)},tt=e=>e.loadingCount>0,st=e=>e.toLoadCount>0,pe=e=>{let t=[];for(let s=0,o;o=e.children[s];s+=1)o.tagName==="SOURCE"&&t.push(o);return t},B=(e,t)=>{const s=e.parentNode;if(!s||s.tagName!=="PICTURE")return;pe(s).forEach(t)},ue=(e,t)=>{pe(e).forEach(t)},k=[g],ge=[g,re],I=[g,V,z],L=e=>!!e[E],we=e=>e[E],fe=e=>delete e[E],x=(e,t)=>{if(L(e))return;const s={};t.forEach(o=>{s[o]=e.getAttribute(o)}),e[E]=s},ot=e=>{L(e)||(e[E]={backgroundImage:e.style.backgroundImage})},rt=(e,t,s)=>{if(!s){e.removeAttribute(t);return}e.setAttribute(t,s)},N=(e,t)=>{if(!L(e))return;const s=we(e);t.forEach(o=>{rt(e,o,s[o])})},it=e=>{if(!L(e))return;const t=we(e);e.style.backgroundImage=t.backgroundImage},at=(e,t,s)=>{v(e,t.class_applied),b(e,ae),!!s&&(t.unobserve_completed&&_(e,t),w(t.callback_applied,e,s))},be=(e,t,s)=>{v(e,t.class_loading),b(e,O),!!s&&(R(s,1),w(t.callback_loading,e,s))},m=(e,t,s)=>{!s||e.setAttribute(t,s)},me=(e,t)=>{m(e,z,h(e,t.data_sizes)),m(e,V,h(e,t.data_srcset)),m(e,g,h(e,t.data_src))},nt=(e,t)=>{B(e,s=>{x(s,I),me(s,t)}),x(e,I),me(e,t)},ct=(e,t)=>{x(e,k),m(e,g,h(e,t.data_src))},lt=(e,t)=>{ue(e,s=>{x(s,k),m(s,g,h(s,t.data_src))}),x(e,ge),m(e,re,h(e,t.data_poster)),m(e,g,h(e,t.data_src)),e.load()},dt=(e,t,s)=>{const o=h(e,t.data_bg),r=h(e,t.data_bg_hidpi),i=te&&r?r:o;!i||(e.style.backgroundImage=`url("${i}")`,de(e).setAttribute(g,i),be(e,t,s))},ht=(e,t,s)=>{const o=h(e,t.data_bg_multi),r=h(e,t.data_bg_multi_hidpi),i=te&&r?r:o;!i||(e.style.backgroundImage=i,at(e,t,s))},ve={IMG:nt,IFRAME:ct,VIDEO:lt},pt=(e,t)=>{const s=ve[e.tagName];!s||s(e,t)},ut=(e,t,s)=>{const o=ve[e.tagName];!o||(o(e,t),be(e,t,s))},gt=["IMG","IFRAME","VIDEO"],wt=e=>gt.indexOf(e.tagName)>-1,ye=(e,t)=>{t&&!tt(t)&&!st(t)&&w(e.callback_finish,t)},Ee=(e,t,s)=>{e.addEventListener(t,s),e.llEvLisnrs[t]=s},ft=(e,t,s)=>{e.removeEventListener(t,s)},W=e=>!!e.llEvLisnrs,bt=(e,t,s)=>{W(e)||(e.llEvLisnrs={});const o=e.tagName==="VIDEO"?"loadeddata":"load";Ee(e,o,t),Ee(e,"error",s)},F=e=>{if(!W(e))return;const t=e.llEvLisnrs;for(let s in t){const o=t[s];ft(e,s,o)}delete e.llEvLisnrs},Se=(e,t,s)=>{Ke(e),R(s,-1),et(s),u(e,t.class_loading),t.unobserve_completed&&_(e,s)},mt=(e,t,s,o)=>{const r=H(t);Se(t,s,o),v(t,s.class_loaded),b(t,ie),w(s.callback_loaded,t,o),r||ye(s,o)},vt=(e,t,s,o)=>{const r=H(t);Se(t,s,o),v(t,s.class_error),b(t,M),w(s.callback_error,t,o),r||ye(s,o)},U=(e,t,s)=>{const o=de(e)||e;if(W(o))return;bt(o,n=>{mt(n,e,t,s),F(o)},n=>{vt(n,e,t,s),F(o)})},yt=(e,t,s)=>{Je(e),U(e,t,s),ot(e),dt(e,t,s),ht(e,t,s)},Et=(e,t,s)=>{U(e,t,s),ut(e,t,s)},j=(e,t,s)=>{wt(e)?Et(e,t,s):yt(e,t,s)},St=(e,t,s)=>{e.setAttribute("loading","lazy"),U(e,t,s),pt(e,t),b(e,ne)},xe=e=>{e.removeAttribute(g),e.removeAttribute(V),e.removeAttribute(z)},xt=e=>{B(e,t=>{xe(t)}),xe(e)},Ne=e=>{B(e,t=>{N(t,I)}),N(e,I)},Nt=e=>{ue(e,t=>{N(t,k)}),N(e,ge),e.load()},$t=e=>{N(e,k)},Ct={IMG:Ne,IFRAME:$t,VIDEO:Nt},Tt=e=>{const t=Ct[e.tagName];if(!t){it(e);return}t(e)},_t=(e,t)=>{D(e)||H(e)||(u(e,t.class_entered),u(e,t.class_exited),u(e,t.class_applied),u(e,t.class_loading),u(e,t.class_loaded),u(e,t.class_error))},kt=(e,t)=>{Tt(e),_t(e,t),T(e),fe(e)},It=(e,t,s,o)=>{!s.cancel_on_exit||!Ge(e)||e.tagName==="IMG"&&(F(e),xt(e),Ne(e),u(e,s.class_loading),R(o,-1),T(e),w(s.callback_cancel,e,t,o))},Lt=(e,t,s,o)=>{const r=Xe(e);b(e,Ue),v(e,s.class_entered),u(e,s.class_exited),Qe(e,s,o),w(s.callback_enter,e,t,o),!r&&j(e,s,o)},Pt=(e,t,s,o)=>{D(e)||(v(e,s.class_exited),It(e,t,s,o),w(s.callback_exit,e,t,o))},At=["IMG","IFRAME","VIDEO"],$e=e=>e.use_native&&"loading"in HTMLImageElement.prototype,Vt=(e,t,s)=>{e.forEach(o=>{At.indexOf(o.tagName)!==-1&&St(o,t,s)}),he(s,0)},zt=e=>e.isIntersecting||e.intersectionRatio>0,Ot=e=>({root:e.container===document?null:e.container,rootMargin:e.thresholds||e.threshold+"px"}),Mt=(e,t,s)=>{e.forEach(o=>zt(o)?Lt(o.target,o,t,s):Pt(o.target,o,t,s))},Dt=(e,t)=>{t.forEach(s=>{e.observe(s)})},Ht=(e,t)=>{Ze(e),Dt(e,t)},Rt=(e,t)=>{!Q||$e(e)||(t._observer=new IntersectionObserver(s=>{Mt(s,e,t)},Ot(e)))},Ce=e=>Array.prototype.slice.call(e),P=e=>e.container.querySelectorAll(e.elements_selector),Bt=e=>Ce(e).filter(D),Wt=e=>Ye(e),Ft=e=>Ce(e).filter(Wt),Te=(e,t)=>Bt(e||P(t)),Ut=(e,t)=>{Ft(P(e)).forEach(o=>{u(o,e.class_error),T(o)}),t.update()},jt=(e,t)=>{!f||window.addEventListener("online",()=>{Ut(e,t)})},y=function(e,t){const s=se(e);this._settings=s,this.loadingCount=0,Rt(s,this),jt(s,this),this.update(t)};y.prototype={update:function(e){const t=this._settings,s=Te(e,t);if(he(this,s.length),Z||!Q){this.loadAll(s);return}if($e(t)){Vt(s,t,this);return}Ht(this._observer,s)},destroy:function(){this._observer&&this._observer.disconnect(),P(this._settings).forEach(e=>{fe(e)}),delete this._observer,delete this._settings,delete this.loadingCount,delete this.toLoadCount},loadAll:function(e){const t=this._settings;Te(e,t).forEach(o=>{_(o,this),j(o,t,this)})},restoreAll:function(){const e=this._settings;P(e).forEach(t=>{kt(t,e)})}};y.load=(e,t)=>{const s=se(t);j(e,s)};y.resetStatus=e=>{T(e)};f&&Fe(y,window.lazyLoadOptions);const Gt=(e,t,s,o)=>{if(s==="length"||s==="prototype"||s==="arguments"||s==="caller")return;const r=Object.getOwnPropertyDescriptor(e,s),i=Object.getOwnPropertyDescriptor(t,s);!Yt(r,i)&&o||Object.defineProperty(e,s,i)},Yt=function(e,t){return e===void 0||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},qt=(e,t)=>{const s=Object.getPrototypeOf(t);s!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,s)},Xt=(e,t)=>`/* Wrapped ${e}*/
${t}`,Jt=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Kt=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Zt=(e,t,s)=>{const o=s===""?"":`with ${s.trim()}() `,r=Xt.bind(null,o,t.toString());Object.defineProperty(r,"name",Kt),Object.defineProperty(e,"toString",K(J({},Jt),{value:r}))},Qt=(e,t,{ignoreNonConfigurable:s=!1}={})=>{const{name:o}=e;for(const r of Reflect.ownKeys(t))Gt(e,t,r,s);return qt(e,t),Zt(e,t,o),e};var es=Qt;const ts=(e,t={})=>{if(typeof e!="function")throw new TypeError(`Expected the first argument to be a function, got \`${typeof e}\``);const{wait:s=0,maxWait:o=Number.Infinity,before:r=!1,after:i=!0}=t;if(!r&&!i)throw new Error("Both `before` and `after` are false, function wouldn't be called.");let n,c,a;const l=function(...d){const p=this,Ae=()=>{n=void 0,c&&(clearTimeout(c),c=void 0),i&&(a=e.apply(p,d))},Ve=()=>{c=void 0,n&&(clearTimeout(n),n=void 0),i&&(a=e.apply(p,d))},ze=r&&!n;return clearTimeout(n),n=setTimeout(Ae,s),o>0&&o!==Number.Infinity&&!c&&(c=setTimeout(Ve,o)),ze&&(a=e.apply(p,d)),a};return es(l,e),l.cancel=()=>{n&&(clearTimeout(n),n=void 0),c&&(clearTimeout(c),c=void 0)},l},_e="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",ss=_e.length,ke=Array(20),$=()=>{for(let e=0;e<20;e++)ke[e]=_e.charAt(Math.random()*ss);return ke.join("")};class G{constructor(){this.disposers=new Map}add(t,s=$()){return this.flush(s),this.disposers.set(s,t()),s}addDisposer(t,s=$()){return this.flush(s),this.disposers.set(s,t),s}addEventListener(t,s,o,r,i=$()){return this.add(()=>(t.addEventListener(s,o,r),()=>t.removeEventListener(s,o,r)),i),i}setTimeout(t,s,o=$()){return this.add(()=>{const r=window.setTimeout(()=>{this.remove(o),t()},s);return()=>window.clearTimeout(r)},o)}setInterval(t,s,o=$()){return this.add(()=>{const r=window.setInterval(t,s);return()=>window.clearInterval(r)},o)}remove(t){const s=this.disposers.get(t);return this.disposers.delete(t),s}flush(t){const s=this.remove(t);if(s)try{s()}catch(o){console.error(o)}}flushAll(){this.disposers.forEach(t=>{try{t()}catch(s){console.error(s)}}),this.disposers.clear()}}function os(e){const t="http://www.w3.org/2000/svg",s=document.createElementNS(t,"svg");s.setAttribute("class",`${e}-footer-icon-sidebar`),s.setAttribute("viewBox","0 0 64 64");const o=document.createElementNS(t,"path");return o.setAttribute("fill","currentColor"),o.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(o),s}function rs(e){const t="http://www.w3.org/2000/svg",s=document.createElementNS(t,"svg");s.setAttribute("class",`${e}-footer-icon-arrow-left`),s.setAttribute("viewBox","0 0 500 500");const o=document.createElementNS(t,"path");return o.setAttribute("fill","currentColor"),o.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(o),s}function is(e){const t="http://www.w3.org/2000/svg",s=document.createElementNS(t,"svg");s.setAttribute("class",`${e}-footer-icon-arrow-right`),s.setAttribute("viewBox","0 0 500 500");const o=document.createElementNS(t,"path");return o.setAttribute("fill","currentColor"),o.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(o),s}function as(e){const t="http://www.w3.org/2000/svg",s=document.createElementNS(t,"svg");s.setAttribute("class",`${e}-footer-icon-play`),s.setAttribute("viewBox","0 0 500 500");const o=document.createElementNS(t,"path");return o.setAttribute("fill","currentColor"),o.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(o),s}function ns(e){const t="http://www.w3.org/2000/svg",s=document.createElementNS(t,"svg");s.setAttribute("class",`${e}-footer-icon-pause`),s.setAttribute("viewBox","0 0 500 500");const o=document.createElementNS(t,"path");return o.setAttribute("fill","currentColor"),o.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(o),s}class Ie{constructor({readonly:t,box:s,pages:o,onNewPageIndex:r,onPlay:i}){if(this.pageIndex=0,this.namespace="netless-app-docs-viewer",this.isShowPreview=!1,this.isSmallBox=!1,this.sideEffect=new G,o.length<=0)throw new Error("[DocsViewer] Empty pages.");this.readonly=t,this.box=s,this.pages=o,this.onNewPageIndex=r,this.onPlay=i,this.render()}mount(){this.box.mountContent(this.$content),this.box.mountFooter(this.$footer),this.sideEffect.add(()=>{const t=new y({container:this.$preview,elements_selector:`.${this.wrapClassName("preview-page>img")}`});return()=>t.destroy()},"preview-lazyload")}unmount(){this.$content.remove(),this.$footer.remove()}setReadonly(t){this.readonly!==t&&(this.readonly=t,this.$content.classList.toggle(this.wrapClassName("readonly"),t),this.$footer.classList.toggle(this.wrapClassName("readonly"),t),this.$pageNumberInput.disabled=t)}destroy(){this.sideEffect.flushAll(),this.unmount()}setPageIndex(t){Number.isNaN(t)||(this.pageIndex=t,this.$pageNumberInput.value=String(t+1))}setSmallBox(t){this.isSmallBox!==t&&(this.isSmallBox=t,this.$footer.classList.toggle(this.wrapClassName("float-footer"),t))}render(){return this.renderContent(),this.renderFooter(),this.$content}renderContent(){if(!this.$content){const t=document.createElement("div");t.className=this.wrapClassName("content"),this.$content=t,this.readonly&&t.classList.add(this.wrapClassName("readonly")),t.appendChild(this.renderPreviewMask()),t.appendChild(this.renderPreview())}return this.$content}renderPreview(){if(!this.$preview){const t=document.createElement("div");t.className=this.wrapClassName("preview")+" tele-fancy-scrollbar",this.$preview=t;const s=this.wrapClassName("preview-page"),o=this.wrapClassName("preview-page-name");this.pages.forEach((r,i)=>{var p;const n=(p=r.thumbnail)!=null?p:r.src.startsWith("ppt")?void 0:r.src;if(!n)return;const c=String(i),a=document.createElement("a");a.className=s+" "+this.wrapClassName(`preview-page-${i}`),a.setAttribute("href","#"),a.dataset.pageIndex=c;const l=document.createElement("span");l.className=o,l.textContent=String(i+1),l.dataset.pageIndex=c;const d=document.createElement("img");d.width=r.width,d.height=r.height,d.dataset.src=n,d.dataset.pageIndex=c,a.appendChild(d),a.appendChild(l),t.appendChild(a)}),this.sideEffect.addEventListener(t,"click",r=>{var n;if(this.readonly)return;const i=(n=r.target.dataset)==null?void 0:n.pageIndex;i&&(r.preventDefault(),r.stopPropagation(),r.stopImmediatePropagation(),this.onNewPageIndex(Number(i)),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",t=>{this.readonly||t.target===this.$previewMask&&this.togglePreview(!1)})),this.$previewMask}renderFooter(){if(!this.$footer){const t=document.createElement("div");if(t.className=this.wrapClassName("footer"),this.$footer=t,this.readonly&&t.classList.add(this.wrapClassName("readonly")),this.isSmallBox&&t.classList.add(this.wrapClassName("float-footer")),this.pages.some(a=>a.thumbnail||!a.src.startsWith("ppt"))){const a=this.renderFooterBtn("btn-sidebar",os(this.namespace));this.sideEffect.addEventListener(a,"click",()=>{this.readonly||this.togglePreview()}),this.$footer.appendChild(a)}const s=document.createElement("div");s.className=this.wrapClassName("page-jumps");const o=this.renderFooterBtn("btn-page-back",rs(this.namespace));if(this.sideEffect.addEventListener(o,"click",()=>{this.readonly||this.onNewPageIndex(this.pageIndex-1)}),s.appendChild(o),this.onPlay){const a=this.renderFooterBtn("btn-page-play",as(this.namespace),ns(this.namespace)),l=()=>{this.sideEffect.setTimeout(()=>{a.classList.toggle(this.wrapClassName("footer-btn-playing"),!1)},500,"returnPlay")};this.sideEffect.addEventListener(a,"click",()=>{this.readonly||(a.classList.toggle(this.wrapClassName("footer-btn-playing"),!0),this.onPlay&&this.onPlay(),l())}),s.appendChild(a)}const r=this.renderFooterBtn("btn-page-next",is(this.namespace));this.sideEffect.addEventListener(r,"click",()=>{this.readonly||this.onNewPageIndex(this.pageIndex+1)}),s.appendChild(r);const i=document.createElement("div");i.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,"change",()=>{this.readonly||n.value&&this.onNewPageIndex(Number(n.value)-1)});const c=document.createElement("span");c.textContent=" / "+this.pages.length,i.appendChild(n),i.appendChild(c),this.$footer.appendChild(s),this.$footer.appendChild(i)}return this.$footer}renderFooterBtn(t,s,o){const r=document.createElement("button");return r.className=this.wrapClassName("footer-btn")+" "+this.wrapClassName(t),r.appendChild(s),o&&r.appendChild(o),r}togglePreview(t){if(this.isShowPreview=t!=null?t:!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(t){return`${this.namespace}-${t}`}}function A(e,t,s){return Math.min(Math.max(e,t),s)}function Le(e){return e.touches?e.touches[0]:e}function Pe(e){e.stopPropagation(),e.cancelable&&e.preventDefault()}const Y=30,C=640;class cs{constructor({whiteboardView:t,readonly:s,box:o,pages:r,pagesSize:i,pageScrollTop:n=0,mountWhiteboard:c,onUserScroll:a}){this.onNewPageIndex=l=>{this.scrollToPage(l)},this.sideEffect=new G,this.scrollbarHeight=Y,this.whiteboardView=t,this.readonly=s,this.box=o,this.pages=r,this.pageScrollTop=n,this.pagesSize=i,this.mountWhiteboard=c,this.onUserScroll=a,this.viewer=new Ie({readonly:s,box:o,pages:r,onNewPageIndex:this.onNewPageIndex}),this.render()}mount(){return this.viewer.mount(),this.sideEffect.add(()=>{const t=new y({container:this.$pages,elements_selector:`.${this.wrapClassName("page")}`});return()=>t.destroy()},"page-lazyload"),this.setupWhiteboardCamera(),this.sideEffect.setTimeout(()=>{this.pageScrollTop!==0&&this.pageScrollTo(this.pageScrollTop)},1e3),this.setupScrollTopEvent(),this.whiteboardView.callbacks.on("onSizeUpdated",()=>{this.renderRatioHeight()}),this}unmount(){return this.viewer.unmount(),this}setReadonly(t){this.readonly!==t&&(this.readonly=t,this.viewer.setReadonly(t))}destroy(){this.sideEffect.flushAll(),this.onUserScroll=void 0,this.unmount(),this.viewer.destroy()}syncPageScrollTop(t){t>=0&&Math.abs(this.pageScrollTop-t)>10&&this.pageScrollTo(t)}render(){this.viewer.$content.appendChild(this.renderPages()),this.viewer.$content.appendChild(this.renderWhiteboardView()),this.viewer.$content.appendChild(this.renderScrollbar()),this.renderRatioHeight()}renderRatioHeight(){const t=this.box.absoluteHeight,s=t<=C;if(this.viewer.setSmallBox(s),s){const o=26/C,r=26/t,i=26/C,n=0,c=Math.max((o+i-(r+n))/2,0);if(this.box.$titleBar){const a=r+c;this.box.$titleBar.style.height=`${a*100}%`}if(this.box.$footer){const a=n+c;this.box.$footer.style.height=`${a*100}%`}}else{if(this.box.$titleBar){const o=Math.max(26/C,26/t);this.box.$titleBar.style.height=`${o*100}%`}if(this.box.$footer){const o=Math.max(26/C,26/t);this.box.$footer.style.height=`${o*100}%`}}}renderPages(){if(!this.$pages){const t=document.createElement("div");t.className=this.wrapClassName("pages"),this.$pages=t;const s=this.wrapClassName("page");this.pages.forEach((o,r)=>{const i=document.createElement("img");i.className=s+" "+this.wrapClassName(`page-${r}`),i.draggable=!1,i.width=o.width,i.height=o.height,i.dataset.src=o.src,i.dataset.pageIndex=String(r),t.appendChild(i)})}return this.$pages}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",t=>{Pe(t),this.readonly||(this.pageScrollTo(this.pageScrollTop+t.deltaY),this.updateUserScroll())},{passive:!1,capture:!0}),this.sideEffect.addEventListener(this.$whiteboardView,"touchmove",t=>{this.readonly||t.touches.length<=1||this.updateUserScroll()},{passive:!0,capture:!0})),this.$whiteboardView}renderScrollbar(){if(!this.$scrollbar){const t=document.createElement("button");this.$scrollbar=t,t.className=this.wrapClassName("scrollbar"),t.style.minHeight=`${Y}px`;const s=o=>{if(this.readonly||o.button!=null&&o.button!==0)return;Pe(o),this.$scrollbar.classList.toggle(this.wrapClassName("scrollbar-dragging"),!0);const r=this.scrollTopPageToEl(this.pageScrollTop),i=this.whiteboardView.size.width/this.pagesSize.width*this.pagesSize.height,{clientY:n}=Le(o),c=l=>{const{clientY:d}=Le(l),{height:p}=this.whiteboardView.size;this.elScrollTo(r+(d-n)*(i/p))},a=()=>{this.$scrollbar.classList.toggle(this.wrapClassName("scrollbar-dragging"),!1),window.removeEventListener("mousemove",c,!0),window.removeEventListener("touchmove",c,!0),window.removeEventListener("mouseup",a,!0),window.removeEventListener("touchend",a,!0),window.removeEventListener("touchcancel",a,!0)};window.addEventListener("mousemove",c,!0),window.addEventListener("touchmove",c,!0),window.addEventListener("mouseup",a,!0),window.addEventListener("touchend",a,!0),window.addEventListener("touchcancel",a,!0)};this.sideEffect.addEventListener(t,"mousedown",s),this.sideEffect.addEventListener(t,"touchstart",s)}return this.$scrollbar}scrollTopPageToEl(t){return t*(this.whiteboardView.size.width/this.pagesSize.width)}scrollTopElToPage(t){return t/(this.whiteboardView.size.width/this.pagesSize.width)}elScrollTo(t){this.pageScrollTo(this.scrollTopElToPage(t))}pageScrollTo(t){const s=this.scrollTopElToPage(this.whiteboardView.size.height/2);this.whiteboardView.moveCamera({centerY:A(t+s,s,this.pagesSize.height-s),animationMode:"immediately"})}scrollToPage(t){if(!this.readonly&&this.$pages&&!Number.isNaN(t)){t=A(t,0,this.pages.length-1);const s=this.$pages.querySelector("."+this.wrapClassName(`page-${t}`));if(s){const o=s.offsetTop+5;this.elScrollTo(o),this.updateUserScroll()}}}setupScrollTopEvent(){const t=this.debounce(()=>{if(this.pages.length>0&&this.$pages&&this.$pages.getBoundingClientRect().width>0){let o=0;for(let r=0;r<this.pages.length;r+=1)if(o+=this.pages[r].height,this.pageScrollTop<=o){this.viewer.setPageIndex(r);return}this.viewer.setPageIndex(this.pages.length-1)}},{wait:5,maxWait:100},"debounce-updatePageIndex");this.sideEffect.add(()=>{const s=o=>{const{width:r,height:i}=this.whiteboardView.size,{width:n,height:c}=this.pagesSize,a=r/n*c,l=this.scrollTopPageToEl(o.centerY)-i/2,d=this.scrollTopElToPage(l);this.pageScrollTop=d,this.$pages.scrollTo({top:l}),this.setScrollbarHeight(i/a*i),this.$scrollbar.style.transform=`translateY(${l/(a-i)*(i-this.scrollbarHeight)}px)`,t()};return this.whiteboardView.callbacks.on("onCameraUpdated",s),()=>this.whiteboardView.callbacks.off("onCameraUpdated",s)})}setupWhiteboardCamera(){this.sideEffect.add(()=>{const t=({width:s,height:o})=>{if(s>0&&o>0){const r=this.$pages.scrollTop,i=this.pagesSize.width,n=i/s;this.whiteboardView.moveCameraToContain({originX:0,originY:r*n,width:i,height:o*n,animationMode:"immediately"}),this.whiteboardView.setCameraBound({damping:1,maxContentMode:()=>s/i,minContentMode:()=>s/i,centerX:this.pagesSize.width/2,centerY:this.pagesSize.height/2,width:this.pagesSize.width,height:this.pagesSize.height}),this.elScrollTo(r)}};return this.whiteboardView.callbacks.on("onSizeUpdated",t),()=>{this.whiteboardView.callbacks.off("onSizeUpdated",t)}},"whiteboard-size-update")}updateUserScroll(){window.requestAnimationFrame(()=>{this.onUserScroll&&this.onUserScroll(this.pageScrollTop)})}debounce(t,s,o){const r=ts(t,s);return this.sideEffect.add(()=>()=>r.cancel(),o),r}wrapClassName(t){return"netless-app-docs-viewer-static-"+t}setScrollbarHeight(t){t=A(t,Y,this.whiteboardView.size.height),this.scrollbarHeight!==t&&(this.scrollbarHeight=t,this.$scrollbar.style.height=`${t}px`)}}class ls{constructor({displayer:t,whiteboardView:s,getRoom:o,readonly:r,box:i,pages:n,mountWhiteboard:c}){this.sideEffect=new G,this.onPlayPPT=()=>{const a=this.getWhiteboardRoom();a&&a.pptNextStep()},this._scaleDocsToFitImpl=()=>{const a=this.pages[this.getPageIndex()];a&&this.whiteboardView.moveCameraToContain({originX:-a.width/2,originY:-a.height/2,width:a.width,height:a.height,animationMode:"immediately"})},this._scaleDocsToFitDebounced=()=>{this.sideEffect.setTimeout(this._scaleDocsToFitImpl,1e3,"_scaleDocsToFitDebounced")},this.scaleDocsToFit=()=>{this._scaleDocsToFitImpl(),this._scaleDocsToFitDebounced()},this.onNewPageIndex=a=>{this.jumpToPage(a,!0)},this.whiteboardView=s,this.readonly=r,this.box=i,this.pages=n,this.displayer=t,this.getWhiteboardRoom=o,this.mountWhiteboard=c,this.viewer=new Ie({readonly:r,box:i,pages:n,onNewPageIndex:this.onNewPageIndex,onPlay:this.onPlayPPT}),this.render()}mount(){this.viewer.mount();const t=this.getPageIndex();return t!==0&&this.jumpToPage(t),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}setReadonly(t){this.readonly!==t&&(this.readonly=t,this.viewer.setReadonly(t))}destroy(){this.sideEffect.flushAll(),this.unmount(),this.viewer.destroy()}getPageIndex(){return this.displayer.state.sceneState.index}jumpToPage(t,s){if(t=A(t,0,this.pages.length-1),t!==this.getPageIndex()){const o=this.getWhiteboardRoom();o&&(o.setSceneIndex(t),this.scaleDocsToFit())}if(t!==this.viewer.pageIndex&&this.viewer.setPageIndex(t),s){const o=this.getWhiteboardRoom();o&&o.setGlobalState({__pptState:void 0})}}render(){this.viewer.$content.appendChild(this.renderMask()),this.viewer.$content.appendChild(this.renderWhiteboardView()),this.sideEffect.addEventListener(window,"keydown",t=>{var s;if(this.box.focus)switch(t.key){case"ArrowUp":case"ArrowLeft":{this.jumpToPage(this.getPageIndex()-1,!0);break}case"ArrowRight":case"ArrowDown":{(s=this.getWhiteboardRoom())==null||s.pptNextStep();break}}})}renderMask(){if(!this.$mask){const t=document.createElement("div");t.className=this.wrapClassName("mask"),this.$mask=t;const s=document.createElement("button");s.className=this.wrapClassName("back");const o=document.createElement("button");o.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",t=>{var o;const s=this.getWhiteboardRoom();if(s&&s.state.memberState.currentApplianceName==="clicker"){for(let r=t.target;r;r=r.parentElement)if((o=r.classList)==null?void 0:o.contains("ppt-event-source"))return;s.pptNextStep()}}),this.mountWhiteboard(this.$whiteboardView)),this.$whiteboardView}wrapClassName(t){return"netless-app-docs-viewer-dynamic-"+t}}const ds="DocsViewer",hs={kind:ds,setup(e){const t=e.getBox(),s=e.getScenes();if(!s)throw new Error("[Docs Viewer]: scenes not found.");const o=e.getView();if(!o)throw new Error("[Docs Viewer]: no whiteboard view.");const r=s.map(({ppt:i})=>i?{width:i.width,height:i.height,src:i.src,thumbnail:i.previewURL}:null).filter(i=>Boolean(i));if(r.length<=0)throw new Error("[Docs Viewer]: empty scenes.");t.mountStyles(Be),r[0].src.startsWith("ppt")?us(e,o,t,r):ps(e,o,t,r)}};function ps(e,t,s,o){var n;const r={width:o[0].width,height:o.reduce((c,a)=>c+a.height*(o[0].width/a.width),0)},i=new cs({whiteboardView:t,readonly:s.readonly,box:s,pages:o,pagesSize:r,pageScrollTop:(n=e.getAttributes())==null?void 0:n.pageScrollTop,mountWhiteboard:e.mountView.bind(e),onUserScroll:c=>{var a;((a=e.getAttributes())==null?void 0:a.pageScrollTop)!==c&&!s.readonly&&e.updateAttributes(["pageScrollTop"],c)}}).mount();e.emitter.on("attributesUpdate",c=>{c&&c.pageScrollTop!=null&&i.syncPageScrollTop(c.pageScrollTop)}),s.events.on("readonly",c=>{i.setReadonly(c)})}function us(e,t,s,o){t.disableCameraTransform=!0;const r=e.getDisplayer(),i=new ls({displayer:r,whiteboardView:t,getRoom:()=>e.getIsWritable()?e.getDisplayer():void 0,readonly:s.readonly,box:s,pages:o,mountWhiteboard:e.mountView.bind(e)}).mount();e.mountView(i.$whiteboardView),e.isAddApp&&t.callbacks.once("onSizeUpdated",({width:n,height:c})=>{if(o.length>0&&s.state!=="maximized"){const{width:a,height:l}=o[0],p=l/a*n-c;p!==0&&e.getIsWritable()&&e.emitter.emit("setBoxSize",{width:s.width,height:s.height+p/s.containerRect.height})}}),e.emitter.on("sceneStateChange",n=>{i.jumpToPage(n.index)}),s.events.on("readonly",n=>{i.setReadonly(n)})}exports.default=hs;
${t}`,Jt=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Kt=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Zt=(e,t,s)=>{const o=s===""?"":`with ${s.trim()}() `,r=Xt.bind(null,o,t.toString());Object.defineProperty(r,"name",Kt),Object.defineProperty(e,"toString",K(J({},Jt),{value:r}))},Qt=(e,t,{ignoreNonConfigurable:s=!1}={})=>{const{name:o}=e;for(const r of Reflect.ownKeys(t))Gt(e,t,r,s);return qt(e,t),Zt(e,t,o),e};var es=Qt;const ts=(e,t={})=>{if(typeof e!="function")throw new TypeError(`Expected the first argument to be a function, got \`${typeof e}\``);const{wait:s=0,maxWait:o=Number.Infinity,before:r=!1,after:i=!0}=t;if(!r&&!i)throw new Error("Both `before` and `after` are false, function wouldn't be called.");let n,c,a;const l=function(...d){const p=this,Ae=()=>{n=void 0,c&&(clearTimeout(c),c=void 0),i&&(a=e.apply(p,d))},Ve=()=>{c=void 0,n&&(clearTimeout(n),n=void 0),i&&(a=e.apply(p,d))},ze=r&&!n;return clearTimeout(n),n=setTimeout(Ae,s),o>0&&o!==Number.Infinity&&!c&&(c=setTimeout(Ve,o)),ze&&(a=e.apply(p,d)),a};return es(l,e),l.cancel=()=>{n&&(clearTimeout(n),n=void 0),c&&(clearTimeout(c),c=void 0)},l},_e="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",ss=_e.length,ke=Array(20),$=()=>{for(let e=0;e<20;e++)ke[e]=_e.charAt(Math.random()*ss);return ke.join("")};class G{constructor(){this.disposers=new Map}add(t,s=$()){return this.flush(s),this.disposers.set(s,t()),s}addDisposer(t,s=$()){return this.flush(s),this.disposers.set(s,t),s}addEventListener(t,s,o,r,i=$()){return this.add(()=>(t.addEventListener(s,o,r),()=>t.removeEventListener(s,o,r)),i),i}setTimeout(t,s,o=$()){return this.add(()=>{const r=window.setTimeout(()=>{this.remove(o),t()},s);return()=>window.clearTimeout(r)},o)}setInterval(t,s,o=$()){return this.add(()=>{const r=window.setInterval(t,s);return()=>window.clearInterval(r)},o)}remove(t){const s=this.disposers.get(t);return this.disposers.delete(t),s}flush(t){const s=this.remove(t);if(s)try{s()}catch(o){console.error(o)}}flushAll(){this.disposers.forEach(t=>{try{t()}catch(s){console.error(s)}}),this.disposers.clear()}}function os(e){const t="http://www.w3.org/2000/svg",s=document.createElementNS(t,"svg");s.setAttribute("class",`${e}-footer-icon-sidebar`),s.setAttribute("viewBox","0 0 64 64");const o=document.createElementNS(t,"path");return o.setAttribute("fill","currentColor"),o.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(o),s}function rs(e){const t="http://www.w3.org/2000/svg",s=document.createElementNS(t,"svg");s.setAttribute("class",`${e}-footer-icon-arrow-left`),s.setAttribute("viewBox","0 0 500 500");const o=document.createElementNS(t,"path");return o.setAttribute("fill","currentColor"),o.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(o),s}function is(e){const t="http://www.w3.org/2000/svg",s=document.createElementNS(t,"svg");s.setAttribute("class",`${e}-footer-icon-arrow-right`),s.setAttribute("viewBox","0 0 500 500");const o=document.createElementNS(t,"path");return o.setAttribute("fill","currentColor"),o.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(o),s}function as(e){const t="http://www.w3.org/2000/svg",s=document.createElementNS(t,"svg");s.setAttribute("class",`${e}-footer-icon-play`),s.setAttribute("viewBox","0 0 500 500");const o=document.createElementNS(t,"path");return o.setAttribute("fill","currentColor"),o.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(o),s}function ns(e){const t="http://www.w3.org/2000/svg",s=document.createElementNS(t,"svg");s.setAttribute("class",`${e}-footer-icon-pause`),s.setAttribute("viewBox","0 0 500 500");const o=document.createElementNS(t,"path");return o.setAttribute("fill","currentColor"),o.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(o),s}class Ie{constructor({readonly:t,box:s,pages:o,onNewPageIndex:r,onPlay:i}){if(this.pageIndex=0,this.namespace="netless-app-docs-viewer",this.isShowPreview=!1,this.isSmallBox=!1,this.sideEffect=new G,o.length<=0)throw new Error("[DocsViewer] Empty pages.");this.readonly=t,this.box=s,this.pages=o,this.onNewPageIndex=r,this.onPlay=i,this.render()}mount(){this.box.mountContent(this.$content),this.box.mountFooter(this.$footer),this.sideEffect.add(()=>{const t=new y({container:this.$preview,elements_selector:`.${this.wrapClassName("preview-page>img")}`});return()=>t.destroy()},"preview-lazyload")}unmount(){this.$content.remove(),this.$footer.remove()}setReadonly(t){this.readonly!==t&&(this.readonly=t,this.$content.classList.toggle(this.wrapClassName("readonly"),t),this.$footer.classList.toggle(this.wrapClassName("readonly"),t),this.$pageNumberInput.disabled=t)}destroy(){this.sideEffect.flushAll(),this.unmount()}setPageIndex(t){Number.isNaN(t)||(this.pageIndex=t,this.$pageNumberInput.value=String(t+1))}setSmallBox(t){this.isSmallBox!==t&&(this.isSmallBox=t,this.$footer.classList.toggle(this.wrapClassName("float-footer"),t))}render(){return this.renderContent(),this.renderFooter(),this.$content}renderContent(){if(!this.$content){const t=document.createElement("div");t.className=this.wrapClassName("content"),this.$content=t,this.readonly&&t.classList.add(this.wrapClassName("readonly")),t.appendChild(this.renderPreviewMask()),t.appendChild(this.renderPreview())}return this.$content}renderPreview(){if(!this.$preview){const t=document.createElement("div");t.className=this.wrapClassName("preview")+" tele-fancy-scrollbar",this.$preview=t;const s=this.wrapClassName("preview-page"),o=this.wrapClassName("preview-page-name");this.pages.forEach((r,i)=>{var p;const n=(p=r.thumbnail)!=null?p:r.src.startsWith("ppt")?void 0:r.src;if(!n)return;const c=String(i),a=document.createElement("a");a.className=s+" "+this.wrapClassName(`preview-page-${i}`),a.setAttribute("href","#"),a.dataset.pageIndex=c;const l=document.createElement("span");l.className=o,l.textContent=String(i+1),l.dataset.pageIndex=c;const d=document.createElement("img");d.width=r.width,d.height=r.height,d.dataset.src=n,d.dataset.pageIndex=c,a.appendChild(d),a.appendChild(l),t.appendChild(a)}),this.sideEffect.addEventListener(t,"click",r=>{var n;if(this.readonly)return;const i=(n=r.target.dataset)==null?void 0:n.pageIndex;i&&(r.preventDefault(),r.stopPropagation(),r.stopImmediatePropagation(),this.onNewPageIndex(Number(i)),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",t=>{this.readonly||t.target===this.$previewMask&&this.togglePreview(!1)})),this.$previewMask}renderFooter(){if(!this.$footer){const t=document.createElement("div");if(t.className=this.wrapClassName("footer"),this.$footer=t,this.readonly&&t.classList.add(this.wrapClassName("readonly")),this.isSmallBox&&t.classList.add(this.wrapClassName("float-footer")),this.pages.some(a=>a.thumbnail||!a.src.startsWith("ppt"))){const a=this.renderFooterBtn("btn-sidebar",os(this.namespace));this.sideEffect.addEventListener(a,"click",()=>{this.readonly||this.togglePreview()}),this.$footer.appendChild(a)}const s=document.createElement("div");s.className=this.wrapClassName("page-jumps");const o=this.renderFooterBtn("btn-page-back",rs(this.namespace));if(this.sideEffect.addEventListener(o,"click",()=>{this.readonly||this.onNewPageIndex(this.pageIndex-1)}),s.appendChild(o),this.onPlay){const a=this.renderFooterBtn("btn-page-play",as(this.namespace),ns(this.namespace)),l=()=>{this.sideEffect.setTimeout(()=>{a.classList.toggle(this.wrapClassName("footer-btn-playing"),!1)},500,"returnPlay")};this.sideEffect.addEventListener(a,"click",()=>{this.readonly||(a.classList.toggle(this.wrapClassName("footer-btn-playing"),!0),this.onPlay&&this.onPlay(),l())}),s.appendChild(a)}const r=this.renderFooterBtn("btn-page-next",is(this.namespace));this.sideEffect.addEventListener(r,"click",()=>{this.readonly||this.onNewPageIndex(this.pageIndex+1)}),s.appendChild(r);const i=document.createElement("div");i.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,"change",()=>{this.readonly||n.value&&this.onNewPageIndex(Number(n.value)-1)});const c=document.createElement("span");c.textContent=" / "+this.pages.length,i.appendChild(n),i.appendChild(c),this.$footer.appendChild(s),this.$footer.appendChild(i)}return this.$footer}renderFooterBtn(t,s,o){const r=document.createElement("button");return r.className=this.wrapClassName("footer-btn")+" "+this.wrapClassName(t),r.appendChild(s),o&&r.appendChild(o),r}togglePreview(t){if(this.isShowPreview=t!=null?t:!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(t){return`${this.namespace}-${t}`}}function A(e,t,s){return Math.min(Math.max(e,t),s)}function Le(e){return e.touches?e.touches[0]:e}function Pe(e){e.stopPropagation(),e.cancelable&&e.preventDefault()}const Y=30,C=640;class cs{constructor({whiteboardView:t,readonly:s,box:o,pages:r,pagesSize:i,pageScrollTop:n=0,mountWhiteboard:c,onUserScroll:a}){this.onNewPageIndex=l=>{this.scrollToPage(l)},this.sideEffect=new G,this.scrollbarHeight=Y,this.whiteboardView=t,this.readonly=s,this.box=o,this.pages=r,this.pageScrollTop=n,this.pagesSize=i,this.mountWhiteboard=c,this.onUserScroll=a,this.viewer=new Ie({readonly:s,box:o,pages:r,onNewPageIndex:this.onNewPageIndex}),this.render()}mount(){return this.viewer.mount(),this.sideEffect.add(()=>{const t=new y({container:this.$pages,elements_selector:`.${this.wrapClassName("page")}`});return()=>t.destroy()},"page-lazyload"),this.setupWhiteboardCamera(),this.sideEffect.setTimeout(()=>{this.pageScrollTop!==0&&this.pageScrollTo(this.pageScrollTop)},1e3),this.setupScrollTopEvent(),this.sideEffect.add(()=>{const t=this.renderRatioHeight.bind(this);return this.box.events.on("visual_resize",t),()=>this.box.events.off("visual_resize",t)}),this}unmount(){return this.viewer.unmount(),this}setReadonly(t){this.readonly!==t&&(this.readonly=t,this.viewer.setReadonly(t))}destroy(){this.sideEffect.flushAll(),this.onUserScroll=void 0,this.unmount(),this.viewer.destroy()}syncPageScrollTop(t){t>=0&&Math.abs(this.pageScrollTop-t)>10&&this.pageScrollTo(t)}render(){this.viewer.$content.appendChild(this.renderPages()),this.viewer.$content.appendChild(this.renderWhiteboardView()),this.viewer.$content.appendChild(this.renderScrollbar()),this.renderRatioHeight()}renderRatioHeight(){const t=this.box.absoluteHeight,s=t<=C;if(this.viewer.setSmallBox(s),s){const o=26/C,r=26/t,i=26/C,n=0,c=Math.max((o+i-(r+n))/2,0);if(this.box.$titleBar){const a=r+c;this.box.$titleBar.style.height=`${a*100}%`}if(this.box.$footer){const a=n+c;this.box.$footer.style.height=`${a*100}%`}}else{if(this.box.$titleBar){const o=Math.max(26/C,26/t);this.box.$titleBar.style.height=`${o*100}%`}if(this.box.$footer){const o=Math.max(26/C,26/t);this.box.$footer.style.height=`${o*100}%`}}}renderPages(){if(!this.$pages){const t=document.createElement("div");t.className=this.wrapClassName("pages"),this.$pages=t;const s=this.wrapClassName("page");this.pages.forEach((o,r)=>{const i=document.createElement("img");i.className=s+" "+this.wrapClassName(`page-${r}`),i.draggable=!1,i.width=o.width,i.height=o.height,i.dataset.src=o.src,i.dataset.pageIndex=String(r),t.appendChild(i)})}return this.$pages}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",t=>{Pe(t),this.readonly||(this.pageScrollTo(this.pageScrollTop+t.deltaY),this.updateUserScroll())},{passive:!1,capture:!0}),this.sideEffect.addEventListener(this.$whiteboardView,"touchmove",t=>{this.readonly||t.touches.length<=1||this.updateUserScroll()},{passive:!0,capture:!0})),this.$whiteboardView}renderScrollbar(){if(!this.$scrollbar){const t=document.createElement("button");this.$scrollbar=t,t.className=this.wrapClassName("scrollbar"),t.style.minHeight=`${Y}px`;const s=o=>{if(this.readonly||o.button!=null&&o.button!==0)return;Pe(o),this.$scrollbar.classList.toggle(this.wrapClassName("scrollbar-dragging"),!0);const r=this.scrollTopPageToEl(this.pageScrollTop),i=this.whiteboardView.size.width/this.pagesSize.width*this.pagesSize.height,{clientY:n}=Le(o),c=l=>{const{clientY:d}=Le(l),{height:p}=this.whiteboardView.size;this.elScrollTo(r+(d-n)*(i/p))},a=()=>{this.$scrollbar.classList.toggle(this.wrapClassName("scrollbar-dragging"),!1),window.removeEventListener("mousemove",c,!0),window.removeEventListener("touchmove",c,!0),window.removeEventListener("mouseup",a,!0),window.removeEventListener("touchend",a,!0),window.removeEventListener("touchcancel",a,!0)};window.addEventListener("mousemove",c,!0),window.addEventListener("touchmove",c,!0),window.addEventListener("mouseup",a,!0),window.addEventListener("touchend",a,!0),window.addEventListener("touchcancel",a,!0)};this.sideEffect.addEventListener(t,"mousedown",s),this.sideEffect.addEventListener(t,"touchstart",s)}return this.$scrollbar}scrollTopPageToEl(t){return t*(this.whiteboardView.size.width/this.pagesSize.width)}scrollTopElToPage(t){return t/(this.whiteboardView.size.width/this.pagesSize.width)}elScrollTo(t){this.pageScrollTo(this.scrollTopElToPage(t))}pageScrollTo(t){const s=this.scrollTopElToPage(this.whiteboardView.size.height/2);this.whiteboardView.moveCamera({centerY:A(t+s,s,this.pagesSize.height-s),animationMode:"immediately"})}scrollToPage(t){if(!this.readonly&&this.$pages&&!Number.isNaN(t)){t=A(t,0,this.pages.length-1);const s=this.$pages.querySelector("."+this.wrapClassName(`page-${t}`));if(s){const o=s.offsetTop+5;this.elScrollTo(o),this.updateUserScroll()}}}setupScrollTopEvent(){const t=this.debounce(()=>{if(this.pages.length>0&&this.$pages&&this.$pages.getBoundingClientRect().width>0){let o=0;for(let r=0;r<this.pages.length;r+=1)if(o+=this.pages[r].height,this.pageScrollTop<=o){this.viewer.setPageIndex(r);return}this.viewer.setPageIndex(this.pages.length-1)}},{wait:5,maxWait:100},"debounce-updatePageIndex");this.sideEffect.add(()=>{const s=o=>{const{width:r,height:i}=this.whiteboardView.size,{width:n,height:c}=this.pagesSize,a=r/n*c,l=this.scrollTopPageToEl(o.centerY)-i/2,d=this.scrollTopElToPage(l);this.pageScrollTop=d,this.$pages.scrollTo({top:l}),this.setScrollbarHeight(i/a*i),this.$scrollbar.style.transform=`translateY(${l/(a-i)*(i-this.scrollbarHeight)}px)`,t()};return this.whiteboardView.callbacks.on("onCameraUpdated",s),()=>this.whiteboardView.callbacks.off("onCameraUpdated",s)})}setupWhiteboardCamera(){this.sideEffect.add(()=>{const t=({width:s,height:o})=>{if(s>0&&o>0){const r=this.$pages.scrollTop,i=this.pagesSize.width,n=i/s;this.whiteboardView.moveCameraToContain({originX:0,originY:r*n,width:i,height:o*n,animationMode:"immediately"}),this.whiteboardView.setCameraBound({damping:1,maxContentMode:()=>s/i,minContentMode:()=>s/i,centerX:this.pagesSize.width/2,centerY:this.pagesSize.height/2,width:this.pagesSize.width,height:this.pagesSize.height}),this.elScrollTo(r)}};return this.whiteboardView.callbacks.on("onSizeUpdated",t),()=>{this.whiteboardView.callbacks.off("onSizeUpdated",t)}},"whiteboard-size-update")}updateUserScroll(){window.requestAnimationFrame(()=>{this.onUserScroll&&this.onUserScroll(this.pageScrollTop)})}debounce(t,s,o){const r=ts(t,s);return this.sideEffect.add(()=>()=>r.cancel(),o),r}wrapClassName(t){return"netless-app-docs-viewer-static-"+t}setScrollbarHeight(t){t=A(t,Y,this.whiteboardView.size.height),this.scrollbarHeight!==t&&(this.scrollbarHeight=t,this.$scrollbar.style.height=`${t}px`)}}class ls{constructor({displayer:t,whiteboardView:s,getRoom:o,readonly:r,box:i,pages:n,mountWhiteboard:c}){this.sideEffect=new G,this.onPlayPPT=()=>{const a=this.getWhiteboardRoom();a&&a.pptNextStep()},this._scaleDocsToFitImpl=()=>{const a=this.pages[this.getPageIndex()];a&&this.whiteboardView.moveCameraToContain({originX:-a.width/2,originY:-a.height/2,width:a.width,height:a.height,animationMode:"immediately"})},this._scaleDocsToFitDebounced=()=>{this.sideEffect.setTimeout(this._scaleDocsToFitImpl,1e3,"_scaleDocsToFitDebounced")},this.scaleDocsToFit=()=>{this._scaleDocsToFitImpl(),this._scaleDocsToFitDebounced()},this.onNewPageIndex=a=>{this.jumpToPage(a,!0)},this.whiteboardView=s,this.readonly=r,this.box=i,this.pages=n,this.displayer=t,this.getWhiteboardRoom=o,this.mountWhiteboard=c,this.viewer=new Ie({readonly:r,box:i,pages:n,onNewPageIndex:this.onNewPageIndex,onPlay:this.onPlayPPT}),this.render()}mount(){this.viewer.mount();const t=this.getPageIndex();return t!==0&&this.jumpToPage(t),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}setReadonly(t){this.readonly!==t&&(this.readonly=t,this.viewer.setReadonly(t))}destroy(){this.sideEffect.flushAll(),this.unmount(),this.viewer.destroy()}getPageIndex(){return this.displayer.state.sceneState.index}jumpToPage(t,s){if(t=A(t,0,this.pages.length-1),t!==this.getPageIndex()){const o=this.getWhiteboardRoom();o&&(o.setSceneIndex(t),this.scaleDocsToFit())}if(t!==this.viewer.pageIndex&&this.viewer.setPageIndex(t),s){const o=this.getWhiteboardRoom();o&&o.setGlobalState({__pptState:void 0})}}render(){this.viewer.$content.appendChild(this.renderMask()),this.viewer.$content.appendChild(this.renderWhiteboardView()),this.sideEffect.addEventListener(window,"keydown",t=>{var s;if(this.box.focus)switch(t.key){case"ArrowUp":case"ArrowLeft":{this.jumpToPage(this.getPageIndex()-1,!0);break}case"ArrowRight":case"ArrowDown":{(s=this.getWhiteboardRoom())==null||s.pptNextStep();break}}})}renderMask(){if(!this.$mask){const t=document.createElement("div");t.className=this.wrapClassName("mask"),this.$mask=t;const s=document.createElement("button");s.className=this.wrapClassName("back");const o=document.createElement("button");o.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",t=>{var o;const s=this.getWhiteboardRoom();if(s&&s.state.memberState.currentApplianceName==="clicker"){for(let r=t.target;r;r=r.parentElement)if((o=r.classList)==null?void 0:o.contains("ppt-event-source"))return;s.pptNextStep()}}),this.mountWhiteboard(this.$whiteboardView)),this.$whiteboardView}wrapClassName(t){return"netless-app-docs-viewer-dynamic-"+t}}const ds="DocsViewer",hs={kind:ds,setup(e){const t=e.getBox(),s=e.getScenes();if(!s)throw new Error("[Docs Viewer]: scenes not found.");const o=e.getView();if(!o)throw new Error("[Docs Viewer]: no whiteboard view.");const r=s.map(({ppt:i})=>i?{width:i.width,height:i.height,src:i.src,thumbnail:i.previewURL}:null).filter(i=>Boolean(i));if(r.length<=0)throw new Error("[Docs Viewer]: empty scenes.");t.mountStyles(Be),r[0].src.startsWith("ppt")?us(e,o,t,r):ps(e,o,t,r)}};function ps(e,t,s,o){var n;const r={width:o[0].width,height:o.reduce((c,a)=>c+a.height*(o[0].width/a.width),0)},i=new cs({whiteboardView:t,readonly:s.readonly,box:s,pages:o,pagesSize:r,pageScrollTop:(n=e.getAttributes())==null?void 0:n.pageScrollTop,mountWhiteboard:e.mountView.bind(e),onUserScroll:c=>{var a;((a=e.getAttributes())==null?void 0:a.pageScrollTop)!==c&&!s.readonly&&e.updateAttributes(["pageScrollTop"],c)}}).mount();e.emitter.on("attributesUpdate",c=>{c&&c.pageScrollTop!=null&&i.syncPageScrollTop(c.pageScrollTop)}),s.events.on("readonly",c=>{i.setReadonly(c)})}function us(e,t,s,o){t.disableCameraTransform=!0;const r=e.getDisplayer(),i=new ls({displayer:r,whiteboardView:t,getRoom:()=>e.getIsWritable()?e.getDisplayer():void 0,readonly:s.readonly,box:s,pages:o,mountWhiteboard:e.mountView.bind(e)}).mount();e.mountView(i.$whiteboardView),e.isAddApp&&t.callbacks.once("onSizeUpdated",({width:n,height:c})=>{if(o.length>0&&s.state!=="maximized"){const{width:a,height:l}=o[0],p=l/a*n-c;p!==0&&e.getIsWritable()&&e.emitter.emit("setBoxSize",{width:s.width,height:s.height+p/s.containerRect.height})}}),e.emitter.on("sceneStateChange",n=>{i.jumpToPage(n.index)}),s.events.on("readonly",n=>{i.setReadonly(n)})}exports.default=hs;
//# sourceMappingURL=main.cjs.js.map
var as=Object.defineProperty,ns=Object.defineProperties;var cs=Object.getOwnPropertyDescriptors;var Le=Object.getOwnPropertySymbols;var ls=Object.prototype.hasOwnProperty,ds=Object.prototype.propertyIsEnumerable;var Pe=(h,p,d)=>p in h?as(h,p,{enumerable:!0,configurable:!0,writable:!0,value:d}):h[p]=d,Ae=(h,p)=>{for(var d in p||(p={}))ls.call(p,d)&&Pe(h,d,p[d]);if(Le)for(var d of Le(p))ds.call(p,d)&&Pe(h,d,p[d]);return h},Ve=(h,p)=>ns(h,cs(p));var NetlessAppDocsViewer=function(h){"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:1.5em;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-pages{overflow:hidden;position:relative;height:100%;user-select:none}.netless-app-docs-viewer-static-pages:hover .netless-app-docs-viewer-static-scrollbar{opacity:1}.netless-app-docs-viewer-static-page{display:block;width:100%;height:auto;user-select:none}.netless-app-docs-viewer-static-wb-view{position:absolute;top:0;left:0;width:100%;height:100%;z-index:100;overflow:hidden}.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,.1);opacity:0;transition:background .4s,opacity .4s,transform .2s;will-change:transform,height;user-select:none}.netless-app-docs-viewer-static-scrollbar.netless-app-docs-viewer-static-scrollbar-dragging{background:rgba(68,78,96,.2);opacity:1;transition:background .4s,opacity .4s}.netless-app-docs-viewer-static-scrollbar:hover,.netless-app-docs-viewer-static-scrollbar:focus{background:rgba(68,78,96,.2)}.netless-app-docs-viewer-static-scrollbar:active{background:rgba(68,78,96,.2)}.netless-app-docs-viewer-content:hover .netless-app-docs-viewer-static-scrollbar{opacity:1}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-static-scrollbar{display:none}.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 d=typeof window!="undefined",J=d&&!("onscroll"in window)||typeof navigator!="undefined"&&/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),K=d&&"IntersectionObserver"in window,Z=d&&"classList"in document.createElement("p"),Q=d&&window.devicePixelRatio>1,ze={elements_selector:".lazy",container:J||d?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},ee=e=>Object.assign({},ze,e),te=function(e,t){let s;const o="LazyLoad::Initialized",r=new e(t);try{s=new CustomEvent(o,{detail:{instance:r}})}catch{s=document.createEvent("CustomEvent"),s.initCustomEvent(o,!1,!1,{instance:r})}window.dispatchEvent(s)},Oe=(e,t)=>{if(!!t)if(!t.length)te(e,t);else for(let s=0,o;o=t[s];s+=1)te(e,o)},b="src",O="srcset",M="sizes",se="poster",N="llOriginalAttrs",D="loading",oe="loaded",re="applied",Me="entered",H="error",ie="native",ae="data-",ne="ll-status",g=(e,t)=>e.getAttribute(ae+t),De=(e,t,s)=>{var o=ae+t;if(s===null){e.removeAttribute(o);return}e.setAttribute(o,s)},$=e=>g(e,ne),v=(e,t)=>De(e,ne,t),k=e=>v(e,null),R=e=>$(e)===null,He=e=>$(e)===D,Re=e=>$(e)===H,B=e=>$(e)===ie,Be=[D,oe,re,H],We=e=>Be.indexOf($(e))>=0,m=(e,t,s,o)=>{if(!!e){if(o!==void 0){e(t,s,o);return}if(s!==void 0){e(t,s);return}e(t)}},E=(e,t)=>{if(Z){e.classList.add(t);return}e.className+=(e.className?" ":"")+t},f=(e,t)=>{if(Z){e.classList.remove(t);return}e.className=e.className.replace(new RegExp("(^|\\s+)"+t+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},Fe=e=>{e.llTempImage=document.createElement("IMG")},Ue=e=>{delete e.llTempImage},ce=e=>e.llTempImage,I=(e,t)=>{if(!t)return;const s=t._observer;!s||s.unobserve(e)},je=e=>{e.disconnect()},Ge=(e,t,s)=>{t.unobserve_entered&&I(e,s)},W=(e,t)=>{!e||(e.loadingCount+=t)},Ye=e=>{!e||(e.toLoadCount-=1)},le=(e,t)=>{!e||(e.toLoadCount=t)},qe=e=>e.loadingCount>0,Xe=e=>e.toLoadCount>0,de=e=>{let t=[];for(let s=0,o;o=e.children[s];s+=1)o.tagName==="SOURCE"&&t.push(o);return t},F=(e,t)=>{const s=e.parentNode;if(!s||s.tagName!=="PICTURE")return;de(s).forEach(t)},he=(e,t)=>{de(e).forEach(t)},L=[b],pe=[b,se],P=[b,O,M],A=e=>!!e[N],ue=e=>e[N],ge=e=>delete e[N],x=(e,t)=>{if(A(e))return;const s={};t.forEach(o=>{s[o]=e.getAttribute(o)}),e[N]=s},Je=e=>{A(e)||(e[N]={backgroundImage:e.style.backgroundImage})},Ke=(e,t,s)=>{if(!s){e.removeAttribute(t);return}e.setAttribute(t,s)},C=(e,t)=>{if(!A(e))return;const s=ue(e);t.forEach(o=>{Ke(e,o,s[o])})},Ze=e=>{if(!A(e))return;const t=ue(e);e.style.backgroundImage=t.backgroundImage},Qe=(e,t,s)=>{E(e,t.class_applied),v(e,re),!!s&&(t.unobserve_completed&&I(e,t),m(t.callback_applied,e,s))},we=(e,t,s)=>{E(e,t.class_loading),v(e,D),!!s&&(W(s,1),m(t.callback_loading,e,s))},y=(e,t,s)=>{!s||e.setAttribute(t,s)},fe=(e,t)=>{y(e,M,g(e,t.data_sizes)),y(e,O,g(e,t.data_srcset)),y(e,b,g(e,t.data_src))},et=(e,t)=>{F(e,s=>{x(s,P),fe(s,t)}),x(e,P),fe(e,t)},tt=(e,t)=>{x(e,L),y(e,b,g(e,t.data_src))},st=(e,t)=>{he(e,s=>{x(s,L),y(s,b,g(s,t.data_src))}),x(e,pe),y(e,se,g(e,t.data_poster)),y(e,b,g(e,t.data_src)),e.load()},ot=(e,t,s)=>{const o=g(e,t.data_bg),r=g(e,t.data_bg_hidpi),i=Q&&r?r:o;!i||(e.style.backgroundImage=`url("${i}")`,ce(e).setAttribute(b,i),we(e,t,s))},rt=(e,t,s)=>{const o=g(e,t.data_bg_multi),r=g(e,t.data_bg_multi_hidpi),i=Q&&r?r:o;!i||(e.style.backgroundImage=i,Qe(e,t,s))},be={IMG:et,IFRAME:tt,VIDEO:st},it=(e,t)=>{const s=be[e.tagName];!s||s(e,t)},at=(e,t,s)=>{const o=be[e.tagName];!o||(o(e,t),we(e,t,s))},nt=["IMG","IFRAME","VIDEO"],ct=e=>nt.indexOf(e.tagName)>-1,me=(e,t)=>{t&&!qe(t)&&!Xe(t)&&m(e.callback_finish,t)},ve=(e,t,s)=>{e.addEventListener(t,s),e.llEvLisnrs[t]=s},lt=(e,t,s)=>{e.removeEventListener(t,s)},U=e=>!!e.llEvLisnrs,dt=(e,t,s)=>{U(e)||(e.llEvLisnrs={});const o=e.tagName==="VIDEO"?"loadeddata":"load";ve(e,o,t),ve(e,"error",s)},j=e=>{if(!U(e))return;const t=e.llEvLisnrs;for(let s in t){const o=t[s];lt(e,s,o)}delete e.llEvLisnrs},ye=(e,t,s)=>{Ue(e),W(s,-1),Ye(s),f(e,t.class_loading),t.unobserve_completed&&I(e,s)},ht=(e,t,s,o)=>{const r=B(t);ye(t,s,o),E(t,s.class_loaded),v(t,oe),m(s.callback_loaded,t,o),r||me(s,o)},pt=(e,t,s,o)=>{const r=B(t);ye(t,s,o),E(t,s.class_error),v(t,H),m(s.callback_error,t,o),r||me(s,o)},G=(e,t,s)=>{const o=ce(e)||e;if(U(o))return;dt(o,n=>{ht(n,e,t,s),j(o)},n=>{pt(n,e,t,s),j(o)})},ut=(e,t,s)=>{Fe(e),G(e,t,s),Je(e),ot(e,t,s),rt(e,t,s)},gt=(e,t,s)=>{G(e,t,s),at(e,t,s)},Y=(e,t,s)=>{ct(e)?gt(e,t,s):ut(e,t,s)},wt=(e,t,s)=>{e.setAttribute("loading","lazy"),G(e,t,s),it(e,t),v(e,ie)},Ee=e=>{e.removeAttribute(b),e.removeAttribute(O),e.removeAttribute(M)},ft=e=>{F(e,t=>{Ee(t)}),Ee(e)},Se=e=>{F(e,t=>{C(t,P)}),C(e,P)},bt={IMG:Se,IFRAME:e=>{C(e,L)},VIDEO:e=>{he(e,t=>{C(t,L)}),C(e,pe),e.load()}},mt=e=>{const t=bt[e.tagName];if(!t){Ze(e);return}t(e)},vt=(e,t)=>{R(e)||B(e)||(f(e,t.class_entered),f(e,t.class_exited),f(e,t.class_applied),f(e,t.class_loading),f(e,t.class_loaded),f(e,t.class_error))},yt=(e,t)=>{mt(e),vt(e,t),k(e),ge(e)},Et=(e,t,s,o)=>{!s.cancel_on_exit||!He(e)||e.tagName==="IMG"&&(j(e),ft(e),Se(e),f(e,s.class_loading),W(o,-1),k(e),m(s.callback_cancel,e,t,o))},St=(e,t,s,o)=>{const r=We(e);v(e,Me),E(e,s.class_entered),f(e,s.class_exited),Ge(e,s,o),m(s.callback_enter,e,t,o),!r&&Y(e,s,o)},Nt=(e,t,s,o)=>{R(e)||(E(e,s.class_exited),Et(e,t,s,o),m(s.callback_exit,e,t,o))},$t=["IMG","IFRAME","VIDEO"],Ne=e=>e.use_native&&"loading"in HTMLImageElement.prototype,xt=(e,t,s)=>{e.forEach(o=>{$t.indexOf(o.tagName)!==-1&&wt(o,t,s)}),le(s,0)},Ct=e=>e.isIntersecting||e.intersectionRatio>0,Tt=e=>({root:e.container===document?null:e.container,rootMargin:e.thresholds||e.threshold+"px"}),_t=(e,t,s)=>{e.forEach(o=>Ct(o)?St(o.target,o,t,s):Nt(o.target,o,t,s))},kt=(e,t)=>{t.forEach(s=>{e.observe(s)})},It=(e,t)=>{je(e),kt(e,t)},Lt=(e,t)=>{!K||Ne(e)||(t._observer=new IntersectionObserver(s=>{_t(s,e,t)},Tt(e)))},$e=e=>Array.prototype.slice.call(e),V=e=>e.container.querySelectorAll(e.elements_selector),Pt=e=>$e(e).filter(R),At=e=>Re(e),Vt=e=>$e(e).filter(At),xe=(e,t)=>Pt(e||V(t)),zt=(e,t)=>{Vt(V(e)).forEach(o=>{f(o,e.class_error),k(o)}),t.update()},Ot=(e,t)=>{!d||window.addEventListener("online",()=>{zt(e,t)})},S=function(e,t){const s=ee(e);this._settings=s,this.loadingCount=0,Lt(s,this),Ot(s,this),this.update(t)};S.prototype={update:function(e){const t=this._settings,s=xe(e,t);if(le(this,s.length),J||!K){this.loadAll(s);return}if(Ne(t)){xt(s,t,this);return}It(this._observer,s)},destroy:function(){this._observer&&this._observer.disconnect(),V(this._settings).forEach(e=>{ge(e)}),delete this._observer,delete this._settings,delete this.loadingCount,delete this.toLoadCount},loadAll:function(e){const t=this._settings;xe(e,t).forEach(o=>{I(o,this),Y(o,t,this)})},restoreAll:function(){const e=this._settings;V(e).forEach(t=>{yt(t,e)})}},S.load=(e,t)=>{const s=ee(t);Y(e,s)},S.resetStatus=e=>{k(e)},d&&Oe(S,window.lazyLoadOptions);const Mt=(e,t,s,o)=>{if(s==="length"||s==="prototype"||s==="arguments"||s==="caller")return;const r=Object.getOwnPropertyDescriptor(e,s),i=Object.getOwnPropertyDescriptor(t,s);!Dt(r,i)&&o||Object.defineProperty(e,s,i)},Dt=function(e,t){return e===void 0||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},Ht=(e,t)=>{const s=Object.getPrototypeOf(t);s!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,s)},Rt=(e,t)=>`/* Wrapped ${e}*/
${t}`,Bt=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Wt=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Ft=(e,t,s)=>{const o=s===""?"":`with ${s.trim()}() `,r=Rt.bind(null,o,t.toString());Object.defineProperty(r,"name",Wt),Object.defineProperty(e,"toString",Ve(Ae({},Bt),{value:r}))};var Ut=(e,t,{ignoreNonConfigurable:s=!1}={})=>{const{name:o}=e;for(const r of Reflect.ownKeys(t))Mt(e,t,r,s);return Ht(e,t),Ft(e,t,o),e};const jt=(e,t={})=>{if(typeof e!="function")throw new TypeError(`Expected the first argument to be a function, got \`${typeof e}\``);const{wait:s=0,maxWait:o=Number.Infinity,before:r=!1,after:i=!0}=t;if(!r&&!i)throw new Error("Both `before` and `after` are false, function wouldn't be called.");let n,c,a;const l=function(...u){const w=this,os=()=>{n=void 0,c&&(clearTimeout(c),c=void 0),i&&(a=e.apply(w,u))},rs=()=>{c=void 0,n&&(clearTimeout(n),n=void 0),i&&(a=e.apply(w,u))},is=r&&!n;return clearTimeout(n),n=setTimeout(os,s),o>0&&o!==Number.Infinity&&!c&&(c=setTimeout(rs,o)),is&&(a=e.apply(w,u)),a};return Ut(l,e),l.cancel=()=>{n&&(clearTimeout(n),n=void 0),c&&(clearTimeout(c),c=void 0)},l},Ce="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",Gt=Ce.length,Te=Array(20),T=()=>{for(let e=0;e<20;e++)Te[e]=Ce.charAt(Math.random()*Gt);return Te.join("")};class q{constructor(){this.disposers=new Map}add(t,s=T()){return this.flush(s),this.disposers.set(s,t()),s}addDisposer(t,s=T()){return this.flush(s),this.disposers.set(s,t),s}addEventListener(t,s,o,r,i=T()){return this.add(()=>(t.addEventListener(s,o,r),()=>t.removeEventListener(s,o,r)),i),i}setTimeout(t,s,o=T()){return this.add(()=>{const r=window.setTimeout(()=>{this.remove(o),t()},s);return()=>window.clearTimeout(r)},o)}setInterval(t,s,o=T()){return this.add(()=>{const r=window.setInterval(t,s);return()=>window.clearInterval(r)},o)}remove(t){const s=this.disposers.get(t);return this.disposers.delete(t),s}flush(t){const s=this.remove(t);if(s)try{s()}catch(o){console.error(o)}}flushAll(){this.disposers.forEach(t=>{try{t()}catch(s){console.error(s)}}),this.disposers.clear()}}function Yt(e){const t="http://www.w3.org/2000/svg",s=document.createElementNS(t,"svg");s.setAttribute("class",`${e}-footer-icon-sidebar`),s.setAttribute("viewBox","0 0 64 64");const o=document.createElementNS(t,"path");return o.setAttribute("fill","currentColor"),o.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(o),s}function qt(e){const t="http://www.w3.org/2000/svg",s=document.createElementNS(t,"svg");s.setAttribute("class",`${e}-footer-icon-arrow-left`),s.setAttribute("viewBox","0 0 500 500");const o=document.createElementNS(t,"path");return o.setAttribute("fill","currentColor"),o.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(o),s}function Xt(e){const t="http://www.w3.org/2000/svg",s=document.createElementNS(t,"svg");s.setAttribute("class",`${e}-footer-icon-arrow-right`),s.setAttribute("viewBox","0 0 500 500");const o=document.createElementNS(t,"path");return o.setAttribute("fill","currentColor"),o.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(o),s}function Jt(e){const t="http://www.w3.org/2000/svg",s=document.createElementNS(t,"svg");s.setAttribute("class",`${e}-footer-icon-play`),s.setAttribute("viewBox","0 0 500 500");const o=document.createElementNS(t,"path");return o.setAttribute("fill","currentColor"),o.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(o),s}function Kt(e){const t="http://www.w3.org/2000/svg",s=document.createElementNS(t,"svg");s.setAttribute("class",`${e}-footer-icon-pause`),s.setAttribute("viewBox","0 0 500 500");const o=document.createElementNS(t,"path");return o.setAttribute("fill","currentColor"),o.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(o),s}class _e{constructor({readonly:t,box:s,pages:o,onNewPageIndex:r,onPlay:i}){if(this.pageIndex=0,this.namespace="netless-app-docs-viewer",this.isShowPreview=!1,this.isSmallBox=!1,this.sideEffect=new q,o.length<=0)throw new Error("[DocsViewer] Empty pages.");this.readonly=t,this.box=s,this.pages=o,this.onNewPageIndex=r,this.onPlay=i,this.render()}mount(){this.box.mountContent(this.$content),this.box.mountFooter(this.$footer),this.sideEffect.add(()=>{const t=new S({container:this.$preview,elements_selector:`.${this.wrapClassName("preview-page>img")}`});return()=>t.destroy()},"preview-lazyload")}unmount(){this.$content.remove(),this.$footer.remove()}setReadonly(t){this.readonly!==t&&(this.readonly=t,this.$content.classList.toggle(this.wrapClassName("readonly"),t),this.$footer.classList.toggle(this.wrapClassName("readonly"),t),this.$pageNumberInput.disabled=t)}destroy(){this.sideEffect.flushAll(),this.unmount()}setPageIndex(t){Number.isNaN(t)||(this.pageIndex=t,this.$pageNumberInput.value=String(t+1))}setSmallBox(t){this.isSmallBox!==t&&(this.isSmallBox=t,this.$footer.classList.toggle(this.wrapClassName("float-footer"),t))}render(){return this.renderContent(),this.renderFooter(),this.$content}renderContent(){if(!this.$content){const t=document.createElement("div");t.className=this.wrapClassName("content"),this.$content=t,this.readonly&&t.classList.add(this.wrapClassName("readonly")),t.appendChild(this.renderPreviewMask()),t.appendChild(this.renderPreview())}return this.$content}renderPreview(){if(!this.$preview){const t=document.createElement("div");t.className=this.wrapClassName("preview")+" tele-fancy-scrollbar",this.$preview=t;const s=this.wrapClassName("preview-page"),o=this.wrapClassName("preview-page-name");this.pages.forEach((r,i)=>{var w;const n=(w=r.thumbnail)!=null?w:r.src.startsWith("ppt")?void 0:r.src;if(!n)return;const c=String(i),a=document.createElement("a");a.className=s+" "+this.wrapClassName(`preview-page-${i}`),a.setAttribute("href","#"),a.dataset.pageIndex=c;const l=document.createElement("span");l.className=o,l.textContent=String(i+1),l.dataset.pageIndex=c;const u=document.createElement("img");u.width=r.width,u.height=r.height,u.dataset.src=n,u.dataset.pageIndex=c,a.appendChild(u),a.appendChild(l),t.appendChild(a)}),this.sideEffect.addEventListener(t,"click",r=>{var n;if(this.readonly)return;const i=(n=r.target.dataset)==null?void 0:n.pageIndex;i&&(r.preventDefault(),r.stopPropagation(),r.stopImmediatePropagation(),this.onNewPageIndex(Number(i)),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",t=>{this.readonly||t.target===this.$previewMask&&this.togglePreview(!1)})),this.$previewMask}renderFooter(){if(!this.$footer){const t=document.createElement("div");if(t.className=this.wrapClassName("footer"),this.$footer=t,this.readonly&&t.classList.add(this.wrapClassName("readonly")),this.isSmallBox&&t.classList.add(this.wrapClassName("float-footer")),this.pages.some(a=>a.thumbnail||!a.src.startsWith("ppt"))){const a=this.renderFooterBtn("btn-sidebar",Yt(this.namespace));this.sideEffect.addEventListener(a,"click",()=>{this.readonly||this.togglePreview()}),this.$footer.appendChild(a)}const s=document.createElement("div");s.className=this.wrapClassName("page-jumps");const o=this.renderFooterBtn("btn-page-back",qt(this.namespace));if(this.sideEffect.addEventListener(o,"click",()=>{this.readonly||this.onNewPageIndex(this.pageIndex-1)}),s.appendChild(o),this.onPlay){const a=this.renderFooterBtn("btn-page-play",Jt(this.namespace),Kt(this.namespace)),l=()=>{this.sideEffect.setTimeout(()=>{a.classList.toggle(this.wrapClassName("footer-btn-playing"),!1)},500,"returnPlay")};this.sideEffect.addEventListener(a,"click",()=>{this.readonly||(a.classList.toggle(this.wrapClassName("footer-btn-playing"),!0),this.onPlay&&this.onPlay(),l())}),s.appendChild(a)}const r=this.renderFooterBtn("btn-page-next",Xt(this.namespace));this.sideEffect.addEventListener(r,"click",()=>{this.readonly||this.onNewPageIndex(this.pageIndex+1)}),s.appendChild(r);const i=document.createElement("div");i.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,"change",()=>{this.readonly||n.value&&this.onNewPageIndex(Number(n.value)-1)});const c=document.createElement("span");c.textContent=" / "+this.pages.length,i.appendChild(n),i.appendChild(c),this.$footer.appendChild(s),this.$footer.appendChild(i)}return this.$footer}renderFooterBtn(t,s,o){const r=document.createElement("button");return r.className=this.wrapClassName("footer-btn")+" "+this.wrapClassName(t),r.appendChild(s),o&&r.appendChild(o),r}togglePreview(t){if(this.isShowPreview=t!=null?t:!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(t){return`${this.namespace}-${t}`}}function z(e,t,s){return Math.min(Math.max(e,t),s)}function ke(e){return e.touches?e.touches[0]:e}function Ie(e){e.stopPropagation(),e.cancelable&&e.preventDefault()}const X=30,_=640;class Zt{constructor({whiteboardView:t,readonly:s,box:o,pages:r,pagesSize:i,pageScrollTop:n=0,mountWhiteboard:c,onUserScroll:a}){this.onNewPageIndex=l=>{this.scrollToPage(l)},this.sideEffect=new q,this.scrollbarHeight=X,this.whiteboardView=t,this.readonly=s,this.box=o,this.pages=r,this.pageScrollTop=n,this.pagesSize=i,this.mountWhiteboard=c,this.onUserScroll=a,this.viewer=new _e({readonly:s,box:o,pages:r,onNewPageIndex:this.onNewPageIndex}),this.render()}mount(){return this.viewer.mount(),this.sideEffect.add(()=>{const t=new S({container:this.$pages,elements_selector:`.${this.wrapClassName("page")}`});return()=>t.destroy()},"page-lazyload"),this.setupWhiteboardCamera(),this.sideEffect.setTimeout(()=>{this.pageScrollTop!==0&&this.pageScrollTo(this.pageScrollTop)},1e3),this.setupScrollTopEvent(),this.whiteboardView.callbacks.on("onSizeUpdated",()=>{this.renderRatioHeight()}),this}unmount(){return this.viewer.unmount(),this}setReadonly(t){this.readonly!==t&&(this.readonly=t,this.viewer.setReadonly(t))}destroy(){this.sideEffect.flushAll(),this.onUserScroll=void 0,this.unmount(),this.viewer.destroy()}syncPageScrollTop(t){t>=0&&Math.abs(this.pageScrollTop-t)>10&&this.pageScrollTo(t)}render(){this.viewer.$content.appendChild(this.renderPages()),this.viewer.$content.appendChild(this.renderWhiteboardView()),this.viewer.$content.appendChild(this.renderScrollbar()),this.renderRatioHeight()}renderRatioHeight(){const t=this.box.absoluteHeight,s=t<=_;if(this.viewer.setSmallBox(s),s){const o=26/_,r=26/t,i=26/_,n=0,c=Math.max((o+i-(r+n))/2,0);if(this.box.$titleBar){const a=r+c;this.box.$titleBar.style.height=`${a*100}%`}if(this.box.$footer){const a=n+c;this.box.$footer.style.height=`${a*100}%`}}else{if(this.box.$titleBar){const o=Math.max(26/_,26/t);this.box.$titleBar.style.height=`${o*100}%`}if(this.box.$footer){const o=Math.max(26/_,26/t);this.box.$footer.style.height=`${o*100}%`}}}renderPages(){if(!this.$pages){const t=document.createElement("div");t.className=this.wrapClassName("pages"),this.$pages=t;const s=this.wrapClassName("page");this.pages.forEach((o,r)=>{const i=document.createElement("img");i.className=s+" "+this.wrapClassName(`page-${r}`),i.draggable=!1,i.width=o.width,i.height=o.height,i.dataset.src=o.src,i.dataset.pageIndex=String(r),t.appendChild(i)})}return this.$pages}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",t=>{Ie(t),this.readonly||(this.pageScrollTo(this.pageScrollTop+t.deltaY),this.updateUserScroll())},{passive:!1,capture:!0}),this.sideEffect.addEventListener(this.$whiteboardView,"touchmove",t=>{this.readonly||t.touches.length<=1||this.updateUserScroll()},{passive:!0,capture:!0})),this.$whiteboardView}renderScrollbar(){if(!this.$scrollbar){const t=document.createElement("button");this.$scrollbar=t,t.className=this.wrapClassName("scrollbar"),t.style.minHeight=`${X}px`;const s=o=>{if(this.readonly||o.button!=null&&o.button!==0)return;Ie(o),this.$scrollbar.classList.toggle(this.wrapClassName("scrollbar-dragging"),!0);const r=this.scrollTopPageToEl(this.pageScrollTop),i=this.whiteboardView.size.width/this.pagesSize.width*this.pagesSize.height,{clientY:n}=ke(o),c=l=>{const{clientY:u}=ke(l),{height:w}=this.whiteboardView.size;this.elScrollTo(r+(u-n)*(i/w))},a=()=>{this.$scrollbar.classList.toggle(this.wrapClassName("scrollbar-dragging"),!1),window.removeEventListener("mousemove",c,!0),window.removeEventListener("touchmove",c,!0),window.removeEventListener("mouseup",a,!0),window.removeEventListener("touchend",a,!0),window.removeEventListener("touchcancel",a,!0)};window.addEventListener("mousemove",c,!0),window.addEventListener("touchmove",c,!0),window.addEventListener("mouseup",a,!0),window.addEventListener("touchend",a,!0),window.addEventListener("touchcancel",a,!0)};this.sideEffect.addEventListener(t,"mousedown",s),this.sideEffect.addEventListener(t,"touchstart",s)}return this.$scrollbar}scrollTopPageToEl(t){return t*(this.whiteboardView.size.width/this.pagesSize.width)}scrollTopElToPage(t){return t/(this.whiteboardView.size.width/this.pagesSize.width)}elScrollTo(t){this.pageScrollTo(this.scrollTopElToPage(t))}pageScrollTo(t){const s=this.scrollTopElToPage(this.whiteboardView.size.height/2);this.whiteboardView.moveCamera({centerY:z(t+s,s,this.pagesSize.height-s),animationMode:"immediately"})}scrollToPage(t){if(!this.readonly&&this.$pages&&!Number.isNaN(t)){t=z(t,0,this.pages.length-1);const s=this.$pages.querySelector("."+this.wrapClassName(`page-${t}`));if(s){const o=s.offsetTop+5;this.elScrollTo(o),this.updateUserScroll()}}}setupScrollTopEvent(){const t=this.debounce(()=>{if(this.pages.length>0&&this.$pages&&this.$pages.getBoundingClientRect().width>0){let o=0;for(let r=0;r<this.pages.length;r+=1)if(o+=this.pages[r].height,this.pageScrollTop<=o){this.viewer.setPageIndex(r);return}this.viewer.setPageIndex(this.pages.length-1)}},{wait:5,maxWait:100},"debounce-updatePageIndex");this.sideEffect.add(()=>{const s=o=>{const{width:r,height:i}=this.whiteboardView.size,{width:n,height:c}=this.pagesSize,a=r/n*c,l=this.scrollTopPageToEl(o.centerY)-i/2,u=this.scrollTopElToPage(l);this.pageScrollTop=u,this.$pages.scrollTo({top:l}),this.setScrollbarHeight(i/a*i),this.$scrollbar.style.transform=`translateY(${l/(a-i)*(i-this.scrollbarHeight)}px)`,t()};return this.whiteboardView.callbacks.on("onCameraUpdated",s),()=>this.whiteboardView.callbacks.off("onCameraUpdated",s)})}setupWhiteboardCamera(){this.sideEffect.add(()=>{const t=({width:s,height:o})=>{if(s>0&&o>0){const r=this.$pages.scrollTop,i=this.pagesSize.width,n=i/s;this.whiteboardView.moveCameraToContain({originX:0,originY:r*n,width:i,height:o*n,animationMode:"immediately"}),this.whiteboardView.setCameraBound({damping:1,maxContentMode:()=>s/i,minContentMode:()=>s/i,centerX:this.pagesSize.width/2,centerY:this.pagesSize.height/2,width:this.pagesSize.width,height:this.pagesSize.height}),this.elScrollTo(r)}};return this.whiteboardView.callbacks.on("onSizeUpdated",t),()=>{this.whiteboardView.callbacks.off("onSizeUpdated",t)}},"whiteboard-size-update")}updateUserScroll(){window.requestAnimationFrame(()=>{this.onUserScroll&&this.onUserScroll(this.pageScrollTop)})}debounce(t,s,o){const r=jt(t,s);return this.sideEffect.add(()=>()=>r.cancel(),o),r}wrapClassName(t){return"netless-app-docs-viewer-static-"+t}setScrollbarHeight(t){t=z(t,X,this.whiteboardView.size.height),this.scrollbarHeight!==t&&(this.scrollbarHeight=t,this.$scrollbar.style.height=`${t}px`)}}class Qt{constructor({displayer:t,whiteboardView:s,getRoom:o,readonly:r,box:i,pages:n,mountWhiteboard:c}){this.sideEffect=new q,this.onPlayPPT=()=>{const a=this.getWhiteboardRoom();a&&a.pptNextStep()},this._scaleDocsToFitImpl=()=>{const a=this.pages[this.getPageIndex()];a&&this.whiteboardView.moveCameraToContain({originX:-a.width/2,originY:-a.height/2,width:a.width,height:a.height,animationMode:"immediately"})},this._scaleDocsToFitDebounced=()=>{this.sideEffect.setTimeout(this._scaleDocsToFitImpl,1e3,"_scaleDocsToFitDebounced")},this.scaleDocsToFit=()=>{this._scaleDocsToFitImpl(),this._scaleDocsToFitDebounced()},this.onNewPageIndex=a=>{this.jumpToPage(a,!0)},this.whiteboardView=s,this.readonly=r,this.box=i,this.pages=n,this.displayer=t,this.getWhiteboardRoom=o,this.mountWhiteboard=c,this.viewer=new _e({readonly:r,box:i,pages:n,onNewPageIndex:this.onNewPageIndex,onPlay:this.onPlayPPT}),this.render()}mount(){this.viewer.mount();const t=this.getPageIndex();return t!==0&&this.jumpToPage(t),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}setReadonly(t){this.readonly!==t&&(this.readonly=t,this.viewer.setReadonly(t))}destroy(){this.sideEffect.flushAll(),this.unmount(),this.viewer.destroy()}getPageIndex(){return this.displayer.state.sceneState.index}jumpToPage(t,s){if(t=z(t,0,this.pages.length-1),t!==this.getPageIndex()){const o=this.getWhiteboardRoom();o&&(o.setSceneIndex(t),this.scaleDocsToFit())}if(t!==this.viewer.pageIndex&&this.viewer.setPageIndex(t),s){const o=this.getWhiteboardRoom();o&&o.setGlobalState({__pptState:void 0})}}render(){this.viewer.$content.appendChild(this.renderMask()),this.viewer.$content.appendChild(this.renderWhiteboardView()),this.sideEffect.addEventListener(window,"keydown",t=>{var s;if(this.box.focus)switch(t.key){case"ArrowUp":case"ArrowLeft":{this.jumpToPage(this.getPageIndex()-1,!0);break}case"ArrowRight":case"ArrowDown":{(s=this.getWhiteboardRoom())==null||s.pptNextStep();break}}})}renderMask(){if(!this.$mask){const t=document.createElement("div");t.className=this.wrapClassName("mask"),this.$mask=t;const s=document.createElement("button");s.className=this.wrapClassName("back");const o=document.createElement("button");o.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",t=>{var o;const s=this.getWhiteboardRoom();if(s&&s.state.memberState.currentApplianceName==="clicker"){for(let r=t.target;r;r=r.parentElement)if((o=r.classList)==null?void 0:o.contains("ppt-event-source"))return;s.pptNextStep()}}),this.mountWhiteboard(this.$whiteboardView)),this.$whiteboardView}wrapClassName(t){return"netless-app-docs-viewer-dynamic-"+t}}const es={kind:"DocsViewer",setup(e){const t=e.getBox(),s=e.getScenes();if(!s)throw new Error("[Docs Viewer]: scenes not found.");const o=e.getView();if(!o)throw new Error("[Docs Viewer]: no whiteboard view.");const r=s.map(({ppt:i})=>i?{width:i.width,height:i.height,src:i.src,thumbnail:i.previewURL}:null).filter(i=>Boolean(i));if(r.length<=0)throw new Error("[Docs Viewer]: empty scenes.");t.mountStyles(p),r[0].src.startsWith("ppt")?ss(e,o,t,r):ts(e,o,t,r)}};function ts(e,t,s,o){var n;const r={width:o[0].width,height:o.reduce((c,a)=>c+a.height*(o[0].width/a.width),0)},i=new Zt({whiteboardView:t,readonly:s.readonly,box:s,pages:o,pagesSize:r,pageScrollTop:(n=e.getAttributes())==null?void 0:n.pageScrollTop,mountWhiteboard:e.mountView.bind(e),onUserScroll:c=>{var a;((a=e.getAttributes())==null?void 0:a.pageScrollTop)!==c&&!s.readonly&&e.updateAttributes(["pageScrollTop"],c)}}).mount();e.emitter.on("attributesUpdate",c=>{c&&c.pageScrollTop!=null&&i.syncPageScrollTop(c.pageScrollTop)}),s.events.on("readonly",c=>{i.setReadonly(c)})}function ss(e,t,s,o){t.disableCameraTransform=!0;const r=e.getDisplayer(),i=new Qt({displayer:r,whiteboardView:t,getRoom:()=>e.getIsWritable()?e.getDisplayer():void 0,readonly:s.readonly,box:s,pages:o,mountWhiteboard:e.mountView.bind(e)}).mount();e.mountView(i.$whiteboardView),e.isAddApp&&t.callbacks.once("onSizeUpdated",({width:n,height:c})=>{if(o.length>0&&s.state!=="maximized"){const{width:a,height:l}=o[0],w=l/a*n-c;w!==0&&e.getIsWritable()&&e.emitter.emit("setBoxSize",{width:s.width,height:s.height+w/s.containerRect.height})}}),e.emitter.on("sceneStateChange",n=>{i.jumpToPage(n.index)}),s.events.on("readonly",n=>{i.setReadonly(n)})}return h.default=es,Object.defineProperty(h,"__esModule",{value:!0}),h[Symbol.toStringTag]="Module",h}({});
${t}`,Bt=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Wt=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Ft=(e,t,s)=>{const o=s===""?"":`with ${s.trim()}() `,r=Rt.bind(null,o,t.toString());Object.defineProperty(r,"name",Wt),Object.defineProperty(e,"toString",Ve(Ae({},Bt),{value:r}))};var Ut=(e,t,{ignoreNonConfigurable:s=!1}={})=>{const{name:o}=e;for(const r of Reflect.ownKeys(t))Mt(e,t,r,s);return Ht(e,t),Ft(e,t,o),e};const jt=(e,t={})=>{if(typeof e!="function")throw new TypeError(`Expected the first argument to be a function, got \`${typeof e}\``);const{wait:s=0,maxWait:o=Number.Infinity,before:r=!1,after:i=!0}=t;if(!r&&!i)throw new Error("Both `before` and `after` are false, function wouldn't be called.");let n,c,a;const l=function(...u){const w=this,os=()=>{n=void 0,c&&(clearTimeout(c),c=void 0),i&&(a=e.apply(w,u))},rs=()=>{c=void 0,n&&(clearTimeout(n),n=void 0),i&&(a=e.apply(w,u))},is=r&&!n;return clearTimeout(n),n=setTimeout(os,s),o>0&&o!==Number.Infinity&&!c&&(c=setTimeout(rs,o)),is&&(a=e.apply(w,u)),a};return Ut(l,e),l.cancel=()=>{n&&(clearTimeout(n),n=void 0),c&&(clearTimeout(c),c=void 0)},l},Ce="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",Gt=Ce.length,Te=Array(20),T=()=>{for(let e=0;e<20;e++)Te[e]=Ce.charAt(Math.random()*Gt);return Te.join("")};class q{constructor(){this.disposers=new Map}add(t,s=T()){return this.flush(s),this.disposers.set(s,t()),s}addDisposer(t,s=T()){return this.flush(s),this.disposers.set(s,t),s}addEventListener(t,s,o,r,i=T()){return this.add(()=>(t.addEventListener(s,o,r),()=>t.removeEventListener(s,o,r)),i),i}setTimeout(t,s,o=T()){return this.add(()=>{const r=window.setTimeout(()=>{this.remove(o),t()},s);return()=>window.clearTimeout(r)},o)}setInterval(t,s,o=T()){return this.add(()=>{const r=window.setInterval(t,s);return()=>window.clearInterval(r)},o)}remove(t){const s=this.disposers.get(t);return this.disposers.delete(t),s}flush(t){const s=this.remove(t);if(s)try{s()}catch(o){console.error(o)}}flushAll(){this.disposers.forEach(t=>{try{t()}catch(s){console.error(s)}}),this.disposers.clear()}}function Yt(e){const t="http://www.w3.org/2000/svg",s=document.createElementNS(t,"svg");s.setAttribute("class",`${e}-footer-icon-sidebar`),s.setAttribute("viewBox","0 0 64 64");const o=document.createElementNS(t,"path");return o.setAttribute("fill","currentColor"),o.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(o),s}function qt(e){const t="http://www.w3.org/2000/svg",s=document.createElementNS(t,"svg");s.setAttribute("class",`${e}-footer-icon-arrow-left`),s.setAttribute("viewBox","0 0 500 500");const o=document.createElementNS(t,"path");return o.setAttribute("fill","currentColor"),o.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(o),s}function Xt(e){const t="http://www.w3.org/2000/svg",s=document.createElementNS(t,"svg");s.setAttribute("class",`${e}-footer-icon-arrow-right`),s.setAttribute("viewBox","0 0 500 500");const o=document.createElementNS(t,"path");return o.setAttribute("fill","currentColor"),o.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(o),s}function Jt(e){const t="http://www.w3.org/2000/svg",s=document.createElementNS(t,"svg");s.setAttribute("class",`${e}-footer-icon-play`),s.setAttribute("viewBox","0 0 500 500");const o=document.createElementNS(t,"path");return o.setAttribute("fill","currentColor"),o.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(o),s}function Kt(e){const t="http://www.w3.org/2000/svg",s=document.createElementNS(t,"svg");s.setAttribute("class",`${e}-footer-icon-pause`),s.setAttribute("viewBox","0 0 500 500");const o=document.createElementNS(t,"path");return o.setAttribute("fill","currentColor"),o.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(o),s}class _e{constructor({readonly:t,box:s,pages:o,onNewPageIndex:r,onPlay:i}){if(this.pageIndex=0,this.namespace="netless-app-docs-viewer",this.isShowPreview=!1,this.isSmallBox=!1,this.sideEffect=new q,o.length<=0)throw new Error("[DocsViewer] Empty pages.");this.readonly=t,this.box=s,this.pages=o,this.onNewPageIndex=r,this.onPlay=i,this.render()}mount(){this.box.mountContent(this.$content),this.box.mountFooter(this.$footer),this.sideEffect.add(()=>{const t=new S({container:this.$preview,elements_selector:`.${this.wrapClassName("preview-page>img")}`});return()=>t.destroy()},"preview-lazyload")}unmount(){this.$content.remove(),this.$footer.remove()}setReadonly(t){this.readonly!==t&&(this.readonly=t,this.$content.classList.toggle(this.wrapClassName("readonly"),t),this.$footer.classList.toggle(this.wrapClassName("readonly"),t),this.$pageNumberInput.disabled=t)}destroy(){this.sideEffect.flushAll(),this.unmount()}setPageIndex(t){Number.isNaN(t)||(this.pageIndex=t,this.$pageNumberInput.value=String(t+1))}setSmallBox(t){this.isSmallBox!==t&&(this.isSmallBox=t,this.$footer.classList.toggle(this.wrapClassName("float-footer"),t))}render(){return this.renderContent(),this.renderFooter(),this.$content}renderContent(){if(!this.$content){const t=document.createElement("div");t.className=this.wrapClassName("content"),this.$content=t,this.readonly&&t.classList.add(this.wrapClassName("readonly")),t.appendChild(this.renderPreviewMask()),t.appendChild(this.renderPreview())}return this.$content}renderPreview(){if(!this.$preview){const t=document.createElement("div");t.className=this.wrapClassName("preview")+" tele-fancy-scrollbar",this.$preview=t;const s=this.wrapClassName("preview-page"),o=this.wrapClassName("preview-page-name");this.pages.forEach((r,i)=>{var w;const n=(w=r.thumbnail)!=null?w:r.src.startsWith("ppt")?void 0:r.src;if(!n)return;const c=String(i),a=document.createElement("a");a.className=s+" "+this.wrapClassName(`preview-page-${i}`),a.setAttribute("href","#"),a.dataset.pageIndex=c;const l=document.createElement("span");l.className=o,l.textContent=String(i+1),l.dataset.pageIndex=c;const u=document.createElement("img");u.width=r.width,u.height=r.height,u.dataset.src=n,u.dataset.pageIndex=c,a.appendChild(u),a.appendChild(l),t.appendChild(a)}),this.sideEffect.addEventListener(t,"click",r=>{var n;if(this.readonly)return;const i=(n=r.target.dataset)==null?void 0:n.pageIndex;i&&(r.preventDefault(),r.stopPropagation(),r.stopImmediatePropagation(),this.onNewPageIndex(Number(i)),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",t=>{this.readonly||t.target===this.$previewMask&&this.togglePreview(!1)})),this.$previewMask}renderFooter(){if(!this.$footer){const t=document.createElement("div");if(t.className=this.wrapClassName("footer"),this.$footer=t,this.readonly&&t.classList.add(this.wrapClassName("readonly")),this.isSmallBox&&t.classList.add(this.wrapClassName("float-footer")),this.pages.some(a=>a.thumbnail||!a.src.startsWith("ppt"))){const a=this.renderFooterBtn("btn-sidebar",Yt(this.namespace));this.sideEffect.addEventListener(a,"click",()=>{this.readonly||this.togglePreview()}),this.$footer.appendChild(a)}const s=document.createElement("div");s.className=this.wrapClassName("page-jumps");const o=this.renderFooterBtn("btn-page-back",qt(this.namespace));if(this.sideEffect.addEventListener(o,"click",()=>{this.readonly||this.onNewPageIndex(this.pageIndex-1)}),s.appendChild(o),this.onPlay){const a=this.renderFooterBtn("btn-page-play",Jt(this.namespace),Kt(this.namespace)),l=()=>{this.sideEffect.setTimeout(()=>{a.classList.toggle(this.wrapClassName("footer-btn-playing"),!1)},500,"returnPlay")};this.sideEffect.addEventListener(a,"click",()=>{this.readonly||(a.classList.toggle(this.wrapClassName("footer-btn-playing"),!0),this.onPlay&&this.onPlay(),l())}),s.appendChild(a)}const r=this.renderFooterBtn("btn-page-next",Xt(this.namespace));this.sideEffect.addEventListener(r,"click",()=>{this.readonly||this.onNewPageIndex(this.pageIndex+1)}),s.appendChild(r);const i=document.createElement("div");i.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,"change",()=>{this.readonly||n.value&&this.onNewPageIndex(Number(n.value)-1)});const c=document.createElement("span");c.textContent=" / "+this.pages.length,i.appendChild(n),i.appendChild(c),this.$footer.appendChild(s),this.$footer.appendChild(i)}return this.$footer}renderFooterBtn(t,s,o){const r=document.createElement("button");return r.className=this.wrapClassName("footer-btn")+" "+this.wrapClassName(t),r.appendChild(s),o&&r.appendChild(o),r}togglePreview(t){if(this.isShowPreview=t!=null?t:!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(t){return`${this.namespace}-${t}`}}function z(e,t,s){return Math.min(Math.max(e,t),s)}function ke(e){return e.touches?e.touches[0]:e}function Ie(e){e.stopPropagation(),e.cancelable&&e.preventDefault()}const X=30,_=640;class Zt{constructor({whiteboardView:t,readonly:s,box:o,pages:r,pagesSize:i,pageScrollTop:n=0,mountWhiteboard:c,onUserScroll:a}){this.onNewPageIndex=l=>{this.scrollToPage(l)},this.sideEffect=new q,this.scrollbarHeight=X,this.whiteboardView=t,this.readonly=s,this.box=o,this.pages=r,this.pageScrollTop=n,this.pagesSize=i,this.mountWhiteboard=c,this.onUserScroll=a,this.viewer=new _e({readonly:s,box:o,pages:r,onNewPageIndex:this.onNewPageIndex}),this.render()}mount(){return this.viewer.mount(),this.sideEffect.add(()=>{const t=new S({container:this.$pages,elements_selector:`.${this.wrapClassName("page")}`});return()=>t.destroy()},"page-lazyload"),this.setupWhiteboardCamera(),this.sideEffect.setTimeout(()=>{this.pageScrollTop!==0&&this.pageScrollTo(this.pageScrollTop)},1e3),this.setupScrollTopEvent(),this.sideEffect.add(()=>{const t=this.renderRatioHeight.bind(this);return this.box.events.on("visual_resize",t),()=>this.box.events.off("visual_resize",t)}),this}unmount(){return this.viewer.unmount(),this}setReadonly(t){this.readonly!==t&&(this.readonly=t,this.viewer.setReadonly(t))}destroy(){this.sideEffect.flushAll(),this.onUserScroll=void 0,this.unmount(),this.viewer.destroy()}syncPageScrollTop(t){t>=0&&Math.abs(this.pageScrollTop-t)>10&&this.pageScrollTo(t)}render(){this.viewer.$content.appendChild(this.renderPages()),this.viewer.$content.appendChild(this.renderWhiteboardView()),this.viewer.$content.appendChild(this.renderScrollbar()),this.renderRatioHeight()}renderRatioHeight(){const t=this.box.absoluteHeight,s=t<=_;if(this.viewer.setSmallBox(s),s){const o=26/_,r=26/t,i=26/_,n=0,c=Math.max((o+i-(r+n))/2,0);if(this.box.$titleBar){const a=r+c;this.box.$titleBar.style.height=`${a*100}%`}if(this.box.$footer){const a=n+c;this.box.$footer.style.height=`${a*100}%`}}else{if(this.box.$titleBar){const o=Math.max(26/_,26/t);this.box.$titleBar.style.height=`${o*100}%`}if(this.box.$footer){const o=Math.max(26/_,26/t);this.box.$footer.style.height=`${o*100}%`}}}renderPages(){if(!this.$pages){const t=document.createElement("div");t.className=this.wrapClassName("pages"),this.$pages=t;const s=this.wrapClassName("page");this.pages.forEach((o,r)=>{const i=document.createElement("img");i.className=s+" "+this.wrapClassName(`page-${r}`),i.draggable=!1,i.width=o.width,i.height=o.height,i.dataset.src=o.src,i.dataset.pageIndex=String(r),t.appendChild(i)})}return this.$pages}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",t=>{Ie(t),this.readonly||(this.pageScrollTo(this.pageScrollTop+t.deltaY),this.updateUserScroll())},{passive:!1,capture:!0}),this.sideEffect.addEventListener(this.$whiteboardView,"touchmove",t=>{this.readonly||t.touches.length<=1||this.updateUserScroll()},{passive:!0,capture:!0})),this.$whiteboardView}renderScrollbar(){if(!this.$scrollbar){const t=document.createElement("button");this.$scrollbar=t,t.className=this.wrapClassName("scrollbar"),t.style.minHeight=`${X}px`;const s=o=>{if(this.readonly||o.button!=null&&o.button!==0)return;Ie(o),this.$scrollbar.classList.toggle(this.wrapClassName("scrollbar-dragging"),!0);const r=this.scrollTopPageToEl(this.pageScrollTop),i=this.whiteboardView.size.width/this.pagesSize.width*this.pagesSize.height,{clientY:n}=ke(o),c=l=>{const{clientY:u}=ke(l),{height:w}=this.whiteboardView.size;this.elScrollTo(r+(u-n)*(i/w))},a=()=>{this.$scrollbar.classList.toggle(this.wrapClassName("scrollbar-dragging"),!1),window.removeEventListener("mousemove",c,!0),window.removeEventListener("touchmove",c,!0),window.removeEventListener("mouseup",a,!0),window.removeEventListener("touchend",a,!0),window.removeEventListener("touchcancel",a,!0)};window.addEventListener("mousemove",c,!0),window.addEventListener("touchmove",c,!0),window.addEventListener("mouseup",a,!0),window.addEventListener("touchend",a,!0),window.addEventListener("touchcancel",a,!0)};this.sideEffect.addEventListener(t,"mousedown",s),this.sideEffect.addEventListener(t,"touchstart",s)}return this.$scrollbar}scrollTopPageToEl(t){return t*(this.whiteboardView.size.width/this.pagesSize.width)}scrollTopElToPage(t){return t/(this.whiteboardView.size.width/this.pagesSize.width)}elScrollTo(t){this.pageScrollTo(this.scrollTopElToPage(t))}pageScrollTo(t){const s=this.scrollTopElToPage(this.whiteboardView.size.height/2);this.whiteboardView.moveCamera({centerY:z(t+s,s,this.pagesSize.height-s),animationMode:"immediately"})}scrollToPage(t){if(!this.readonly&&this.$pages&&!Number.isNaN(t)){t=z(t,0,this.pages.length-1);const s=this.$pages.querySelector("."+this.wrapClassName(`page-${t}`));if(s){const o=s.offsetTop+5;this.elScrollTo(o),this.updateUserScroll()}}}setupScrollTopEvent(){const t=this.debounce(()=>{if(this.pages.length>0&&this.$pages&&this.$pages.getBoundingClientRect().width>0){let o=0;for(let r=0;r<this.pages.length;r+=1)if(o+=this.pages[r].height,this.pageScrollTop<=o){this.viewer.setPageIndex(r);return}this.viewer.setPageIndex(this.pages.length-1)}},{wait:5,maxWait:100},"debounce-updatePageIndex");this.sideEffect.add(()=>{const s=o=>{const{width:r,height:i}=this.whiteboardView.size,{width:n,height:c}=this.pagesSize,a=r/n*c,l=this.scrollTopPageToEl(o.centerY)-i/2,u=this.scrollTopElToPage(l);this.pageScrollTop=u,this.$pages.scrollTo({top:l}),this.setScrollbarHeight(i/a*i),this.$scrollbar.style.transform=`translateY(${l/(a-i)*(i-this.scrollbarHeight)}px)`,t()};return this.whiteboardView.callbacks.on("onCameraUpdated",s),()=>this.whiteboardView.callbacks.off("onCameraUpdated",s)})}setupWhiteboardCamera(){this.sideEffect.add(()=>{const t=({width:s,height:o})=>{if(s>0&&o>0){const r=this.$pages.scrollTop,i=this.pagesSize.width,n=i/s;this.whiteboardView.moveCameraToContain({originX:0,originY:r*n,width:i,height:o*n,animationMode:"immediately"}),this.whiteboardView.setCameraBound({damping:1,maxContentMode:()=>s/i,minContentMode:()=>s/i,centerX:this.pagesSize.width/2,centerY:this.pagesSize.height/2,width:this.pagesSize.width,height:this.pagesSize.height}),this.elScrollTo(r)}};return this.whiteboardView.callbacks.on("onSizeUpdated",t),()=>{this.whiteboardView.callbacks.off("onSizeUpdated",t)}},"whiteboard-size-update")}updateUserScroll(){window.requestAnimationFrame(()=>{this.onUserScroll&&this.onUserScroll(this.pageScrollTop)})}debounce(t,s,o){const r=jt(t,s);return this.sideEffect.add(()=>()=>r.cancel(),o),r}wrapClassName(t){return"netless-app-docs-viewer-static-"+t}setScrollbarHeight(t){t=z(t,X,this.whiteboardView.size.height),this.scrollbarHeight!==t&&(this.scrollbarHeight=t,this.$scrollbar.style.height=`${t}px`)}}class Qt{constructor({displayer:t,whiteboardView:s,getRoom:o,readonly:r,box:i,pages:n,mountWhiteboard:c}){this.sideEffect=new q,this.onPlayPPT=()=>{const a=this.getWhiteboardRoom();a&&a.pptNextStep()},this._scaleDocsToFitImpl=()=>{const a=this.pages[this.getPageIndex()];a&&this.whiteboardView.moveCameraToContain({originX:-a.width/2,originY:-a.height/2,width:a.width,height:a.height,animationMode:"immediately"})},this._scaleDocsToFitDebounced=()=>{this.sideEffect.setTimeout(this._scaleDocsToFitImpl,1e3,"_scaleDocsToFitDebounced")},this.scaleDocsToFit=()=>{this._scaleDocsToFitImpl(),this._scaleDocsToFitDebounced()},this.onNewPageIndex=a=>{this.jumpToPage(a,!0)},this.whiteboardView=s,this.readonly=r,this.box=i,this.pages=n,this.displayer=t,this.getWhiteboardRoom=o,this.mountWhiteboard=c,this.viewer=new _e({readonly:r,box:i,pages:n,onNewPageIndex:this.onNewPageIndex,onPlay:this.onPlayPPT}),this.render()}mount(){this.viewer.mount();const t=this.getPageIndex();return t!==0&&this.jumpToPage(t),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}setReadonly(t){this.readonly!==t&&(this.readonly=t,this.viewer.setReadonly(t))}destroy(){this.sideEffect.flushAll(),this.unmount(),this.viewer.destroy()}getPageIndex(){return this.displayer.state.sceneState.index}jumpToPage(t,s){if(t=z(t,0,this.pages.length-1),t!==this.getPageIndex()){const o=this.getWhiteboardRoom();o&&(o.setSceneIndex(t),this.scaleDocsToFit())}if(t!==this.viewer.pageIndex&&this.viewer.setPageIndex(t),s){const o=this.getWhiteboardRoom();o&&o.setGlobalState({__pptState:void 0})}}render(){this.viewer.$content.appendChild(this.renderMask()),this.viewer.$content.appendChild(this.renderWhiteboardView()),this.sideEffect.addEventListener(window,"keydown",t=>{var s;if(this.box.focus)switch(t.key){case"ArrowUp":case"ArrowLeft":{this.jumpToPage(this.getPageIndex()-1,!0);break}case"ArrowRight":case"ArrowDown":{(s=this.getWhiteboardRoom())==null||s.pptNextStep();break}}})}renderMask(){if(!this.$mask){const t=document.createElement("div");t.className=this.wrapClassName("mask"),this.$mask=t;const s=document.createElement("button");s.className=this.wrapClassName("back");const o=document.createElement("button");o.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",t=>{var o;const s=this.getWhiteboardRoom();if(s&&s.state.memberState.currentApplianceName==="clicker"){for(let r=t.target;r;r=r.parentElement)if((o=r.classList)==null?void 0:o.contains("ppt-event-source"))return;s.pptNextStep()}}),this.mountWhiteboard(this.$whiteboardView)),this.$whiteboardView}wrapClassName(t){return"netless-app-docs-viewer-dynamic-"+t}}const es={kind:"DocsViewer",setup(e){const t=e.getBox(),s=e.getScenes();if(!s)throw new Error("[Docs Viewer]: scenes not found.");const o=e.getView();if(!o)throw new Error("[Docs Viewer]: no whiteboard view.");const r=s.map(({ppt:i})=>i?{width:i.width,height:i.height,src:i.src,thumbnail:i.previewURL}:null).filter(i=>Boolean(i));if(r.length<=0)throw new Error("[Docs Viewer]: empty scenes.");t.mountStyles(p),r[0].src.startsWith("ppt")?ss(e,o,t,r):ts(e,o,t,r)}};function ts(e,t,s,o){var n;const r={width:o[0].width,height:o.reduce((c,a)=>c+a.height*(o[0].width/a.width),0)},i=new Zt({whiteboardView:t,readonly:s.readonly,box:s,pages:o,pagesSize:r,pageScrollTop:(n=e.getAttributes())==null?void 0:n.pageScrollTop,mountWhiteboard:e.mountView.bind(e),onUserScroll:c=>{var a;((a=e.getAttributes())==null?void 0:a.pageScrollTop)!==c&&!s.readonly&&e.updateAttributes(["pageScrollTop"],c)}}).mount();e.emitter.on("attributesUpdate",c=>{c&&c.pageScrollTop!=null&&i.syncPageScrollTop(c.pageScrollTop)}),s.events.on("readonly",c=>{i.setReadonly(c)})}function ss(e,t,s,o){t.disableCameraTransform=!0;const r=e.getDisplayer(),i=new Qt({displayer:r,whiteboardView:t,getRoom:()=>e.getIsWritable()?e.getDisplayer():void 0,readonly:s.readonly,box:s,pages:o,mountWhiteboard:e.mountView.bind(e)}).mount();e.mountView(i.$whiteboardView),e.isAddApp&&t.callbacks.once("onSizeUpdated",({width:n,height:c})=>{if(o.length>0&&s.state!=="maximized"){const{width:a,height:l}=o[0],w=l/a*n-c;w!==0&&e.getIsWritable()&&e.emitter.emit("setBoxSize",{width:s.width,height:s.height+w/s.containerRect.height})}}),e.emitter.on("sceneStateChange",n=>{i.jumpToPage(n.index)}),s.events.on("readonly",n=>{i.setReadonly(n)})}return h.default=es,Object.defineProperty(h,"__esModule",{value:!0}),h[Symbol.toStringTag]="Module",h}({});
//# sourceMappingURL=main.iife.js.map
{
"name": "@netless/app-docs-viewer",
"version": "0.1.23",
"version": "0.1.24",
"description": "Netless App Docs Viewer",

@@ -5,0 +5,0 @@ "repository": "netless-io/netless-app",

@@ -95,4 +95,6 @@ import type { AnimationMode, ReadonlyTeleBox } from "@netless/window-manager";

this.whiteboardView.callbacks.on("onSizeUpdated", () => {
this.renderRatioHeight();
this.sideEffect.add(() => {
const handler = this.renderRatioHeight.bind(this);
this.box.events.on("visual_resize", handler);
return () => this.box.events.off("visual_resize", handler);
});

@@ -99,0 +101,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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc