replaywebpage 2.4.3 → 2.4.5

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.
package/ui.js CHANGED
@@ -66,7 +66,7 @@ class Ee extends Ie{constructor(e){if(super(e),this.it=X,e.type!==_e)throw Error
66
66
  * Copyright 2017 Google LLC
67
67
  * SPDX-License-Identifier: BSD-3-Clause
68
68
  */
69
- class Ae extends Ee{}Ae.directiveName="unsafeSVG",Ae.resultType=2;const Te=Ce(Ae),Pe="important",De=" !"+Pe,Fe=Ce(class extends Ie{constructor(e){if(super(e),e.type!==ze||"style"!==e.name||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce((t,i)=>{const o=e[i];return null==o?t:t+`${i=i.includes("-")?i:i.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${o};`},"")}update(e,[t]){const{style:i}=e.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(t)),this.render(t);for(const e of this.ft)null==t[e]&&(this.ft.delete(e),e.includes("-")?i.removeProperty(e):i[e]=null);for(const e in t){const o=t[e];if(null!=o){this.ft.add(e);const t="string"==typeof o&&o.endsWith(De);e.includes("-")||t?i.setProperty(e,t?o.slice(0,-11):o,t?Pe:""):i[e]=o}}return J}});var Me,Re=__webpack_require__(989);const Oe="./w/api",Ue="./w",Be=d(Re.A);function Ne(e){return[Be,e]}const qe=window.IS_APP||(null===(Me=window.electron)||void 0===Me?void 0:Me.IS_APP)||window.matchMedia("(display-mode: standalone)").matches,He="2.4.3";function je(e){" "==e.key&&(e.preventDefault(),e.target.click())}function We(e){const t=document.querySelector("head"),i=document.querySelectorAll("link[rel*='icon']");for(const e of i)t.removeChild(e);for(const i of e.icons){const e=document.createElement("link");e.rel=i.rel,e.href=i.href,t.appendChild(e)}}class Ve extends me{constructor(){super(),this.size="1.1em",this.width=null,this.height=null}static get properties(){return{svg:{type:String},size:{type:String},width:{type:String},height:{type:String}}}static get styles(){return h`
69
+ class Ae extends Ee{}Ae.directiveName="unsafeSVG",Ae.resultType=2;const Te=Ce(Ae),Pe="important",De=" !"+Pe,Fe=Ce(class extends Ie{constructor(e){if(super(e),e.type!==ze||"style"!==e.name||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce((t,i)=>{const o=e[i];return null==o?t:t+`${i=i.includes("-")?i:i.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${o};`},"")}update(e,[t]){const{style:i}=e.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(t)),this.render(t);for(const e of this.ft)null==t[e]&&(this.ft.delete(e),e.includes("-")?i.removeProperty(e):i[e]=null);for(const e in t){const o=t[e];if(null!=o){this.ft.add(e);const t="string"==typeof o&&o.endsWith(De);e.includes("-")||t?i.setProperty(e,t?o.slice(0,-11):o,t?Pe:""):i[e]=o}}return J}});var Me,Re=__webpack_require__(989);const Oe="./w/api",Ue="./w",Be=d(Re.A);function Ne(e){return[Be,e]}const qe=window.IS_APP||(null===(Me=window.electron)||void 0===Me?void 0:Me.IS_APP)||window.matchMedia("(display-mode: standalone)").matches,He="2.4.5";function je(e){" "==e.key&&(e.preventDefault(),e.target.click())}function We(e){const t=document.querySelector("head"),i=document.querySelectorAll("link[rel*='icon']");for(const e of i)t.removeChild(e);for(const i of e.icons){const e=document.createElement("link");e.rel=i.rel,e.href=i.href,t.appendChild(e)}}class Ve extends me{constructor(){super(),this.size="1.1em",this.width=null,this.height=null}static get properties(){return{svg:{type:String},size:{type:String},width:{type:String},height:{type:String}}}static get styles(){return h`
70
70
  :host {
71
71
  display: inline-block;
72
72
  padding: 0;
@@ -2361,7 +2361,7 @@ function*(e,t){if(void 0!==e){let i=0;for(const o of e)yield t(o,i++)}}(e.resour
2361
2361
 
2362
2362
  ${this.extraMsg&&Q` <p class="extra-msg">(${this.extraMsg})</p> `}
2363
2363
  </div>`:Q``}
2364
- `}onAskPermission(){var e;return i(this,void 0,void 0,function*(){"granted"===(yield null===(e=this.fileHandle)||void 0===e?void 0:e.requestPermission({mode:"read"}))&&this.doLoad()})}}t([ye({type:String})],So.prototype,"sourceUrl",void 0),t([ye({type:Object})],So.prototype,"loadInfo",void 0),t([ye({type:String})],So.prototype,"state",void 0),t([ye({type:Number})],So.prototype,"progress",void 0),t([ye({type:Number})],So.prototype,"percent",void 0),t([ye({type:Number})],So.prototype,"currentSize",void 0),t([ye({type:Number})],So.prototype,"totalSize",void 0),t([ye({type:String})],So.prototype,"error",void 0),t([ye({type:Number})],So.prototype,"total",void 0),t([ye({type:String})],So.prototype,"status",void 0),t([ye({type:String})],So.prototype,"coll",void 0),t([ye({type:String})],So.prototype,"embed",void 0),t([ye({type:Boolean})],So.prototype,"tryFileHandle",void 0),t([ye({type:Boolean})],So.prototype,"errorAllowRetry",void 0),t([ye({type:String})],So.prototype,"extraMsg",void 0),t([ye({type:String})],So.prototype,"swName",void 0),customElements.define("wr-loader",So);var $o=__webpack_require__(563),zo=__webpack_require__.n($o),_o=__webpack_require__(112);class Co extends me{constructor(){super(...arguments),this.filteredPages=[],this.sortedPages=[],this.query="",this.flex=null,this.textPages=null,this.newQuery=null,this.loading=!1,this.updatingSearch=!1,this.showAllPages=!1,this.hasExtraPages=!1,this.currList=0,this.active=!1,this.editable=!1,this.changeNeeded=!1,this.selectedPages=new Set,this.menuActive=!1,this.sortKey="date",this.sortDesc=!0,this.isSidebar=!1,this.url="",this.ts="",this.editing=!1,this.toDeletePages=null,this.toDeletePage=null,this.collInfo=null,this.allSelected=!1,this.defaultKey="",this.dynamicPagesQuery=!1,this.totalPages=0,this.dynamicPageCount=1,this.skipScrollMore=!1}static get sortKeys(){return[{key:"",name:"Best Match"},{key:"title",name:"Title"},{key:"date",name:"Date"}]}_timedUpdate(){null!==this.newQuery&&(this.query=this.newQuery,this.newQuery=null,this.filter())}updated(e){return i(this,void 0,void 0,function*(){if(e.has("collInfo")?this.updateTextSearch():(e.has("query")||e.has("currList")||e.has("showAllPages"))&&this.filter(),e.has("active")&&this.active&&this.changeNeeded&&this.filter(),e.has("query")){this.query?(this.sortKey="",this.sortDesc=!1):(this.sortKey="date",this.sortDesc=!0);const e=this.renderRoot.querySelector("wr-sorter");e&&(e.sortKey=this.sortKey,e.sortDesc=this.sortDesc)}if(e.has("sortedPages")&&this.isSidebar){const e=this.renderRoot.querySelector(".current");if(e){const t={behavior:"smooth",block:"nearest",inline:"nearest"};setTimeout(()=>e.scrollIntoView(t),100)}}})}onChangeQuery(e){this.newQuery=e.currentTarget.value,this._ival&&window.clearTimeout(this._ival),this._ival=window.setTimeout(()=>this._timedUpdate(),250)}filter(){return i(this,void 0,void 0,function*(){if(this.loading)return;if(this.active||(this.changeNeeded=!0),this.loading=!0,this.flex&&this.query&&this.textPages){const e=yield this.flex.searchAsync(this.query,25);this.filteredPages=e.map(e=>this.textPages[e])}else this.showAllPages&&this.hasExtraPages?this.filteredPages=[...this.textPages]:this.dynamicPagesQuery||(this.filteredPages=[...this.collInfo.pages]);if(this.totalPages=this.filteredPages.length,this.dynamicPagesQuery){if(this.query)this.hasExtraPages=!1;else{const e=this.collInfo.pages.filter(e=>e.isSeed||e.seed);this.filteredPages=this.showAllPages||!e.length?[...this.collInfo.pages]:e,this.hasExtraPages=e.length<this.collInfo.pages.length}this.dynamicPageCount=1,yield this.addDynamicPages()}0!==this.currList&&(yield this.filterCurated());for(const e of this.filteredPages){const{timestamp:t,date:i}=yt(e);e.timestamp=t,e.date=i}this.loading=!1,this.changeNeeded=!1;const e={query:this.query,currList:this.currList};this.sendChangeEvent(e)})}addDynamicPages(){return i(this,void 0,void 0,function*(){const e=new URLSearchParams;this.query&&e.set("search",this.query),e.set("page",this.dynamicPageCount+""),e.set("pageSize","25");const t=yield fetch(`${this.collInfo.apiPrefix}/pages?${e.toString()}`),i=yield t.json();if(!i.pages)return;i.pages.length||(this.skipScrollMore=!0);const o=new Set;this.filteredPages.forEach(e=>o.add(e.id));const n=[];for(const{id:e,url:t,title:r,mime:s,status:a,ts:l,favIconUrl:c,waczhash:d,isSeed:h,size:u}of i.pages){if(o.has(e))continue;if(!this.showAllPages&&this.hasExtraPages&&!this.query&&!h)continue;let i,f;"string"==typeof l?(f=new Date(l),i=new Date(l).getTime()):(i=l,f=new Date(i));const p={id:e,url:t,title:r,mime:s,status:a,ts:i,favIconUrl:c,waczhash:d,timestamp:xt(f.toISOString()),size:u,date:f};n.push(p)}n.length&&(this.filteredPages=[...this.filteredPages,...n]),this.totalPages=this.filteredPages.length})}filterCurated(){return i(this,void 0,void 0,function*(){const e=yield fetch(`${this.collInfo.apiPrefix}/curated/${this.currList}`),t=(yield e.json()).curated;this.filteredPages=t})}sendChangeEvent(e){this.dispatchEvent(new CustomEvent("coll-tab-nav",{detail:{data:e}}))}addPages(e){var t;const i=new _o.Index;return this.flex=i,this.textPages=e,this.dynamicPagesQuery||(this.hasExtraPages=Boolean(this.textPages&&(null===(t=this.collInfo)||void 0===t?void 0:t.pages)&&this.textPages.length>this.collInfo.pages.length)),this.collInfo&&(this.dynamicPagesQuery=this.collInfo.canQueryPages||!1),Promise.all(e.map((e,t)=>{let o=e.url;return e.title&&(o+=" "+e.title),e.text&&(o+=" "+e.text),i.addAsync(t,o)}))}updateTextSearch(){var e,t,o,r;return i(this,void 0,void 0,function*(){if(this.updatingSearch)return;this.updatingSearch=!0;let i=0;try{const c=yield caches.open("cache:"+this.collInfo.coll),d=`${this.collInfo.apiPrefix}/textIndex`;let h=yield c.match(d);h&&Number(h.headers.get("Content-Length"))||(h=yield fetch(d),200===h.status&&Number(h.headers.get("Content-Length"))&&c.put(d,h.clone()));const u=[];try{for(var s,a=!0,l=n(zo()(h.body.getReader()));s=yield l.next(),!(e=s.done);a=!0){r=s.value,a=!1;const e=r;e.url&&(e.id=++i,u.push(e))}}catch(e){t={error:e}}finally{try{a||e||!(o=l.return)||(yield o.call(l))}finally{if(t)throw t.error}}yield this.addPages(u)}catch(e){console.warn(e)}finally{0===i&&(yield this.addPages(this.collInfo.pages)),this.updatingSearch=!1}yield this.filter()})}static get styles(){return Ne(h`
2364
+ `}onAskPermission(){var e;return i(this,void 0,void 0,function*(){"granted"===(yield null===(e=this.fileHandle)||void 0===e?void 0:e.requestPermission({mode:"read"}))&&this.doLoad()})}}t([ye({type:String})],So.prototype,"sourceUrl",void 0),t([ye({type:Object})],So.prototype,"loadInfo",void 0),t([ye({type:String})],So.prototype,"state",void 0),t([ye({type:Number})],So.prototype,"progress",void 0),t([ye({type:Number})],So.prototype,"percent",void 0),t([ye({type:Number})],So.prototype,"currentSize",void 0),t([ye({type:Number})],So.prototype,"totalSize",void 0),t([ye({type:String})],So.prototype,"error",void 0),t([ye({type:Number})],So.prototype,"total",void 0),t([ye({type:String})],So.prototype,"status",void 0),t([ye({type:String})],So.prototype,"coll",void 0),t([ye({type:String})],So.prototype,"embed",void 0),t([ye({type:Boolean})],So.prototype,"tryFileHandle",void 0),t([ye({type:Boolean})],So.prototype,"errorAllowRetry",void 0),t([ye({type:String})],So.prototype,"extraMsg",void 0),t([ye({type:String})],So.prototype,"swName",void 0),customElements.define("wr-loader",So);var $o=__webpack_require__(563),zo=__webpack_require__.n($o),_o=__webpack_require__(112);class Co extends me{constructor(){super(...arguments),this.filteredPages=[],this.sortedPages=[],this.query="",this.flex=null,this.textPages=null,this.newQuery=null,this.loading=!1,this.updatingSearch=!1,this.showAllPages=!1,this.hasExtraPages=!1,this.currList=0,this.active=!1,this.editable=!1,this.changeNeeded=!1,this.selectedPages=new Set,this.menuActive=!1,this.sortKey="date",this.sortDesc=!0,this.isSidebar=!1,this.url="",this.ts="",this.editing=!1,this.toDeletePages=null,this.toDeletePage=null,this.collInfo=null,this.allSelected=!1,this.defaultKey="",this.dynamicPagesQuery=!1,this.totalPages=0,this.dynamicPageCount=1,this.skipScrollMore=!1}static get sortKeys(){return[{key:"",name:"Best Match"},{key:"title",name:"Title"},{key:"date",name:"Date"}]}_timedUpdate(){null!==this.newQuery&&(this.query=this.newQuery,this.newQuery=null,this.filter())}updated(e){return i(this,void 0,void 0,function*(){if(e.has("collInfo")?this.updateTextSearch():(e.has("query")||e.has("currList")||e.has("showAllPages"))&&this.filter(),e.has("active")&&this.active&&this.changeNeeded&&this.filter(),e.has("query")){this.query?(this.sortKey="",this.sortDesc=!1):(this.sortKey="date",this.sortDesc=!0);const e=this.renderRoot.querySelector("wr-sorter");e&&(e.sortKey=this.sortKey,e.sortDesc=this.sortDesc)}if(e.has("sortedPages")&&this.isSidebar){const e=this.renderRoot.querySelector(".current");if(e){const t={behavior:"smooth",block:"nearest",inline:"nearest"};setTimeout(()=>e.scrollIntoView(t),100)}}})}onChangeQuery(e){this.newQuery=e.currentTarget.value,this._ival&&window.clearTimeout(this._ival),this._ival=window.setTimeout(()=>this._timedUpdate(),250)}filter(){return i(this,void 0,void 0,function*(){if(this.loading)return;if(this.active||(this.changeNeeded=!0),this.loading=!0,this.flex&&this.query&&this.textPages){const e=yield this.flex.searchAsync(this.query,25);this.filteredPages=e.map(e=>this.textPages[e])}else this.showAllPages&&this.hasExtraPages?this.filteredPages=[...this.textPages]:this.dynamicPagesQuery||(this.filteredPages=[...this.collInfo.pages]);if(this.totalPages=this.filteredPages.length,this.dynamicPagesQuery){if(this.query)this.hasExtraPages=!1;else{const e=this.collInfo.pages.filter(e=>e.isSeed||e.seed);this.filteredPages=this.showAllPages||!e.length?[...this.collInfo.pages]:e,this.hasExtraPages=e.length<this.collInfo.pages.length}this.dynamicPageCount=1,yield this.addDynamicPages()}0!==this.currList&&(yield this.filterCurated());for(const e of this.filteredPages){const{timestamp:t,date:i}=yt(e);e.timestamp=t,e.date=i}this.loading=!1,this.changeNeeded=!1;const e={query:this.query,currList:this.currList};this.sendChangeEvent(e)})}addDynamicPages(){return i(this,void 0,void 0,function*(){const e=new URLSearchParams;this.query&&e.set("search",this.query),e.set("page",this.dynamicPageCount+""),e.set("pageSize","25");const t=yield fetch(`${this.collInfo.apiPrefix}/pages?${e.toString()}`),i=yield t.json();if(!i.pages)return;i.pages.length||(this.skipScrollMore=!0);const o=new Set;this.filteredPages.forEach(e=>o.add(e.id));const n=[];for(const{id:e,url:t,title:r,mime:s,status:a,ts:l,favIconUrl:c,waczhash:d,isSeed:h,size:u}of i.pages){if(o.has(e))continue;if(!this.showAllPages&&this.hasExtraPages&&!this.query&&!h)continue;let i,f;"string"==typeof l?(f=new Date(l),i=new Date(l).getTime()):(i=l,f=new Date(i));const p={id:e,url:t,title:r,mime:s,status:a,ts:i,favIconUrl:c,waczhash:d,timestamp:xt(f.toISOString()),size:u,date:f};n.push(p)}n.length&&(this.filteredPages=[...this.filteredPages,...n]),this.totalPages=this.filteredPages.length})}filterCurated(){return i(this,void 0,void 0,function*(){const e=yield fetch(`${this.collInfo.apiPrefix}/curated/${this.currList}`),t=(yield e.json()).curated;this.filteredPages=t})}sendChangeEvent(e){this.dispatchEvent(new CustomEvent("coll-tab-nav",{detail:{data:e}}))}addPages(e){var t;const i=new _o.Index;return this.flex=i,this.textPages=e,this.dynamicPagesQuery||(this.hasExtraPages=Boolean(this.textPages&&(null===(t=this.collInfo)||void 0===t?void 0:t.pages)&&this.textPages.length>this.collInfo.pages.length)),this.collInfo&&(this.dynamicPagesQuery=this.collInfo.canQueryPages||!1),Promise.all(e.map((e,t)=>{let o=e.url;return e.title&&(o+=" "+e.title),e.text&&(o+=" "+e.text),i.addAsync(t,o)}))}updateTextSearch(){var e,t,o,r;return i(this,void 0,void 0,function*(){if(this.updatingSearch)return;this.updatingSearch=!0;let i=0;try{const c=yield caches.open("cache:"+this.collInfo.coll),d=`${this.collInfo.apiPrefix}/textIndex`;let h=yield c.match(d);h&&Number(h.headers.get("Content-Length"))||(h=yield fetch(d),200===h.status&&Number(h.headers.get("Content-Length"))&&c.put(d,h.clone()));const u=[];try{for(var s,a=!0,l=n(zo()(h.body.getReader()));s=yield l.next(),!(e=s.done);a=!0){r=s.value,a=!1;const e=r;e.url&&(e.id=++i,"string"==typeof e.ts&&(e.ts=new Date(e.ts).getTime()),u.push(e))}}catch(e){t={error:e}}finally{try{a||e||!(o=l.return)||(yield o.call(l))}finally{if(t)throw t.error}}yield this.addPages(u)}catch(e){console.warn(e)}finally{0===i&&(yield this.addPages(this.collInfo.pages)),this.updatingSearch=!1}yield this.filter()})}static get styles(){return Ne(h`
2365
2365
  :host {
2366
2366
  width: 100%;
2367
2367
  flex: 1 1 auto;