define(["exports"],function(_exports){function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(_isNativeReflectConstruct=function(){return!!t})()}function ownKeys(e,r){var o,t=Object.keys(e);return Object.getOwnPropertySymbols&&(o=Object.getOwnPropertySymbols(e),r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,o)),t}function _classPrivateFieldInitSpec(e,t,a){_checkPrivateRedeclaration(e,t),t.set(e,a)}function _checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function _classPrivateFieldSet(s,a,r){s.set(_assertClassBrand(s,a),r)}function _classPrivateFieldGet(s,a){return s.get(_assertClassBrand(s,a))}function _assertClassBrand(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}function _createForOfIteratorHelper(r,e){var o,a,u,n,t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(t)return u=!(a=!0),{s:function(){t=t.call(r)},n:function(){var r=t.next();return a=r.done,r},e:function(r){u=!0,o=r},f:function(){try{a||null==t.return||t.return()}finally{if(u)throw o}}};if(Array.isArray(r)||(t=function(r,a){{var t;if(r)return"string"==typeof r?_arrayLikeToArray(r,a):"Map"===(t="Object"===(t={}.toString.call(r).slice(8,-1))&&r.constructor?r.constructor.name:t)||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0}}(r))||e&&r&&"number"==typeof r.length)return t&&(r=t),n=0,{s:e=function(){},n:function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}},e:function(r){throw r},f:e};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);estart?0:b.left>start?-1:1}),endOffset=1===_nodes.nodeType?0:bisectNode(doc,_nodes,function(a,b){a=mapRect(getBoundingClientRect(a)),b=mapRect(getBoundingClientRect(b));return a.rightend?0:b.left>end?-1:1}),range=doc.createRange();return range.setStart(_nodes$,startOffset),range.setEnd(_nodes,endOffset),range}function selectionIsBackward(sel){var range=document.createRange();return range.setStart(sel.anchorNode,sel.anchorOffset),range.setEnd(sel.focusNode,sel.focusOffset),range.collapsed}function setSelectionTo(target,collapse){var range;target.startContainer?range=target.cloneRange():target.nodeType&&(range=document.createRange()).selectNode(target),range&&(target=range.startContainer.ownerDocument.defaultView.getSelection())&&(target.removeAllRanges(),-1===collapse?range.collapse(!0):1===collapse&&range.collapse(),target.addRange(range))}function getBackground(doc){var bodyStyle=doc.defaultView.getComputedStyle(doc.body);return("rgba(0, 0, 0, 0)"===bodyStyle.backgroundColor&&"none"===bodyStyle.backgroundImage?doc.defaultView.getComputedStyle(doc.documentElement):bodyStyle).background}function makeMarginals(length,part){return Array.from({length:length},function(){var div=document.createElement("div"),child=document.createElement("div");return div.append(child),child.setAttribute("part",part),div})}function setStylesImportant(el,styles){for(var style=el.style,_i=0,_Object$entries=Object.entries(styles);_i<_Object$entries.length;_i++){var _Object$entries$_i=babelHelpers.slicedToArray(_Object$entries[_i],2),k=_Object$entries$_i[0],_Object$entries$_i=_Object$entries$_i[1];style.setProperty(k,_Object$entries$_i,"important")}}var easeOutQuad=function(x){return 1-(1-x)*(1-x)},animate=function(a,b,duration,ease,render){return new Promise(function(resolve){var start,step=function(now){null==start&&(start=now);var min,max,now=Math.min(1,(now-start)/duration);render((min=a,max=b,ease(now)*(max-min)+min)),now<1?requestAnimationFrame(step):resolve()};requestAnimationFrame(step)})},uncollapse=function(range){if(null!=range&&range.collapsed){var node,endOffset=range.endOffset,endContainer=range.endContainer;if(1===endContainer.nodeType)return 1===(null==(node=endContainer.childNodes[endOffset])?void 0:node.nodeType)?node:endContainer;if(endOffset+1=this.pages-2}},{key:"prev",value:function(distance){return _assertClassBrand(_Paginator_brand,this,_turnPage).call(this,-1,distance)}},{key:"next",value:function(distance){return _assertClassBrand(_Paginator_brand,this,_turnPage).call(this,1,distance)}},{key:"prevSection",value:function(){return this.goTo({index:_assertClassBrand(_Paginator_brand,this,_adjacentIndex).call(this,-1)})}},{key:"nextSection",value:function(){return this.goTo({index:_assertClassBrand(_Paginator_brand,this,_adjacentIndex).call(this,1)})}},{key:"firstSection",value:function(){var index=this.sections.findIndex(function(section){return"no"!==section.linear});return this.goTo({index:index})}},{key:"lastSection",value:function(){var index=this.sections.findLastIndex(function(section){return"no"!==section.linear});return this.goTo({index:index})}},{key:"getContents",value:function(){return _classPrivateFieldGet(_view,this)?[{index:_classPrivateFieldGet(_index,this),overlayer:_classPrivateFieldGet(_view,this).overlayer,doc:_classPrivateFieldGet(_view,this).document}]:[]}},{key:"setStyles",value:function(styles){var $beforeStyle,beforeStyle,_styles2,_this5=this,_classPrivateFieldGet8=(_classPrivateFieldSet(_styles,this,styles),_classPrivateFieldGet(_styleMap,this).get(null==(_classPrivateFieldGet8=_classPrivateFieldGet(_view,this))?void 0:_classPrivateFieldGet8.document));_classPrivateFieldGet8&&($beforeStyle=(_classPrivateFieldGet8=babelHelpers.slicedToArray(_classPrivateFieldGet8,2))[0],_classPrivateFieldGet8=_classPrivateFieldGet8[1],Array.isArray(styles)?(beforeStyle=(_styles2=babelHelpers.slicedToArray(styles,2))[0],_styles2=_styles2[1],$beforeStyle.textContent=beforeStyle,_classPrivateFieldGet8.textContent=_styles2):_classPrivateFieldGet8.textContent=styles,requestAnimationFrame(function(){return _classPrivateFieldGet(_background,_this5).style.background=getBackground(_classPrivateFieldGet(_view,_this5).document)}),null!=($beforeStyle=_classPrivateFieldGet(_view,this)))&&null!=($beforeStyle=$beforeStyle.document)&&null!=($beforeStyle=$beforeStyle.fonts)&&null!=($beforeStyle=$beforeStyle.ready)&&$beforeStyle.then(function(){return _classPrivateFieldGet(_view,_this5).expand()})}},{key:"focusView",value:function(){_classPrivateFieldGet(_view,this).document.defaultView.focus()}},{key:"destroy",value:function(){var _this$sections$_class;_classPrivateFieldGet(_observer2,this).unobserve(this),_classPrivateFieldGet(_view,this).destroy(),_classPrivateFieldSet(_view,this,null),null!=(_this$sections$_class=this.sections[_classPrivateFieldGet(_index,this)])&&null!=_this$sections$_class.unload&&_this$sections$_class.unload(),_classPrivateFieldGet(_mediaQuery,this).removeEventListener("change",_classPrivateFieldGet(_mediaQueryListener,this))}}])}(babelHelpers.wrapNativeSuper(HTMLElement));function _createView(){var _this6=this;return _classPrivateFieldGet(_view,this)&&(_classPrivateFieldGet(_view,this).destroy(),_classPrivateFieldGet(_container,this).removeChild(_classPrivateFieldGet(_view,this).element)),_classPrivateFieldSet(_view,this,new View({container:this,onExpand:function(){return _assertClassBrand(_Paginator_brand,_this6,_scrollToAnchor).call(_this6,_classPrivateFieldGet(_anchor,_this6))}})),_classPrivateFieldGet(_container,this).append(_classPrivateFieldGet(_view,this).element),_classPrivateFieldGet(_view,this)}function _beforeRender(_ref8){var _columnWidth,vertical=_ref8.vertical,rtl=_ref8.rtl,_ref8=_ref8.background,_ref8=(_classPrivateFieldSet(_vertical2,this,vertical),_classPrivateFieldSet(_rtl2,this,rtl),_classPrivateFieldGet(_top,this).classList.toggle("vertical",vertical),_classPrivateFieldGet(_background,this).style.background=_ref8,_classPrivateFieldGet(_container,this).getBoundingClientRect()),width=_ref8.width,_ref8=_ref8.height,size=vertical?_ref8:width,style=getComputedStyle(_classPrivateFieldGet(_top,this)),maxInlineSize=parseFloat(style.getPropertyValue("--_max-inline-size")),maxColumnCount=parseInt(style.getPropertyValue("--_max-column-count-spread")),margin=parseFloat(style.getPropertyValue("--_margin")),style=(_classPrivateFieldSet(_margin,this,margin),parseFloat(style.getPropertyValue("--_gap"))/100),style=-style/(style-1)*size,flow=this.getAttribute("flow");return"scrolled"===flow?(this.setAttribute("dir",vertical?"rtl":"ltr"),_classPrivateFieldGet(_top,this).style.padding="0",_columnWidth=maxInlineSize,this.heads=null,this.feet=null,_classPrivateFieldGet(_header,this).replaceChildren(),_classPrivateFieldGet(_footer,this).replaceChildren(),{flow:flow,margin:margin,gap:style,columnWidth:_columnWidth}):(_columnWidth=size/(flow=Math.min(maxColumnCount,Math.ceil(size/maxInlineSize)))-style,this.setAttribute("dir",rtl?"rtl":"ltr"),maxColumnCount=vertical?Math.min(2,Math.ceil(width/maxInlineSize)):flow,size={gridTemplateColumns:"repeat(".concat(maxColumnCount,", 1fr)"),gap:"".concat(style,"px"),direction:"rtl"===this.bookDir?"rtl":"ltr"},Object.assign(_classPrivateFieldGet(_header,this).style,size),Object.assign(_classPrivateFieldGet(_footer,this).style,size),rtl=makeMarginals(maxColumnCount,"head"),vertical=makeMarginals(maxColumnCount,"foot"),this.heads=rtl.map(function(el){return el.children[0]}),this.feet=vertical.map(function(el){return el.children[0]}),(maxInlineSize=_classPrivateFieldGet(_header,this)).replaceChildren.apply(maxInlineSize,babelHelpers.toConsumableArray(rtl)),(flow=_classPrivateFieldGet(_footer,this)).replaceChildren.apply(flow,babelHelpers.toConsumableArray(vertical)),{height:_ref8,width:width,margin:margin,gap:style,columnWidth:_columnWidth})}function _onTouchStart(e){var touch=e.changedTouches[0];_classPrivateFieldSet(_touchState,this,{x:null==touch?void 0:touch.screenX,y:null==touch?void 0:touch.screenY,t:e.timeStamp,vx:0,xy:0})}function _onTouchMove(e){var x,touch,dx,dy,dt,state=_classPrivateFieldGet(_touchState,this);state.pinched||(state.pinched=1