bloom-player 2.22.0-alpha.3 → 2.23.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -7979,7 +7979,7 @@ Add a <Suspense fallback=...> component higher in the tree to provide a loading
|
|
|
7979
7979
|
display:none !important;
|
|
7980
7980
|
}
|
|
7981
7981
|
`.replace(`
|
|
7982
|
-
`,"").replace("\r","")}function FM(e){const t=e.lastIndexOf("/"),n=e.lastIndexOf("%2f");let a;t>n?a=e.substring(t+1,e.length):a=e.substring(n+3,e.length);const r=a.endsWith(".htm"),l=r?e:e+"/"+a+".htm",d=r?e.substring(0,Math.max(t,n)):e;return{urlOfBookHtmlFile:l,urlPrefix:d}}function Vu(e,t){return t+"/"+e}async function WM(e,t){const n=zi.get(Vu(".distribution",t)).then(k=>k,k=>({data:""})),a=zi.get(e),r=zi.get(Vu("meta.json",t)),[l,d,f]=await Promise.all([a,r,n]);return{bookHtmlElement:new DOMParser().parseFromString(l?.data,"text/html").documentElement,metaDataObject:d?.data,distributionSource:f.data}}function _M(e){const t={};for(let n=0;n<e.attributes.length;n++)t[e.attributes.item(n).nodeName]=e.attributes.item(n).nodeValue;return t}function VM(e,t){const n=e.ownerDocument.evaluate(".//*[@src]",e,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);for(let l=0;l<n.snapshotLength;l++){const d=n.snapshotItem(l);if(!d)continue;const f=d.getAttribute("src"),p=Vu(f,t);d.setAttribute("src",p)}const a=e.ownerDocument.evaluate(".//*[@style]",e,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null),r=new RegExp(/background-image:url\(['"](.*)['"]\)/);for(let l=0;l<a.snapshotLength;l++){const d=a.snapshotItem(l);if(!d)continue;const f=d.getAttribute("style")||"",p=r.exec(f);if(!p)continue;const y=Vu(p[1],t),k=f.replace(r,"");d.setAttribute("style",k),d.setAttribute("data-background",y),d.classList.add("swiper-lazy")}}function rp(e){const n=(e.getAttribute("class")||"").match(/\b\S*?(Portrait|Landscape)\b/);return n&&n.length?n[0]:""}function GM(e,t,n,a,r){let l=!1;const d=rp(e);if(d){l=t?n:d.endsWith("Landscape");let f="";a?f=l?r.replace("Portrait","Landscape"):r.replace("Landscape","Portrait"):f=l?"Device16x9Landscape":"Device16x9Portrait",d!==f&&(e.classList.remove(d),e.classList.add(f))}return l}function UM(e,t){e.querySelectorAll(".coverBottomBookTopic, .coverBottomLangName").forEach(n=>{t||n.classList.contains("bloom-content1")?n.classList.remove("do-not-display"):n.classList.add("do-not-display")})}function YM(e){const t=e.getElementsByClassName("bloom-canvas");if(t&&t.length>0)return Array.from(t);const n=e.getElementsByClassName("bloom-imageContainer");return Array.from(n).filter(a=>a.parentElement.closest(".bloom-imageContainer")===null)}function XM(e,t){if(!(!t||!e))try{const n=t;YM(e).forEach(a=>{Array.from(a.querySelectorAll(dl)).forEach(l=>{const d=Array.from(l.getElementsByClassName("bloom-editable")).find(f=>f.getAttribute("lang")===n);if(d){const f=d.getAttribute("data-bubble-alternate");if(f){const p=JSON.parse(f.replace(/`/g,'"'));l.setAttribute("style",p.style)}}});const r=Array.from(a.getElementsByClassName("comical-alternate")).find(l=>l.getAttribute("data-lang")===n);if(r){const l=a.getElementsByClassName("comical-generated")[0];l&&(l.classList.remove("comical-generated"),l.classList.add("comical-alternate"),l.style.display="none"),r.classList.remove("comical-alternate"),r.classList.add("comical-generated"),r.style.removeProperty("display")}})}catch(n){console.error(n)}}function ZM(e,t){return e.localeCompare(t,"en-US",{sensitivity:"accent"})===0}function JM(e,t,n,a){if(!t||!e)return;const r=n[0]===t||!t,l=t,d=e.ownerDocument.evaluate(".//div[contains(@class, 'bloom-translationGroup')]",e,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null),f="bloom-visibility-code-on";for(let p=0;p<d.snapshotLength;p++){const y=d.snapshotItem(p),k=y.getAttribute("data-default-languages"),E=k?k.split(/,| /):[],N=E==null||E.length===0||!E[0]||E.includes("V")||E.includes("L1")||ZM(E[0],"auto"),I=y.childNodes;for(let L=0;L<I.length;L++){const K=I.item(L);!K||!K.classList||!K.classList.contains("bloom-editable")||(a&&K.setAttribute("data-original-class",K.getAttribute("class")||""),r?K.setAttribute("class",K.getAttribute("data-original-class")||""):N&&(K.getAttribute("lang")===l?(K.classList.add(f),Array.from(K.classList).forEach(F=>{F.startsWith("bloom-content")&&K.classList.remove(F)}),K.classList.add("bloom-content1"),K.classList.add("bloom-contentFirst")):K.classList.remove(f)))}}}const lc=[];function QM(){return lc.length>0}function tA(e){const t=lc.pop();if(t)return{bookUrl:e===t.bookId?void 0:bh(t.bookId),pageId:t.pageId}}function eA(e,t,n){const a=e.target.closest("[href], [data-href]");if(!a)return;e.preventDefault(),e.stopPropagation();const r=(a.getAttribute("href")||a.getAttribute("data-href"))??void 0;if(!r)return;if(r.startsWith("http://")||r.startsWith("https://")){window.open(r,"_blank","noreferrer");return}let l,d;if(r==="back"){const p=lc.pop();return p?{bookUrl:t===p.bookId?void 0:bh(p.bookId),pageId:p.pageId}:void 0}else if(r.startsWith("/book/")){const p=nA(r);l=p.bookId,d=p.pageId,p.bookId===t&&(l=void 0)}else r.startsWith("#")&&(d=r.substring(1));const f=n();if(l)return zv(t,f),{bookUrl:bh(l),pageId:d};if(d)return zv(t,f),{pageId:d}}function zv(e,t,n){lc.push({bookId:e,pageId:t})}function bh(e){return`/book/${e}/index.htm`}function nA(e){try{const t=new URL(e,window.location.origin);if(!t.pathname.startsWith("/book/"))throw new Error("Invalid book URL format");const n=t.pathname.replace("/book/",""),a=t.hash.replace("#","");return{bookId:n,pageId:a}}catch(t){return console.error("Error parsing book URL:",t),{bookId:void 0,pageId:void 0}}}const aA="2.22.0-alpha.3",iA={version:aA},nr="#d65649",rA="#2e2e2e",oA="#febf00",Wb=ul({palette:{primary:{main:rA,contrastText:nr},secondary:{main:nr}}});function _b(){var e=iA.version;return e}const sA=({getBookInstanceId:e})=>{const[t,n]=R.useState(!1),a=_b(),r=new Date("2026-11-16T22:32:41.826Z").toLocaleDateString();if(R.useEffect(()=>{const d=p=>{p.key==="Control"&&n(!0)},f=p=>{p.key==="Control"&&n(!1)};return window.addEventListener("keydown",d),window.addEventListener("keyup",f),()=>{window.removeEventListener("keydown",d),window.removeEventListener("keyup",f)}},[]),!t)return null;const l=e?.();return Rt.createElement("div",{className:"diagnostic-info-control",style:{color:nr,fontFamily:"sans-serif",padding:"5px",zIndex:1e3,lineHeight:"1.5"}},Rt.createElement("div",null,"Bloom Player v",a," (built ",r,")"),Rt.createElement("div",null,"Book ID: ",l??""))},lA=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,Iv=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");const t=e.match(lA);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},Dv=e=>e==="*"||e==="x"||e==="X",Rv=e=>{const t=parseInt(e,10);return isNaN(t)?e:t},uA=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],cA=(e,t)=>{if(Dv(e)||Dv(t))return 0;const[n,a]=uA(Rv(e),Rv(t));return n>a?1:n<a?-1:0},jv=(e,t)=>{for(let n=0;n<Math.max(e.length,t.length);n++){const a=cA(e[n]||"0",t[n]||"0");if(a!==0)return a}return 0},Ov=(e,t)=>{const n=Iv(e),a=Iv(t),r=n.pop(),l=a.pop(),d=jv(n,a);return d!==0?d:r&&l?jv(r.split("."),l.split(".")):r||l?r?-1:1:0},wh=new rr;class op extends R.Component{constructor(t,n){super(t,n),this.activityManager=new dP,this.initialPages=["loading..."],this.initialStyleRules="",this.originalPageClass="Device16x9Portrait",this.bookInfo=new yh,this.bookInteraction=new KM,this.mustUseOriginalPageSize=!1,this.indicesOfPagesWhereWeShouldPreserveDOMState={},this.startingUpSwiper=!0,this.pendingTimeouts=new Set,this.state={pages:this.initialPages,pageIdToIndexMap:{},styleRules:this.initialStyleRules,importedBodyAttributes:{},currentSwiperIndex:0,isLoading:!0,loadFailed:!1,loadErrorHtml:"",ignorePhonyClick:!1,isFinishUpForNewBookComplete:!1,inPauseForced:!1,bookUrl:""},this.isPagesLocalized=!1,this.currentPage=null,this.currentPageHidesNavigationButtons=!1,this.handleWindowFocusEvent=()=>this.handleWindowFocus(),this.handleWindowBlurEvent=()=>this.handleWindowBlur(),this.handlePointerDownCapture=r=>{(r.target.closest("[href], [data-href]")||r.target.closest(".bloom-videoContainer")&&!r.target.closest("[data-draggable-id]"))&&(r.stopPropagation(),r.preventDefault())},this.handleDragStartCapture=r=>{this.activityManager.getActivityAbsorbsDragging()||r.preventDefault()},this.handleDocumentLevelKeyDown=r=>{r.key==="Home"&&(this.goToFirstPage(),r.preventDefault()),r.key==="End"&&(this.goToLastPage(),r.preventDefault())},this.distributionSource="",this.finishUpCalled=!1,this.hasImageDescriptions=!1,this.handlePageVideoComplete=r=>{r.page===this.currentPage&&this.playAudioAndAnimation(r.page)},this.handlePlayFailed=()=>{this.setState({inPauseForced:!0}),this.props.setForcedPausedCallback&&this.props.setForcedPausedCallback(!0)},this.handlePlayUnblocked=()=>{this.state.inPauseForced&&this.props.setForcedPausedCallback&&this.props.setForcedPausedCallback(!1),this.setState({inPauseForced:!1})},this.handlePlayCompleted=()=>{Yn(Cn.MediaFinished),this.props.imageDescriptionCallback(!1)},this.handleToggleImageDescription=r=>{this.props.imageDescriptionCallback(r)},this.handlePageNarrationComplete=r=>{if(r&&(Yn(Cn.MediaFinished),this.shouldAutoPlay())){const l=this.props.autoplayCount??0,d=this.state.startPageIndex??0,f=this.swiperInstance.slides.length-1;let p=this.props.autoplayCount?Math.min(d+l-1,f):f;this.swiperInstance.activeIndex>=p?(this.music.pause(),this.props.shouldReportSoundLog&&dS(),uS(),ZS({})):this.swiperInstance.slideNext()}},this.skipAutoPlay=!1,this.sentBloomNotification=!1;const a=t.url.startsWith("http")?new URL(t.url):new URL(t.url,window.location.origin);a.hash?(this.state.startPageId=a.hash.substring(1),a.hash=""):this.state.startPageIndex=t.startPageIndex,this.state.bookUrl=a.href,this.legacyQuestionHandler=new hP(t.locationOfDistFolder)}setPlayerTimeout(t,n){const a=window.setTimeout(()=>{this.pendingTimeouts.delete(a),t()},n);this.pendingTimeouts.add(a)}componentDidMount(){wn.setUp(),nx(this),window.addEventListener("focus",this.handleWindowFocusEvent),window.addEventListener("blur",this.handleWindowBlurEvent),document.addEventListener("keydown",this.handleDocumentLevelKeyDown),document.addEventListener("pointerdown",this.handlePointerDownCapture,{capture:!0}),document.addEventListener("dragstart",this.handleDragStartCapture,{capture:!0}),this.componentDidUpdate(this.props,this.state)}CanGoBack(){return QM()}HandleBackButtonClickedIfHavePlayerHistory(){const t=this.getBookIdFromBookUrlForHistory(this.state.bookUrl)||this.bookInfo.bookInstanceId,n=tA(t);return n?(this.navigate(n.bookUrl,n.pageId),!0):!1}navigate(t,n){if(t){const a=new URL(t,this.state.bookUrl);this.setState({bookUrl:a.href,startPageId:n,startPageIndex:void 0})}else if(n!==void 0){const a=this.state.pageIdToIndexMap[n];this.swiperInstance.slideTo(a)}}getBookIdFromBookUrlForHistory(t){if(t)try{const a=new URL(t,window.location.href).pathname.match(/^\/book\/([^/]+)\/index\.htm$/i);return a?a[1]:void 0}catch{return}}handleWindowFocus(){const t=localStorage.getItem(Ru),n=localStorage.getItem(Lm);t&&n==this.sourceUrl&&(this.bookInteraction.beginReadTime=Date.now()-parseInt(t,10))}handleWindowBlur(){const t=Date.now()-this.bookInteraction.beginReadTime;localStorage.setItem(Ru,t.toString()),localStorage.setItem(Lm,this.sourceUrl)}getRequiredVersionMessage(t){const n=t.querySelector('meta[name="FeatureRequirement"]')?.getAttribute("content");if(!n)return"";const a=/BloomPlayerMinVersion":"(.*?)".*?"FeatureId":"(.*?)"/g;let r,l=null,d=null;for(;(r=a.exec(n))!==null;){const p=r[1];(!l||Ov(p,l)>0)&&(l=p,d=r[2])}if(!l||!d)return"";const f=_b();if(Ov(f,l)>=0)return"";if(window.location.hostname.toLowerCase().indexOf("bloomlibrary.org")>=0)return wn.getTranslation("Version.Problem.Web",this.props.preferredUiLanguages,"This book uses the feature {feature}. Unfortunately, {hostname} is not ready to display this book yet. Please check back again later or write to issues@bloomlibrary.org if you think this is unexpected.").replace("{feature}",d).replace("{hostname}",window.location.hostname);{let p=Oa("host","");switch(p){case"bloomreader":p="Bloom Reader";break;case"bloompubviewer":p="BloomPUB Viewer";break;case"readerapp":p="";break}return p?wn.getTranslation("Version.Problem.Host",this.props.preferredUiLanguages,"This book uses the feature {feature} and requires a newer version of {host} to read it. Please upgrade to the latest version.").replace("{feature}",d).replace("{host}",p):wn.getTranslation("Version.Problem.NoHost",this.props.preferredUiLanguages,"This book uses the feature {feature} and requires a newer version of the program you are using to read it. Please upgrade to the latest version.").replace("{feature}",d)}}componentDidUpdate(t,n){try{if(!this.props.url||this.state.loadFailed&&n.bookUrl===this.state.bookUrl)return;this.initializeMedia();const a=this.preprocessUrl();if(a&&a!=="/working"&&a!==this.sourceUrl){this.finishUpCalled=!1,this.setState({isLoading:!0,loadFailed:!1}),this.metaDataObject=void 0,this.htmlElement=void 0,this.sourceUrl=a;const{urlOfBookHtmlFile:r,urlPrefix:l}=FM(this.sourceUrl);this.urlPrefix=l,this.music.urlPrefix=l,sx(l),WM(r,l).then(d=>{const{bookHtmlElement:f}=d;this.metaDataObject=d.metaDataObject,this.distributionSource=d.distributionSource;const p=this.getRequiredVersionMessage(f.ownerDocument);this.setState({requiredVersion:p});const y=f.getElementsByTagName("body")[0];this.mustUseOriginalPageSize=this.computeMustUseOriginalPageSize(y),this.bookInfo.setSomeBookInfoFromBody(y),this.localizeOnce(),this.props.shouldReportSoundLog&&(this.videoList=this.getVideoList(f.ownerDocument)),this.animation.PlayAnimations=this.bookInfo.playAnimations,this.setState({importedBodyAttributes:_M(y)}),this.makeNonEditable(y),this.htmlElement=f;const k=f.getElementsByClassName("bloom-page")[0];this.originalPageClass="Device16x9Portrait",k&&(this.originalPageClass=rp(k)),this.legacyQuestionHandler.generateQuizPagesFromLegacyJSON(this.urlPrefix,y,this.originalPageClass,()=>{this.finishUp()})}).catch(d=>this.HandleLoadingError(d))}else if(t.landscape!==this.props.landscape||t.useOriginalPageSize!==this.props.useOriginalPageSize||t.autoplay!==this.props.autoplay){const r=document.getElementsByClassName("bloom-page");for(let l=0;l<r.length;l++){const d=r[l];this.applyPageSizeClass(d)}}!this.state.isLoading&&(n.isLoading||t.activeLanguageCode!==this.props.activeLanguageCode)&&(JM(this.htmlElement,this.props.activeLanguageCode,this.bookInfo.getPreferredTranslationLanguages(),n.isLoading),XM(this.htmlElement,this.props.activeLanguageCode),this.finishUpCalled&&this.finishUp(!1)),this.state.currentSwiperIndex!=n.currentSwiperIndex&&this.rootDiv?.querySelectorAll(ip).forEach(r=>{const l=fl(r).getNiceScroll();l&&l.length>0&&l.remove()}),!this.state.isLoading&&(n.isLoading||t.shouldReadImageDescriptions!==this.props.shouldReadImageDescriptions)&&this.finishUpCalled&&(this.setIndex(this.state.currentSwiperIndex),this.showingPage(this.state.currentSwiperIndex)),this.state.isFinishUpForNewBookComplete&&t.landscape!==this.props.landscape&&(this.setIndex(this.state.currentSwiperIndex),this.showingPage(this.state.currentSwiperIndex)),t.paused!==this.props.paused&&this.handlePausePlay(),this.swiperInstance&&this.swiperInstance.lazy.load()}catch(a){this.setState({isLoading:!1,loadFailed:!0,loadErrorHtml:a.message})}}HandleLoadingError(t){let a=`<p>There was a problem displaying this book: ${t.message}<p>`;const r=!!t.config?.url&&new URL(t.config.url,window.location.href).pathname.startsWith("/book/");r?a="<p>We could not find that book.</p>":(t.config&&t.config.url&&t.config.url.startsWith("file://")||t.message.indexOf("404")>=0)&&(a="<p>This book (or some part of it) was not found.<p>",t.config&&t.config.url&&(a+=`<p class='errorDetails'>${dA(t.config.url)}</p>`)),this.setState({isLoading:!1,loadFailed:!0,loadErrorHtml:a}),r&&wh.raise()}async finishUp(t=!0){if(this.finishUpCalled=!0,!this.htmlElement)return;Qs.setAllVideoPostersTo1x1TransparentPNG(this.htmlElement);const n=this.htmlElement.getElementsByClassName("bloom-page"),a=[];t&&(this.bookInfo.totalNumberedPages=0,this.bookInfo.questionCount=0,this.activityManager.collectActivityContextForBook(n),this.bookInteraction.clearPagesShown(),this.music.processAllMusicForBook(n));const r=this.bookInfo.getPreferredTranslationLanguages(),l=r[0]===this.props.activeLanguageCode||!this.props.activeLanguageCode,d={},f=y=>y.classList.contains("bloom-interactive-page")||y.classList.contains("simple-comprehension-quiz")||y.getAttribute("data-activity")=="iframe"||y.getElementsByClassName("questions").length>0;d.length=0,d.cover=0;for(let y=0;y<n.length;y++){const k=n[y],E=k.getAttribute("id");E&&(d[E]=y);const N=this.applyPageSizeClass(k);k.setAttribute("data-index",y.toString(10)),y===0&&this.props.reportBookProperties&&this.props.reportBookProperties({landscape:N,canRotate:this.bookInfo.canRotate,preferredLanguages:r,pageNumbers:Array.from(n).map(L=>L.getAttribute("data-page-number")??""),isRtl:this.metaDataObject.isRtl,internalUrl:this.state.bookUrl}),t&&(VM(k,this.urlPrefix),k.classList.contains("numberedPage")&&(this.indexOflastNumberedPage=y,this.bookInfo.totalNumberedPages++),(k.getAttribute("data-analyticscategories")||k.getAttribute("data-analyticsCategories"))==="comprehension"&&this.bookInfo.questionCount++),UM(k,l);const I=f(k);I&&this.activityManager.initializePageHtml(this.urlPrefix,k,a.length),(!this.props.skipActivities||!I)&&a.push(k.outerHTML)}if(t){const y=this.htmlElement.getElementsByTagName("head")[0];this.bookInfo.setSomeBookInfoFromHead(y);const k=this.htmlElement.getElementsByTagName("body")[0];if(this.metaDataObject&&(this.bookInfo.setSomeBookInfoFromMetadata(this.metaDataObject,k),this.reportBookOpened(k)),this.props.controlsCallback){const E=sl.createLangDataArrayFromDomAndMetadata(k,this.metaDataObject);this.hasImageDescriptions=fA(k),this.props.controlsCallback(E,this.hasImageDescriptions,N=>{this.swiperInstance?.slideTo(N)})}}if(t){var p;try{p=await qM(this.htmlElement,this.urlPrefix,this.bookInfo,()=>this.legacyQuestionHandler.getPromiseForAnyQuizCss())}catch(y){this.HandleLoadingError(y),p=""}if(this.startingUpSwiper=!0,this.state.startPageId){if(d[this.state.startPageId]===void 0)throw new Error(`Page ID ${this.state.startPageId} not found in the current pageIdToIndexMap`);this.setState({startPageIndex:d[this.state.startPageId]})}this.setState({pages:a,pageIdToIndexMap:d,styleRules:p,isLoading:!1,currentSwiperIndex:this.state.startPageIndex??0})}else this.setState({pages:a,isLoading:!1});this.props.pageStylesAreNowInstalled(),t?this.setPlayerTimeout(()=>{this.setState({isFinishUpForNewBookComplete:!0});const y=this.startingUpSwiper;this.startingUpSwiper=!1;var k=this.state.startPageIndex??0;this.setIndex(k),this.showingPage(k),y&&this.swiperInstance&&this.addScrollbarsToPageWhenReady(this.swiperInstance.activeIndex);const E=document.getElementsByClassName("swiper-button-next")[0];document.getElementsByClassName("swiper-button-prev")[0]?.setAttribute("tabindex","4"),E?.setAttribute("tabindex","5"),this.shouldFocusNextButtonForNewBook()&&E?.focus()},500):this.currentPage&&this.setPlayerTimeout(()=>{this.setIndex(this.currentPageIndex),this.showingPage(this.currentPageIndex)},200)}shouldFocusNextButtonForNewBook(){return window.self===window.top||document.referrer.startsWith("http://localhost:")?!0:document.referrer.includes("bloomlibrary.org/player/")}localizeOnce(){!this.isPagesLocalized&&this.state.pages!==this.initialPages&&this.state.styleRules!==this.initialStyleRules&&(wn.localizePages(document.body,this.bookInfo.getPreferredTranslationLanguages()),this.isPagesLocalized=!0)}initializeMedia(){this.video||(this.video=new Qs,this.video.PageVideoComplete=new rr,this.video.PageVideoComplete.subscribe(this.handlePageVideoComplete)),this.animation||(this.animation=new Mu),Ko.subscribe(this.handlePageNarrationComplete),il.subscribe(this.handlePlayFailed),Vf.subscribe(this.handlePlayUnblocked),al.subscribe(this.handlePlayCompleted),ix(this.storeAudioAnalytics.bind(this)),qo.subscribe(this.handleToggleImageDescription.bind(this)),rx(()=>this.swiperInstance?.animating),ox(t=>Ny(t,1)),this.music||(this.music=new fS,this.music.PlayFailed=new rr,this.music.PlayFailed.subscribe(()=>{this.setState({inPauseForced:!0}),this.props.setForcedPausedCallback&&this.props.setForcedPausedCallback(!0)}))}preprocessUrl(){let t=this.state.bookUrl;if(t===void 0||t.trim()==="")throw new Error("The url parameter was empty. It should point to the url of a book.");return t.endsWith("/")&&(t=t.substring(0,t.length-1)),t.endsWith("%2f")&&(t=t.substring(0,t.length-3)),t}handlePausePlay(){this.props.paused?this.pauseAllMultimedia():this.currentPage!==oy()||oa===Cn.MediaFinished?this.resetForNewPageAndPlay(this.currentPage):oa===Cn.VideoPaused?this.video.play():(jx(),this.animation.resumeAnimation(),this.music.play())}computeMustUseOriginalPageSize(t){return this.props.useOriginalPageSize||t.querySelector(".bloom-canvas-element")?!0:!!t.querySelector(".bloom-textOverPicture")}componentWillUnmount(){this.pauseAllMultimedia(),window.removeEventListener("focus",this.handleWindowFocusEvent),window.removeEventListener("blur",this.handleWindowBlurEvent),document.removeEventListener("keydown",this.handleDocumentLevelKeyDown),document.removeEventListener("pointerdown",this.handlePointerDownCapture,{capture:!0}),document.removeEventListener("dragstart",this.handleDragStartCapture,{capture:!0}),this.unsubscribeAllEvents(),this.pendingTimeouts.forEach(t=>window.clearTimeout(t)),this.pendingTimeouts.clear(),ax(this)}unsubscribeAllEvents(){this.video.PageVideoComplete.unsubscribe(this.handlePageVideoComplete),Ko.unsubscribe(this.handlePageNarrationComplete),il.unsubscribe(this.handlePlayFailed),Vf.unsubscribe(this.handlePlayUnblocked),al.unsubscribe(this.handlePlayCompleted),qo.unsubscribe(this.handleToggleImageDescription)}pauseAllMultimedia(){oa===Cn.VideoPlaying?this.video.pause():oa===Cn.AudioPlaying&&(Ox(),this.animation.PauseAnimation()),this.music.pause()}reportBookOpened(t){const n=this.bookInfo.getAmbientAnalyticsProps();this.distributionSource&&(n.distributionSource=this.distributionSource),YS(n),By("BookOrShelf opened",{})}sendUpdateOfBookProgressReportToExternalContext(){const t=this.bookInteraction.getProgressReportPropertiesForAnalytics();JS("Pages Read",t)}makeNonEditable(t){const n=t.ownerDocument.evaluate(".//*[@contenteditable]",t,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);for(let a=0;a<n.snapshotLength;a++)n.snapshotItem(a).removeAttribute("contenteditable")}applyPageSizeClass(t){return GM(t,this.bookInfo.canRotate,this.props.landscape,this.mustUseOriginalPageSize,this.originalPageClass)}goToFirstPage(){this.swiperInstance.slideTo(0)}goToLastPage(){this.swiperInstance.slideTo(99999)}getRootDiv(){return this.rootDiv}slideNext(){this.swiperInstance&&this.swiperInstance.slideNext()}slidePrevious(){this.swiperInstance&&this.swiperInstance.slidePrev()}getBookInstanceId(){return this.bookInfo.bookInstanceId}getPlayerOptionsForPage(t){if(!t)return;let n=t.getAttribute("data-player-options");if(n)try{return n=n.replace(/'/g,'"'),JSON.parse(n)}catch(a){console.log("getPlayerOptionsForPage failed to parse json: "+n+" with error "+a.message);return}}render(){const t=this.activityManager.getActivityAbsorbsDragging();if(this.state.isLoading)return R.createElement(DP,{className:"loadingSpinner",color:"secondary"});if(this.state.loadFailed)return R.createElement(R.Fragment,null,R.createElement(x1,{className:"loadFailedIcon",color:"secondary"}),R.createElement("div",{className:"loadErrorMessage",dangerouslySetInnerHTML:{__html:this.state.loadErrorHtml}}));if(this.state.requiredVersion)return R.createElement("div",{className:"requiredVersionMessage"},this.state.requiredVersion);hx(this.props.shouldReadImageDescriptions&&this.hasImageDescriptions);const n={getSwiper:r=>{this.swiperInstance=r,this.metaDataObject?.isRtl&&this.swiperInstance&&(this.swiperInstance.el?.setAttribute("dir","rtl"),this.swiperInstance.rtl=!0,this.swiperInstance.rtlTranslate=!0)},simulateTouch:!0,touchStartPreventDefault:!1,on:{slideChange:()=>{this.state.inPauseForced&&(this.props.setForcedPausedCallback&&this.props.setForcedPausedCallback(!1),this.setState({inPauseForced:!1})),this.startingUpSwiper||this.showingPage(this.swiperInstance.activeIndex)},slideChangeTransitionStart:()=>{this.startingUpSwiper||this.setIndex(this.swiperInstance.activeIndex)},slideChangeTransitionEnd:()=>{this.addScrollbarsToPageWhenReady(this.swiperInstance.activeIndex)}},keyboard:{enabled:!0,onlyInViewport:!1},preloadImages:!1,lazy:{loadPrevNext:!0,loadOnTransitionStart:!0,loadPrevNextAmount:2},shouldSwiperUpdate:!0};this.startingUpSwiper&&(n.activeSlideKey=this.state.startPageIndex?.toString());let a="bloomPlayer";return this.currentPageHidesNavigationButtons?a+=" hideNextPrevButtons extraScalingForChrome85Bug":(this.props.outsideButtonPageClass&&(a+=" "+this.props.outsideButtonPageClass),t&&(a+=" showNavigationButtonsEvenOnTouchDevices")),R.createElement("div",{"aria-label":"Player Content",className:a+(this.props.extraClassNames?" "+this.props.extraClassNames:""),ref:r=>this.rootDiv=r},R.createElement(Q0,{key:this.shouldAutoPlay()?"fade":"slide",...n,effect:this.shouldAutoPlay()?"fade":"slide"},this.state.pages.map((r,l)=>{const f=Math.abs(l-this.state.currentSwiperIndex)<2||this.indicesOfPagesWhereWeShouldPreserveDOMState[l];return R.createElement("div",{key:l,className:"page-preview-slide",onClick:p=>this.handlePageClick(p)},f?R.createElement(R.Fragment,null,R.createElement("style",{scoped:!0},this.state.styleRules),R.createElement("div",{...this.state.importedBodyAttributes,className:`bloomPlayer-page ${this.bookInfo.hasAppearanceSystem?"appearance-system":""} ${this.state.importedBodyAttributes.class??""}`,dangerouslySetInnerHTML:{__html:r}})):"")})),R.createElement("div",{className:"swiper-button-prev "+(this.metaDataObject.isRtl?"swiper-button-right":"swiper-button-left")+(this.props.hideSwiperButtons||this.state.currentSwiperIndex===0?" swiper-button-disabled":""),onClick:()=>this.slidePrevious(),onTouchStart:r=>{this.setState({ignorePhonyClick:!0})}},R.createElement(pi,{className:"nav-button",disableRipple:!0},this.metaDataObject.isRtl?R.createElement(gv,{titleAccess:wn.getTranslation("Button.Prev",this.props.preferredUiLanguages,"Previous Page")}):R.createElement(hv,{titleAccess:wn.getTranslation("Button.Prev",this.props.preferredUiLanguages,"Previous Page")}))),R.createElement("div",{className:"swiper-button-next "+(this.metaDataObject.isRtl?"swiper-button-left":"swiper-button-right")+(this.props.hideSwiperButtons||this.state.currentSwiperIndex>=this.state.pages.length-1?" swiper-button-disabled":""),onClick:()=>this.slideNext(),onTouchStart:r=>{this.setState({ignorePhonyClick:!0})}},R.createElement(pi,{className:"nav-button",disableRipple:!0},this.metaDataObject.isRtl?R.createElement(hv,{titleAccess:wn.getTranslation("Button.Next",this.props.preferredUiLanguages,"Next Page")}):R.createElement(gv,{titleAccess:wn.getTranslation("Button.Next",this.props.preferredUiLanguages,"Next Page")}))))}shouldAutoPlay(){var t=this.bookInfo.autoAdvance&&this.props.landscape;return this.props.autoplay==="yes"?t=!0:this.props.autoplay==="no"&&(t=!1),t&&!this.skipAutoPlay}setIndex(t){if(this.state.isLoading||this.startingUpSwiper)return;this.setState({currentSwiperIndex:t});const n=this.getPageAtSwiperIndex(t);n&&(this.applyPageSizeClass(n),this.animation.HandlePageBeforeVisible(n),this.video.hidingPage(),this.video.HandlePageBeforeVisible(n),qx(),this.music.hidingPage(),oa===Cn.AudioPaused||oa===Cn.VideoPaused?Yn(Cn.NewPageMediaPaused):(this.skipAutoPlay=!0,Nx(),this.skipAutoPlay=!1,Yn(Cn.NewPage)))}getPageAtSwiperIndex(t){if(this.swiperInstance==null)return null;const n=this.swiperInstance.slides[t];return n?n.getElementsByClassName("bloom-page")[0]:null}getPageIdFromIndex(t){const n=this.getPageAtSwiperIndex(t);if(!n)throw new Error("No bloomPage at index "+t);return n.getAttribute("id")}getCurrentPage(){return this.currentPage}isXmatterPage(){const t=this.currentPage;if(!t)return!0;const n=t.getAttribute("class");return!n||n.indexOf("bloom-page")<0||n.indexOf("bloom-backMatter")>=0||n.indexOf("bloom-frontMatter")>=0?!0:t.hasAttribute("data-xmatter-page")}showingPage(t){if(this.state.isLoading||this.startingUpSwiper)return;this.props.pageChanged&&this.props.pageChanged(t);const n=this.getPageAtSwiperIndex(t);if(!n){this.swiperInstance&&this.setPlayerTimeout(()=>this.showingPage(t),50);return}const a=this.getPlayerOptionsForPage(n);this.currentPageHidesNavigationButtons=!!(a&&a.hideNavigation),this.props.hidingNavigationButtonsCallback&&this.props.hidingNavigationButtonsCallback(this.currentPageHidesNavigationButtons),this.activityManager.showingPage(t,n)&&(this.indicesOfPagesWhereWeShouldPreserveDOMState[t]=!0),this.setPlayerTimeout(()=>{this.currentPage=n,this.currentPageIndex=t,this.currentPageHasVideo=Qs.pageHasVideo(n),this.applyPageSizeClass(n),this.resetForNewPageAndPlay(n),this.props.paused&&this.animation.shouldAnimate(n)&&(this.animation.HandlePageBeforeVisible(n),this.animation.HandlePageVisible(n,this.props.paused),this.animation.HandlePageDurationAvailable(n,nm(n),this.props.paused)),this.isXmatterPage()||(this.bookInteraction.pageShown(t),t===this.indexOflastNumberedPage&&(this.bookInteraction.lastNumberedPageWasRead=!0)),this.props.reportPageProperties&&this.props.reportPageProperties({hasAudio:Rx(n),hasMusic:this.music.pageHasMusic(n),hasVideo:this.currentPageHasVideo}),this.bookInteraction.reportedAudioOnCurrentPage=!1,this.bookInteraction.reportedVideoOnCurrentPage=!1,this.sendUpdateOfBookProgressReportToExternalContext(),this.swiperInstance.params.noSwiping=this.activityManager.getActivityAbsorbsDragging(),this.swiperInstance.params.touchRatio=this.activityManager.getActivityAbsorbsDragging()?0:1,this.activityManager.getActivityAbsorbsTyping()?this.swiperInstance.keyboard.disable():this.swiperInstance.keyboard.enable(),Array.from(n.querySelectorAll("[data-sound]")).forEach(l=>{l.addEventListener("click",Jh)})},0)}addScrollbarsToPageWhenReady(t){if(this.state.isLoading||this.startingUpSwiper)return;const n=this.getPageAtSwiperIndex(t);if(!n){this.swiperInstance&&this.setPlayerTimeout(()=>this.addScrollbarsToPageWhenReady(t),50);return}V1(n,op.handlePointerMoveEvent)}static handlePointerMoveEvent(t){t.pointerType==="mouse"&&t.target?.closest(".nicescroll-cursors")&&t.stopPropagation()}storeAudioAnalytics(t){t<.001||Number.isNaN(t)||(this.bookInteraction.totalAudioDuration+=t,!this.isXmatterPage()&&(this.bookInteraction.reportedAudioOnCurrentPage||(this.bookInteraction.reportedAudioOnCurrentPage=!0,this.bookInteraction.audioPageShown(this.currentPageIndex)),this.sendUpdateOfBookProgressReportToExternalContext()))}storeVideoAnalytics(t){t<.001||(this.bookInteraction.totalVideoDuration+=t,!this.bookInteraction.reportedVideoOnCurrentPage&&!this.isXmatterPage()&&(this.bookInteraction.reportedVideoOnCurrentPage=!0,this.bookInteraction.videoPageShown(this.currentPageIndex)),this.sendUpdateOfBookProgressReportToExternalContext())}resetForNewPageAndPlay(t){if(this.props.paused){this.video.HandlePageVisible(t,()=>this.props.paused);return}if(ry(t),this.currentPageHasVideo){const n=()=>{this.video.HandlePageVisible(t,()=>this.props.paused),this.music.pause()};if(Yn(Cn.VideoPlaying),!this.sentBloomNotification&&(this.sentBloomNotification=!0,this.props.shouldReportSoundLog)){Yf("/publish/av/startRecording",this.videoList).then(n);return}n()}else this.playAudioAndAnimation(t)}playAudioAndAnimation(t){if(this.activityManager.getActivityManagesSound()){this.activityManager.doInitialSoundAndAnimation();return}if(Yn(Cn.AudioPlaying),!t)return;const n=nm(t);this.animation.HandlePageDurationAvailable(t,n,this.props.paused);const a=()=>{Mu.pageHasAnimation(t)&&this.animation.HandlePageBeforeVisible(t),this.animation.HandlePageVisible(t,this.props.paused),ly(t,this.animation.animatableCanvas),this.music.HandlePageVisible(t)};if(!this.sentBloomNotification&&(this.sentBloomNotification=!0,this.props.shouldReportSoundLog)){Yf("/publish/av/startRecording",this.videoList).then(a);return}a()}getVideoList(t){let n="";for(const l of Array.from(t.getElementsByTagName("video"))){var a=l,r=a.getElementsByTagName("source")[0].getAttribute("src");n&&(n+="|"),n+=r}return n}handlePageClick(t){if(!this.state.ignorePhonyClick&&(!this.activityManager.getActivityAbsorbsClicking()||t.target.closest("[data-href]")&&t.target.closest(".bloom-canvas"))&&!t.target.closest(".bloom-videoContainer")){const n=eA(t.nativeEvent,this.bookInfo.bookInstanceId,()=>this.getPageIdFromIndex(this.state.currentSwiperIndex));n?(this.navigate(n.bookUrl,n.pageId),t.stopPropagation(),t.preventDefault()):this.props.onContentClick&&this.props.onContentClick(t)}this.setState({ignorePhonyClick:!1})}}function dA(e){return e.replace("%23","#").replace(/[\u00A0-\u9999<>\&]/gim,t=>"&#"+t.charCodeAt(0)+";")}function fA(e){return e.ownerDocument.evaluate("//div[contains(@class, 'bloom-imageDescription')]/div[contains(@class, 'bloom-editable') and contains(@class, 'bloom-visibility-code-on')]//*[contains(@class, 'audio-sentence') or contains(@class, 'bloom-highlightSegment')]",e,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null).snapshotLength>0?!0:e.ownerDocument.evaluate("//div[contains(@class, 'bloom-imageDescription')]/div[contains(@class, 'bloom-editable') and contains(@class, 'bloom-visibility-code-on') and @data-audiorecordingmode='TextBox']/p[text()]",e,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null).snapshotLength>0}var Ks={},Kv;function hA(){if(Kv)return Ks;Kv=1;var e=Za(),t=Ja();Object.defineProperty(Ks,"__esModule",{value:!0}),Ks.default=void 0;var n=t(sa()),a=e(Qa()),r=(0,a.default)(n.createElement("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"}),"ArrowBack");return Ks.default=r,Ks}var pA=hA();const gA=On(pA);var qs={},qv;function mA(){if(qv)return qs;qv=1;var e=Za(),t=Ja();Object.defineProperty(qs,"__esModule",{value:!0}),qs.default=void 0;var n=t(sa()),a=e(Qa()),r=(0,a.default)(n.createElement("path",{d:"M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"}),"MoreHoriz");return qs.default=r,qs}var vA=mA();const yA=On(vA);var $s={},$v;function bA(){if($v)return $s;$v=1;var e=Za(),t=Ja();Object.defineProperty($s,"__esModule",{value:!0}),$s.default=void 0;var n=t(sa()),a=e(Qa()),r=(0,a.default)(n.createElement("path",{d:"M10 16.5l6-4.5-6-4.5v9zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"}),"PlayCircleOutline");return $s.default=r,$s}var wA=bA();const Vb=On(wA);var Hs={},Hv;function kA(){if(Hv)return Hs;Hv=1;var e=Za(),t=Ja();Object.defineProperty(Hs,"__esModule",{value:!0}),Hs.default=void 0;var n=t(sa()),a=e(Qa()),r=(0,a.default)(n.createElement("path",{d:"M9 16h2V8H9v8zm3-14C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm1-4h2V8h-2v8z"}),"PauseCircleOutline");return Hs.default=r,Hs}var xA=kA();const SA=On(xA);var Fs={},Fv;function CA(){if(Fv)return Fs;Fv=1;var e=Za(),t=Ja();Object.defineProperty(Fs,"__esModule",{value:!0}),Fs.default=void 0;var n=t(sa()),a=e(Qa()),r=(0,a.default)(n.createElement("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zm6.93 6h-2.95c-.32-1.25-.78-2.45-1.38-3.56 1.84.63 3.37 1.91 4.33 3.56zM12 4.04c.83 1.2 1.48 2.53 1.91 3.96h-3.82c.43-1.43 1.08-2.76 1.91-3.96zM4.26 14C4.1 13.36 4 12.69 4 12s.1-1.36.26-2h3.38c-.08.66-.14 1.32-.14 2 0 .68.06 1.34.14 2H4.26zm.82 2h2.95c.32 1.25.78 2.45 1.38 3.56-1.84-.63-3.37-1.9-4.33-3.56zm2.95-8H5.08c.96-1.66 2.49-2.93 4.33-3.56C8.81 5.55 8.35 6.75 8.03 8zM12 19.96c-.83-1.2-1.48-2.53-1.91-3.96h3.82c-.43 1.43-1.08 2.76-1.91 3.96zM14.34 14H9.66c-.09-.66-.16-1.32-.16-2 0-.68.07-1.35.16-2h4.68c.09.65.16 1.32.16 2 0 .68-.07 1.34-.16 2zm.25 5.56c.6-1.11 1.06-2.31 1.38-3.56h2.95c-.96 1.65-2.49 2.93-4.33 3.56zM16.36 14c.08-.66.14-1.32.14-2 0-.68-.06-1.34-.14-2h3.38c.16.64.26 1.31.26 2s-.1 1.36-.26 2h-3.38z"}),"Language");return Fs.default=r,Fs}var TA=CA();const EA=On(TA);var Ws={},Wv;function PA(){if(Wv)return Ws;Wv=1;var e=Za(),t=Ja();Object.defineProperty(Ws,"__esModule",{value:!0}),Ws.default=void 0;var n=t(sa()),a=e(Qa()),r=(0,a.default)(n.createElement("path",{d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"}),"Fullscreen");return Ws.default=r,Ws}var MA=PA();const AA=On(MA);var _s={},_v;function NA(){if(_v)return _s;_v=1;var e=Za(),t=Ja();Object.defineProperty(_s,"__esModule",{value:!0}),_s.default=void 0;var n=t(sa()),a=e(Qa()),r=(0,a.default)(n.createElement("path",{d:"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"}),"FullscreenExit");return _s.default=r,_s}var LA=NA();const BA=On(LA);function zA(e){return Rt.createElement(fh,{...e,width:"21",height:"20",viewBox:"0 0 21 20"},Rt.createElement("path",{d:"M20.6181 9.909C20.6181 9.909 17.3581 3.70568 10.2454 3.70568C10.1127 3.70568 9.9821 3.70851 9.8522 3.71275L9.23133 0.590958L8.27889 0.807585L8.87136 3.78574C2.72807 4.50344 0 9.86355 0 9.86355C0 9.86355 0.566707 11.0581 1.77366 12.4165L1.27674 9.91983C1.26639 9.90052 1.26089 9.89016 1.26089 9.89016C1.26089 9.89016 1.45882 9.53343 1.86833 9.01188L2.73952 13.3918C3.09729 13.7179 3.49205 14.0383 3.92423 14.3419L2.68074 8.09074C2.92754 7.84068 3.20826 7.58049 3.52199 7.32171L5.05787 15.0424C5.40441 15.2277 5.77033 15.3993 6.15474 15.5514L4.38901 6.67725C4.6772 6.48487 4.98565 6.29932 5.31568 6.12485L7.26481 15.9206C7.59924 16.0118 7.94578 16.0871 8.30509 16.146L7.56314 12.4167C7.89823 12.8518 8.32205 13.2046 8.80465 13.4464L9.36563 16.2656C9.59813 16.2802 9.83459 16.2891 10.0765 16.2891C10.1734 16.2891 10.2694 16.2873 10.3654 16.2844L9.86541 13.773C10.0112 13.7923 10.1591 13.8033 10.3099 13.8033C10.4957 13.8033 10.6783 13.7883 10.8559 13.7588L11.9801 19.4091L12.9321 19.1924L12.3108 16.0683C17.848 14.9378 20.6181 9.909 20.6181 9.909ZM6.88084 8.9881L6.22651 5.69889C6.53386 5.57339 6.8575 5.45942 7.19546 5.35982L7.6228 7.50844C7.28066 7.93015 7.02351 8.43381 6.88084 8.9881ZM8.46692 6.74577L8.14503 5.12836C8.45547 5.06785 8.77691 5.01958 9.11002 4.9859L9.3773 6.32923C9.05322 6.42294 8.74741 6.56375 8.46692 6.74577ZM10.3467 6.19713L10.0944 4.93033C10.1472 4.92963 10.1998 4.92845 10.2533 4.92845C10.4858 4.92845 10.713 4.93599 10.9365 4.94941C13.2188 5.33628 14.964 7.44981 14.964 9.99965C14.964 12.1188 13.7579 13.9352 12.0406 14.7106L11.7914 13.4565C13.0153 12.8558 13.8654 11.5342 13.8654 9.99942C13.8652 7.91226 12.2936 6.21856 10.3467 6.19713ZM14.5336 14.0984C15.4349 13.0056 15.9823 11.5718 15.9823 9.99942C15.9823 8.35399 15.3821 6.8595 14.405 5.74928C17.7771 7.16772 19.3574 9.92642 19.3574 9.92642C19.3574 9.92642 17.7491 12.6074 14.5336 14.0984Z"}))}var Vs={},Vv;function IA(){if(Vv)return Vs;Vv=1;var e=Za(),t=Ja();Object.defineProperty(Vs,"__esModule",{value:!0}),Vs.default=void 0;var n=t(sa()),a=e(Qa()),r=(0,a.default)(n.createElement("path",{d:"M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"}),"VolumeUp");return Vs.default=r,Vs}var DA=IA();const RA=On(DA),jA=e=>{const[t,n]=R.useState((e.languages.filter(d=>d.IsSelected)[0]||e.languages[0]).Code),a=d=>{const f=d.target.value;n(f),e.onClose(f)},r=()=>{e.onClose("")},l=()=>{const d=e.languages.map(f=>Rt.createElement("div",{className:"chooserItem",key:f.Code},Rt.createElement(hM,{value:f.Code,control:Rt.createElement(EM,null),label:f.Name,checked:f.Code===t}),Rt.createElement("span",{className:"spacer"}),Rt.createElement(RA,{className:"icon",visibility:f.HasAudio?"inherit":"hidden"})));return Rt.createElement("div",{className:"radioGroupDiv"},d)};return Rt.createElement(QP,{className:"languageMenu",onClose:r,"aria-labelledby":"language-menu-title",open:!0,scroll:"paper"},Rt.createElement(rM,{id:"language-menu-title"},"Languages in this book:"),Rt.createElement(cM,{component:"fieldset"},Rt.createElement(PM,{className:"radioGroup","aria-label":"languages",name:"languages",value:t,onChange:a},l())),Rt.createElement(nM,null,Rt.createElement(AP,{onClick:r,color:"secondary"},"Close")))};var Kr=(e=>(e[e.showArrow=0]="showArrow",e[e.showEllipsis=1]="showEllipsis",e[e.showNothing=2]="showNothing",e))(Kr||{});const OA=e=>{const[t,n]=R.useState(!1),a="button"+(e.bookLanguages.length<2?" disabled":""),r=L=>{n(!1),L!==""&&(e.onLanguageChanged(L),d({lang:L}))},l=()=>{try{document.fullscreenElement!=null||document.webkitFullscreenElement!=null?document.exitFullscreen?document.exitFullscreen():document.webkitExitFullScreen&&document.webkitExitFullScreen():document.documentElement.requestFullscreen?document.documentElement.requestFullscreen():document.documentElement.webkitRequestFullscreen&&document.documentElement.webkitRequestFullscreen()}catch(L){console.error("RequestFullScreen failed: ",L)}},d=L=>{if(!e.videoPreviewMode)return;const K={lang:e.activeLanguageCode,imageDescriptions:e.readImageDescriptions,...L};Yf("publish/av/videoSettings",encodeURIComponent(JSON.stringify(K)))},f=wn.getTranslation("Audio.Pause",e.preferredLanguages,"Pause"),p=e.paused?Rt.createElement(Vb,{titleAccess:e.playLabel}):Rt.createElement(SA,{titleAccess:f}),y=wn.getTranslation("Button.ReadImageDescriptions",e.preferredLanguages,"Read Image Descriptions"),k=wn.getTranslation("Button.IgnoreImageDescriptions",e.preferredLanguages,"Ignore Image Descriptions"),E=ul({palette:{primary:{main:oA},secondary:{main:Wb.palette.secondary.main}}}),N=Rt.createElement(qu,{theme:E},Rt.createElement(zA,{"aria-label":e.readImageDescriptions?"Read image descriptions":"Ignore image descriptions",titleAccess:e.readImageDescriptions?k:y,opacity:e.readImageDescriptions?1:.38,color:e.nowReadingImageDescription?"primary":"secondary"})),I=e.extraButtons?e.extraButtons.map(L=>Rt.createElement(pi,{key:L.id,color:"secondary",title:L.description,onClick:()=>bi({messageType:L.id})},Rt.createElement("img",{style:{maxHeight:"24px",maxWidth:"24px"},src:L.iconUrl}))):void 0;return Rt.createElement(bP,{color:"primary",className:`control-bar ${e.visible?", visible":""}`,id:"control-bar",elevation:0,position:"relative"},Rt.createElement(OM,null,!e.videoPreviewMode&&Rt.createElement(pi,{color:"secondary",onClick:()=>{e.backClicked&&e.backClicked()},"data-testid":"history-back-button",disabled:e.getBackButtonState()===2},e.getBackButtonState()===0?Rt.createElement(gA,{"aria-label":"Go Back",titleAccess:wn.getTranslation("Button.Back",e.preferredLanguages,"Back")}):e.getBackButtonState()===1&&Rt.createElement(yA,{"aria-label":"More Menu",titleAccess:wn.getTranslation("Button.More",e.preferredLanguages,"More")})),Rt.createElement("div",{className:"filler"}),e.bookHasImageDescriptions&&Rt.createElement(pi,{onClick:()=>{e.onReadImageDescriptionToggled(),d({imageDescriptions:!e.readImageDescriptions})}},N),e.bookLanguages.length>1&&Rt.createElement(pi,{className:a,"aria-label":"Choose Language",color:"secondary",onClick:()=>{n(!0)}},Rt.createElement(EA,{titleAccess:wn.getTranslation("Button.ChooseLanguage",e.preferredLanguages,"Choose Language")})),t&&Rt.createElement(jA,{languages:e.bookLanguages,onClose:r}),!e.videoPreviewMode&&Rt.createElement(pi,{color:"secondary","aria-label":"PlayPause",onClick:()=>{e.pausedChanged&&e.pausedChanged(!e.paused)}},e.showPlayPause?p:null),I,document.fullscreenEnabled&&e.canShowFullScreen&&!e.videoPreviewMode&&Rt.createElement(pi,{color:"secondary",onClick:()=>l()},document.fullscreenElement==null?Rt.createElement(AA,{"aria-label":"Full Screen",titleAccess:wn.getTranslation("Button.FullScreen",e.preferredLanguages,"Full Screen")}):Rt.createElement(BA,{"aria-label":"Exit Full Screen",titleAccess:wn.getTranslation("Button.ExitFullScreen",e.preferredLanguages,"Exit Full Screen")}))))};function qf(e,t){return Math.round(e/t)*t}function KA(e){if(!(!e||e==="cover")){if(/^\d+$/.test(e))return e;try{return e.replace(new RegExp("(?![0-9])\\p{Nd}","gu"),t=>{const n=t.charCodeAt(0);return(n&15)-6*(new RegExp("\\p{Nd}","u").test(String.fromCodePoint(n|15))?1:0)})}catch{return}}}let $f=!1,kh=e=>{};function qA(e){kh&&kh(e)}let Gv=0,Uv=0;function Yv(){const e=/iPad|iPhone|iPod/.test(navigator.platform);let t,n,a;e&&(t=document.getElementsByClassName("bloomPlayer")[0],n=t.parentElement,a=t.nextSibling,n.removeChild(t));const r=document.documentElement.clientWidth,l=document.documentElement.clientHeight;return e&&n.insertBefore(t,a),{width:r,height:l}}const $A=e=>{const[t,n]=R.useState(e.autoplay),a=e.centerVertically===void 0?!0:e.centerVertically;aC(Pt=>{Pt.pause?($f=!_,$(!0)):Pt.resume&&$f?$(!1):Pt.play?($(!1),Pt.autoplay&&n(Pt.autoplay)):Pt.reset?(k(e.startPage??0),Oe.current&&Oe.current(e.startPage??0)):Pt.controlAction&&st(Pt.controlAction)});const[r,l]=R.useState(!1),[d,f]=R.useState(e.initiallyShowAppBar),[,p]=R.useState(0);R.useEffect(()=>{const Pt=()=>{f(!0),p(ne=>ne+1)};return wh.subscribe(Pt),()=>{wh.unsubscribe(Pt)}},[]);const[y,k]=R.useState(e.startPage??0),[E,N]=R.useState([""]),[I,L]=R.useState(!1),[K,J]=R.useState(!1),[F,G]=R.useState(""),[ot,dt]=R.useState("Device16x9Portrait");R.useEffect(()=>{f(e.initiallyShowAppBar)},[e.initiallyShowAppBar]),R.useEffect(()=>{d?tC():eC()},[d]),R.useEffect(()=>{$(e.paused)},[e.paused]);const[_,$]=R.useState(e.paused),[v,mt]=R.useState(!1),ft=wn.getBloomUiLanguage(),Lt=ft==="en"?[ft]:[ft,"en"],[Nt,At]=R.useState(Lt);R.useEffect(()=>{_||($f=!1)},[_]);const[tt,H]=R.useState(!1),[s,ht]=R.useState(!1),[x,lt]=R.useState(!1),[bt,St]=R.useState(!1),[O,wt]=R.useState(!1),[xt,Ot]=R.useState(0),[Mt,Ht]=R.useState(9/16),Qt=[],[de,me]=R.useState(Qt),[Pe,ln]=R.useState(""),Oe=R.useRef(),[rn,Ve]=R.useState(!0),[kn,Ye]=R.useState(!1),[yn,Je]=R.useState(!1),[un,M]=R.useState(0),D=()=>{M(Pt=>Pt+1)},[Y,it]=R.useState("");R.useEffect(()=>{Xt()},[O,un,tt,e.useOriginalPageSize]),R.useEffect(()=>()=>{const Pt=document.getElementById("scale-style-sheet");Pt&&Pt.parentNode.removeChild(Pt)},[]);const vt=R.useRef(),st=Pt=>{switch(Pt){case"navigate-to-next-page":vt&&vt.current&&vt.current.slideNext();break;case"navigate-to-previous-page":vt&&vt.current&&vt.current.slidePrevious();break;default:console.log("'handleControlMessage' received an unknown message.");return}},Xt=()=>{const Pt=document.getElementsByClassName("swiper-slide-active")[0];let ne=null;if(Pt&&(ne=Pt.getElementsByClassName("bloom-page")[0]),!ne||!O){window.setTimeout(D,100);return}let xe=document.getElementById("scale-style-sheet");xe||(xe=document.createElement("style"),xe.setAttribute("type","text/css"),xe.setAttribute("id","scale-style-sheet"),document.head.appendChild(xe));let ve=xt,zt=Mt;const Ft=rp(ne);(e.url!==F||Ft!==ot)&&(G(e.url),dt(Ft),window.onresize=()=>{const{width:ta,height:Ta}=Yv();(Ta!==Uv||ta!==Gv)&&D()},ve=Math.max(ne.offsetHeight,ne.offsetWidth),zt=Math.min(ne.offsetHeight,ne.offsetWidth)/ve,Ht(zt),Ot(ve));const{width:re,height:Le}=Yv();Gv=re,Uv=Le;const Ae=re>Le;if(Ae!==tt){H(Ae);return}let cn=0,je=0;const $n=window.getComputedStyle(document.body);$n&&$n.marginTop&&(cn=parseInt($n.marginTop,10)),$n&&$n.marginBottom&&(je=parseInt($n.marginBottom,10));const Jn=ne.getAttribute("class").indexOf("Landscape")>=0,la=Jn?ve*zt:ve,ua=Jn?ve:ve*zt;let Qn=cn+je;if(d){const ta=document.getElementById("control-bar");ta&&(Qn+=ta.offsetHeight);const Ta=document.getElementById("pageNumberControl");Ta&&(Qn+=Ta.offsetHeight)}const ur=Le-Qn,Sn=Me({pageWidth:ua,pageHeight:la,desiredPageHeight:ur}),dn=Re(ua);let fn=Math.min(Sn,dn);const ca=la*fn;let zn=ca*zt/fn;Jn&&(zn=ca/zt/fn);const wi=re/fn-zn;let $a="",Tn=Math.max((re-ua*fn)/2,0);e.roundMarginToNearestK&&(Tn=qf(Tn,e.roundMarginToNearestK));const cr=Tn,dr=fn,Vr=30;if(wi>100*2)$a="largeOutsideButtons";else if(wi>Vr*2)$a="smallOutsideButtons";else if(re>407&&navigator.userAgent.includes("Chrome")&&!e.hideSwiperButtons){const Ta=new RegExp(" Chrome/([0-9]+).").exec(navigator.userAgent),fr=parseInt(Ta[1]);fr&&fr<90&&(fn*=.9,Tn=Math.max((re-ua*fn)/2,0),$a="smallOutsideButtons extraScalingForChrome85Bug")}$a!==Y&&it($a);let Ri="";if(a){const ta=(Le-ca-Qn)/2;ta>0&&(Ri=`translate(0, ${ta.toFixed(0)}px) `)}xe.innerText=`.bloomPlayer {
|
|
7982
|
+
`,"").replace("\r","")}function FM(e){const t=e.lastIndexOf("/"),n=e.lastIndexOf("%2f");let a;t>n?a=e.substring(t+1,e.length):a=e.substring(n+3,e.length);const r=a.endsWith(".htm"),l=r?e:e+"/"+a+".htm",d=r?e.substring(0,Math.max(t,n)):e;return{urlOfBookHtmlFile:l,urlPrefix:d}}function Vu(e,t){return t+"/"+e}async function WM(e,t){const n=zi.get(Vu(".distribution",t)).then(k=>k,k=>({data:""})),a=zi.get(e),r=zi.get(Vu("meta.json",t)),[l,d,f]=await Promise.all([a,r,n]);return{bookHtmlElement:new DOMParser().parseFromString(l?.data,"text/html").documentElement,metaDataObject:d?.data,distributionSource:f.data}}function _M(e){const t={};for(let n=0;n<e.attributes.length;n++)t[e.attributes.item(n).nodeName]=e.attributes.item(n).nodeValue;return t}function VM(e,t){const n=e.ownerDocument.evaluate(".//*[@src]",e,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);for(let l=0;l<n.snapshotLength;l++){const d=n.snapshotItem(l);if(!d)continue;const f=d.getAttribute("src"),p=Vu(f,t);d.setAttribute("src",p)}const a=e.ownerDocument.evaluate(".//*[@style]",e,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null),r=new RegExp(/background-image:url\(['"](.*)['"]\)/);for(let l=0;l<a.snapshotLength;l++){const d=a.snapshotItem(l);if(!d)continue;const f=d.getAttribute("style")||"",p=r.exec(f);if(!p)continue;const y=Vu(p[1],t),k=f.replace(r,"");d.setAttribute("style",k),d.setAttribute("data-background",y),d.classList.add("swiper-lazy")}}function rp(e){const n=(e.getAttribute("class")||"").match(/\b\S*?(Portrait|Landscape)\b/);return n&&n.length?n[0]:""}function GM(e,t,n,a,r){let l=!1;const d=rp(e);if(d){l=t?n:d.endsWith("Landscape");let f="";a?f=l?r.replace("Portrait","Landscape"):r.replace("Landscape","Portrait"):f=l?"Device16x9Landscape":"Device16x9Portrait",d!==f&&(e.classList.remove(d),e.classList.add(f))}return l}function UM(e,t){e.querySelectorAll(".coverBottomBookTopic, .coverBottomLangName").forEach(n=>{t||n.classList.contains("bloom-content1")?n.classList.remove("do-not-display"):n.classList.add("do-not-display")})}function YM(e){const t=e.getElementsByClassName("bloom-canvas");if(t&&t.length>0)return Array.from(t);const n=e.getElementsByClassName("bloom-imageContainer");return Array.from(n).filter(a=>a.parentElement.closest(".bloom-imageContainer")===null)}function XM(e,t){if(!(!t||!e))try{const n=t;YM(e).forEach(a=>{Array.from(a.querySelectorAll(dl)).forEach(l=>{const d=Array.from(l.getElementsByClassName("bloom-editable")).find(f=>f.getAttribute("lang")===n);if(d){const f=d.getAttribute("data-bubble-alternate");if(f){const p=JSON.parse(f.replace(/`/g,'"'));l.setAttribute("style",p.style)}}});const r=Array.from(a.getElementsByClassName("comical-alternate")).find(l=>l.getAttribute("data-lang")===n);if(r){const l=a.getElementsByClassName("comical-generated")[0];l&&(l.classList.remove("comical-generated"),l.classList.add("comical-alternate"),l.style.display="none"),r.classList.remove("comical-alternate"),r.classList.add("comical-generated"),r.style.removeProperty("display")}})}catch(n){console.error(n)}}function ZM(e,t){return e.localeCompare(t,"en-US",{sensitivity:"accent"})===0}function JM(e,t,n,a){if(!t||!e)return;const r=n[0]===t||!t,l=t,d=e.ownerDocument.evaluate(".//div[contains(@class, 'bloom-translationGroup')]",e,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null),f="bloom-visibility-code-on";for(let p=0;p<d.snapshotLength;p++){const y=d.snapshotItem(p),k=y.getAttribute("data-default-languages"),E=k?k.split(/,| /):[],N=E==null||E.length===0||!E[0]||E.includes("V")||E.includes("L1")||ZM(E[0],"auto"),I=y.childNodes;for(let L=0;L<I.length;L++){const K=I.item(L);!K||!K.classList||!K.classList.contains("bloom-editable")||(a&&K.setAttribute("data-original-class",K.getAttribute("class")||""),r?K.setAttribute("class",K.getAttribute("data-original-class")||""):N&&(K.getAttribute("lang")===l?(K.classList.add(f),Array.from(K.classList).forEach(F=>{F.startsWith("bloom-content")&&K.classList.remove(F)}),K.classList.add("bloom-content1"),K.classList.add("bloom-contentFirst")):K.classList.remove(f)))}}}const lc=[];function QM(){return lc.length>0}function tA(e){const t=lc.pop();if(t)return{bookUrl:e===t.bookId?void 0:bh(t.bookId),pageId:t.pageId}}function eA(e,t,n){const a=e.target.closest("[href], [data-href]");if(!a)return;e.preventDefault(),e.stopPropagation();const r=(a.getAttribute("href")||a.getAttribute("data-href"))??void 0;if(!r)return;if(r.startsWith("http://")||r.startsWith("https://")){window.open(r,"_blank","noreferrer");return}let l,d;if(r==="back"){const p=lc.pop();return p?{bookUrl:t===p.bookId?void 0:bh(p.bookId),pageId:p.pageId}:void 0}else if(r.startsWith("/book/")){const p=nA(r);l=p.bookId,d=p.pageId,p.bookId===t&&(l=void 0)}else r.startsWith("#")&&(d=r.substring(1));const f=n();if(l)return zv(t,f),{bookUrl:bh(l),pageId:d};if(d)return zv(t,f),{pageId:d}}function zv(e,t,n){lc.push({bookId:e,pageId:t})}function bh(e){return`/book/${e}/index.htm`}function nA(e){try{const t=new URL(e,window.location.origin);if(!t.pathname.startsWith("/book/"))throw new Error("Invalid book URL format");const n=t.pathname.replace("/book/",""),a=t.hash.replace("#","");return{bookId:n,pageId:a}}catch(t){return console.error("Error parsing book URL:",t),{bookId:void 0,pageId:void 0}}}const aA="2.23.0-alpha.1",iA={version:aA},nr="#d65649",rA="#2e2e2e",oA="#febf00",Wb=ul({palette:{primary:{main:rA,contrastText:nr},secondary:{main:nr}}});function _b(){var e=iA.version;return e}const sA=({getBookInstanceId:e})=>{const[t,n]=R.useState(!1),a=_b(),r=new Date("2026-11-19T18:03:04.233Z").toLocaleDateString();if(R.useEffect(()=>{const d=p=>{p.key==="Control"&&n(!0)},f=p=>{p.key==="Control"&&n(!1)};return window.addEventListener("keydown",d),window.addEventListener("keyup",f),()=>{window.removeEventListener("keydown",d),window.removeEventListener("keyup",f)}},[]),!t)return null;const l=e?.();return Rt.createElement("div",{className:"diagnostic-info-control",style:{color:nr,fontFamily:"sans-serif",padding:"5px",zIndex:1e3,lineHeight:"1.5"}},Rt.createElement("div",null,"Bloom Player v",a," (built ",r,")"),Rt.createElement("div",null,"Book ID: ",l??""))},lA=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,Iv=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");const t=e.match(lA);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},Dv=e=>e==="*"||e==="x"||e==="X",Rv=e=>{const t=parseInt(e,10);return isNaN(t)?e:t},uA=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],cA=(e,t)=>{if(Dv(e)||Dv(t))return 0;const[n,a]=uA(Rv(e),Rv(t));return n>a?1:n<a?-1:0},jv=(e,t)=>{for(let n=0;n<Math.max(e.length,t.length);n++){const a=cA(e[n]||"0",t[n]||"0");if(a!==0)return a}return 0},Ov=(e,t)=>{const n=Iv(e),a=Iv(t),r=n.pop(),l=a.pop(),d=jv(n,a);return d!==0?d:r&&l?jv(r.split("."),l.split(".")):r||l?r?-1:1:0},wh=new rr;class op extends R.Component{constructor(t,n){super(t,n),this.activityManager=new dP,this.initialPages=["loading..."],this.initialStyleRules="",this.originalPageClass="Device16x9Portrait",this.bookInfo=new yh,this.bookInteraction=new KM,this.mustUseOriginalPageSize=!1,this.indicesOfPagesWhereWeShouldPreserveDOMState={},this.startingUpSwiper=!0,this.pendingTimeouts=new Set,this.state={pages:this.initialPages,pageIdToIndexMap:{},styleRules:this.initialStyleRules,importedBodyAttributes:{},currentSwiperIndex:0,isLoading:!0,loadFailed:!1,loadErrorHtml:"",ignorePhonyClick:!1,isFinishUpForNewBookComplete:!1,inPauseForced:!1,bookUrl:""},this.isPagesLocalized=!1,this.currentPage=null,this.currentPageHidesNavigationButtons=!1,this.handleWindowFocusEvent=()=>this.handleWindowFocus(),this.handleWindowBlurEvent=()=>this.handleWindowBlur(),this.handlePointerDownCapture=r=>{(r.target.closest("[href], [data-href]")||r.target.closest(".bloom-videoContainer")&&!r.target.closest("[data-draggable-id]"))&&(r.stopPropagation(),r.preventDefault())},this.handleDragStartCapture=r=>{this.activityManager.getActivityAbsorbsDragging()||r.preventDefault()},this.handleDocumentLevelKeyDown=r=>{r.key==="Home"&&(this.goToFirstPage(),r.preventDefault()),r.key==="End"&&(this.goToLastPage(),r.preventDefault())},this.distributionSource="",this.finishUpCalled=!1,this.hasImageDescriptions=!1,this.handlePageVideoComplete=r=>{r.page===this.currentPage&&this.playAudioAndAnimation(r.page)},this.handlePlayFailed=()=>{this.setState({inPauseForced:!0}),this.props.setForcedPausedCallback&&this.props.setForcedPausedCallback(!0)},this.handlePlayUnblocked=()=>{this.state.inPauseForced&&this.props.setForcedPausedCallback&&this.props.setForcedPausedCallback(!1),this.setState({inPauseForced:!1})},this.handlePlayCompleted=()=>{Yn(Cn.MediaFinished),this.props.imageDescriptionCallback(!1)},this.handleToggleImageDescription=r=>{this.props.imageDescriptionCallback(r)},this.handlePageNarrationComplete=r=>{if(r&&(Yn(Cn.MediaFinished),this.shouldAutoPlay())){const l=this.props.autoplayCount??0,d=this.state.startPageIndex??0,f=this.swiperInstance.slides.length-1;let p=this.props.autoplayCount?Math.min(d+l-1,f):f;this.swiperInstance.activeIndex>=p?(this.music.pause(),this.props.shouldReportSoundLog&&dS(),uS(),ZS({})):this.swiperInstance.slideNext()}},this.skipAutoPlay=!1,this.sentBloomNotification=!1;const a=t.url.startsWith("http")?new URL(t.url):new URL(t.url,window.location.origin);a.hash?(this.state.startPageId=a.hash.substring(1),a.hash=""):this.state.startPageIndex=t.startPageIndex,this.state.bookUrl=a.href,this.legacyQuestionHandler=new hP(t.locationOfDistFolder)}setPlayerTimeout(t,n){const a=window.setTimeout(()=>{this.pendingTimeouts.delete(a),t()},n);this.pendingTimeouts.add(a)}componentDidMount(){wn.setUp(),nx(this),window.addEventListener("focus",this.handleWindowFocusEvent),window.addEventListener("blur",this.handleWindowBlurEvent),document.addEventListener("keydown",this.handleDocumentLevelKeyDown),document.addEventListener("pointerdown",this.handlePointerDownCapture,{capture:!0}),document.addEventListener("dragstart",this.handleDragStartCapture,{capture:!0}),this.componentDidUpdate(this.props,this.state)}CanGoBack(){return QM()}HandleBackButtonClickedIfHavePlayerHistory(){const t=this.getBookIdFromBookUrlForHistory(this.state.bookUrl)||this.bookInfo.bookInstanceId,n=tA(t);return n?(this.navigate(n.bookUrl,n.pageId),!0):!1}navigate(t,n){if(t){const a=new URL(t,this.state.bookUrl);this.setState({bookUrl:a.href,startPageId:n,startPageIndex:void 0})}else if(n!==void 0){const a=this.state.pageIdToIndexMap[n];this.swiperInstance.slideTo(a)}}getBookIdFromBookUrlForHistory(t){if(t)try{const a=new URL(t,window.location.href).pathname.match(/^\/book\/([^/]+)\/index\.htm$/i);return a?a[1]:void 0}catch{return}}handleWindowFocus(){const t=localStorage.getItem(Ru),n=localStorage.getItem(Lm);t&&n==this.sourceUrl&&(this.bookInteraction.beginReadTime=Date.now()-parseInt(t,10))}handleWindowBlur(){const t=Date.now()-this.bookInteraction.beginReadTime;localStorage.setItem(Ru,t.toString()),localStorage.setItem(Lm,this.sourceUrl)}getRequiredVersionMessage(t){const n=t.querySelector('meta[name="FeatureRequirement"]')?.getAttribute("content");if(!n)return"";const a=/BloomPlayerMinVersion":"(.*?)".*?"FeatureId":"(.*?)"/g;let r,l=null,d=null;for(;(r=a.exec(n))!==null;){const p=r[1];(!l||Ov(p,l)>0)&&(l=p,d=r[2])}if(!l||!d)return"";const f=_b();if(Ov(f,l)>=0)return"";if(window.location.hostname.toLowerCase().indexOf("bloomlibrary.org")>=0)return wn.getTranslation("Version.Problem.Web",this.props.preferredUiLanguages,"This book uses the feature {feature}. Unfortunately, {hostname} is not ready to display this book yet. Please check back again later or write to issues@bloomlibrary.org if you think this is unexpected.").replace("{feature}",d).replace("{hostname}",window.location.hostname);{let p=Oa("host","");switch(p){case"bloomreader":p="Bloom Reader";break;case"bloompubviewer":p="BloomPUB Viewer";break;case"readerapp":p="";break}return p?wn.getTranslation("Version.Problem.Host",this.props.preferredUiLanguages,"This book uses the feature {feature} and requires a newer version of {host} to read it. Please upgrade to the latest version.").replace("{feature}",d).replace("{host}",p):wn.getTranslation("Version.Problem.NoHost",this.props.preferredUiLanguages,"This book uses the feature {feature} and requires a newer version of the program you are using to read it. Please upgrade to the latest version.").replace("{feature}",d)}}componentDidUpdate(t,n){try{if(!this.props.url||this.state.loadFailed&&n.bookUrl===this.state.bookUrl)return;this.initializeMedia();const a=this.preprocessUrl();if(a&&a!=="/working"&&a!==this.sourceUrl){this.finishUpCalled=!1,this.setState({isLoading:!0,loadFailed:!1}),this.metaDataObject=void 0,this.htmlElement=void 0,this.sourceUrl=a;const{urlOfBookHtmlFile:r,urlPrefix:l}=FM(this.sourceUrl);this.urlPrefix=l,this.music.urlPrefix=l,sx(l),WM(r,l).then(d=>{const{bookHtmlElement:f}=d;this.metaDataObject=d.metaDataObject,this.distributionSource=d.distributionSource;const p=this.getRequiredVersionMessage(f.ownerDocument);this.setState({requiredVersion:p});const y=f.getElementsByTagName("body")[0];this.mustUseOriginalPageSize=this.computeMustUseOriginalPageSize(y),this.bookInfo.setSomeBookInfoFromBody(y),this.localizeOnce(),this.props.shouldReportSoundLog&&(this.videoList=this.getVideoList(f.ownerDocument)),this.animation.PlayAnimations=this.bookInfo.playAnimations,this.setState({importedBodyAttributes:_M(y)}),this.makeNonEditable(y),this.htmlElement=f;const k=f.getElementsByClassName("bloom-page")[0];this.originalPageClass="Device16x9Portrait",k&&(this.originalPageClass=rp(k)),this.legacyQuestionHandler.generateQuizPagesFromLegacyJSON(this.urlPrefix,y,this.originalPageClass,()=>{this.finishUp()})}).catch(d=>this.HandleLoadingError(d))}else if(t.landscape!==this.props.landscape||t.useOriginalPageSize!==this.props.useOriginalPageSize||t.autoplay!==this.props.autoplay){const r=document.getElementsByClassName("bloom-page");for(let l=0;l<r.length;l++){const d=r[l];this.applyPageSizeClass(d)}}!this.state.isLoading&&(n.isLoading||t.activeLanguageCode!==this.props.activeLanguageCode)&&(JM(this.htmlElement,this.props.activeLanguageCode,this.bookInfo.getPreferredTranslationLanguages(),n.isLoading),XM(this.htmlElement,this.props.activeLanguageCode),this.finishUpCalled&&this.finishUp(!1)),this.state.currentSwiperIndex!=n.currentSwiperIndex&&this.rootDiv?.querySelectorAll(ip).forEach(r=>{const l=fl(r).getNiceScroll();l&&l.length>0&&l.remove()}),!this.state.isLoading&&(n.isLoading||t.shouldReadImageDescriptions!==this.props.shouldReadImageDescriptions)&&this.finishUpCalled&&(this.setIndex(this.state.currentSwiperIndex),this.showingPage(this.state.currentSwiperIndex)),this.state.isFinishUpForNewBookComplete&&t.landscape!==this.props.landscape&&(this.setIndex(this.state.currentSwiperIndex),this.showingPage(this.state.currentSwiperIndex)),t.paused!==this.props.paused&&this.handlePausePlay(),this.swiperInstance&&this.swiperInstance.lazy.load()}catch(a){this.setState({isLoading:!1,loadFailed:!0,loadErrorHtml:a.message})}}HandleLoadingError(t){let a=`<p>There was a problem displaying this book: ${t.message}<p>`;const r=!!t.config?.url&&new URL(t.config.url,window.location.href).pathname.startsWith("/book/");r?a="<p>We could not find that book.</p>":(t.config&&t.config.url&&t.config.url.startsWith("file://")||t.message.indexOf("404")>=0)&&(a="<p>This book (or some part of it) was not found.<p>",t.config&&t.config.url&&(a+=`<p class='errorDetails'>${dA(t.config.url)}</p>`)),this.setState({isLoading:!1,loadFailed:!0,loadErrorHtml:a}),r&&wh.raise()}async finishUp(t=!0){if(this.finishUpCalled=!0,!this.htmlElement)return;Qs.setAllVideoPostersTo1x1TransparentPNG(this.htmlElement);const n=this.htmlElement.getElementsByClassName("bloom-page"),a=[];t&&(this.bookInfo.totalNumberedPages=0,this.bookInfo.questionCount=0,this.activityManager.collectActivityContextForBook(n),this.bookInteraction.clearPagesShown(),this.music.processAllMusicForBook(n));const r=this.bookInfo.getPreferredTranslationLanguages(),l=r[0]===this.props.activeLanguageCode||!this.props.activeLanguageCode,d={},f=y=>y.classList.contains("bloom-interactive-page")||y.classList.contains("simple-comprehension-quiz")||y.getAttribute("data-activity")=="iframe"||y.getElementsByClassName("questions").length>0;d.length=0,d.cover=0;for(let y=0;y<n.length;y++){const k=n[y],E=k.getAttribute("id");E&&(d[E]=y);const N=this.applyPageSizeClass(k);k.setAttribute("data-index",y.toString(10)),y===0&&this.props.reportBookProperties&&this.props.reportBookProperties({landscape:N,canRotate:this.bookInfo.canRotate,preferredLanguages:r,pageNumbers:Array.from(n).map(L=>L.getAttribute("data-page-number")??""),isRtl:this.metaDataObject.isRtl,internalUrl:this.state.bookUrl}),t&&(VM(k,this.urlPrefix),k.classList.contains("numberedPage")&&(this.indexOflastNumberedPage=y,this.bookInfo.totalNumberedPages++),(k.getAttribute("data-analyticscategories")||k.getAttribute("data-analyticsCategories"))==="comprehension"&&this.bookInfo.questionCount++),UM(k,l);const I=f(k);I&&this.activityManager.initializePageHtml(this.urlPrefix,k,a.length),(!this.props.skipActivities||!I)&&a.push(k.outerHTML)}if(t){const y=this.htmlElement.getElementsByTagName("head")[0];this.bookInfo.setSomeBookInfoFromHead(y);const k=this.htmlElement.getElementsByTagName("body")[0];if(this.metaDataObject&&(this.bookInfo.setSomeBookInfoFromMetadata(this.metaDataObject,k),this.reportBookOpened(k)),this.props.controlsCallback){const E=sl.createLangDataArrayFromDomAndMetadata(k,this.metaDataObject);this.hasImageDescriptions=fA(k),this.props.controlsCallback(E,this.hasImageDescriptions,N=>{this.swiperInstance?.slideTo(N)})}}if(t){var p;try{p=await qM(this.htmlElement,this.urlPrefix,this.bookInfo,()=>this.legacyQuestionHandler.getPromiseForAnyQuizCss())}catch(y){this.HandleLoadingError(y),p=""}if(this.startingUpSwiper=!0,this.state.startPageId){if(d[this.state.startPageId]===void 0)throw new Error(`Page ID ${this.state.startPageId} not found in the current pageIdToIndexMap`);this.setState({startPageIndex:d[this.state.startPageId]})}this.setState({pages:a,pageIdToIndexMap:d,styleRules:p,isLoading:!1,currentSwiperIndex:this.state.startPageIndex??0})}else this.setState({pages:a,isLoading:!1});this.props.pageStylesAreNowInstalled(),t?this.setPlayerTimeout(()=>{this.setState({isFinishUpForNewBookComplete:!0});const y=this.startingUpSwiper;this.startingUpSwiper=!1;var k=this.state.startPageIndex??0;this.setIndex(k),this.showingPage(k),y&&this.swiperInstance&&this.addScrollbarsToPageWhenReady(this.swiperInstance.activeIndex);const E=document.getElementsByClassName("swiper-button-next")[0];document.getElementsByClassName("swiper-button-prev")[0]?.setAttribute("tabindex","4"),E?.setAttribute("tabindex","5"),this.shouldFocusNextButtonForNewBook()&&E?.focus()},500):this.currentPage&&this.setPlayerTimeout(()=>{this.setIndex(this.currentPageIndex),this.showingPage(this.currentPageIndex)},200)}shouldFocusNextButtonForNewBook(){return window.self===window.top||document.referrer.startsWith("http://localhost:")?!0:document.referrer.includes("bloomlibrary.org/player/")}localizeOnce(){!this.isPagesLocalized&&this.state.pages!==this.initialPages&&this.state.styleRules!==this.initialStyleRules&&(wn.localizePages(document.body,this.bookInfo.getPreferredTranslationLanguages()),this.isPagesLocalized=!0)}initializeMedia(){this.video||(this.video=new Qs,this.video.PageVideoComplete=new rr,this.video.PageVideoComplete.subscribe(this.handlePageVideoComplete)),this.animation||(this.animation=new Mu),Ko.subscribe(this.handlePageNarrationComplete),il.subscribe(this.handlePlayFailed),Vf.subscribe(this.handlePlayUnblocked),al.subscribe(this.handlePlayCompleted),ix(this.storeAudioAnalytics.bind(this)),qo.subscribe(this.handleToggleImageDescription.bind(this)),rx(()=>this.swiperInstance?.animating),ox(t=>Ny(t,1)),this.music||(this.music=new fS,this.music.PlayFailed=new rr,this.music.PlayFailed.subscribe(()=>{this.setState({inPauseForced:!0}),this.props.setForcedPausedCallback&&this.props.setForcedPausedCallback(!0)}))}preprocessUrl(){let t=this.state.bookUrl;if(t===void 0||t.trim()==="")throw new Error("The url parameter was empty. It should point to the url of a book.");return t.endsWith("/")&&(t=t.substring(0,t.length-1)),t.endsWith("%2f")&&(t=t.substring(0,t.length-3)),t}handlePausePlay(){this.props.paused?this.pauseAllMultimedia():this.currentPage!==oy()||oa===Cn.MediaFinished?this.resetForNewPageAndPlay(this.currentPage):oa===Cn.VideoPaused?this.video.play():(jx(),this.animation.resumeAnimation(),this.music.play())}computeMustUseOriginalPageSize(t){return this.props.useOriginalPageSize||t.querySelector(".bloom-canvas-element")?!0:!!t.querySelector(".bloom-textOverPicture")}componentWillUnmount(){this.pauseAllMultimedia(),window.removeEventListener("focus",this.handleWindowFocusEvent),window.removeEventListener("blur",this.handleWindowBlurEvent),document.removeEventListener("keydown",this.handleDocumentLevelKeyDown),document.removeEventListener("pointerdown",this.handlePointerDownCapture,{capture:!0}),document.removeEventListener("dragstart",this.handleDragStartCapture,{capture:!0}),this.unsubscribeAllEvents(),this.pendingTimeouts.forEach(t=>window.clearTimeout(t)),this.pendingTimeouts.clear(),ax(this)}unsubscribeAllEvents(){this.video.PageVideoComplete.unsubscribe(this.handlePageVideoComplete),Ko.unsubscribe(this.handlePageNarrationComplete),il.unsubscribe(this.handlePlayFailed),Vf.unsubscribe(this.handlePlayUnblocked),al.unsubscribe(this.handlePlayCompleted),qo.unsubscribe(this.handleToggleImageDescription)}pauseAllMultimedia(){oa===Cn.VideoPlaying?this.video.pause():oa===Cn.AudioPlaying&&(Ox(),this.animation.PauseAnimation()),this.music.pause()}reportBookOpened(t){const n=this.bookInfo.getAmbientAnalyticsProps();this.distributionSource&&(n.distributionSource=this.distributionSource),YS(n),By("BookOrShelf opened",{})}sendUpdateOfBookProgressReportToExternalContext(){const t=this.bookInteraction.getProgressReportPropertiesForAnalytics();JS("Pages Read",t)}makeNonEditable(t){const n=t.ownerDocument.evaluate(".//*[@contenteditable]",t,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);for(let a=0;a<n.snapshotLength;a++)n.snapshotItem(a).removeAttribute("contenteditable")}applyPageSizeClass(t){return GM(t,this.bookInfo.canRotate,this.props.landscape,this.mustUseOriginalPageSize,this.originalPageClass)}goToFirstPage(){this.swiperInstance.slideTo(0)}goToLastPage(){this.swiperInstance.slideTo(99999)}getRootDiv(){return this.rootDiv}slideNext(){this.swiperInstance&&this.swiperInstance.slideNext()}slidePrevious(){this.swiperInstance&&this.swiperInstance.slidePrev()}getBookInstanceId(){return this.bookInfo.bookInstanceId}getPlayerOptionsForPage(t){if(!t)return;let n=t.getAttribute("data-player-options");if(n)try{return n=n.replace(/'/g,'"'),JSON.parse(n)}catch(a){console.log("getPlayerOptionsForPage failed to parse json: "+n+" with error "+a.message);return}}render(){const t=this.activityManager.getActivityAbsorbsDragging();if(this.state.isLoading)return R.createElement(DP,{className:"loadingSpinner",color:"secondary"});if(this.state.loadFailed)return R.createElement(R.Fragment,null,R.createElement(x1,{className:"loadFailedIcon",color:"secondary"}),R.createElement("div",{className:"loadErrorMessage",dangerouslySetInnerHTML:{__html:this.state.loadErrorHtml}}));if(this.state.requiredVersion)return R.createElement("div",{className:"requiredVersionMessage"},this.state.requiredVersion);hx(this.props.shouldReadImageDescriptions&&this.hasImageDescriptions);const n={getSwiper:r=>{this.swiperInstance=r,this.metaDataObject?.isRtl&&this.swiperInstance&&(this.swiperInstance.el?.setAttribute("dir","rtl"),this.swiperInstance.rtl=!0,this.swiperInstance.rtlTranslate=!0)},simulateTouch:!0,touchStartPreventDefault:!1,on:{slideChange:()=>{this.state.inPauseForced&&(this.props.setForcedPausedCallback&&this.props.setForcedPausedCallback(!1),this.setState({inPauseForced:!1})),this.startingUpSwiper||this.showingPage(this.swiperInstance.activeIndex)},slideChangeTransitionStart:()=>{this.startingUpSwiper||this.setIndex(this.swiperInstance.activeIndex)},slideChangeTransitionEnd:()=>{this.addScrollbarsToPageWhenReady(this.swiperInstance.activeIndex)}},keyboard:{enabled:!0,onlyInViewport:!1},preloadImages:!1,lazy:{loadPrevNext:!0,loadOnTransitionStart:!0,loadPrevNextAmount:2},shouldSwiperUpdate:!0};this.startingUpSwiper&&(n.activeSlideKey=this.state.startPageIndex?.toString());let a="bloomPlayer";return this.currentPageHidesNavigationButtons?a+=" hideNextPrevButtons extraScalingForChrome85Bug":(this.props.outsideButtonPageClass&&(a+=" "+this.props.outsideButtonPageClass),t&&(a+=" showNavigationButtonsEvenOnTouchDevices")),R.createElement("div",{"aria-label":"Player Content",className:a+(this.props.extraClassNames?" "+this.props.extraClassNames:""),ref:r=>this.rootDiv=r},R.createElement(Q0,{key:this.shouldAutoPlay()?"fade":"slide",...n,effect:this.shouldAutoPlay()?"fade":"slide"},this.state.pages.map((r,l)=>{const f=Math.abs(l-this.state.currentSwiperIndex)<2||this.indicesOfPagesWhereWeShouldPreserveDOMState[l];return R.createElement("div",{key:l,className:"page-preview-slide",onClick:p=>this.handlePageClick(p)},f?R.createElement(R.Fragment,null,R.createElement("style",{scoped:!0},this.state.styleRules),R.createElement("div",{...this.state.importedBodyAttributes,className:`bloomPlayer-page ${this.bookInfo.hasAppearanceSystem?"appearance-system":""} ${this.state.importedBodyAttributes.class??""}`,dangerouslySetInnerHTML:{__html:r}})):"")})),R.createElement("div",{className:"swiper-button-prev "+(this.metaDataObject.isRtl?"swiper-button-right":"swiper-button-left")+(this.props.hideSwiperButtons||this.state.currentSwiperIndex===0?" swiper-button-disabled":""),onClick:()=>this.slidePrevious(),onTouchStart:r=>{this.setState({ignorePhonyClick:!0})}},R.createElement(pi,{className:"nav-button",disableRipple:!0},this.metaDataObject.isRtl?R.createElement(gv,{titleAccess:wn.getTranslation("Button.Prev",this.props.preferredUiLanguages,"Previous Page")}):R.createElement(hv,{titleAccess:wn.getTranslation("Button.Prev",this.props.preferredUiLanguages,"Previous Page")}))),R.createElement("div",{className:"swiper-button-next "+(this.metaDataObject.isRtl?"swiper-button-left":"swiper-button-right")+(this.props.hideSwiperButtons||this.state.currentSwiperIndex>=this.state.pages.length-1?" swiper-button-disabled":""),onClick:()=>this.slideNext(),onTouchStart:r=>{this.setState({ignorePhonyClick:!0})}},R.createElement(pi,{className:"nav-button",disableRipple:!0},this.metaDataObject.isRtl?R.createElement(hv,{titleAccess:wn.getTranslation("Button.Next",this.props.preferredUiLanguages,"Next Page")}):R.createElement(gv,{titleAccess:wn.getTranslation("Button.Next",this.props.preferredUiLanguages,"Next Page")}))))}shouldAutoPlay(){var t=this.bookInfo.autoAdvance&&this.props.landscape;return this.props.autoplay==="yes"?t=!0:this.props.autoplay==="no"&&(t=!1),t&&!this.skipAutoPlay}setIndex(t){if(this.state.isLoading||this.startingUpSwiper)return;this.setState({currentSwiperIndex:t});const n=this.getPageAtSwiperIndex(t);n&&(this.applyPageSizeClass(n),this.animation.HandlePageBeforeVisible(n),this.video.hidingPage(),this.video.HandlePageBeforeVisible(n),qx(),this.music.hidingPage(),oa===Cn.AudioPaused||oa===Cn.VideoPaused?Yn(Cn.NewPageMediaPaused):(this.skipAutoPlay=!0,Nx(),this.skipAutoPlay=!1,Yn(Cn.NewPage)))}getPageAtSwiperIndex(t){if(this.swiperInstance==null)return null;const n=this.swiperInstance.slides[t];return n?n.getElementsByClassName("bloom-page")[0]:null}getPageIdFromIndex(t){const n=this.getPageAtSwiperIndex(t);if(!n)throw new Error("No bloomPage at index "+t);return n.getAttribute("id")}getCurrentPage(){return this.currentPage}isXmatterPage(){const t=this.currentPage;if(!t)return!0;const n=t.getAttribute("class");return!n||n.indexOf("bloom-page")<0||n.indexOf("bloom-backMatter")>=0||n.indexOf("bloom-frontMatter")>=0?!0:t.hasAttribute("data-xmatter-page")}showingPage(t){if(this.state.isLoading||this.startingUpSwiper)return;this.props.pageChanged&&this.props.pageChanged(t);const n=this.getPageAtSwiperIndex(t);if(!n){this.swiperInstance&&this.setPlayerTimeout(()=>this.showingPage(t),50);return}const a=this.getPlayerOptionsForPage(n);this.currentPageHidesNavigationButtons=!!(a&&a.hideNavigation),this.props.hidingNavigationButtonsCallback&&this.props.hidingNavigationButtonsCallback(this.currentPageHidesNavigationButtons),this.activityManager.showingPage(t,n)&&(this.indicesOfPagesWhereWeShouldPreserveDOMState[t]=!0),this.setPlayerTimeout(()=>{this.currentPage=n,this.currentPageIndex=t,this.currentPageHasVideo=Qs.pageHasVideo(n),this.applyPageSizeClass(n),this.resetForNewPageAndPlay(n),this.props.paused&&this.animation.shouldAnimate(n)&&(this.animation.HandlePageBeforeVisible(n),this.animation.HandlePageVisible(n,this.props.paused),this.animation.HandlePageDurationAvailable(n,nm(n),this.props.paused)),this.isXmatterPage()||(this.bookInteraction.pageShown(t),t===this.indexOflastNumberedPage&&(this.bookInteraction.lastNumberedPageWasRead=!0)),this.props.reportPageProperties&&this.props.reportPageProperties({hasAudio:Rx(n),hasMusic:this.music.pageHasMusic(n),hasVideo:this.currentPageHasVideo}),this.bookInteraction.reportedAudioOnCurrentPage=!1,this.bookInteraction.reportedVideoOnCurrentPage=!1,this.sendUpdateOfBookProgressReportToExternalContext(),this.swiperInstance.params.noSwiping=this.activityManager.getActivityAbsorbsDragging(),this.swiperInstance.params.touchRatio=this.activityManager.getActivityAbsorbsDragging()?0:1,this.activityManager.getActivityAbsorbsTyping()?this.swiperInstance.keyboard.disable():this.swiperInstance.keyboard.enable(),Array.from(n.querySelectorAll("[data-sound]")).forEach(l=>{l.addEventListener("click",Jh)})},0)}addScrollbarsToPageWhenReady(t){if(this.state.isLoading||this.startingUpSwiper)return;const n=this.getPageAtSwiperIndex(t);if(!n){this.swiperInstance&&this.setPlayerTimeout(()=>this.addScrollbarsToPageWhenReady(t),50);return}V1(n,op.handlePointerMoveEvent)}static handlePointerMoveEvent(t){t.pointerType==="mouse"&&t.target?.closest(".nicescroll-cursors")&&t.stopPropagation()}storeAudioAnalytics(t){t<.001||Number.isNaN(t)||(this.bookInteraction.totalAudioDuration+=t,!this.isXmatterPage()&&(this.bookInteraction.reportedAudioOnCurrentPage||(this.bookInteraction.reportedAudioOnCurrentPage=!0,this.bookInteraction.audioPageShown(this.currentPageIndex)),this.sendUpdateOfBookProgressReportToExternalContext()))}storeVideoAnalytics(t){t<.001||(this.bookInteraction.totalVideoDuration+=t,!this.bookInteraction.reportedVideoOnCurrentPage&&!this.isXmatterPage()&&(this.bookInteraction.reportedVideoOnCurrentPage=!0,this.bookInteraction.videoPageShown(this.currentPageIndex)),this.sendUpdateOfBookProgressReportToExternalContext())}resetForNewPageAndPlay(t){if(this.props.paused){this.video.HandlePageVisible(t,()=>this.props.paused);return}if(ry(t),this.currentPageHasVideo){const n=()=>{this.video.HandlePageVisible(t,()=>this.props.paused),this.music.pause()};if(Yn(Cn.VideoPlaying),!this.sentBloomNotification&&(this.sentBloomNotification=!0,this.props.shouldReportSoundLog)){Yf("/publish/av/startRecording",this.videoList).then(n);return}n()}else this.playAudioAndAnimation(t)}playAudioAndAnimation(t){if(this.activityManager.getActivityManagesSound()){this.activityManager.doInitialSoundAndAnimation();return}if(Yn(Cn.AudioPlaying),!t)return;const n=nm(t);this.animation.HandlePageDurationAvailable(t,n,this.props.paused);const a=()=>{Mu.pageHasAnimation(t)&&this.animation.HandlePageBeforeVisible(t),this.animation.HandlePageVisible(t,this.props.paused),ly(t,this.animation.animatableCanvas),this.music.HandlePageVisible(t)};if(!this.sentBloomNotification&&(this.sentBloomNotification=!0,this.props.shouldReportSoundLog)){Yf("/publish/av/startRecording",this.videoList).then(a);return}a()}getVideoList(t){let n="";for(const l of Array.from(t.getElementsByTagName("video"))){var a=l,r=a.getElementsByTagName("source")[0].getAttribute("src");n&&(n+="|"),n+=r}return n}handlePageClick(t){if(!this.state.ignorePhonyClick&&(!this.activityManager.getActivityAbsorbsClicking()||t.target.closest("[data-href]")&&t.target.closest(".bloom-canvas"))&&!t.target.closest(".bloom-videoContainer")){const n=eA(t.nativeEvent,this.bookInfo.bookInstanceId,()=>this.getPageIdFromIndex(this.state.currentSwiperIndex));n?(this.navigate(n.bookUrl,n.pageId),t.stopPropagation(),t.preventDefault()):this.props.onContentClick&&this.props.onContentClick(t)}this.setState({ignorePhonyClick:!1})}}function dA(e){return e.replace("%23","#").replace(/[\u00A0-\u9999<>\&]/gim,t=>"&#"+t.charCodeAt(0)+";")}function fA(e){return e.ownerDocument.evaluate("//div[contains(@class, 'bloom-imageDescription')]/div[contains(@class, 'bloom-editable') and contains(@class, 'bloom-visibility-code-on')]//*[contains(@class, 'audio-sentence') or contains(@class, 'bloom-highlightSegment')]",e,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null).snapshotLength>0?!0:e.ownerDocument.evaluate("//div[contains(@class, 'bloom-imageDescription')]/div[contains(@class, 'bloom-editable') and contains(@class, 'bloom-visibility-code-on') and @data-audiorecordingmode='TextBox']/p[text()]",e,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null).snapshotLength>0}var Ks={},Kv;function hA(){if(Kv)return Ks;Kv=1;var e=Za(),t=Ja();Object.defineProperty(Ks,"__esModule",{value:!0}),Ks.default=void 0;var n=t(sa()),a=e(Qa()),r=(0,a.default)(n.createElement("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"}),"ArrowBack");return Ks.default=r,Ks}var pA=hA();const gA=On(pA);var qs={},qv;function mA(){if(qv)return qs;qv=1;var e=Za(),t=Ja();Object.defineProperty(qs,"__esModule",{value:!0}),qs.default=void 0;var n=t(sa()),a=e(Qa()),r=(0,a.default)(n.createElement("path",{d:"M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"}),"MoreHoriz");return qs.default=r,qs}var vA=mA();const yA=On(vA);var $s={},$v;function bA(){if($v)return $s;$v=1;var e=Za(),t=Ja();Object.defineProperty($s,"__esModule",{value:!0}),$s.default=void 0;var n=t(sa()),a=e(Qa()),r=(0,a.default)(n.createElement("path",{d:"M10 16.5l6-4.5-6-4.5v9zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"}),"PlayCircleOutline");return $s.default=r,$s}var wA=bA();const Vb=On(wA);var Hs={},Hv;function kA(){if(Hv)return Hs;Hv=1;var e=Za(),t=Ja();Object.defineProperty(Hs,"__esModule",{value:!0}),Hs.default=void 0;var n=t(sa()),a=e(Qa()),r=(0,a.default)(n.createElement("path",{d:"M9 16h2V8H9v8zm3-14C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm1-4h2V8h-2v8z"}),"PauseCircleOutline");return Hs.default=r,Hs}var xA=kA();const SA=On(xA);var Fs={},Fv;function CA(){if(Fv)return Fs;Fv=1;var e=Za(),t=Ja();Object.defineProperty(Fs,"__esModule",{value:!0}),Fs.default=void 0;var n=t(sa()),a=e(Qa()),r=(0,a.default)(n.createElement("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zm6.93 6h-2.95c-.32-1.25-.78-2.45-1.38-3.56 1.84.63 3.37 1.91 4.33 3.56zM12 4.04c.83 1.2 1.48 2.53 1.91 3.96h-3.82c.43-1.43 1.08-2.76 1.91-3.96zM4.26 14C4.1 13.36 4 12.69 4 12s.1-1.36.26-2h3.38c-.08.66-.14 1.32-.14 2 0 .68.06 1.34.14 2H4.26zm.82 2h2.95c.32 1.25.78 2.45 1.38 3.56-1.84-.63-3.37-1.9-4.33-3.56zm2.95-8H5.08c.96-1.66 2.49-2.93 4.33-3.56C8.81 5.55 8.35 6.75 8.03 8zM12 19.96c-.83-1.2-1.48-2.53-1.91-3.96h3.82c-.43 1.43-1.08 2.76-1.91 3.96zM14.34 14H9.66c-.09-.66-.16-1.32-.16-2 0-.68.07-1.35.16-2h4.68c.09.65.16 1.32.16 2 0 .68-.07 1.34-.16 2zm.25 5.56c.6-1.11 1.06-2.31 1.38-3.56h2.95c-.96 1.65-2.49 2.93-4.33 3.56zM16.36 14c.08-.66.14-1.32.14-2 0-.68-.06-1.34-.14-2h3.38c.16.64.26 1.31.26 2s-.1 1.36-.26 2h-3.38z"}),"Language");return Fs.default=r,Fs}var TA=CA();const EA=On(TA);var Ws={},Wv;function PA(){if(Wv)return Ws;Wv=1;var e=Za(),t=Ja();Object.defineProperty(Ws,"__esModule",{value:!0}),Ws.default=void 0;var n=t(sa()),a=e(Qa()),r=(0,a.default)(n.createElement("path",{d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"}),"Fullscreen");return Ws.default=r,Ws}var MA=PA();const AA=On(MA);var _s={},_v;function NA(){if(_v)return _s;_v=1;var e=Za(),t=Ja();Object.defineProperty(_s,"__esModule",{value:!0}),_s.default=void 0;var n=t(sa()),a=e(Qa()),r=(0,a.default)(n.createElement("path",{d:"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"}),"FullscreenExit");return _s.default=r,_s}var LA=NA();const BA=On(LA);function zA(e){return Rt.createElement(fh,{...e,width:"21",height:"20",viewBox:"0 0 21 20"},Rt.createElement("path",{d:"M20.6181 9.909C20.6181 9.909 17.3581 3.70568 10.2454 3.70568C10.1127 3.70568 9.9821 3.70851 9.8522 3.71275L9.23133 0.590958L8.27889 0.807585L8.87136 3.78574C2.72807 4.50344 0 9.86355 0 9.86355C0 9.86355 0.566707 11.0581 1.77366 12.4165L1.27674 9.91983C1.26639 9.90052 1.26089 9.89016 1.26089 9.89016C1.26089 9.89016 1.45882 9.53343 1.86833 9.01188L2.73952 13.3918C3.09729 13.7179 3.49205 14.0383 3.92423 14.3419L2.68074 8.09074C2.92754 7.84068 3.20826 7.58049 3.52199 7.32171L5.05787 15.0424C5.40441 15.2277 5.77033 15.3993 6.15474 15.5514L4.38901 6.67725C4.6772 6.48487 4.98565 6.29932 5.31568 6.12485L7.26481 15.9206C7.59924 16.0118 7.94578 16.0871 8.30509 16.146L7.56314 12.4167C7.89823 12.8518 8.32205 13.2046 8.80465 13.4464L9.36563 16.2656C9.59813 16.2802 9.83459 16.2891 10.0765 16.2891C10.1734 16.2891 10.2694 16.2873 10.3654 16.2844L9.86541 13.773C10.0112 13.7923 10.1591 13.8033 10.3099 13.8033C10.4957 13.8033 10.6783 13.7883 10.8559 13.7588L11.9801 19.4091L12.9321 19.1924L12.3108 16.0683C17.848 14.9378 20.6181 9.909 20.6181 9.909ZM6.88084 8.9881L6.22651 5.69889C6.53386 5.57339 6.8575 5.45942 7.19546 5.35982L7.6228 7.50844C7.28066 7.93015 7.02351 8.43381 6.88084 8.9881ZM8.46692 6.74577L8.14503 5.12836C8.45547 5.06785 8.77691 5.01958 9.11002 4.9859L9.3773 6.32923C9.05322 6.42294 8.74741 6.56375 8.46692 6.74577ZM10.3467 6.19713L10.0944 4.93033C10.1472 4.92963 10.1998 4.92845 10.2533 4.92845C10.4858 4.92845 10.713 4.93599 10.9365 4.94941C13.2188 5.33628 14.964 7.44981 14.964 9.99965C14.964 12.1188 13.7579 13.9352 12.0406 14.7106L11.7914 13.4565C13.0153 12.8558 13.8654 11.5342 13.8654 9.99942C13.8652 7.91226 12.2936 6.21856 10.3467 6.19713ZM14.5336 14.0984C15.4349 13.0056 15.9823 11.5718 15.9823 9.99942C15.9823 8.35399 15.3821 6.8595 14.405 5.74928C17.7771 7.16772 19.3574 9.92642 19.3574 9.92642C19.3574 9.92642 17.7491 12.6074 14.5336 14.0984Z"}))}var Vs={},Vv;function IA(){if(Vv)return Vs;Vv=1;var e=Za(),t=Ja();Object.defineProperty(Vs,"__esModule",{value:!0}),Vs.default=void 0;var n=t(sa()),a=e(Qa()),r=(0,a.default)(n.createElement("path",{d:"M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"}),"VolumeUp");return Vs.default=r,Vs}var DA=IA();const RA=On(DA),jA=e=>{const[t,n]=R.useState((e.languages.filter(d=>d.IsSelected)[0]||e.languages[0]).Code),a=d=>{const f=d.target.value;n(f),e.onClose(f)},r=()=>{e.onClose("")},l=()=>{const d=e.languages.map(f=>Rt.createElement("div",{className:"chooserItem",key:f.Code},Rt.createElement(hM,{value:f.Code,control:Rt.createElement(EM,null),label:f.Name,checked:f.Code===t}),Rt.createElement("span",{className:"spacer"}),Rt.createElement(RA,{className:"icon",visibility:f.HasAudio?"inherit":"hidden"})));return Rt.createElement("div",{className:"radioGroupDiv"},d)};return Rt.createElement(QP,{className:"languageMenu",onClose:r,"aria-labelledby":"language-menu-title",open:!0,scroll:"paper"},Rt.createElement(rM,{id:"language-menu-title"},"Languages in this book:"),Rt.createElement(cM,{component:"fieldset"},Rt.createElement(PM,{className:"radioGroup","aria-label":"languages",name:"languages",value:t,onChange:a},l())),Rt.createElement(nM,null,Rt.createElement(AP,{onClick:r,color:"secondary"},"Close")))};var Kr=(e=>(e[e.showArrow=0]="showArrow",e[e.showEllipsis=1]="showEllipsis",e[e.showNothing=2]="showNothing",e))(Kr||{});const OA=e=>{const[t,n]=R.useState(!1),a="button"+(e.bookLanguages.length<2?" disabled":""),r=L=>{n(!1),L!==""&&(e.onLanguageChanged(L),d({lang:L}))},l=()=>{try{document.fullscreenElement!=null||document.webkitFullscreenElement!=null?document.exitFullscreen?document.exitFullscreen():document.webkitExitFullScreen&&document.webkitExitFullScreen():document.documentElement.requestFullscreen?document.documentElement.requestFullscreen():document.documentElement.webkitRequestFullscreen&&document.documentElement.webkitRequestFullscreen()}catch(L){console.error("RequestFullScreen failed: ",L)}},d=L=>{if(!e.videoPreviewMode)return;const K={lang:e.activeLanguageCode,imageDescriptions:e.readImageDescriptions,...L};Yf("publish/av/videoSettings",encodeURIComponent(JSON.stringify(K)))},f=wn.getTranslation("Audio.Pause",e.preferredLanguages,"Pause"),p=e.paused?Rt.createElement(Vb,{titleAccess:e.playLabel}):Rt.createElement(SA,{titleAccess:f}),y=wn.getTranslation("Button.ReadImageDescriptions",e.preferredLanguages,"Read Image Descriptions"),k=wn.getTranslation("Button.IgnoreImageDescriptions",e.preferredLanguages,"Ignore Image Descriptions"),E=ul({palette:{primary:{main:oA},secondary:{main:Wb.palette.secondary.main}}}),N=Rt.createElement(qu,{theme:E},Rt.createElement(zA,{"aria-label":e.readImageDescriptions?"Read image descriptions":"Ignore image descriptions",titleAccess:e.readImageDescriptions?k:y,opacity:e.readImageDescriptions?1:.38,color:e.nowReadingImageDescription?"primary":"secondary"})),I=e.extraButtons?e.extraButtons.map(L=>Rt.createElement(pi,{key:L.id,color:"secondary",title:L.description,onClick:()=>bi({messageType:L.id})},Rt.createElement("img",{style:{maxHeight:"24px",maxWidth:"24px"},src:L.iconUrl}))):void 0;return Rt.createElement(bP,{color:"primary",className:`control-bar ${e.visible?", visible":""}`,id:"control-bar",elevation:0,position:"relative"},Rt.createElement(OM,null,!e.videoPreviewMode&&Rt.createElement(pi,{color:"secondary",onClick:()=>{e.backClicked&&e.backClicked()},"data-testid":"history-back-button",disabled:e.getBackButtonState()===2},e.getBackButtonState()===0?Rt.createElement(gA,{"aria-label":"Go Back",titleAccess:wn.getTranslation("Button.Back",e.preferredLanguages,"Back")}):e.getBackButtonState()===1&&Rt.createElement(yA,{"aria-label":"More Menu",titleAccess:wn.getTranslation("Button.More",e.preferredLanguages,"More")})),Rt.createElement("div",{className:"filler"}),e.bookHasImageDescriptions&&Rt.createElement(pi,{onClick:()=>{e.onReadImageDescriptionToggled(),d({imageDescriptions:!e.readImageDescriptions})}},N),e.bookLanguages.length>1&&Rt.createElement(pi,{className:a,"aria-label":"Choose Language",color:"secondary",onClick:()=>{n(!0)}},Rt.createElement(EA,{titleAccess:wn.getTranslation("Button.ChooseLanguage",e.preferredLanguages,"Choose Language")})),t&&Rt.createElement(jA,{languages:e.bookLanguages,onClose:r}),!e.videoPreviewMode&&Rt.createElement(pi,{color:"secondary","aria-label":"PlayPause",onClick:()=>{e.pausedChanged&&e.pausedChanged(!e.paused)}},e.showPlayPause?p:null),I,document.fullscreenEnabled&&e.canShowFullScreen&&!e.videoPreviewMode&&Rt.createElement(pi,{color:"secondary",onClick:()=>l()},document.fullscreenElement==null?Rt.createElement(AA,{"aria-label":"Full Screen",titleAccess:wn.getTranslation("Button.FullScreen",e.preferredLanguages,"Full Screen")}):Rt.createElement(BA,{"aria-label":"Exit Full Screen",titleAccess:wn.getTranslation("Button.ExitFullScreen",e.preferredLanguages,"Exit Full Screen")}))))};function qf(e,t){return Math.round(e/t)*t}function KA(e){if(!(!e||e==="cover")){if(/^\d+$/.test(e))return e;try{return e.replace(new RegExp("(?![0-9])\\p{Nd}","gu"),t=>{const n=t.charCodeAt(0);return(n&15)-6*(new RegExp("\\p{Nd}","u").test(String.fromCodePoint(n|15))?1:0)})}catch{return}}}let $f=!1,kh=e=>{};function qA(e){kh&&kh(e)}let Gv=0,Uv=0;function Yv(){const e=/iPad|iPhone|iPod/.test(navigator.platform);let t,n,a;e&&(t=document.getElementsByClassName("bloomPlayer")[0],n=t.parentElement,a=t.nextSibling,n.removeChild(t));const r=document.documentElement.clientWidth,l=document.documentElement.clientHeight;return e&&n.insertBefore(t,a),{width:r,height:l}}const $A=e=>{const[t,n]=R.useState(e.autoplay),a=e.centerVertically===void 0?!0:e.centerVertically;aC(Pt=>{Pt.pause?($f=!_,$(!0)):Pt.resume&&$f?$(!1):Pt.play?($(!1),Pt.autoplay&&n(Pt.autoplay)):Pt.reset?(k(e.startPage??0),Oe.current&&Oe.current(e.startPage??0)):Pt.controlAction&&st(Pt.controlAction)});const[r,l]=R.useState(!1),[d,f]=R.useState(e.initiallyShowAppBar),[,p]=R.useState(0);R.useEffect(()=>{const Pt=()=>{f(!0),p(ne=>ne+1)};return wh.subscribe(Pt),()=>{wh.unsubscribe(Pt)}},[]);const[y,k]=R.useState(e.startPage??0),[E,N]=R.useState([""]),[I,L]=R.useState(!1),[K,J]=R.useState(!1),[F,G]=R.useState(""),[ot,dt]=R.useState("Device16x9Portrait");R.useEffect(()=>{f(e.initiallyShowAppBar)},[e.initiallyShowAppBar]),R.useEffect(()=>{d?tC():eC()},[d]),R.useEffect(()=>{$(e.paused)},[e.paused]);const[_,$]=R.useState(e.paused),[v,mt]=R.useState(!1),ft=wn.getBloomUiLanguage(),Lt=ft==="en"?[ft]:[ft,"en"],[Nt,At]=R.useState(Lt);R.useEffect(()=>{_||($f=!1)},[_]);const[tt,H]=R.useState(!1),[s,ht]=R.useState(!1),[x,lt]=R.useState(!1),[bt,St]=R.useState(!1),[O,wt]=R.useState(!1),[xt,Ot]=R.useState(0),[Mt,Ht]=R.useState(9/16),Qt=[],[de,me]=R.useState(Qt),[Pe,ln]=R.useState(""),Oe=R.useRef(),[rn,Ve]=R.useState(!0),[kn,Ye]=R.useState(!1),[yn,Je]=R.useState(!1),[un,M]=R.useState(0),D=()=>{M(Pt=>Pt+1)},[Y,it]=R.useState("");R.useEffect(()=>{Xt()},[O,un,tt,e.useOriginalPageSize]),R.useEffect(()=>()=>{const Pt=document.getElementById("scale-style-sheet");Pt&&Pt.parentNode.removeChild(Pt)},[]);const vt=R.useRef(),st=Pt=>{switch(Pt){case"navigate-to-next-page":vt&&vt.current&&vt.current.slideNext();break;case"navigate-to-previous-page":vt&&vt.current&&vt.current.slidePrevious();break;default:console.log("'handleControlMessage' received an unknown message.");return}},Xt=()=>{const Pt=document.getElementsByClassName("swiper-slide-active")[0];let ne=null;if(Pt&&(ne=Pt.getElementsByClassName("bloom-page")[0]),!ne||!O){window.setTimeout(D,100);return}let xe=document.getElementById("scale-style-sheet");xe||(xe=document.createElement("style"),xe.setAttribute("type","text/css"),xe.setAttribute("id","scale-style-sheet"),document.head.appendChild(xe));let ve=xt,zt=Mt;const Ft=rp(ne);(e.url!==F||Ft!==ot)&&(G(e.url),dt(Ft),window.onresize=()=>{const{width:ta,height:Ta}=Yv();(Ta!==Uv||ta!==Gv)&&D()},ve=Math.max(ne.offsetHeight,ne.offsetWidth),zt=Math.min(ne.offsetHeight,ne.offsetWidth)/ve,Ht(zt),Ot(ve));const{width:re,height:Le}=Yv();Gv=re,Uv=Le;const Ae=re>Le;if(Ae!==tt){H(Ae);return}let cn=0,je=0;const $n=window.getComputedStyle(document.body);$n&&$n.marginTop&&(cn=parseInt($n.marginTop,10)),$n&&$n.marginBottom&&(je=parseInt($n.marginBottom,10));const Jn=ne.getAttribute("class").indexOf("Landscape")>=0,la=Jn?ve*zt:ve,ua=Jn?ve:ve*zt;let Qn=cn+je;if(d){const ta=document.getElementById("control-bar");ta&&(Qn+=ta.offsetHeight);const Ta=document.getElementById("pageNumberControl");Ta&&(Qn+=Ta.offsetHeight)}const ur=Le-Qn,Sn=Me({pageWidth:ua,pageHeight:la,desiredPageHeight:ur}),dn=Re(ua);let fn=Math.min(Sn,dn);const ca=la*fn;let zn=ca*zt/fn;Jn&&(zn=ca/zt/fn);const wi=re/fn-zn;let $a="",Tn=Math.max((re-ua*fn)/2,0);e.roundMarginToNearestK&&(Tn=qf(Tn,e.roundMarginToNearestK));const cr=Tn,dr=fn,Vr=30;if(wi>100*2)$a="largeOutsideButtons";else if(wi>Vr*2)$a="smallOutsideButtons";else if(re>407&&navigator.userAgent.includes("Chrome")&&!e.hideSwiperButtons){const Ta=new RegExp(" Chrome/([0-9]+).").exec(navigator.userAgent),fr=parseInt(Ta[1]);fr&&fr<90&&(fn*=.9,Tn=Math.max((re-ua*fn)/2,0),$a="smallOutsideButtons extraScalingForChrome85Bug")}$a!==Y&&it($a);let Ri="";if(a){const ta=(Le-ca-Qn)/2;ta>0&&(Ri=`translate(0, ${ta.toFixed(0)}px) `)}xe.innerText=`.bloomPlayer {
|
|
7983
7983
|
width: ${zn}px;
|
|
7984
7984
|
transform-origin: left top 0;
|
|
7985
7985
|
transform: ${Ri}scale(${fn});
|
|
@@ -7992,4 +7992,4 @@ Add a <Suspense fallback=...> component higher in the tree to provide a loading
|
|
|
7992
7992
|
}
|
|
7993
7993
|
}
|
|
7994
7994
|
.bloomPlayer-page {height: ${ca/fn}px; overflow: hidden;}`,Y1(ne,fn),r||l(!0)},Me=Pt=>{const{pageWidth:ne,pageHeight:xe,desiredPageHeight:ve}=Pt,zt=ve/xe;if(!e.roundPageWidthToNearestK)return zt;const Ft=ne*zt;return qf(Ft,e.roundPageWidthToNearestK)/ne},Re=Pt=>{let ne=document.body.offsetWidth;return e.roundPageWidthToNearestK&&(ne=qf(ne,e.roundPageWidthToNearestK)),ne/Pt};R.useEffect(()=>{v&&!_&&mt(!1);const Pt=document.getElementById("root");Pt&&(kh=ne=>{(ne.key===" "||ne.key==="ArrowRight"&&v)&&(ne.preventDefault(),ne.stopImmediatePropagation(),$(!_),mt(!1))},Pt.addEventListener("keydown",qA,{capture:!0}))});const ee=Pt=>{Pe!==Pt&&(sl.selectNewLanguageCode(de,Pt),ln(Pt))},Xe=(Pt,ne,xe)=>{Oe.current=xe;let ve;if(e.videoSettings){const zt=JSON.parse(e.videoSettings);ve=zt.lang,Ve(zt.imageDescriptions??!1)}e.initialLanguageCode&&(ve=e.initialLanguageCode),ve&&Pt.map(zt=>zt.Code).includes(ve)?sl.selectNewLanguageCode(Pt,ve):ve=Pt.length>0?Pt[0].Code:"",ln(ve),me(Pt),Ye(ne),e.videoPreviewMode&&!d&&f(!0)},Qe=wn.getTranslation("Audio.Play",Nt,"Play"),Kn=wn.getTranslation("Audio.ReadAloud",Nt,"Read Aloud"),Ze=s?Kn:Qe,{allowToggleAppBar:xn,showBackButton:Bn,backButtonIcon:qn,initiallyShowAppBar:Vt,locationOfDistFolder:Nn,hideFullScreenButton:X,...Ut}=e,ie=ul({palette:{primary:{main:"#000",contrastText:"#FFF"},secondary:{main:"#FFF"}}}),$e=Pt=>{Je(Pt)},Ge=gn({root:{color:nr,height:2,padding:"15px 0"},active:{},valueLabel:{left:"calc(50% - 16px)",top:-31,"& *":{background:nr,color:"white"}},track:{height:4,opacity:.5},rail:{height:2,opacity:.5,backgroundColor:nr},mark:{backgroundColor:"transparent"},markActive:{backgroundColor:"transparent"},markLabel:{top:20,fontSize:"0.6rem",color:nr},markLabelActive:{top:20,fontSize:"0.6rem",color:nr}})(DM),Ue=ul({direction:"rtl"}),ke=Rt.createElement(Ge,{valueLabelDisplay:"on",min:1,max:E.length,step:1,disabled:K,defaultValue:y+1,onChangeCommitted:(Pt,ne)=>{const xe=ne;xe-1!=y&&(k(xe-1),Oe.current&&Oe.current(xe-1))},valueLabelFormat:(Pt,ne)=>E[Pt-1],marks:[{value:E.length,label:E.length.toString()}]});return Rt.createElement("div",{className:"reactRoot"},v&&Rt.createElement(Rt.Fragment,null,Rt.createElement("div",{className:"bigButtonOverlay"},Rt.createElement(qu,{theme:ie},Rt.createElement(pi,{className:"bigPlayButton",color:"secondary",onClick:()=>{mt(!1),$(!1)}},Rt.createElement(Vb,{titleAccess:Ze,preserveAspectRatio:"xMidYMid meet"})))),Rt.createElement("div",{className:"behindBigButtonOverlay"})),Rt.createElement(OA,{getBackButtonState:()=>vt.current?.CanGoBack()?Kr.showArrow:Bn?qn==="arrow"?Kr.showArrow:qn==="ellipsis"?Kr.showEllipsis:window===window.top?Kr.showArrow:Kr.showEllipsis:Kr.showNothing,visible:d,paused:_,pausedChanged:Pt=>$(Pt),playLabel:Ze,preferredLanguages:Nt,backClicked:()=>{vt.current?.HandleBackButtonClickedIfHavePlayerHistory()||QS()},showPlayPause:s||x||bt,bookLanguages:de,activeLanguageCode:Pe,onLanguageChanged:ee,canShowFullScreen:!e.hideFullScreenButton,extraButtons:e.extraButtons,bookHasImageDescriptions:kn,readImageDescriptions:rn,onReadImageDescriptionToggled:()=>Ve(!rn),nowReadingImageDescription:yn,videoPreviewMode:e.videoPreviewMode}),Rt.createElement(sA,{getBookInstanceId:()=>vt.current?.getBookInstanceId()??""}),Rt.createElement(op,{ref:vt,url:e.url,landscape:tt,paused:_,preferredUiLanguages:Nt,pageStylesAreNowInstalled:()=>{wt(!0)},locationOfDistFolder:e.locationOfDistFolder,reportBookProperties:Pt=>{const ne={landscape:Pt.landscape,canRotate:Pt.canRotate};XS(ne),At([ft].concat(Pt.preferredLanguages)),N(Pt.pageNumbers),L(Pt.isRtl),Pt.internalUrl!=Hf&&(Hf&&D(),Hf=Pt.internalUrl)},controlsCallback:Xe,setForcedPausedCallback:Pt=>{Pt?($(Pt),mt(!0)):mt(!1)},reportPageProperties:Pt=>{ht(Pt.hasAudio),lt(Pt.hasMusic),St(Pt.hasVideo)},onContentClick:Pt=>{e.allowToggleAppBar&&(f(!d),window.setTimeout(D,300+50))},activeLanguageCode:Pe,useOriginalPageSize:e.useOriginalPageSize,hideSwiperButtons:e.hideSwiperButtons,autoplay:t,skipActivities:e.skipActivities,outsideButtonPageClass:Y,extraClassNames:r?"":"hidePlayer",shouldReadImageDescriptions:rn,imageDescriptionCallback:$e,pageChanged:Pt=>{Pt!=y&&k(Pt)},hidingNavigationButtonsCallback:Pt=>{Pt!=K&&J(Pt)},shouldReportSoundLog:e.shouldReportSoundLog,startPageIndex:e.startPage,autoplayCount:e.autoplayCount}),d&&!e.videoPreviewMode&&Rt.createElement("div",{id:"pageNumberControl",className:"MuiToolbar-gutters"},I?Rt.createElement(qu,{theme:Ue},ke):ke))};function HA(){const e=Oa("extraButtons");if(!e)return[];const t=decodeURIComponent(e);try{return JSON.parse(t)}catch(n){return console.error("Failed to parse extra button info "+JSON.stringify(n)),nC("error decoding extraButtons param "+e+": "+n),[]}}function FA(){const e=Oa("backButtonIcon");return e==="arrow"||e==="ellipsis"?e:void 0}function WA(){fx(parseFloat(Oa("defaultDuration","3.0")));const e=Oa("autoplay","motion"),t=Oa("start-page"),n=KA(t),a=n?parseInt(n):void 0,r=Oa("autoplay-count"),l=t?parseInt(r):void 0,d=xa("paused",!1);lr.render(Rt.createElement(qu,{theme:Wb},Rt.createElement($A,{url:Oa("url"),allowToggleAppBar:xa("allowToggleAppBar",!1),showBackButton:xa("showBackButton",!1),backButtonIcon:FA(),initiallyShowAppBar:xa("initiallyShowAppBar",!0),centerVertically:xa("centerVertically",!0),initialLanguageCode:Oa("lang"),videoSettings:Oa("videoSettings"),paused:d,locationOfDistFolder:"",useOriginalPageSize:xa("useOriginalPageSize",!1),hideFullScreenButton:xa("hideFullScreenButton",!1),autoplay:e,skipActivities:xa("skipActivities",!1),videoPreviewMode:xa("videoPreviewMode",!1),hideSwiperButtons:xa("hideNavButtons",!1),extraButtons:HA(),shouldReportSoundLog:xa("reportSoundLog",!1),startPage:a,autoplayCount:l,roundPageWidthToNearestK:Nm("roundPageWidthToNearestK"),roundMarginToNearestK:Nm("roundMarginToNearestK")})),document.getElementById("root"))}let Hf="";WA();
|
|
7995
|
-
//# sourceMappingURL=bloomPlayer.
|
|
7995
|
+
//# sourceMappingURL=bloomPlayer.COPDbsaZ.js.map
|
package/dist/bloomplayer.htm
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
<!-- At build time, we replace the target of this script tag to point at the
|
|
20
20
|
the bloom player bundle with the cache-busting hash in its name. -->
|
|
21
|
-
<script src="bloomPlayer.
|
|
21
|
+
<script src="bloomPlayer.COPDbsaZ.js"></script>
|
|
22
22
|
</body>
|
|
23
23
|
|
|
24
24
|
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "A library for displaying Bloom books in iframes or WebViews",
|
|
4
4
|
"author": "SIL Global",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "2.
|
|
6
|
+
"version": "2.23.0-alpha.1",
|
|
7
7
|
"packageManager": "pnpm@11.1.2",
|
|
8
8
|
"private": false,
|
|
9
9
|
"// sideeffects might need to be ['*.css'] to avoid 'shaking' our CSS, if we ever get tree shaking working": "",
|