@cocalc/static
Version:
CoCalc's static frontend Webpack-based build system and framework
1 lines • 28.2 kB
JavaScript
(self.webpackChunk_cocalc_static=self.webpackChunk_cocalc_static||[]).push([[2830,5520],{10552:(e,t,n)=>{"use strict";n.d(t,{X:()=>i});var r=n(12430),o=n(32295),i=o.React.memo((function(e){var t,n=e.actions,i=e.id,l=e.project_id,u=e.is_current,a=e.path,c=e.reload,s=o.React.useRef(null);return o.React.createElement("div",{style:{position:"relative",height:"100%",width:"100%"}},o.React.createElement(o.React.Fragment,null,o.React.createElement("div",{style:{position:"absolute",width:"100%",height:"100%",zIndex:u?-1:1},onMouseEnter:function(){n.set_active_id(i),$(s.current).focus()}}),(t="".concat((0,r.v)(l,a),"?param=").concat(c),o.React.createElement("embed",{ref:s,width:"100%",height:"100%",src:t,type:"application/pdf"}))))}))},47975:(e,t,n)=>{"use strict";n.d(t,{a:()=>V}),n(86099);var r=n(63505),o=n(19990),i=n(18760),l=n(95788),u=n(24620),a=n(13435),c=n(32295),s=n(56570),f=n(35586),d=n(63505);function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function p(e,t,n,r,o,i,l){try{var u=e[i](l),a=u.value}catch(e){return void n(e)}u.done?t(a):Promise.resolve(a).then(r,o)}function h(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function l(e){p(i,r,o,l,u,"next",e)}function u(e){p(i,r,o,l,u,"throw",e)}l(void 0)}))}}function g(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],l=!0,u=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);l=!0);}catch(e){u=!0,o=e}finally{try{l||null==n.return||n.return()}finally{if(u)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return v(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?v(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var y=function(e,t){var n,r,o,i,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;l;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return l.label++,{value:i[1],done:!1};case 5:l.label++,r=i[1],i=[0];continue;case 7:i=l.ops.pop(),l.trys.pop();continue;default:if(!((o=(o=l.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){l=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){l.label=i[1];break}if(6===i[0]&&l.label<o[1]){l.label=o[1],o=i;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(i);break}o[2]&&l.ops.pop(),l.trys.pop();continue}i=t.call(e,l)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}};function b(e){var t=e.page,n=e.scale,o=e.clickAnnotation,i=e.syncHighlight,l=(0,c.useIsMountedRef)(),u=(0,r.useRef)(0),a=g((0,r.useState)(void 0),2),s=a[0],v=a[1],p=g((0,r.useState)(i),2),b=p[0],w=p[1];function m(){return m=h((function(){var e;return y(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,t.getAnnotations()];case 1:return e=n.sent(),l.current?(v(e),[3,3]):[2];case 2:return n.sent(),console.error("pdf.js -- Error updating annotations: #{err}"),[2];case 3:return[2]}}))})),m.apply(this,arguments)}return(0,r.useEffect)((function(){!function(){m.apply(this,arguments)}()}),[t]),(0,r.useEffect)((function(){null!=i&&i!=b&&w(i)}),[i]),(0,r.useEffect)((function(){if(null!=b){var e=b.until.getTime()-Date.now();u.current+=1;var t=u.current,n=setTimeout((function(){l.current&&u.current===t&&w(void 0)}),e);return function(){return clearTimeout(n)}}}),[b]),function(){if(null==s)return d.createElement("div",null);var e=[],r=!0,i=!1,l=void 0;try{for(var u,a=function(){var r=u.value;if("Link"!=r.subtype)return console.log("Annotation not implemented",r),"continue";var i=g(f.Util.normalizeRect(r.rect),4),l=i[0],a=i[1],c=i[2],s=i[3],v=l-1,p=t.view[3]-s-1,h=c-l+2,y=s-a+1,b="";r.borderStyle.width&&(b="0.5px solid rgb(".concat(r.color[0],", ").concat(r.color[1],", ").concat(r.color[2],")"));var w=d.createElement("div",{onClick:function(){return o(r)},key:r.id,style:{position:"absolute",left:v*n,top:p*n,width:h*n,height:y*n,border:b,cursor:"pointer",zIndex:1}});e.push(w)},c=s[Symbol.iterator]();!(r=(u=c.next()).done);r=!0)a()}catch(e){i=!0,l=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw l}}return void 0!==b&&e.push(function(e,t,n){return d.createElement("div",{onDoubleClick:function(e){return e.stopPropagation()},key:"sync",style:{position:"absolute",top:(n-15)*e,width:t*e,height:30*e,opacity:.35,background:"yellow",border:"1px solid grey",boxShadow:"3px 3px 3px 0px #ddd"}})}(n,t.view[2],b.y)),d.createElement("div",{style:{position:"absolute"}},e)}()}var w=n(74591),m=n(63505);function x(e,t,n,r,o,i,l){try{var u=e[i](l),a=u.value}catch(e){return void n(e)}u.done?t(a):Promise.resolve(a).then(r,o)}function k(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function l(e){x(i,r,o,l,u,"next",e)}function u(e){x(i,r,o,l,u,"throw",e)}l(void 0)}))}}var _=function(e,t){var n,r,o,i,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;l;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return l.label++,{value:i[1],done:!1};case 5:l.label++,r=i[1],i=[0];continue;case 7:i=l.ops.pop(),l.trys.pop();continue;default:if(!((o=(o=l.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){l=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){l.label=i[1];break}if(6===i[0]&&l.label<o[1]){l.label=o[1],o=i;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(i);break}o[2]&&l.ops.pop(),l.trys.pop();continue}i=t.call(e,l)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}};function E(e){var t,n=e.page,o=e.scale,i=e.clickAnnotation,l=e.syncHighlight,u=(0,r.useRef)(null),a=(0,r.useRef)(null),c=(0,r.useRef)(o),s=(0,r.useRef)(o),f=n.getViewport({scale:o*window.devicePixelRatio}),d="".concat(f.height/window.devicePixelRatio,"px"),v=(0,r.useCallback)((t=k((function(e){var t,r,o;return _(this,(function(i){return c.current==e||(t=u.current,r=a.current,null==t||null==r||(c.current=e,o=n.getViewport({scale:e*window.devicePixelRatio}),r.style.width="".concat(o.width/window.devicePixelRatio,"px"),r.style.height="".concat(o.height/window.devicePixelRatio,"px"))),[2]}))})),function(e){return t.apply(this,arguments)}),[]),p=(0,r.useCallback)(function(){var e=k((function(e,t){var n,r,o,i,l;return _(this,(function(f){switch(f.label){case 0:if(null==u.current)return[2];if(c.current=s.current=t,n=u.current,r=e.getViewport({scale:t*window.devicePixelRatio}),o=document.createElement("canvas"),a.current=o,null==(i=o.getContext("2d")))return console.error("pdf.js -- unable to get a 2d canvas, so not rendering page"),[2];o.width=r.width,o.height=r.height,o.style.width="".concat(r.width/window.devicePixelRatio,"px"),o.style.height="".concat(r.height/window.devicePixelRatio,"px"),n.replaceChildren(o),f.label=1;case 1:return f.trys.push([1,3,,4]),[4,e.render({canvasContext:i,viewport:r}).promise];case 2:return f.sent(),[3,4];case 3:return l=f.sent(),console.error("pdf.js -- Error rendering canvas page: ".concat(l)),[2];case 4:return[2]}}))}));return function(t,n){return e.apply(this,arguments)}}(),[]),h=(0,w.Z)(p,500);return(0,r.useEffect)((function(){p(n,o)}),[n]),(0,r.useEffect)((function(){v(o),s.current<o?h(n,o):h.cancel()}),[o]),m.createElement("div",{style:{position:"relative",display:"inline-block",height:d}},m.createElement(b,{page:n,scale:o,clickAnnotation:i,syncHighlight:l}),m.createElement("div",{ref:u}))}var P=n(63505);function S(e,t,n,r,o,i,l){try{var u=e[i](l),a=u.value}catch(e){return void n(e)}u.done?t(a):Promise.resolve(a).then(r,o)}function R(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function l(e){S(i,r,o,l,u,"next",e)}function u(e){S(i,r,o,l,u,"throw",e)}l(void 0)}))}}var C=function(e,t){var n,r,o,i,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;l;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return l.label++,{value:i[1],done:!1};case 5:l.label++,r=i[1],i=[0];continue;case 7:i=l.ops.pop(),l.trys.pop();continue;default:if(!((o=(o=l.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){l=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){l.label=i[1];break}if(6===i[0]&&l.label<o[1]){l.label=o[1],o=i;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(i);break}o[2]&&l.ops.pop(),l.trys.pop();continue}i=t.call(e,l)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}},A="#525659";function O(e){var t=e.actions,n=e.id,r=e.n,o=e.doc,i=e.scale,l=e.page,u=e.syncHighlight;function a(){return(a=R((function(e){var r,i,u,a,c;return C(this,(function(s){switch(s.label){case 0:return(r=e).url?((i=window.open(r.url,"_blank"))&&i.focus(),[2]):r.dest?[4,o.getDestination(r.dest)]:[3,3];case 1:return null==(u=s.sent())?(console.warn("Unknown destination ".concat(r.dest)),[2]):[4,o.getPageIndex(u[0])];case 2:return a=s.sent(),c=l.view[3],t.scroll_pdf_into_view(a+1,c-u[3],n),[2];case 3:return console.warn("Unknown annotation link",r),[2]}}))}))).apply(this,arguments)}var c=l.getViewport({scale:i});return P.createElement("div",{style:{height:"".concat(8+c.height,"px"),background:A}},P.createElement("div",{style:{height:"".concat(c.height,"px"),width:"".concat(c.width,"px"),background:"white",margin:"auto"},onDoubleClick:function(e){if(t.synctex_pdf_to_tex){var n=e.nativeEvent.offsetX/i,o=e.nativeEvent.offsetY/i;t.synctex_pdf_to_tex(r,n,o)}}},P.createElement(E,{page:l,scale:i,clickAnnotation:function(e){return a.apply(this,arguments)},syncHighlight:u})))}var B=n(26286),I=n(429),z=n(3455),M=n(19303),j=n(63505);function T(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function D(e,t,n,r,o,i,l){try{var u=e[i](l),a=u.value}catch(e){return void n(e)}u.done?t(a):Promise.resolve(a).then(r,o)}function K(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function l(e){D(i,r,o,l,u,"next",e)}function u(e){D(i,r,o,l,u,"throw",e)}l(void 0)}))}}function F(){return F=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},F.apply(this,arguments)}function L(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],l=!0,u=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);l=!0);}catch(e){u=!0,o=e}finally{try{l||null==n.return||n.return()}finally{if(u)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return T(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?T(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var U=function(e,t){var n,r,o,i,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;l;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return l.label++,{value:i[1],done:!1};case 5:l.label++,r=i[1],i=[0];continue;case 7:i=l.ops.pop(),l.trys.pop();continue;default:if(!((o=(o=l.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){l=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){l.label=i[1];break}if(6===i[0]&&l.label<o[1]){l.label=o[1],o=i;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(i);break}o[2]&&l.ops.pop(),l.trys.pop();continue}i=t.call(e,l)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}};function V(e){var t,n,f=e.id,d=e.name,v=e.actions,p=e.editor_state,h=e.project_id,g=e.path,y=e.reload,b=e.font_size,w=e.is_current,m=e.is_visible,x=e.status,k=function(e){var t=e.n,n=e.id;if(null!=D&&D.page===t&&D.id===n)return{y:D.y,until:(0,u.seconds_ago)(-6)}},_=function(e){var t;return(null!==(t=c.redux.getStore("account").get("font_size"))&&void 0!==t?t:14)*e},E=(0,I.s8)().desc,P=(0,c.useIsMountedRef)(),S=(0,c.useActions)("page"),R=(0,c.useRedux)(d,"zoom_page_width"),C=(0,c.useRedux)(d,"zoom_page_height"),T=(0,c.useRedux)(d,"sync"),D=null===(t=(0,c.useRedux)(d,"scroll_pdf_into_view"))||void 0===t?void 0:t.toJS(),V=(0,c.useRedux)(d,"mode"),G=(0,c.useRedux)(d,"derived_file_types"),H=(0,c.useRedux)(d,"custom_pdf_error_message"),Z=L((0,r.useState)(!1),2),Y=Z[0],W=Z[1],N=L((0,r.useState)([]),2),X=N[0],J=N[1],q=L((0,r.useState)(!1),2),Q=q[0],ee=q[1],te=L((0,r.useState)(null),2),ne=te[0],re=te[1],oe=L((0,r.useState)("grab"),2),ie=oe[0],le=oe[1],ue=(0,r.useRef)(null);(0,B.ZP)({target:ue}),(0,r.useEffect)((function(){!function(e){se.apply(this,arguments)}(y)}),[y]),(0,r.useEffect)((function(){C==f&&function(){ve.apply(this,arguments)}(),R==f&&function(){de.apply(this,arguments)}(),T==f&&function(){if(null!=ue.current){v.setState({sync:void 0});var e,t,n,r,o=$(ue.current),i=o.offset(),l=o.height();i&&l&&(e=i.left,t=i.top+l/2,n=new MouseEvent("dblclick",{view:window,bubbles:!0,cancelable:!0,clientX:e,clientY:t}),null!=(r=document.elementFromPoint(e,t))&&r.dispatchEvent(n))}}()}),[C,R,T]),(0,r.useEffect)((function(){D&&function(e,t,n){fe.apply(this,arguments)}(D.page,D.y,D.id)}),[D]);var ae,ce=(0,r.useCallback)((function(e){var t,n,r,o,i,l,u,a,s,d,p,h,g,y,b,w,m,x,k,_,E,P,S,R,C,A,O,B,I,z,M;" "==e.key&&!e.shiftKey||"PageDown"==e.key?null===(t=ke.current)||void 0===t||t.scrollBy({top:null!==(o=null===(r=null===(n=ue.current)||void 0===n?void 0:n.getBoundingClientRect())||void 0===r?void 0:r.height)&&void 0!==o?o:200}):" "==e.key&&e.shiftKey||"PageUp"==e.key?null===(i=ke.current)||void 0===i||i.scrollBy({top:-(null!==(a=null===(u=null===(l=ue.current)||void 0===l?void 0:l.getBoundingClientRect())||void 0===u?void 0:u.height)&&void 0!==a?a:200)}):"ArrowRight"!=e.key?"ArrowLeft"!=e.key?"ArrowDown"!=e.key?"ArrowUp"!=e.key?"Home"!=e.key?"End"!=e.key?"-"==e.key||","==e.key&&e.ctrlKey&&e.shiftKey?v.decrease_font_size(f):"="==e.key||"."==e.key&&e.ctrlKey&&e.shiftKey?v.increase_font_size(f):"0"!=e.key||!e.metaKey&&!e.ctrlKey||v.set_font_size(f,null!==(s=c.redux.getStore("account").get("font_size"))&&void 0!==s?s:14):null===(d=ke.current)||void 0===d||d.scrollTo({top:1e16}):null===(p=ke.current)||void 0===p||p.scrollTo({top:0}):e.ctrlKey||e.metaKey?null===(h=ke.current)||void 0===h||h.scrollTo({top:0}):null===(g=ke.current)||void 0===g||g.scrollBy({top:-(null!==(w=null===(b=null===(y=ue.current)||void 0===y?void 0:y.getBoundingClientRect())||void 0===b?void 0:b.height)&&void 0!==w?w:300)/20}):e.ctrlKey||e.metaKey?null===(m=ke.current)||void 0===m||m.scrollTo({top:1e16}):null===(x=ke.current)||void 0===x||x.scrollBy({top:(null!==(E=null===(_=null===(k=ue.current)||void 0===k?void 0:k.getBoundingClientRect())||void 0===_?void 0:_.height)&&void 0!==E?E:300)/20}):null===(P=ke.current)||void 0===P||P.scrollBy({top:-(null!==(A=null!==(C=ye.current)&&void 0!==C?C:null===(R=null===(S=ue.current)||void 0===S?void 0:S.getBoundingClientRect())||void 0===R?void 0:R.height)&&void 0!==A?A:200)}):null===(O=ke.current)||void 0===O||O.scrollBy({top:null!==(M=null!==(z=ye.current)&&void 0!==z?z:null===(I=null===(B=ue.current)||void 0===B?void 0:B.getBoundingClientRect())||void 0===I?void 0:I.height)&&void 0!==M?M:200})}),[]);function se(){return se=K((function(e){var t,n,r,o,i,u,a,c,d;return U(this,(function(p){switch(p.label){case 0:return p.trys.push([0,4,,7]),[4,(0,s.Me)((0,s.t$)(h,g,e))];case 1:if(t=p.sent(),!P.current)return[2];for(ee(!1),n=[],r=1;r<=t.numPages;r++)o=t.getPage(r),n.push(o);return[4,Promise.all(n)];case 2:return i=p.sent(),P.current?(re(t),W(!0),J(i),ee(!1),[4,t.getPageLabels()]):[2];case 3:return u=p.sent(),v.setPages(f,null!=u?u:t.numPages),v.setPage(f,null!==(a=E.get("page"))&&void 0!==a?a:null==u?1:"1"),[3,7];case 4:return c=p.sent(),console.log("WARNING: error loading PDF -- ".concat(c)),P.current&&null!=c&&-1!=(null===(d=c.toString())||void 0===d?void 0:d.indexOf("Missing"))?(ee(!0),[4,(0,l.delay)(3e3)]):[3,6];case 5:p.sent(),P.current&&Q&&null!=v.update_pdf&&v.update_pdf((new Date).valueOf(),!0),p.label=6;case 6:return[3,7];case 7:return[2]}}))})),se.apply(this,arguments)}function fe(){return fe=K((function(e,t,n){var r,o,i,u,a,c;return U(this,(function(s){switch(s.label){case 0:if(f!=n)return[2];if(null==ue.current)return[2];u=function(){return null!=ne&&null!=ne.getPage},a=0,s.label=1;case 1:return a<50&&!u()?[4,(0,l.delay)(100)]:[3,3];case 2:return s.sent(),P.current?(a+=1,[3,1]):[2];case 3:return u()?null==ne?[2]:(c=null===(o=null===(r=ue.current)||void 0===r?void 0:r.getBoundingClientRect())||void 0===o?void 0:o.height)?(null===(i=ke.current)||void 0===i||i.scrollToIndex({index:e-1,offset:t*_e()+8-c/2}),[4,(0,l.delay)(100)]):[2]:[2];case 4:return s.sent(),v.setState({scroll_pdf_into_view:void 0}),[2]}}))})),fe.apply(this,arguments)}function de(){return(de=K((function(){var e,t,n;return U(this,(function(r){switch(r.label){case 0:if(null==ue.current)return[2];if(v.setState({zoom_page_width:void 0}),null==ne)return[2];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,ne.getPage(1)];case 2:return e=r.sent(),P.current?[3,4]:[2];case 3:return r.sent(),[2];case 4:return void 0===(t=$(ue.current).width())||(n=(t-10)/e.view[2],v.set_font_size(f,_(n))),[2]}}))}))).apply(this,arguments)}function ve(){return(ve=K((function(){var e,t,n;return U(this,(function(r){switch(r.label){case 0:if(null==ue.current)return[2];if(v.setState({zoom_page_height:void 0}),null==ne)return[2];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,ne.getPage(1)];case 2:return e=r.sent(),P.current?[3,4]:[2];case 3:return r.sent(),[2];case 4:return void 0===(t=$(ue.current).height())||(n=(t-10)/e.view[3],v.set_font_size(f,_(n))),[2]}}))}))).apply(this,arguments)}(0,r.useEffect)((function(){null!=v&&(w&&m?v.set_active_key_handler(ce):v.erase_active_key_handler(ce))}),[w,m,null!=S]);var pe=L((0,r.useState)(null!==(ae=E.get("page"))&&void 0!==ae?ae:0),2),he=pe[0],ge=pe[1],ye=(0,r.useRef)(void 0),be=(0,r.useRef)(void 0),we=(0,r.useCallback)((function(e){var t,n,r,o,i=e.index,l=e.offset,u=_e(),a=null===(n=null===(t=ue.current)||void 0===t?void 0:t.getBoundingClientRect())||void 0===n?void 0:n.height;if(null!=a){var c=a/2,s=-l,d=null===(o=null===(r=X[i])||void 0===r?void 0:r.getViewport({scale:u}))||void 0===o?void 0:o.height;if(null!=d){var p=s+d+8;for(ye.current=d+8;i+1<X.length&&!(s<=c&&p>=c);){var h,g;s=p;var y=null===(g=null===(h=X[i+=1])||void 0===h?void 0:h.getViewport({scale:u}))||void 0===g?void 0:g.height;if(null==y)return;p=s+y+8,ye.current=y+8}ge(i),be.current={topOfPage:s,bottomOfPage:p,middle:c},v.setPage(f,i+1)}}}),[f,X,b]),me=(0,r.useCallback)((function(){var e=E.get("page");if(null!=e){var t,n,r;if("string"==typeof e){if(-1==(t=null===(n=E.get("pages"))||void 0===n||null===(r=n.indexOf)||void 0===r?void 0:r.call(n,e))||null==t)return}else t=e-1;return t}}),[E.get("page"),E.get("pages")]);(0,r.useEffect)((function(){var e,t=me();null!=t&&he!=t&&(null===(e=ke.current)||void 0===e||e.scrollToIndex({index:t,align:"center"}))}),[E.get("page")]),(0,r.useEffect)((function(){var e,t,n,r,o,i=me();if(null!=i){var l=null===(t=null===(e=ue.current)||void 0===e?void 0:e.getBoundingClientRect())||void 0===t?void 0:t.height;if(l){var u=be.current;if(null!=u){var a=u.topOfPage,c=u.bottomOfPage,s=(u.middle-a)/(c-a),f=_e(),d=null===(r=null===(n=X[i])||void 0===n?void 0:n.getViewport({scale:f}))||void 0===r?void 0:r.height;if(null!=d){var v={index:i,offset:-l/2+d*s};null===(o=ke.current)||void 0===o||o.scrollToIndex(v)}}}}}),[b]);var xe=(0,M.Z)({cacheId:d+f,onScroll:function(e){v.save_editor_state(f,{scrollState:e}),we(e)},initialState:null===(n=p.get("scrollState"))||void 0===n?void 0:n.toJS()}),ke=(0,r.useRef)(null),_e=(0,r.useCallback)((function(){var e;return b/(null!==(e=c.redux.getStore("account").get("font_size"))&&void 0!==e?e:14)}),[b]);if("rmd"==V&&null!=G&&!G.contains("pdf"))return j.createElement("div",{style:{backgroundColor:"white",margin:"15px",overflowY:"auto"}},"There is no rendered PDF file available. ",function(){if(0!=G.size)return j.createElement(j.Fragment,null,"Instead, you might want to switch to the"," ",(0,u.list_alternatives)(G)," view by selecting it via the dropdown selector above.")}(),j.createElement("hr",null),function(){if(null!=H)return j.createElement(i.Z,{message:j.createElement(o.Markdown,{value:H}),type:"info"})}());var Ee=(0,r.useRef)(null),Pe=(0,r.useCallback)((function(e){Ee.current=e.clientY,le("grabbing")}),[]),Se=(0,r.useCallback)((function(e){var t;if(e.buttons&&null!=Ee.current){var n=Ee.current-e.clientY;null===(t=ke.current)||void 0===t||t.scrollBy({top:n}),Ee.current=e.clientY}}),[]),Re=(0,r.useCallback)((function(){Ee.current=null,le("grab")}),[]);return j.createElement("div",{className:"smc-vfill",style:{overflow:"auto",width:"100%",cursor:ie,textAlign:"center",backgroundColor:Y?A:"white"},ref:ue,onMouseDown:Pe,onMouseMove:Se,onMouseUp:Re},Y?j.createElement("div",{className:"smc-vfill"},function(){var e;if(null==X||0==X.length)return[];var t,n=_e(),r=null===(e=X[0])||void 0===e?void 0:e.getViewport({scale:n}),o=(null!==(t=null==r?void 0:r.height)&&void 0!==t?t:500)+8;return j.createElement(z.OO,F({increaseViewportBy:2e3,ref:ke,defaultItemHeight:o,totalCount:ne.numPages,itemContent:function(e){var t=X[e];if(null==t)return j.createElement("div",{style:{height:"1px"}});var r=e+1;return j.createElement(O,{id:f,actions:v,doc:ne,page:t,n:r,key:r,scale:n,syncHighlight:k({n:r,id:f})})}},xe))}()):Q?j.createElement("div",{style:{fontSize:"20pt",color:a.COLORS.GRAY}},"Missing PDF -- ",x?j.createElement(o.Loading,{text:"Building..."}):j.createElement(j.Fragment,null,j.createElement(o.Icon,{name:"play-circle"})," Build or fix")):j.createElement(o.Loading,{theme:"medium"}))}},26286:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>c});var r=n(63505),o=n(429),i=n(16230),l=n(20812),u=n(67941),a=function(e){e.preventDefault()};document.addEventListener("gesturestart",a),document.addEventListener("gesturechange",a),document.addEventListener("gestureend",a);function c(e){var t=e.target,n=e.min,a=void 0===n?5:n,c=e.max,s=void 0===c?100:c,f=e.onZoom,d=e.throttleMs,v=void 0===d?50:d,p=e.smooth,h=void 0===p?5:p,g=e.disabled,y=e.getFontSize,b=(0,o.s8)(),w=b.actions,m=b.id,x=(0,r.useMemo)((function(){return g?function(){}:(0,l.throttle)((function(e,t){null==f?w.set_font_size(m,e):f({fontSize:e,first:t})}),v)}),[m]),k=(0,r.useMemo)((function(){return g?function(){}:function(e,t){x(e,t)}}),[m]);(0,i.useWheel)((function(e){e.event.ctrlKey&&(e.first?E.current=!0:e.last&&(E.current=!1),e.event.preventDefault(),k(s-e.offset[1]/h,e.first))}),{enabled:!u.IS_MACOS,target:t,eventOptions:{passive:!1,capture:!0},bounds:{top:0,bottom:(s-a)*h},disabled:g});var _=(0,r.useRef)(100),E=(0,r.useRef)(!1);return(0,i.usePinch)((function(e){var t=e.first,n=e.offset;e.first?E.current=!0:e.last&&(E.current=!1),_.current=n[0];var r=(n[0]-1)/1e3;k(a+r*(s-a),t)}),{target:t,scaleBounds:{min:1,max:1001},axis:"x",from:function(){return null!=y?[(y()-a)/(s-a)*1e3+1]:[_.current,0]},disabled:g}),E}},12430:(e,t,n)=>{"use strict";n.d(t,{l:()=>l,v:()=>u});var r=n(24620),o=n(56393),i=n(41780);function l(e){var t=(0,r.path_split)(e),n=(0,r.separate_file_extension)(t.tail);return{directory:t.head,base:n.name,filename:t.tail}}function u(e,t){var n=(0,r.encode_path)(t);return(0,o.join)(i.appBasePath,e,"raw",n)}},56570:(e,t,n)=>{"use strict";n.d(t,{Me:()=>g,j5:()=>y,t$:()=>d});var r=n(48853),o=n.n(r),i=n(56160),l=n(92858),u=n(41780),a=n(35586),c=n(12430),s=n(89550);function f(e,t,n,r,o,i,l){try{var u=e[i](l),a=u.value}catch(e){return void n(e)}u.done?t(a):Promise.resolve(a).then(r,o)}function d(e,t,n){var r=(0,c.v)(e,(0,s.n)(t));return"".concat(r,"?param=").concat(n)}var v,p,h=new(o())({max:1e3,length:function(e){return e.numPages}}),g=(0,i.reuseInFlight)((v=function(e){var t,n;return function(e,t){var n,r,o,i,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;l;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return l.label++,{value:i[1],done:!1};case 5:l.label++,r=i[1],i=[0];continue;case 7:i=l.ops.pop(),l.trys.pop();continue;default:if(!((o=(o=l.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){l=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){l.label=i[1];break}if(6===i[0]&&l.label<o[1]){l.label=o[1],o=i;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(i);break}o[2]&&l.ops.pop(),l.trys.pop();continue}i=t.call(e,l)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}(this,(function(r){switch(r.label){case 0:return void 0!==(t=h.get(e))?[3,2]:(n="pdfjs-dist-".concat(l.dd["pdfjs-dist"]),[4,(0,a.getDocument)({url:e,cMapUrl:"".concat(u.appBasePath,"/cdn/").concat(n,"/cmaps/"),cMapPacked:!0,disableStream:!0,disableAutoFetch:!0}).promise]);case 1:t=r.sent(),h.set(e,t),r.label=2;case 2:return[2,t]}}))},p=function(){var e=this,t=arguments;return new Promise((function(n,r){var o=v.apply(e,t);function i(e){f(o,n,r,i,l,"next",e)}function l(e){f(o,n,r,i,l,"throw",e)}i(void 0)}))},function(e){return p.apply(this,arguments)}));function y(e){h.del(e)}},86099:(e,t,n)=>{var r=n(35586),o=n(44718).Z;window.PdfjsWorker=o,r.GlobalWorkerOptions.workerPort=new o},89550:(e,t,n)=>{"use strict";n.d(t,{n:()=>o,q:()=>i});var r=n(24620);function o(e){var t=(0,r.separate_file_extension)(e),n=t.name;return"pdf"==t.ext.toLowerCase()?e:"".concat(n,".pdf")}function i(e,t){e=e.trim();var n="'".concat(t,"'"),r=e.indexOf("'");if(-1==r){var o=e.lastIndexOf(" ");return-1==o?e:e.slice(0,o)+" "+n}return e.slice(0,r).trim()+" "+n}},44718:(e,t,n)=>{"use strict";function r(){return new Worker(n.p+"pdf.worker.cd8a82915d268b3af2c3.worker.js")}n.d(t,{Z:()=>r})},84663:()=>{},70172:()=>{},2001:()=>{},33779:()=>{},66558:()=>{},82258:()=>{}}]);