/ *
THIS IS A GENERATED / BUNDLED FILE BY ESBUILD
if you want to view the source , please visit the github repository of this plugin
* /
var Lr = Object . create ; var ke = Object . defineProperty ; var Fr = Object . getOwnPropertyDescriptor ; var _r = Object . getOwnPropertyNames , Lt = Object . getOwnPropertySymbols , Vr = Object . getPrototypeOf , Ft = Object . prototype . hasOwnProperty , Hr = Object . prototype . propertyIsEnumerable ; var _t = ( r , e , t ) => e in r ? ke ( r , e , { enumerable : ! 0 , configurable : ! 0 , writable : ! 0 , value : t } ) : r [ e ] = t , we = ( r , e ) => { for ( var t in e || ( e = { } ) ) Ft . call ( e , t ) && _t ( r , t , e [ t ] ) ; if ( Lt ) for ( var t of Lt ( e ) ) Hr . call ( e , t ) && _t ( r , t , e [ t ] ) ; return r } ; var Vt = r => ke ( r , "__esModule" , { value : ! 0 } ) ; var $r = ( r , e ) => { Vt ( r ) ; for ( var t in e ) ke ( r , t , { get : e [ t ] , enumerable : ! 0 } ) } , Wr = ( r , e , t ) => { if ( e && typeof e == "object" || typeof e == "function" ) for ( let o of _r ( e ) ) ! Ft . call ( r , o ) && o !== "default" && ke ( r , o , { get : ( ) => e [ o ] , enumerable : ! ( t = Fr ( e , o ) ) || t . enumerable } ) ; return r } , W = r => Wr ( Vt ( ke ( r != null ? Lr ( Vr ( r ) ) : { } , "default" , r && r . _ _esModule && "default" in r ? { get : ( ) => r . default , enumerable : ! 0 } : { value : r , enumerable : ! 0 } ) ) , r ) ; var d = ( r , e , t ) => new Promise ( ( o , i ) => { var n = p => { try { s ( t . next ( p ) ) } catch ( c ) { i ( c ) } } , a = p => { try { s ( t . throw ( p ) ) } catch ( c ) { i ( c ) } } , s = p => p . done ? o ( p . value ) : Promise . resolve ( p . value ) . then ( n , a ) ; s ( ( t = t . apply ( r , e ) ) . next ( ) ) } ) ; $r ( exports , { default : ( ) => Ot } ) ; var kr = W ( require ( "path" ) ) , Ce = W ( require ( "obsidian" ) ) ; var xe = W ( require ( "obsidian" ) ) ; var N ; ( function ( t ) { t . google = "google" , t . naver = "naver" } ) ( N || ( N = { } ) ) ; var Ht = W ( require ( "obsidian" ) ) ; var tt = class { getByQuery ( e ) { return d ( this , null , function * ( ) { try { let t = { q : e , maxResults : 40 , printType : "books" } , o = window . moment . locale ( ) ; o && ( t . langRestrict = o ) ; let i = yield $e ( "https://www.googleapis.com/books/v1/volumes" , t ) ; if ( i . totalItems == 0 ) throw new Error ( "No results found." ) ; return i . items . map ( ( { volumeInfo : n } ) => this . createBookItem ( n ) ) } catch ( t ) { throw console . warn ( t ) , t } } ) } getISBN ( e ) { return e == null ? void 0 : e . reduce ( ( t , o ) => ( o . type == "ISBN_10" && ( t . isbn10 = o . identifier . trim ( ) ) , o . type == "ISBN_13" && ( t . isbn13 = o . identifier . trim ( ) ) , t ) , { } ) } createBookItem ( e ) { var o , i , n , a , s ; return we ( { title : e . title , author : this . formatList ( e . authors ) , category : this . formatList ( e . categories ) , publisher : e . publisher , totalPage : e . pageCount , coverUrl : ( i = ( o = e . imageLinks ) == null ? void 0 : o . thumbnail ) != null ? i : "" , coverSmallUrl : ( a = ( n = e . imageLinks ) == null ? void 0 : n . smallThumbnail ) != null ? a : "" , publishDate : ( ( s = e . publishedDate ) == null ? void 0 : s . slice ( 0 , 4 ) ) || "" , description : e . description , link : e . canonicalVolumeLink || e . infoLink , previewLink : e . previewLink } , this . getISBN ( e . industryIdentifiers ) ) } convertGoogleBookImageURLSize ( e , t ) { return e . replace ( /(&zoom)=\d/ , ` $ 1= ${ t } ` ) } formatList ( e ) { var t , o ; return ( e == null ? void 0 : e . length ) > 1 ? e . map ( i => ` ${ i . trim ( ) } ` ) . join ( ", " ) : ( o = ( t = e == null ? void 0 : e [ 0 ] ) == null ? void 0 : t . replace ( "N/A" , "" ) ) != null ? o : "" } } ; var rt = class { constructor ( e , t ) { this . clientId = e ; this . clientSecret = t } getByQuery ( e ) { return d ( this , null , function * ( ) { try { let t = { query : e , display : 50 , sort : "sim" } , o = { "X-Naver-Client-Id" : this . clientId , "X-Naver-Client-Secret" : this . clientSecret } , i = yield $e ( "https://openapi.naver.com/v1/search/book.json" , t , o ) ; if ( i . total == 0 ) throw new Error ( "No results found." ) ; return i . items . map ( this . createBookItem ) } catch ( t ) { throw console . warn ( t ) , t } } ) } createBookItem ( e ) { var t , o ; return we ( { title : e . title , author : e . author , publisher : e . publisher , coverUrl : e . image , publishDate : ( ( t = e . pubdate ) == null ? void 0 : t . slice ( 0 , 4 ) ) || "" , link : e . link , description : e . description , isbn : e . isbn } , ( ( o = e . isbn ) == null ? void 0 : o . length ) >= 13 ? { isbn13 : e . isbn } : { isbn10 : e . isbn } ) } } ; function $t ( r ) { if ( r . serviceProvider === N . google ) return new tt ; if ( r . serviceProvider === N . naver ) { if ( ! r . naverClientId || ! r . naverClientSecret ) throw new Error ( '\uB124\uC774\uBC84 \uAC1C\uBC1C\uC790\uC13C\uD130\uC5D0\uC11C "Client ID"\uC640 "Client Secret"\uB97C \uBC1C\uAE09\uBC1B\uC544 \uC124\uC815\uD574\uC8FC\uC138\uC694.' ) ; return new rt ( r . naverClientId , r . naverClientSecret ) } } function $e ( o ) { return d ( this , arguments , function * ( r , e = { } , t ) { let i = new URL ( r ) ; return Object . entries ( e ) . forEach ( ( [ a , s ] ) => { i . searchParams . append ( a , s == null ? void 0 : s . toString ( ) ) } ) , ( yield ( 0 , Ht . requestUrl ) ( { url : i . href , method : "GET" , headers : we ( { Accept : "*/*" , "Content-Type" : "application/json; charset=utf-8" } , t ) } ) ) . json } ) } var ot = class extends xe . Modal { constructor ( e , t , o ) { super ( e . app ) ; this . query = t , this . callback = o , this . serviceProvider = $
` ).map(e=>{var n,a;let t=e.indexOf(":");if(t===-1)return[e.trim(),""];let o=(n=e.slice(0,t))==null?void 0:n.trim(),i=(a=e.slice(t+1))==null?void 0:a.trim();return[o,i]}).reduce((e,[t,o])=>{var i;return t&&(e[t]=(i=o==null?void 0:o.trim())!=null?i:""),e},{}):{}}function Yt(r){return Object.entries(r).map(([e,t])=>{var i;let o=(i=t==null?void 0:t.toString().trim())!=null?i:"";return/ \r | \n /.test(o)?"":/: \s /.test(o)? ` $ { e } : "${o.replace(/" / g , """ ) } "
` : ` $ { e } : $ { o }
` }).join("").trim()}function zt(r){let e;return r.offset!==null&&r.offset!==void 0&&typeof r.offset=="number"&&(e=window.moment.duration(r.offset,"days")),r.format?window.moment().add(e).format(r.format):window.moment().add(e).format("YYYY-MM-DD")}function We(r){let e=r;for(;st.test(e);){let t=st.exec(e),o;if(t[1]){let i=t[1].replace("+","").trim();Gt.test(i)&&(o=parseInt(i))}e=Kt(e,st,zt({offset:o}))}for(;at.test(e);){let t=at.exec(e),o=t[1],i;if(t[2]){let n=t[2].replace("+","").trim();Gt.test(n)&&(i=parseInt(n))}e=Kt(e,at,zt({format:o,offset:i}))}return e}function Kt(r,e,t){return r.replace(e,function(){return t})}var wr=W(require("obsidian"));var P="top",D="bottom",k="right",T="left",Xe="auto",oe=[P,D,k,T],Z="start",le="end",Qt="clippingParents",Ge="viewport",be="popper",Jt="reference",lt=oe.reduce(function(r,e){return r.concat([e+"-"+Z,e+"-"+le])},[]),Ue=[].concat(oe,[Xe]).reduce(function(r,e){return r.concat([e,e+"-"+Z,e+"-"+le])},[]),Yr="beforeRead",zr="read",Kr="afterRead",Qr="beforeMain",Jr="main",Zr="afterMain",eo="beforeWrite",to="write",ro="afterWrite",Zt=[Yr,zr,Kr,Qr,Jr,Zr,eo,to,ro];function M(r){return r?(r.nodeName||"").toLowerCase():null}function B(r){if(r==null)return window;if(r.toString()!=="[object Window]"){var e=r.ownerDocument;return e&&e.defaultView||window}return r}function J(r){var e=B(r).Element;return r instanceof e||r instanceof Element}function A(r){var e=B(r).HTMLElement;return r instanceof e||r instanceof HTMLElement}function ye(r){if(typeof ShadowRoot=="undefined")return!1;var e=B(r).ShadowRoot;return r instanceof e||r instanceof ShadowRoot}function oo(r){var e=r.state;Object.keys(e.elements).forEach(function(t){var o=e.styles[t]||{},i=e.attributes[t]||{},n=e.elements[t];!A(n)||!M(n)||(Object.assign(n.style,o),Object.keys(i).forEach(function(a){var s=i[a];s===!1?n.removeAttribute(a):n.setAttribute(a,s===!0?"":s)}))})}function io(r){var e=r.state,t={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,t.popper),e.styles=t,e.elements.arrow&&Object.assign(e.elements.arrow.style,t.arrow),function(){Object.keys(e.elements).forEach(function(o){var i=e.elements[o],n=e.attributes[o]||{},a=Object.keys(e.styles.hasOwnProperty(o)?e.styles[o]:t[o]),s=a.reduce(function(p,c){return p[c]="",p},{});!A(i)||!M(i)||(Object.assign(i.style,s),Object.keys(n).forEach(function(p){i.removeAttribute(p)}))})}}var er={name:"applyStyles",enabled:!0,phase:"write",fn:oo,effect:io,requires:["computeStyles"]};function R(r){return r.split("-")[0]}var Y=Math.max,pe=Math.min,ee=Math.round;function X(r,e){e===void 0&&(e=!1);var t=r.getBoundingClientRect(),o=1,i=1;if(A(r)&&e){var n=r.offsetHeight,a=r.offsetWidth;a>0&&(o=ee(t.width)/a||1),n>0&&(i=ee(t.height)/n||1)}return{width:t.width/o,height:t.height/i,top:t.top/i,right:t.right/o,bottom:t.bottom/i,left:t.left/o,x:t.left/o,y:t.top/i}}function ce(r){var e=X(r),t=r.offsetWidth,o=r.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-o)<=1&&(o=e.height),{x:r.offsetLeft,y:r.offsetTop,width:t,height:o}}function De(r,e){var t=e.getRootNode&&e.getRootNode();if(r.contains(e))return!0;if(t&&ye(t)){var o=e;do{if(o&&r.isSameNode(o))return!0;o=o.parentNode||o.host}while(o)}return!1}function _(r){return B(r).getComputedStyle(r)}function pt(r){return["table","td","th"].indexOf(M(r))>=0}function F(r){return((J(r)?r.ownerDocument:r.document)||window.document).documentElement}function te(r){return M(r)==="html"?r:r.assignedSlot||r.parentNode||(ye(r)?r.host:null)||F(r)}function tr(r){return!A(r)||_(r).position==="fixed"?null:r.offsetParent}function no(r){var e=navigator.userAgent.toLowerCase().indexOf("firefox")!==-1,t=navigator.userAgent.indexOf("Trident")!==-1;if(t&&A(r)){var o=_(r);if(o.position==="fixed")return null}var i=te(r);for(ye(i)&&(i=i.host);A(i)&&["html","body"].indexOf(M(i))<0;){var n=_(i);if(n.transform!=="none"||n.perspective!=="none"||n.contain==="paint"||["transform","perspective"].indexOf(n.willChange)!==-1||e&&n.willChange==="filter"||e&&n.filter&&n.filte
$ { s }
-- -
$ { p } ` :p})}insertMetadata(){return d(this,null,function*(){try{let e=this.app.workspace.getActiveViewOfType(Ce.MarkdownView);if(!e){console.warn("Can not find an active markdown view");return}let t=yield this.searchBookMetadata(e.file.basename);if(!e.editor){console.warn("Can not find editor from the active markdown view");return}let o=yield this.getRenderedContents(t);e.editor.replaceRange(o,{line:0,ch:0})}catch(e){console.warn(e),this.showNotice(e)}})}createNewBookNote(){return d(this,null,function*(){try{let e=yield this.searchBookMetadata(),t=this.app.workspace.getLeaf();if(!t){console.warn("No active leaf");return}let o=yield this.getRenderedContents(e),i=Ut(e,this.settings.fileNameFormat),n=kr.join(this.settings.folder,i),a=yield this.app.vault.create(n,o);yield t.openFile(a,{state:{mode:"source"}}),t.setEphemeralState({rename:"all"}),yield new nt(this.app).jumpToNextCursorLocation()}catch(e){this.showNotice(e)}})}openBookSearchModal(e=""){return d(this,null,function*(){return new Promise((t,o)=>new ot(this,e,(i,n)=>i?o(i):t(n)).open())})}openBookSuggestModal(e){return d(this,null,function*(){return new Promise((t,o)=>new it(this.app,e,(i,n)=>i?o(i):t(n)).open())})}loadSettings(){return d(this,null,function*(){this.settings=Object.assign({},jr,yield this.loadData())})}saveSettings(){return d(this,null,function*(){yield this.saveData(this.settings)})}};