/*! */ (()=>{"use strict";var t={8183:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BookmarkButton=void 0;const n=i(8312),s=i(6911),r=i(6738);let a="https://b.hatena.ne.jp";const o=new RegExp("^((?:local|b(?!log)\\w+)\\.hatena\\.ne\\.jp(?::[0-9]+)?)$").exec(location.host),h=new RegExp("^([\\w-]+\\.b-dev\\.hatena\\.ne\\.jp)$").exec(location.host),l=new RegExp("^(b-staging\\.hatena\\.ne\\.jp)$").exec(location.host);o?a=location.protocol+"//"+o[1]:h?a=location.protocol+"//"+h[1]:l&&(a=location.protocol+"//"+l[1]);class c{constructor(t){this.link=t,this.url=t.getAttribute("data-hatena-bookmark-url")||c.extractURL(t.href)||c.getCurrentURL(),this.setup()}static isInitialized(){return!!window.hatenaBookmarkButtonsInitialized}static setup(){window.hatenaBookmarkButtonsInitialized=!0,window.setInterval((function(){c.tryCreate()}),c.interval),c.tryCreate()}static tryCreate(){document.querySelectorAll("a.hatena-bookmark-button").forEach((t=>{t.dataset.hatenaBookmarkInitialized||new c(t)}))}static extractURL(t){if(!t)return null;const e=t.match(/^https?:\/\/b\.hatena\.ne\.jp\/entry\/(?:add\/)?(.+)/);if(!e)return null;let i=e[1];const n=i.match(/^(?:https?(?:(:)|(%3A))|(s\/))?/);if(n&&n[2])try{return decodeURIComponent(i)}catch(t){return null}return n&&!n[1]&&(i=n[3]?"https://"+i.substring(2):"http://"+i),i.replace(/%23/g,"#")}static getCurrentURL(){let t=location.href,e=c.getCanonicalURL();if(e){const i=t.indexOf("#");i>=0&&e.indexOf("#")<0&&(e+=t.substring(i)),t=e}return t}static getCanonicalURL(){const t=document.querySelector('link[rel="canonical"]');return null==t?void 0:t.href}setup(){var t;let e=this.link.getAttribute("data-hatena-bookmark-layout");if("simple"===e){if(this.link.dataset.hatenaBookmarkInitialized="1",this.link.addEventListener("click",this.clickHandler.bind(this)),location.origin!==a){const t=new Image,e=new URL(a+"/entry/button/");e.searchParams.set("url",this.url),e.searchParams.set("layout","simple"),e.searchParams.set("format","image"),t.src=e.toString()}return}const i={"simple-balloon":{width:47,height:20},"standard-balloon":{width:115,height:20},"standard-noballoon":{width:86,height:20},"vertical-balloon":{width:84,height:40},basic:{width:20,height:20},"basic-counter":{width:47,height:20},"basic-label":{width:86,height:20},"basic-label-counter":{width:115,height:20},touch:{width:40,height:40},"touch-counter":{width:40,height:40},"vertical-normal":{width:84,height:40},"vertical-large":{width:88,height:58}};"vertical"===e&&(e="vertical-normal");let o=50,h=20;e&&i[e]&&(o=i[e].width,h=i[e].height);const l=Number(this.link.getAttribute("data-hatena-bookmark-width")),c=Number(this.link.getAttribute("data-hatena-bookmark-height")),d=l&&Number.isFinite(l)?l:o,u=c&&Number.isFinite(c)?c:h;this.frame=(0,s.createElement)("iframe",{className:"hatena-bookmark-button-frame",title:this.link.title,width:d,height:u,src:"javascript:false"}),this.frame.style.width=`${d}px`,this.frame.style.height=`${u}px`,this.frame.style.border="none",null===(t=this.link.parentNode)||void 0===t||t.replaceChild(this.frame,this.link);const m=this.link.getAttribute("data-hatena-bookmark-theme");let p=a+"/entry/button/?url="+encodeURIComponent(this.url);e&&"standard"!==e&&(p+="&layout="+encodeURIComponent(e));const g=this.link.getAttribute("data-hatena-bookmark-lang");g&&(p+="&lang="+encodeURIComponent(g)),m&&(p+="&theme="+encodeURIComponent(m)),this.messenger=r.WindowMessenger.createForFrame(this.frame,p),this.observer=new n.Observer(this.messenger,"click",this.clickHandler.bind(this)),this.resizeObserver=new n.Observer(this.messenger,"resize",this.resizeMessageHandler.bind(this)),this.button=this.frame}clickHandler(t){t.preventDefault&&t.preventDefault(),window.open(this.makePanelURL(),"_blank")}resizeMessageHandler(t){const e=t.data.width+"",i=t.data.height+"";/^\d+$/.test(e)&&(this.frame.style.width=e+"px"),/^\d+$/.test(i)&&(this.frame.style.height=i+"px")}destroy(){this.observer&&this.observer.stop(),this.resizeObserver&&this.resizeObserver.stop(),this.messenger&&this.messenger.destroy(),this.button&&this.button.parentNode&&this.button.parentNode.removeChild(this.button)}makePanelURL(){let t=a+"/entry/panel/?url="+encodeURIComponent(this.url);return t+="#bbutton",t}}e.BookmarkButton=c,c.interval=428},8312:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Observer=e.Dispatchable=e.DispatchableEvent=void 0;class i{constructor(t,e){this.type=t,this.data=e,this.defaultPrevented=!1}preventDefault(){this.defaultPrevented=!0}}e.DispatchableEvent=i;e.Dispatchable=class{constructor(){this._listenersMap={}}addEventListener(t,e){const i=this.getListeners(t);for(let t=0;t{Object.defineProperty(e,"__esModule",{value:!0}),e.createElement=void 0,e.createElement=function(t,e){const i=document.createElement(t);for(const t in e)i[t]=e[t];for(let t=2;t{Object.defineProperty(e,"__esModule",{value:!0}),e.WindowMessenger=void 0;const n=i(8312);class s extends n.Dispatchable{constructor(t,e){super(),this.win=t,this.origin=e.replace(/^(https?:\/\/[^\/?#]+)[\s\S]*/,"$1"),this.messageCallback=this.messageHandler.bind(this),window.addEventListener("message",this.messageCallback,!1)}static createForFrame(t,e){const i=t.contentWindow;return i.name=(++s.keySeed).toString(36)+"|"+location.href,i.location.replace(e),new s(i,e)}messageHandler(t){if(t.origin!==this.origin||t.source!==this.win||!/^HBMessage@/.test(t.data))return;const e=JSON.parse(t.data.substring(10));this.dispatchEvent(e.type,e.data)}destroy(){window.removeEventListener("message",this.messageCallback,!1)}}e.WindowMessenger=s,s.keySeed=65536*Math.random()<<8}},e={};function i(n){var s=e[n];if(void 0!==s)return s.exports;var r=e[n]={exports:{}};return t[n](r,r.exports,i),r.exports}(()=>{const t=i(8183);t.BookmarkButton.isInitialized()||t.BookmarkButton.setup()})()})();