window.storecrm_config = {"backendUrl":"https://obake.groovymedia.co","appProxyName":"obake"}; (()=>{"use strict";var t={208:(t,e,n)=>{n.d(e,{A:()=>a});var o=n(601),i=n.n(o),r=n(314),s=n.n(r)()(i());s.push([t.id,'.storecrm_modal {\n  display: none;\n}\n\n.storecrm_modal.is-open {\n  display: block;\n}\n\n.storecrm_modal_line {\n  margin: 1rem 0;\n}\n\n.storecrm_modal_line label {\n  display: flex;\n  align-items: center;\n}\n\n#storecrm_restock_accepts_marketing {\n  margin: 0 5px 0 0;\n  max-width: 15px;\n}\n\n@media (hover: hover) {\n  .storecrm_modal_line label:hover {\n    cursor: pointer;\n  }\n  #storecrm_restock_accepts_marketing:hover {\n    cursor: pointer;\n  }\n}\n\n.storecrm_modal input, .storecrm_modal select {\n  width: 100%;\n  padding: 10px;\n  font-size: 100%;\n  margin: 1rem 0;\n}\n\n.storecrm_modal__overlay {\n  position: fixed;\n  top: 0;\n  left: 0;\n  right: 0;\n  bottom: 0;\n  z-index: 10000;\n  background: rgba(0,0,0,0.6);\n  display: flex;\n  justify-content: center;\n  align-items: center;\n}\n\n.storecrm_modal__container {\n  background-color: #fff;\n  padding: 30px;\n  min-width: 320px;\n  max-width: 500px;\n  min-height: 200px;\n  max-height: 100vh;\n  border-radius: 4px;\n  overflow-y: auto;\n  box-sizing: border-box;\n}\n\n.storecrm_modal__header {\n  display: flex;\n  justify-content: space-between;\n  align-items: center;\n}\n\n.storecrm_modal__title {\n  margin-top: 0;\n  margin-bottom: 0;\n  font-weight: 600;\n  font-size: 1.25;\n  line-height: 1.25;\n  box-sizing: border-box;\n}\n\n.storecrm_modal__close {\n  background: transparent;\n  border: 0;\n  cursor: pointer;\n}\n\n.storecrm_modal_message {\n  margin-top: 2rem;\n  padding: 1rem;\n}\n\n.storecrm_modal__header .storecrm_modal__close:before { content: "\\2715"; }\n\n.storecrm_modal__content {\n  margin-top: 2rem;\n  margin-bottom: 1rem;\n  line-height: 1.5;\n  color: rgba(0,0,0,.8);\n}\n\n.storecrm_modal__btn {\n  display: block;\n  width: 100%;\n  padding-top: 1rem;\n  padding-bottom: 1rem;\n  background-color: #e6e6e6;\n  color: rgba(0,0,0,.8);\n  border-radius: .25rem;\n  border-style: none;\n  border-width: 0;\n  cursor: pointer;\n  -webkit-appearance: button;\n  text-transform: none;\n  overflow: visible;\n  line-height: 1.15;\n  margin: 0;\n  margin-top: 1rem;\n  will-change: transform;\n  -moz-osx-font-smoothing: grayscale;\n  -webkit-backface-visibility: hidden;\n  backface-visibility: hidden;\n  -webkit-transform: translateZ(0);\n  transform: translateZ(0);\n  transition: -webkit-transform .25s ease-out;\n  transition: transform .25s ease-out;\n  transition: transform .25s ease-out,-webkit-transform .25s ease-out;\n}\n\n.storecrm_modal__btn:hover {\n  -webkit-transform: scale(1.05);\n  transform: scale(1.05);\n}\n\n.storecrm_modal__btn-primary {\n  background-color: #00449e;\n  color: #fff;\n}\n\n.storecrm_modal__btn:disabled {\n  opacity: 0.5;\n  cursor: not-allowed;\n}\n\n@keyframes mmfadeIn {\n    from { opacity: 0; }\n      to { opacity: 1; }\n}\n\n@keyframes mmfadeOut {\n    from { opacity: 1; }\n      to { opacity: 0; }\n}\n\n@keyframes mmslideIn {\n  from { transform: translateY(15%); }\n    to { transform: translateY(0); }\n}\n\n@keyframes mmslideOut {\n    from { transform: translateY(0); }\n    to { transform: translateY(-10%); }\n}\n\n.micromodal-slide {\n  display: none;\n}\n\n.micromodal-slide.is-open {\n  display: block;\n}\n\n.micromodal-slide[aria-hidden="false"] .storecrm_modal__overlay {\n  animation: mmfadeIn .3s cubic-bezier(0.0, 0.0, 0.2, 1);\n}\n\n.micromodal-slide[aria-hidden="false"] .storecrm_modal__container {\n  animation: mmslideIn .3s cubic-bezier(0, 0, .2, 1);\n}\n\n.micromodal-slide[aria-hidden="true"] .storecrm_modal__overlay {\n  animation: mmfadeOut .3s cubic-bezier(0.0, 0.0, 0.2, 1);\n}\n\n.micromodal-slide[aria-hidden="true"] .storecrm_modal__container {\n  animation: mmslideOut .3s cubic-bezier(0, 0, .2, 1);\n}\n\n.micromodal-slide .storecrm_modal__container,\n.micromodal-slide .storecrm_modal__overlay {\n  will-change: transform;\n}\n\n/* フェードイン・フェードアウトアニメーション用のクラス */\n.fade-out {\n  animation: mmfadeOut .3s cubic-bezier(0.0, 0.0, 0.2, 1) forwards;\n}\n\n.fade-in {\n  animation: mmfadeIn .3s cubic-bezier(0.0, 0.0, 0.2, 1) forwards;\n}\n\n.storecrm-status-widget {\n  width: 100%;\n  border: 1px solid #e6e6e6;\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  max-height: 3em;\n}\n\n.storecrm-status-widget > div {\n  padding: 1rem;\n}\n\n.storecrm-on {\n  /* deep green, bold */\n  color: #094c00;\n  font-weight: bold;;\n}\n\n.storecrm-off {\n  color: #df8536c6;\n  font-weight: bold;\n}\n',""]);const a=s},314:t=>{t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n="",o=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),o&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),o&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n})).join("")},e.i=function(t,n,o,i,r){"string"==typeof t&&(t=[[null,t,void 0]]);var s={};if(o)for(var a=0;a<this.length;a++){var c=this[a][0];null!=c&&(s[c]=!0)}for(var d=0;d<t.length;d++){var l=[].concat(t[d]);o&&s[l[0]]||(void 0!==r&&(void 0===l[5]||(l[1]="@layer".concat(l[5].length>0?" ".concat(l[5]):""," {").concat(l[1],"}")),l[5]=r),n&&(l[2]?(l[1]="@media ".concat(l[2]," {").concat(l[1],"}"),l[2]=n):l[2]=n),i&&(l[4]?(l[1]="@supports (".concat(l[4],") {").concat(l[1],"}"),l[4]=i):l[4]="".concat(i)),e.push(l))}},e}},601:t=>{t.exports=function(t){return t[1]}},804:(t,e,n)=>{function o(t){return function(t){if(Array.isArray(t))return i(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return i(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n<e;n++)o[n]=t[n];return o}n.r(e),n.d(e,{default:()=>u});var r,s,a,c,d,l=(r=["a[href]","area[href]",'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',"select:not([disabled]):not([aria-hidden])","textarea:not([disabled]):not([aria-hidden])","button:not([disabled]):not([aria-hidden])","iframe","object","embed","[contenteditable]",'[tabindex]:not([tabindex^="-"])'],s=function(){function t(e){var n=e.targetModal,i=e.triggers,r=void 0===i?[]:i,s=e.onShow,a=void 0===s?function(){}:s,c=e.onClose,d=void 0===c?function(){}:c,l=e.openTrigger,u=void 0===l?"data-micromodal-trigger":l,h=e.closeTrigger,m=void 0===h?"data-micromodal-close":h,f=e.openClass,p=void 0===f?"is-open":f,g=e.disableScroll,b=void 0!==g&&g,v=e.disableFocus,_=void 0!==v&&v,w=e.awaitCloseAnimation,y=void 0!==w&&w,k=e.awaitOpenAnimation,S=void 0!==k&&k,x=e.debugMode,E=void 0!==x&&x;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.modal=document.getElementById(n),this.config={debugMode:E,disableScroll:b,openTrigger:u,closeTrigger:m,openClass:p,onShow:a,onClose:d,awaitCloseAnimation:y,awaitOpenAnimation:S,disableFocus:_},r.length>0&&this.registerTriggers.apply(this,o(r)),this.onClick=this.onClick.bind(this),this.onKeydown=this.onKeydown.bind(this)}var e;return(e=[{key:"registerTriggers",value:function(){for(var t=this,e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];n.filter(Boolean).forEach((function(e){e.addEventListener("click",(function(e){return t.showModal(e)}))}))}},{key:"showModal",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.activeElement=document.activeElement,this.modal.setAttribute("aria-hidden","false"),this.modal.classList.add(this.config.openClass),this.scrollBehaviour("disable"),this.addEventListeners(),this.config.awaitOpenAnimation?this.modal.addEventListener("animationend",(function e(){t.modal.removeEventListener("animationend",e,!1),t.setFocusToFirstNode()}),!1):this.setFocusToFirstNode(),this.config.onShow(this.modal,this.activeElement,e)}},{key:"closeModal",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=this.modal;if(this.modal.setAttribute("aria-hidden","true"),this.removeEventListeners(),this.scrollBehaviour("enable"),this.activeElement&&this.activeElement.focus&&this.activeElement.focus(),this.config.onClose(this.modal,this.activeElement,t),this.config.awaitCloseAnimation){var n=this.config.openClass;this.modal.addEventListener("animationend",(function t(){e.classList.remove(n),e.removeEventListener("animationend",t,!1)}),!1)}else e.classList.remove(this.config.openClass)}},{key:"closeModalById",value:function(t){this.modal=document.getElementById(t),this.modal&&this.closeModal()}},{key:"scrollBehaviour",value:function(t){if(this.config.disableScroll){var e=document.querySelector("body");switch(t){case"enable":Object.assign(e.style,{overflow:""});break;case"disable":Object.assign(e.style,{overflow:"hidden"})}}}},{key:"addEventListeners",value:function(){this.modal.addEventListener("touchstart",this.onClick),this.modal.addEventListener("click",this.onClick),document.addEventListener("keydown",this.onKeydown)}},{key:"removeEventListeners",value:function(){this.modal.removeEventListener("touchstart",this.onClick),this.modal.removeEventListener("click",this.onClick),document.removeEventListener("keydown",this.onKeydown)}},{key:"onClick",value:function(t){(t.target.hasAttribute(this.config.closeTrigger)||t.target.parentNode.hasAttribute(this.config.closeTrigger))&&(t.preventDefault(),t.stopPropagation(),this.closeModal(t))}},{key:"onKeydown",value:function(t){27===t.keyCode&&this.closeModal(t),9===t.keyCode&&this.retainFocus(t)}},{key:"getFocusableNodes",value:function(){var t=this.modal.querySelectorAll(r);return Array.apply(void 0,o(t))}},{key:"setFocusToFirstNode",value:function(){var t=this;if(!this.config.disableFocus){var e=this.getFocusableNodes();if(0!==e.length){var n=e.filter((function(e){return!e.hasAttribute(t.config.closeTrigger)}));n.length>0&&n[0].focus(),0===n.length&&e[0].focus()}}}},{key:"retainFocus",value:function(t){var e=this.getFocusableNodes();if(0!==e.length)if(e=e.filter((function(t){return null!==t.offsetParent})),this.modal.contains(document.activeElement)){var n=e.indexOf(document.activeElement);t.shiftKey&&0===n&&(e[e.length-1].focus(),t.preventDefault()),!t.shiftKey&&e.length>0&&n===e.length-1&&(e[0].focus(),t.preventDefault())}else e[0].focus()}}])&&function(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}(t.prototype,e),t}(),a=null,c=function(t){if(!document.getElementById(t))return console.warn("MicroModal: ❗Seems like you have missed %c'".concat(t,"'"),"background-color: #f8f9fa;color: #50596c;font-weight: bold;","ID somewhere in your code. Refer example below to resolve it."),console.warn("%cExample:","background-color: #f8f9fa;color: #50596c;font-weight: bold;",'<div class="modal" id="'.concat(t,'"></div>')),!1},d=function(t,e){if(function(t){t.length<=0&&(console.warn("MicroModal: ❗Please specify at least one %c'micromodal-trigger'","background-color: #f8f9fa;color: #50596c;font-weight: bold;","data attribute."),console.warn("%cExample:","background-color: #f8f9fa;color: #50596c;font-weight: bold;",'<a href="#" data-micromodal-trigger="my-modal"></a>'))}(t),!e)return!0;for(var n in e)c(n);return!0},{init:function(t){var e=Object.assign({},{openTrigger:"data-micromodal-trigger"},t),n=o(document.querySelectorAll("[".concat(e.openTrigger,"]"))),i=function(t,e){var n=[];return t.forEach((function(t){var o=t.attributes[e].value;void 0===n[o]&&(n[o]=[]),n[o].push(t)})),n}(n,e.openTrigger);if(!0!==e.debugMode||!1!==d(n,i))for(var r in i){var c=i[r];e.targetModal=r,e.triggers=o(c),a=new s(e)}},show:function(t,e){var n=e||{};n.targetModal=t,!0===n.debugMode&&!1===c(t)||(a&&a.removeEventListeners(),(a=new s(n)).showModal())},close:function(t){t?a.closeModalById(t):a.closeModal()}});"undefined"!=typeof window&&(window.MicroModal=l);const u=l},511:(t,e,n)=>{n.r(e),n.d(e,{default:()=>b});var o=n(72),i=n.n(o),r=n(825),s=n.n(r),a=n(659),c=n.n(a),d=n(56),l=n.n(d),u=n(540),h=n.n(u),m=n(113),f=n.n(m),p=n(208),g={};g.styleTagTransform=f(),g.setAttributes=l(),g.insert=c().bind(null,"head"),g.domAPI=s(),g.insertStyleElement=h(),i()(p.A,g);const b=p.A&&p.A.locals?p.A.locals:void 0},72:t=>{var e=[];function n(t){for(var n=-1,o=0;o<e.length;o++)if(e[o].identifier===t){n=o;break}return n}function o(t,o){for(var r={},s=[],a=0;a<t.length;a++){var c=t[a],d=o.base?c[0]+o.base:c[0],l=r[d]||0,u="".concat(d," ").concat(l);r[d]=l+1;var h=n(u),m={css:c[1],media:c[2],sourceMap:c[3],supports:c[4],layer:c[5]};if(-1!==h)e[h].references++,e[h].updater(m);else{var f=i(m,o);o.byIndex=a,e.splice(a,0,{identifier:u,updater:f,references:1})}s.push(u)}return s}function i(t,e){var n=e.domAPI(e);return n.update(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;n.update(t=e)}else n.remove()}}t.exports=function(t,i){var r=o(t=t||[],i=i||{});return function(t){t=t||[];for(var s=0;s<r.length;s++){var a=n(r[s]);e[a].references--}for(var c=o(t,i),d=0;d<r.length;d++){var l=n(r[d]);0===e[l].references&&(e[l].updater(),e.splice(l,1))}r=c}}},659:t=>{var e={};t.exports=function(t,n){var o=function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}(t);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},540:t=>{t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},56:(t,e,n)=>{t.exports=function(t){var e=n.nc;e&&t.setAttribute("nonce",e)}},825:t=>{t.exports=function(t){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=t.insertStyleElement(t);return{update:function(n){!function(t,e,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var i=void 0!==n.layer;i&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,i&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var r=n.sourceMap;r&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(r))))," */")),e.styleTagTransform(o,t,e.options)}(e,t,n)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},113:t=>{t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}},989:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.schema=e.renderWidgetSelector=e.hideWidgetSelector=e.render=e.getIcon=void 0,e.getIcon=(t,e=!1)=>{let n=null;return"star"===t.buttonicon?n=e?'<svg fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="m21.12 9.88005c-.0419-.13286-.1204-.25121-.2265-.34143-.1062-.09022-.2356-.14865-.3735-.16857l-5.42-.79-2.43-4.91c-.0692-.11602-.1673-.2121-.2847-.27882-.1175-.06672-.2502-.1018-.3853-.1018s-.2678.03508-.3853.1018c-.1174.06672-.2156.1628-.2847.27882l-2.43001 4.91-5.42.79c-.13788.01992-.26733.07835-.37347.16857s-.18466.20857-.22653.34143c-.0447.13235-.05153.27465-.01972.41065.0318.1361.10097.2605.19972.3594l3.94 3.82-.93 5.4c-.02357.139-.008.2818.04498.4125.05299.1307.14128.2441.25502.3275.11392.0811.24826.1288.38786.1377.13961.0088.2789-.0216.40214-.0877l4.84001-2.55 4.85 2.55c.1073.0588.2276.0898.35.09.1573-.0019.3105-.0506.44-.14.1137-.0834.202-.1968.255-.3275s.0686-.2735.045-.4125l-.94-5.4 3.93-3.82c.1005-.0978.1715-.2218.2051-.3579s.0283-.2789-.0151-.41215z" fill="#000"/></svg>':'<svg fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="m17.2 20.7501c-.1224-.0002-.2427-.0312-.35-.09l-4.85-2.55-4.85001 2.55c-.12324.0661-.26253.0965-.40213.0877-.13961-.0089-.27395-.0566-.38787-.1377-.11374-.0834-.20203-.1968-.25502-.3275-.05298-.1307-.06855-.2735-.04498-.4125l.94-5.4-3.94-3.82c-.09875-.0989-.16792-.2233-.19972-.3594-.03181-.136-.02498-.2783.01972-.41065.04187-.13286.12039-.25121.22653-.34143s.23559-.14865.37347-.16857l5.42-.79 2.43001-4.91c.0691-.11602.1673-.2121.2847-.27882.1175-.06672.2502-.1018.3853-.1018s.2678.03508.3853.1018c.1174.06672.2155.1628.2847.27882l2.43 4.91 5.42.79c.1379.01992.2673.07835.3735.16857.1061.09022.1846.20857.2265.34143.0447.13235.0515.27465.0197.41065-.0318.1361-.101.2605-.1997.3594l-3.94 3.82.93 5.4c.0236.139.008.2818-.045.4125s-.1413.2441-.255.3275c-.1266.0875-.2761.1362-.43.14zm-5.2-4.23c.121.0014.2403.0287.35.08l3.85 2-.73-4.29c-.0198-.1204-.0111-.2437.0253-.36.0365-.1164.0997-.2226.1847-.31l3.12-3-4.31-.64c-.1192-.01901-.2322-.06609-.3295-.13739-.0974-.0713-.1764-.16476-.2305-.27266l-1.93-3.9-1.93 3.91c-.0541.1079-.1331.20136-.23048.27266s-.21034.11838-.32953.13739l-4.31.63 3.12 3c.08494.0874.14818.1936.18465.31.03647.1163.04515.2396.02535.36l-.73 4.32 3.85001-2c.1073-.0618.2267-.0993.35-.11z" fill="#000"/></svg>':"heart"===t.buttonicon?n=e?'<svg fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="m19.3 5.71002c-.459-.46401-1.0057-.83205-1.6083-1.08271-.6026-.25065-1.2491-.37891-1.9017-.37729-.6527-.00162-1.2991.12664-1.9017.37729-.6026.25066-1.1493.6187-1.6083 1.08271l-.28.29-.28-.28001c-.9283-.92819-2.18727-1.44964-3.5-1.44964-1.31274 0-2.57171.52145-3.5 1.44964-.91614.93465-1.42929 2.19124-1.42929 3.50001 0 1.30878.51315 2.56538 1.42929 3.49998l6.77 6.79c.1406.1405.3312.2194.53.2194.1987 0 .3894-.0789.53-.2194l6.77-6.79c.9165-.9377 1.4279-2.1979 1.4242-3.50908-.0037-1.31119-.5224-2.56844-1.4442-3.5009z" fill="#000"/></svg>':'<svg fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="m12 19.7501c-.1988-.0002-.3895-.0793-.53-.22l-6.76999-6.79c-.91614-.9347-1.42929-2.1913-1.42929-3.50004 0-1.30876.51315-2.56536 1.42929-3.5.92829-.9282 2.18726-1.44964 3.5-1.44964 1.31273 0 2.57169.52144 3.49999 1.44964l.3.26.28-.28c.459-.464 1.0057-.83205 1.6083-1.0827.6026-.25066 1.2491-.37891 1.9017-.3773.652-.00292 1.298.12376 1.9006.37268.6025.24893 1.1496.61512 1.6094 1.07732.9161.93464 1.4293 2.19124 1.4293 3.5 0 1.30874-.5132 2.56534-1.4293 3.50004l-6.77 6.79c-.067.0751-.1485.1359-.2396.1789-.091.0429-.1898.0671-.2904.0711zm-3.78999-14.00004c-.45417-.00331-.9045.08336-1.32501.25499-.4205.17164-.80285.42484-1.12499.74501-.64913.65215-1.01355 1.53485-1.01355 2.455 0 .92014.36442 1.80284 1.01355 2.45504l6.23999 6.28 6.23-6.26c.3226-.3223.5786-.705.7532-1.1263.1746-.4212.2645-.87273.2645-1.32874s-.0899-.90754-.2645-1.32879c-.1746-.42124-.4306-.80394-.7532-1.12621-.3196-.32077-.7001-.57446-1.1191-.74619-.419-.17172-.8681-.25801-1.3209-.25381-.4542-.00331-.9045.08336-1.325.25499-.4205.17164-.8029.42484-1.125.74501l-.81.81c-.1431.13575-.3328.21143-.53.21143s-.3869-.07568-.53-.21143l-.81-.81c-.3205-.32378-.70209-.58067-1.12267-.75577s-.87175-.26492-1.32732-.26423z" fill="#000"/></svg>':"tag"===t.buttonicon?n='<svg fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="m12.32 19.98c-.58 0-1.16-.22-1.6-.66l-6.48-6.47c-.14-.14-.22-.33-.22-.53v-7.54998c0-.41.34-.75.75-.75h7.54c.2 0 .39.08.53.22l6.48 6.47998c.87.88.87 2.31 0 3.19l-5.41 5.41c-.44.44-1.02.66-1.6.66zm-6.8-7.97 6.26 6.25c.3.29.78.29 1.07 0l5.41-5.41c.29-.29.29-.77 0-1.07l-6.26-6.25998h-6.48v6.47998zm2.98-2.25998c-.69 0-1.25-.56-1.25-1.25s.56-1.25 1.25-1.25 1.25.56 1.25 1.25-.56 1.25-1.25 1.25z" fill="#000"/></svg>':"clip"===t.buttonicon&&(n='<svg fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="m8.94 20.74c-1.48285.0058-2.91257-.5518-3.99999-1.56-.52958-.4896-.95214-1.0835-1.24114-1.7444-.289-.6608-.43819-1.3743-.43819-2.0956 0-.7212.14919-1.4347.43819-2.0955.289-.6609.71156-1.2548 1.24114-1.7445l7.55999-7.13995c.7775-.70973 1.7923-1.10321 2.845-1.10321s2.0675.39348 2.845 1.10321c.4054.37634.7304.83082.9556 1.33607.2251.50526.3457 1.05085.3544 1.60393.0027.47797-.0936.95132-.2829 1.3902-.1893.43889-.4676.83379-.8171 1.1598l-7.57 7.14995c-.4568.4239-1.05688.6594-1.68.6594-.62311 0-1.22321-.2355-1.67999-.6594-.22667-.2088-.40758-.4624-.53132-.7446-.12374-.2823-.18763-.5872-.18763-.8954s.06389-.613.18763-.8953.30465-.5358.53132-.7447l6.99999-6.58995c.1406-.14045.3313-.21934.53-.21934.1988 0 .3894.07889.53.21934.1405.14062.2193.33125.2193.53s-.0788.38937-.2193.53l-7 6.58995c-.07851.0686-.14144.1531-.18456.248-.04312.0948-.06544.1978-.06544.302 0 .1043.02232.2073.06544.3021.04312.0949.10605.1794.18456.2479.18114.155.41165.2401.65001.2401.23835 0 .46886-.0851.65-.2401l7.56999-7.12995c.1926-.18876.345-.41452.4482-.6637.1031-.24918.1547-.51664.1518-.7863-.0083-.34757-.087-.68985-.2314-1.00612-.1444-.31626-.3514-.59995-.6086-.83388-.4937-.45755-1.1419-.71177-1.815-.71177s-1.3213.25422-1.815.71177l-7.52999 7.12995c-.38134.3495-.68582.7744-.89413 1.2478-.20831.4735-.31587.985-.31587 1.5022 0 .5173.10756 1.0288.31587 1.5023.20831.4734.51279.8983.89413 1.2477.81451.7592 1.88655 1.1814 3 1.1814 1.11349 0 2.18549-.4222 2.99999-1.1814l7.49-7.09c.069-.0707.1514-.1269.2424-.1653s.1888-.0582.2876-.0582.1966.0198.2876.0582.1735.0946.2424.1653c.1405.1407.2193.3313.2193.53 0 .1988-.0788.3894-.2193.53l-7.55 7.12c-1.102 1.0234-2.5563 1.5822-4.06 1.56z" fill="#000"/></svg>'),n&&(n=n.replace("viewBox",`width="${t.icon_size}" height="${t.icon_size}" style="margin-right: ${t.icon_margin}px;" viewBox`)),n};class n{constructor(t,e,n,o,i,r=!1,s=!1,a){this.eventTriggered=!1,this.variants=n,this.buttonSettings=Object.assign({},o),this.productId=e,this.button=i,this.isFavorited=r,this.hasVariantSelector=s,this.variantId=a,this.buttonSettings.has_background||(this.buttonSettings.button_width="auto",this.buttonSettings.button_height="auto",this.buttonSettings.button_radius=0,this.buttonSettings.button_border_width=0,this.buttonSettings.button_background_color="transparent",this.buttonSettings.button_border_color="transparent",this.buttonSettings.button_hover_border_color="transparent",this.buttonSettings.button_hover_background_color="transparent")}static getInstance(t,e,o,i,r,s=!1,a=!1,c){return n.instances[t]?(n.instances[t].isFavorited=s,n.instances[t].hasVariantSelector=a):n.instances[t]=new n(t,e,o,i,r,s,a,c),n.instances[t]}checkRender(t){document.querySelectorAll(`.storecrm-wishlistbutton-${t}`).forEach((t=>{if(t instanceof HTMLElement&&t.closest('[data-type="wishlist-button"]')){const e=new URL(location.href),n=e.searchParams.get("variant")&&e.searchParams.get("variant")||"";n&&(t.dataset.variantId=n),window.storecrm&&window.storecrm.render(!0)}}))}render(t,n=!1){const o=(0,e.getIcon)(this.buttonSettings,this.isFavorited),i=new URL(location.href),r=parseInt(i.searchParams.get("variant")||this.variantId||"0",10)||"",s=this.hasVariantSelector?"data-variant-selector":"",a=void 0!==this.button.dataset.noLabel;if(!this.eventTriggered)if(window.navigation)window.navigation.addEventListener("navigate",(()=>{window.setTimeout((()=>this.checkRender(t)),100)})),window.setTimeout((()=>this.checkRender(t)),100),window.setTimeout((()=>this.checkRender(t)),1e3);else{let e=location.href;window.setInterval((()=>{e!==location.href&&(e=location.href,this.checkRender(t))}),1e3),window.setTimeout((()=>this.checkRender(t)),100),window.setTimeout((()=>this.checkRender(t)),1e3)}this.eventTriggered,this.eventTriggered=!0;const c=n?"":`onclick="event.preventDefault();window.storecrm ? window.storecrm.toggleWishlist(this, ${this.isFavorited?"true":"false"}, ${this.buttonSettings.is_only_member}, '${this.buttonSettings.non_member_link}') : alert('読込中です。しばらくたってから再度お試しください。');"`,d=`<style id="storecrm-wishlistbutton-style">\n.storecrm-wishlistbutton {\n-webkit-appearance: button;\nfont-feature-settings: inherit;\nfont-variation-settings: inherit;\nfont-size: 100%;\nfont-weight: inherit;\nline-height: inherit;\ncolor: inherit;\nmargin: 0;\npadding: 0;\ncursor: pointer;\n}\n.storecrm-wishlistbutton-wishlist{\ntransition: color ${this.buttonSettings.button_speed}s, background-color ${this.buttonSettings.button_speed}s, border-color ${this.buttonSettings.button_speed}s;\n\nwidth: ${this.buttonSettings.button_width}px;\nheight: ${this.buttonSettings.button_height}px;\ncolor: ${this.buttonSettings.button_color};\nbackground-color: ${this.buttonSettings.button_background_color};\nfont-family: ${this.buttonSettings.button_font};\nfont-size: ${this.buttonSettings.button_fontsize}px;\nfont-weight: ${this.buttonSettings.button_fontweight};\nborder-radius: ${this.buttonSettings.button_radius}px;\nborder: ${this.buttonSettings.button_border_width}px solid ${this.buttonSettings.button_border_color};\ndisplay: inline-flex;\njustify-content: center;\nalign-items: center;\n}\n\n.storecrm-wishlistbutton path, .storecrm-wishlistbutton g {\nfill: ${this.buttonSettings.icon_color};\ntransition: fill ${this.buttonSettings.button_speed}s;\n}\n.storecrm-wishlistbutton:hover path, .storecrm-wishlistbutton:hover g {\nfill: ${this.buttonSettings.icon_hover_color};\n}\n\n.storecrm-wishlistbutton:hover{\ncolor: ${this.buttonSettings.button_hover_color};\nbackground-color: ${this.buttonSettings.button_hover_background_color};\nborder-color: ${this.buttonSettings.button_hover_border_color};\n}\n\n.storecrm-wishlistbuttonwrapper{\ntext-align: ${this.buttonSettings.align};\nwidth: 100%;\n}\n\n.storecrm-variantselector-dropdown {\n  position: absolute;\n  width: 250px;\n  box-shadow: none;\n  border-radius: 0;\n  border-width: ${this.buttonSettings.popup_border_width||0}px;\n  border-color: ${this.buttonSettings.popup_border_color||"#000"};\n  border-style: solid;\n  margin-top: 0.3rem;\n  background: white;\n  z-index: 5;\n}\n\n.storecrm-variantselector-dropdown a {\n  display: flex;\n  align-items: center;\n  padding: 1em;\n  text-decoration: none;\n  font-family: ${this.buttonSettings.button_font};\n  font-size: ${this.buttonSettings.button_fontsize}px;\n  color: ${this.buttonSettings.popup_text_color||"#000"};\n  background-color: ${this.buttonSettings.popup_background_color||"#fff"};\n}\n\n.storecrm-variantselector-dropdown path, .storecrm-variantselector-dropdown g {\n  fill: ${this.buttonSettings.popup_icon_color||"#000"};\n  transition: fill ${this.buttonSettings.button_speed}s;\n}\n.storecrm-variantselector-dropdown a:hover path, .storecrm-variantselector-dropdown a:hover g {\n  fill: ${this.buttonSettings.popup_icon_hover_color||"#000"};\n}\n\n.storecrm-variantselector-dropdown a:hover {\n}\n\n</style>`,l=document.querySelector("#storecrm-wishlistbutton-style");return n?(l&&l.remove(),document.body.insertAdjacentHTML("afterend",d)):l||document.body.insertAdjacentHTML("afterend",d),`<div class="storecrm-wishlistbuttonwrapper">\n<button data-product-id="${this.productId}" data-variant-id="${r}" data-block-id="${t}" ${s} class="storecrm-wishlistbutton storecrm-wishlistbutton-wishlist storecrm-wishlistbutton-${t}" ${c}>\n${o}${a?"":this.isFavorited?this.buttonSettings.button_text_remove:this.buttonSettings.button_text}\n</button>\n</div>`}}let o,i,r;n.instances={},e.render=({productId:t,variantId:e,id:o,variants:i,product:r,button:s,buttonSettings:a,isFavorited:c=!1,preview:d=!1,hasVariantSelector:l=!1})=>n.getInstance(o,t,i,a,s,c,l,e).render(o,d),e.hideWidgetSelector=()=>{o&&(o.remove(),o=void 0),document.querySelectorAll(".storecrm-variantselector-dropdown").forEach((t=>t.remove())),i=void 0,r=void 0},e.renderWidgetSelector=({button:t,productId:n,variants:s,wishlist:a,buttonSettings:c,preview:d=!1,rerender:l=!1})=>{const u=i===n&&r?r:s,h=o&&l&&i==n?o.style:void 0;if(!d&&l&&i!==n)return;if(!d&&o&&(o.remove(),o=void 0,!l))return;i=n,r=u;const m=u.map((t=>{const o=a.variants.indexOf(t.id.toString())>=0,i=(0,e.getIcon)(c,o),r=d?"":`onclick="event.preventDefault();event.stopPropagation();window.storecrm ? window.storecrm.toggleWishlist(this, ${o?"true":"false"}, ${c.is_only_member}, '${c.non_member_link}') : alert('読込中です。しばらくたってから再度お試しください。');"`;return`<a data-product-id="${n}" data-variant-id="${t.id}" data-variant-selector href="javascript:;" ${r}>\n        ${i||(o?c.button_text_remove:c.button_text)}\n        ${t.title}\n      </a>`})).join("");let f="";if(d)f="position: static;";else if(h)f=`top: ${h.top}; left: ${h.left};`;else{const e=t.getBoundingClientRect(),n=250;let o=e.left+document.documentElement.scrollLeft;o+n>window.innerWidth&&(o=window.innerWidth-n),f=`top: ${e.bottom+document.documentElement.scrollTop}px; left: ${o}px;`}const p=`<div class="storecrm-variantselector-dropdown" id="dropdown" style="${f}">${m}</div>`;d||(document.body.insertAdjacentHTML("afterend",p),o=document.querySelector(".storecrm-variantselector-dropdown"));{const t=t=>{t.target&&t.target instanceof HTMLElement&&t.target.closest("[data-variant-selector]")||o&&(o.remove(),o=void 0)};document.addEventListener("click",t),document.addEventListener("resize",t)}return p},e.schema={preview:t=>{let n='<div style="font-size:0.8em; font-weight:bold;">お気に入り(お気に入り前)</div>';return n+=(0,e.render)({productId:"TEMP_product",id:"TEMP_favorite",buttonSettings:t,button:document.createElement("div"),isFavorited:!1,preview:!0,variants:[],product:null}),"variant"===t.favoriteMode&&(n+='<div style="font-size:0.8em; font-weight:bold;">バリエーションモードの際の</div>',n+=(0,e.renderWidgetSelector)({productId:"TEMP_product",variants:[{id:"1",title:"バリエーション1"},{id:"2",title:"バリエーション2"},{id:"3",title:"バリエーション3"}],wishlist:{variants:[]},buttonSettings:t,button:document.createElement("div"),preview:!0,rerender:!1})),n+='<div style="font-size:0.8em; font-weight:bold;">お気に入り(お気に入り後)</div>',n+=(0,e.render)({productId:"TEMP_product",id:"TEMP_favorite2",buttonSettings:t,button:document.createElement("div"),isFavorited:!0,preview:!0,variants:[],product:null}),n},rows:[{type:"card",slug:"favoriteMode",nameJa:"お気に入りのモードを選んでください",nameEn:"Choose the favorite mode",default:"product",selectOptions:[{value:"product",label:"商品ごとにお気に入りをする"},{value:"variant",label:"バリエーション(商品の色やサイズなど)ごとにお気に入りをする"}],warningOnChangeJa:"設定を変更すると、既存のお気に入りデータが無効となります。データ移管をご希望の方はこの設定を保存せずに、お問い合わせください。",warningOnChangeEn:"Changing the setting will invalidate existing favorite data. Please contact us if you wish to transfer the data.",fullsize:!0},{type:"checkbox",slug:"is_only_member",nameJa:"お気に入り機能の利用を会員限定にする",nameEn:"isOnlyMember",default:!1,fullsize:!0},{type:"text",slug:"non_member_link",nameJa:"ゲストがお気に入りを押した場合の遷移先URL ※空欄の場合ログイン画面に遷移します",nameEn:"nonMemberLink ※If left blank, you will be redirected to the login screen.",default:"",depends:"is_only_member",fullsize:!0},{type:"select",slug:"buttonicon",nameJa:"アイコン",nameEn:"buttonIcon",selectOptions:[{value:"star",label:"星マーク(☆)"},{value:"heart",label:"ハートマーク(♡)"},{value:"tag",label:"タグアイコン"},{value:"clip",label:"クリップアイコン"},{value:"none",label:"なし"}],default:"star"},{type:"text",slug:"button_text",nameJa:"ボタンのテキスト",nameEn:"buttonText",default:"お気に入り"},{type:"text",slug:"button_text_remove",nameJa:"ボタンのテキスト(お気に入り解除)",nameEn:"buttonTextRemove",default:"お気に入り済み"},{type:"checkbox",slug:"has_background",nameJa:"背景があるボタンにする",nameEn:"hasBackground",default:!1},{type:"range",slug:"button_width",nameJa:"ボタンの幅",nameEn:"buttonWidth",default:200,min:50,max:600,step:10,depends:"has_background"},{type:"range",slug:"button_height",nameJa:"ボタンの高さ",nameEn:"buttonHeight",default:50,min:30,max:100,step:10,depends:"has_background"},{type:"colorpicker",slug:"button_color",nameJa:"ボタンの文字色",nameEn:"buttonColor",default:"#000000"},{type:"colorpicker",slug:"icon_color",nameJa:"アイコンの文字色",nameEn:"iconColor",default:"#000000"},{type:"colorpicker",slug:"button_background_color",nameJa:"ボタンの背景色",nameEn:"buttonBackgroundColor",default:"#ffffff",depends:"has_background"},{type:"colorpicker",slug:"button_border_color",nameJa:"ボタンの線の色",nameEn:"buttonBorderColor",default:"#000000",depends:"has_background"},{type:"colorpicker",slug:"button_hover_color",nameJa:"ボタンの文字色(ホバー時)",nameEn:"buttonHoverColor",default:"#222222"},{type:"colorpicker",slug:"icon_hover_color",nameJa:"アイコンの文字色(ホバー時)",nameEn:"iconHoverColor",default:"#000000"},{type:"colorpicker",slug:"button_hover_background_color",nameJa:"ボタンの背景色(ホバー時)",nameEn:"buttonHoverBackgroundColor",default:"#dddddd",depends:"has_background"},{type:"colorpicker",slug:"button_hover_border_color",nameJa:"ボタンの線の色(ホバー時)",nameEn:"buttonHoverBorderColor",default:"#222222",depends:"has_background"},{type:"range",slug:"button_radius",nameJa:"ボタンの丸み",nameEn:"buttonRadius",default:5,min:0,max:20,step:1,depends:"has_background"},{type:"range",slug:"button_border_width",nameJa:"ボタンの線の太さ",nameEn:"buttonBorderWidth",default:0,min:0,max:10,step:1,depends:"has_background"},{type:"fontpicker",slug:"button_font",nameJa:"ボタンのフォント",nameEn:"buttonFont",default:"helvetica_n4"},{type:"range",slug:"button_fontsize",nameJa:"ボタンのフォントサイズ",nameEn:"buttonFontSize",default:16,min:10,max:30,step:1},{type:"range",slug:"button_fontweight",nameJa:"ボタンのフォントウェイト",nameEn:"buttonFontWeight",default:400,min:100,max:900,step:100},{type:"range",slug:"icon_size",nameJa:"アイコンのサイズ",nameEn:"iconSize",default:16,min:10,max:30,step:1},{type:"range",slug:"icon_margin",nameJa:"アイコンとテキストとの間隔",nameEn:"iconMargin",default:5,min:0,max:20,step:1},{type:"range",slug:"button_speed",nameJa:"ボタンのアニメーション速度",nameEn:"buttonSpeed",default:.3,min:0,max:1,step:.1},{type:"select",slug:"align",nameJa:"ボタンの配置",nameEn:"align",default:"center",selectOptions:[{value:"left",label:"左寄せ"},{value:"center",label:"中央寄せ"},{value:"right",label:"右寄せ"}]},{type:"colorpicker",slug:"popup_text_color",nameJa:"POPUPのテキスト色",nameEn:"popupTextColor",default:"#000000",checkVisible:t=>"variant"===t.favoriteMode},{type:"colorpicker",slug:"popup_background_color",nameJa:"POPUPの背景色",nameEn:"popupBackgroundColor",default:"#ffffff",checkVisible:t=>"variant"===t.favoriteMode},{type:"colorpicker",slug:"popup_icon_color",nameJa:"POPUPのアイコン色",nameEn:"popupIconColor",default:"#000000",checkVisible:t=>"variant"===t.favoriteMode},{type:"colorpicker",slug:"popup_icon_hover_color",nameJa:"POPUPのアイコン色(ホバー時)",nameEn:"popupIconHoverColor",default:"#000000",checkVisible:t=>"variant"===t.favoriteMode},{type:"range",slug:"popup_border_width",nameJa:"POPUPの線の太さ",nameEn:"popupBorderWidth",default:0,min:0,max:10,step:1,checkVisible:t=>"variant"===t.favoriteMode},{type:"colorpicker",slug:"popup_border_color",nameJa:"POPUPの線の色",nameEn:"popupBorderColor",default:"#999",checkVisible:t=>"variant"===t.favoriteMode}]}},158:function(t,e,n){var o=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function s(t){try{c(o.next(t))}catch(t){r(t)}}function a(t){try{c(o.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((o=o.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.Renderer=void 0;const i=n(215),r=n(264),s={list_title:"お気に入り一覧",loading_text:"読込中です...",non_item_text:"現在お気に入り中の商品はありません",show_cart:!1,insert_cart_directly:!0};class a{static getInstance(t){return a.instance||(a.instance=new a(t)),a.instance}constructor(t){this.config=s,this.mode="product",this.inited=!1,this.parent=t}init(){return o(this,void 0,void 0,(function*(){this.inited||(this.inited=!0,yield this.loadConfig())}))}loadConfig(){return o(this,void 0,void 0,(function*(){this.config=Object.assign(Object.assign({},s),this.parent.config.favoriteList||{}),this.applyConfig(),this.mode=this.parent.favoriteMode}))}applyConfig(){const t=document.getElementById("list_title"),e=document.getElementById("loading_text"),n=document.getElementById("non_item_text");t&&(t.textContent=this.config.list_title),e&&(e.textContent=this.config.loading_text),n&&(n.textContent=this.config.non_item_text)}render(){return o(this,void 0,void 0,(function*(){var t;const e=JSON.parse(localStorage.getItem("storecrm_wishlist")||"{}");if("product"===this.mode?e.products.join(","):e.variants.join(","),!(null==e?void 0:e.products)||0===e.products.length){null===(t=document.querySelector(".storecrm_favoritelist table"))||void 0===t||t.remove();const e=document.querySelector(".storecrm_favoritelist_loading"),n=document.querySelector(".storecrm_favoritelist_non_item");return e&&(e.style.display="none"),void(n&&(n.style.display="block"))}const n=document.querySelector(".storecrm_favoritelist_loading");n&&(n.style.display="none");const o="product"===this.mode?e.products.join(","):e.variants.join(",");yield this.loadProductAndRender(o)}))}loadProductAndRender(t){return o(this,void 0,void 0,(function*(){const e=yield fetch(`/apps/${this.parent.config.appProxyName}/favorites/products?mode=${this.mode}&ids=${t}`),n=yield e.json();this.renderProducts(n)}))}renderProducts(t){const e=document.querySelector(".storecrm_favoritelist tbody"),n=document.querySelector(".storecrm_favoritelist_loading"),o=document.querySelector(".storecrm_favoritelist table");if(!(e&&n&&o&&e instanceof HTMLElement&&n instanceof HTMLElement&&o instanceof HTMLElement))return void console.log("StoreCRM: Elements not found",e,n,o);const i="variant"===this.mode?t.variants:t.products;for(;e.firstChild;)e.removeChild(e.firstChild);i.forEach((t=>e.appendChild(this.createFavoriteRow(e,t)))),n.style.display="none",o.style.display="table"}createFavoriteRow(t,e){const n=document.createElement("tr");n.classList.add(`storecrm_favoritelist_id-${e.variant_id||e.product_id}`);const o="product"===this.mode?`/products/${e.handle}`:`/products/${e.handle}?variant=${e.variant_id}`,s=document.createElement("td");s.classList.add("storecrm_favoritelist_lefttd");const a=document.createElement("a");if(a.href=o,a.textContent=e.title,e.thumbnail_url){const t=document.createElement("img");t.classList.add("storecrm_favoritelist_img"),t.src=e.thumbnail_url,s.appendChild(t)}s.appendChild(a);const c=document.createElement("td");c.classList.add("storecrm_favoritelist_righttd");const d=document.createElement("div");if(d.classList.add("storecrm_favoritelist_links"),this.config.show_cart&&e.available){const t=document.createElement("a");t.classList.add("storecrm_favoritelist_link"),t.href="javascript:void(0);",t.innerHTML=r.iconCart,t.onclick=()=>(0,i.cartFavorite)(this.mode,"product"==this.mode?e.product_id:e.variant_id||"",e.handle,this.config.insert_cart_directly),d.appendChild(t)}const l=document.createElement("a");return l.classList.add("storecrm_favoritelist_link"),l.href="javascript:void(0);",l.innerHTML=r.iconDelete,"product"==this.mode||(l.dataset.variantId=e.variant_id),l.dataset.productId=e.product_id,l.onclick=()=>this.parent.toggleWishlist(l,!0,this.parent.config.favorite.is_only_member,this.parent.config.favorite.non_member_link),d.appendChild(l),c.appendChild(d),n.appendChild(s),n.appendChild(c),n}}e.Renderer=a,a.instance=void 0},264:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.iconCart=e.iconDelete=void 0,e.iconDelete='<svg width="20" height="20" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg>',e.iconCart='<svg width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M6.29977 5H21L19 12H7.37671M20 16H8L6 3H3M9 20C9 20.5523 8.55228 21 8 21C7.44772 21 7 20.5523 7 20C7 19.4477 7.44772 19 8 19C8.55228 19 9 19.4477 9 20ZM20 20C20 20.5523 19.5523 21 19 21C18.4477 21 18 20.5523 18 20C18 19.4477 18.4477 19 19 19C19.5523 19 20 19.4477 20 20Z" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>'},215:function(t,e){var n=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function s(t){try{c(o.next(t))}catch(t){r(t)}}function a(t){try{c(o.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((o=o.apply(t,e||[])).next())}))};function o(t){return n(this,void 0,void 0,(function*(){try{const e=yield fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:t,quantity:1})});if(!e.ok)throw new Error(`Failed to add to cart: ${e.statusText}`);const n=yield e.json();console.log("StoreCRM: 商品がカートに追加されました:",n),window.location.href="/cart"}catch(t){console.error("StoreCRM: エラーが発生しました:",t),alert("カートに追加できませんでした。")}}))}Object.defineProperty(e,"__esModule",{value:!0}),e.addToCart=e.cartFavorite=void 0,e.cartFavorite=function(t,e,n,i){"product"!==t?i?o(e):window.location.href=`/products/${encodeURIComponent(n)}?variant=${e}`:window.location.href=`/products/${encodeURIComponent(n)}`},e.addToCart=o},435:function(t,e,n){var o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.schema=e.RestockPopupManager=void 0;const i=o(n(804));class r{constructor(t,e=!1){this.content=null,this.title=null,this.popup=null,this.button=null,this.footer=null,this.preview=!1,this.container=null,this.close=null,this.product_id=null,this.inited=!1,this.preview=e,this.config=t,this.init()}static getInstance(t,e=!1){return r.instance||(r.instance=new r(t,e)),r.instance}setParent(t){this.parent=t}renderTemplate(){document&&document.body?document.body.insertAdjacentHTML("beforeend",r.template):window.setTimeout(this.renderTemplate.bind(this),100)}init(){document&&document.body?this.runInit():window.setTimeout(this.init.bind(this),100)}runInit(){this.inited=!0,this.preview||document.body.insertAdjacentHTML("beforeend",r.template),i.default.init(),this.popup=document.getElementById("storecrm-modal"),this.content=document.getElementById("storecrm-modal-content"),this.title=document.getElementById("storecrm-modal-title"),this.footer=document.querySelector(".storecrm_modal__footer"),this.container=document.querySelector(".storecrm_modal__container"),this.container&&this.container.addEventListener("click",(t=>{t.stopPropagation()})),this.close=document.querySelector(".storecrm_modal__close"),this.close&&!this.preview&&this.close.addEventListener("click",(t=>{i.default.close("storecrm-modal")}))}render(t,e){var n,o;const i=document.createElement("button");i.className="storecrm_modal__btn storecrm_modal__btn-primary",i.innerHTML=t.button_text,this.footer&&0!==this.footer.children.length&&(this.footer.innerHTML=""),null===(n=this.footer)||void 0===n||n.appendChild(i),this.button=i,this.button&&!this.preview&&this.button.addEventListener("click",(()=>{this.checkAcceptsMarketingStatusAndClearMessages()})),this.config=t;const r=(null===(o=window.storecrm_data)||void 0===o?void 0:o.customer_email)||window.localStorage.getItem("storecrm_restock_email")||"";if(this.title&&this.content&&this.popup){this.title.innerText=t.popup_title;let n=`\n<div>${t.popup_description}</div>\n<div class="storecrm_modal_line" style="\x3c!-- select_style --\x3e"><select id="storecrm_restock_variant">\x3c!-- options --\x3e</select></div>\n<div class="storecrm_modal_line">${t.emailaddress}<br /><input id="storecrm_restock_email" type="email" value="${r}"></div>\n${t.add_accepts_marketing_checkbox?`<div id="email_confirmation_container" ${this.preview?"":'style="display:none"'}>${t.email_confirmation_text}</div>`:""}\n${t.add_accepts_marketing_checkbox?`<div class="storecrm_modal_line" id="accepts_marketing_checkbox_container" ${this.preview?"":'style="display:none"'}><label for="storecrm_restock_accepts_marketing">\n<input id="storecrm_restock_accepts_marketing" type="checkbox" checked>${t.accepts_marketing_checkbox_text}</label></div>`:""}\n<div id="storecrm_restock_message"></div>\n`.trim(),o=null;if(location.search&&location.search.includes("variant")){const t=new URL(location.href);o=t.searchParams.get("variant")}console.log("RestockPopupManager: render: variants",e,o);const i=e.map((t=>`<option value="${t.id}"${String(t.id)===o?" selected":""}>${t.title}</option>`)).join("");e&&Array.isArray(e)&&e.length>1?(n=n.replace("\x3c!-- select_style --\x3e",""),n=n.replace("\x3c!-- options --\x3e",i)):(n=n.replace("\x3c!-- select_style --\x3e","display:none"),n=n.replace("\x3c!-- options --\x3e",i)),this.content.innerHTML=n,this.content.style.color=t.text_color,this.container&&(this.container.style.backgroundColor=t.background_color,this.container.style.borderRadius=`${t.button_radius}px`),this.button&&(this.button.style.backgroundColor=t.button_background_color,this.button.style.color=t.button_text_color),this.close&&(this.close.style.color=t.close_text_color)}this.resetMessage(),this.preview&&(this.success(this.config.success_text),this.failure(this.config.error_text),this.popup&&this.popup.querySelectorAll(".storecrm_modal__overlay,.storecrm_modal__close").forEach((t=>{t.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation()}))})))}resetMessage(){var t;this.footer&&(null===(t=this.footer)||void 0===t||t.querySelectorAll(".storecrm_modal_message").forEach((t=>t.remove())))}disableButton(){this.button&&(this.button.setAttribute("disabled","disabled"),this.button.innerText="Sending...")}enableButtion(){this.button&&(this.button.removeAttribute("disabled"),this.button.innerText=this.config.button_text||"Enable Restock Notification")}submit(t=!1){var e,n,o;if(this.preview)return;this.resetMessage(),this.disableButton();const i=null===(e=this.content)||void 0===e?void 0:e.querySelector("#storecrm_restock_email"),r=null===(n=this.content)||void 0===n?void 0:n.querySelector("#storecrm_restock_variant"),s=null===(o=this.content)||void 0===o?void 0:o.querySelector("#storecrm_restock_accepts_marketing"),a=i?i.value:"",c=r?r.value:"",d=this.product_id,l=s?s.checked:null;this.parent&&this.parent.storeRestock(a,c,d,l,this.config.add_accepts_marketing_checkbox,t,this.success.bind(this),this.failure.bind(this))}show(t,e,n){this.product_id=n,this.inited?this.runShow(t,e):window.setTimeout(this.show.bind(this),100)}runShow(t,e){this.render(t,e),i.default.show("storecrm-modal")}hide(){i.default.close("storecrm-modal")}success(t){this.enableButtion();const e=document.createElement("div");e.classList.add("storecrm_modal_success","storecrm_modal_message"),e.style.color=this.config.success_text_color,e.style.backgroundColor=this.config.success_background_color,e.innerText=t,this.footer&&this.footer.appendChild(e)}failure(t){this.enableButtion();const e=document.createElement("div");e.classList.add("storecrm_modal_error","storecrm_modal_message"),e.style.color=this.config.failure_text_color,e.style.backgroundColor=this.config.failure_background_color,e.innerText=t,this.footer&&this.footer.appendChild(e)}checkAcceptsMarketingStatusAndClearMessages(){var t;if(this.resetMessage(),!this.config.add_accepts_marketing_checkbox)return void this.submit(!1);const e=null===(t=this.content)||void 0===t?void 0:t.querySelector("#storecrm_restock_email");this.parent.doMailCheck(e.value,this.failure.bind(this)).then((t=>{t.email?t.accepts_marketing?this.submit(!1):this.showAcceptsMarketingCheckbox(!1):this.showAcceptsMarketingCheckbox(!0)}))}showAcceptsMarketingCheckbox(t){var e;const n=document.getElementById("storecrm-modal-content"),o=null===(e=this.content)||void 0===e?void 0:e.querySelector("#storecrm_restock_email"),i=document.getElementById("accepts_marketing_checkbox_container"),r=document.getElementById("email_confirmation_container");if(!n||!i||!r)return;r.innerHTML=this.config.email_confirmation_text+" "+o.value;const s=Array.from(n.children);s.forEach((t=>{"none"!==t.style.display&&t.classList.add("fade-out")})),setTimeout((()=>{s.forEach((t=>{t.style.display="none"}))}),300),i.classList.add("fade-in"),setTimeout((()=>{i.style.display=""}),300),r.classList.add("fade-in"),setTimeout((()=>{r.style.display=""}),300),this.switchSubmitButton(t)}switchSubmitButton(t){var e;this.footer&&(this.footer.innerHTML="");const n=document.createElement("button");n.className="storecrm_modal__btn storecrm_modal__btn-primary",n.style.color=this.config.button_text_color,n.style.backgroundColor=this.config.button_background_color,n.innerHTML=this.config.button_text,this.footer&&this.footer.appendChild(n),this.button=n,null===(e=this.button)||void 0===e||e.addEventListener("click",(()=>{this.submit(t)}))}}e.RestockPopupManager=r,r.template='<div class="micromodal-slide storecrm_modal"aria-hidden=true id=storecrm-modal><div class=storecrm_modal__overlay data-micromodal-close tabindex=-1><div class=storecrm_modal__container aria-labelledby=storecrm-modal-title aria-modal=true role=dialog><header class=storecrm_modal__header><h2 class=storecrm_modal__title id=storecrm-modal-title>Micromodal</h2><button class=storecrm_modal__close aria-label="Close modal"data-micromodal-close></button></header><main class=storecrm_modal__content id=storecrm-modal-content></main><footer class=storecrm_modal__footer></footer></div></div></div>';let s=null;e.schema={preview:t=>{var e;return e=()=>{r.getInstance(t,!0).show(t,[],"1234567890")},300,clearTimeout(s),s=setTimeout(e,300),r.template},rows:[{type:"text",slug:"popup_title",nameJa:"ポップアップのタイトル",nameEn:"Popup title",default:"再入荷通知"},{type:"text",slug:"popup_description",nameJa:"POPUPの本文",nameEn:"Popup description",default:"再入荷通知をご希望の方は以下から、ご選択ください。"},{type:"text",slug:"emailaddress",nameJa:"メールアドレスフォーム名",nameEn:"Email address form name",default:"ご連絡メールアドレス"},{type:"colorpicker",slug:"background_color",nameJa:"ポップアップの背景色",nameEn:"Popup background color",default:"#ffffff"},{type:"colorpicker",slug:"text_color",nameJa:"ポップアップのテキスト色",nameEn:"Popup text color",default:"#000000"},{type:"colorpicker",slug:"close_text_color",nameJa:"閉じるボタンの色",nameEn:"Popup close button text color",default:"#000000"},{type:"colorpicker",slug:"button_background_color",nameJa:"ボタンの背景色",nameEn:"buttonHoverColor",default:"#222222"},{type:"colorpicker",slug:"button_text_color",nameJa:"ボタンのテキストカラー",nameEn:"buttonHoverBackgroundColor",default:"#dddddd"},{type:"text",slug:"button_text",nameJa:"ボタンのテキスト",nameEn:"buttonText",default:"再入荷通知を有効にする"},{type:"text",slug:"success_text",nameJa:"成功時のテキスト",nameEn:"Success text",default:"再入荷通知が登録されました。"},{type:"colorpicker",slug:"success_background_color",nameJa:"成功時の背景色",nameEn:"Success background color",default:"#F0FDF4"},{type:"colorpicker",slug:"success_text_color",nameJa:"成功時の文字色",nameEn:"Success text color",default:"#166534"},{type:"text",slug:"error_text",nameJa:"失敗時のテキスト",nameEn:"Error text",default:"再入荷通知の登録に失敗しました。しばらくたってから再度お試しください。"},{type:"text",slug:"error_text_email",nameJa:"失敗時のテキスト(メールアドレスの判定)",nameEn:"Error text",default:"メールアドレスが正しくありません。確認の上、再度ご記入ください。"},{type:"colorpicker",slug:"failure_background_color",nameJa:"エラー時の背景色",nameEn:"Success background color",default:"#FEF2F2"},{type:"colorpicker",slug:"failure_text_color",nameJa:"エラー時の文字色",nameEn:"Success text color",default:"#991B1B"},{type:"range",slug:"button_radius",nameJa:"ポップアップの丸み",nameEn:"buttonRadius",default:10,min:0,max:40,step:1},{type:"checkbox",slug:"add_accepts_marketing_checkbox",nameJa:"メルマガ配信チェックボックスを有効化",nameEn:"Add accepts marketing checkbox",default:!1},{type:"text",slug:"accepts_marketing_checkbox_text",nameJa:"メルマガ配信チェックボックスのテキスト",nameEn:"Accepts marketing checkbox text",default:"メルマガ配信に同意する"},{type:"text",slug:"email_confirmation_text",nameJa:"メールアドレス確認テキスト",nameEn:"Email confirmation text",default:"こちらのメールアドレスで間違いないですか?"}]}},898:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.schema=e.render=e.RestockButton=void 0;class n{constructor(t,e,n,o,i){this.eventTriggered=!1,this.variants=n,this.buttonSettings=o,this.productId=e,this.product=i}static getInstance(t,e=null,o=null,i=null,r=null){if(!n.instances[t]){if(!(e&&o&&i&&r))throw console.log("StoreCRM Restock: productId, variants, buttonSettings, product are required",t,e,o,i,r),new Error("StoreCRM Restock: productId, variants, buttonSettings, product are required");n.instances[t]=new n(t,e,o,i,r)}return n.instances[t]}createScript(t,e){const n=t?"":"onclick=\"event.preventDefault();window.storecrm ? window.storecrm.showRestock(this) : alert('読込中です。しばらくたってから再度お試しください。');\"";return`\n<style>\n.storecrm-restock-${e}{\n-webkit-appearance: button;\nfont-feature-buttonSettings: inherit;\nfont-variation-buttonSettings: inherit;\nfont-size: 100%;\nfont-weight: inherit;\nline-height: inherit;\ncolor: inherit;\nmargin: 0;\npadding: 0;\ntransition: color ${this.buttonSettings.button_speed}s, background-color ${this.buttonSettings.button_speed}s, border-color ${this.buttonSettings.button_speed}s;\n\nwidth: ${this.buttonSettings.button_width}px;\nheight: ${this.buttonSettings.button_height}px;\ncolor: ${this.buttonSettings.button_color};\nbackground-color: ${this.buttonSettings.button_background_color};\nfont-family: ${this.buttonSettings.button_font};\nfont-size: ${this.buttonSettings.button_fontsize}px;\nfont-weight: ${this.buttonSettings.button_fontweight};\nborder-radius: ${this.buttonSettings.button_radius}px;\nborder: ${this.buttonSettings.button_border_width}px solid ${this.buttonSettings.button_border_color};\ndisplay: ${t?"inline-block":"none"};\n}\n\n.storecrm-restockwrapper-${e}{\ntext-align: ${this.buttonSettings.align};\nwidth: 100%;\n}\n\n.storecrm-restock-${e} path, .storecrm-restock-${e} g {\nfill: ${this.buttonSettings.button_color};\n}\n\n.storecrm-restock-${e}:hover{\ncolor: ${this.buttonSettings.button_hover_color};\nbackground-color: ${this.buttonSettings.button_hover_background_color};\nborder-color: ${this.buttonSettings.button_hover_border_color};\n}\n\n</style>\n\n<div class="storecrm-restockwrapper-${e}">\n<button data-id="${e}" data-product-id="${this.productId}" data-block-id="${e}" class="storecrm-restock storecrm-restock-restock storecrm-restock-${e}" ${n}>\n${this.buttonSettings.button_text}\n</button>\n</div>\n    `}checkRender(t){document.querySelectorAll(`.storecrm-restock-${t}`).forEach((t=>{if(t instanceof HTMLElement&&t.closest('[data-type="restock-button"]')){const e=new URL(location.href),n=this.variants.length>0?this.variants[0].id:null,o=parseInt(e.searchParams.get("variant")||n,10);if(!o)return void console.error("StoreCRM Restock: variantId is not set",o);if(!this.product||!this.product.tags||this.product.tags.indexOf("storecrm-restock-hidden")>=0)return console.log("StoreCRM: Restock:product not found or hidden"),void(t.style.display="none");const i=window.Shopify&&window.Shopify.designMode||this.variants.find((t=>!t.available&&t.id===o));t.style.display=i?"inline-block":"none"}}))}render(t,e=!1){if(e)return this.createScript(!0,t);if(!this.eventTriggered){if(this.eventTriggered=!0,window.navigation)window.navigation.addEventListener("navigate",(()=>{window.setTimeout((()=>this.checkRender(t)),100)})),window.setTimeout((()=>this.checkRender(t)),100),window.setTimeout((()=>this.checkRender(t)),1e3);else{let e=location.href;window.setInterval((()=>{e!==location.href&&(e=location.href,this.checkRender(t))}),1e3),window.setTimeout((()=>this.checkRender(t)),100),window.setTimeout((()=>this.checkRender(t)),1e3)}return this.createScript(!1,t)}}}e.RestockButton=n,n.instances={},e.render=({productId:t,variantId:e,variants:o,id:i,buttonSettings:r,isOutOfStock:s,product:a,preview:c=!1})=>(console.log("StoreCRM Restock: render",i,t,o,r,a),n.getInstance(i,t,o,r,a).render(i,c)),e.schema={preview:t=>(0,e.render)({productId:"TEMP_productId",id:"TEMP_restock",buttonSettings:t,isOutOfStock:!1,preview:!0,product:{tags:[]},variants:[]}),rows:[{type:"text",slug:"button_text",nameJa:"ボタンのテキスト",nameEn:"buttonText",default:"再入荷通知をする"},{type:"range",slug:"button_width",nameJa:"ボタンの幅",nameEn:"buttonWidth",default:200,min:50,max:600,step:10},{type:"range",slug:"button_height",nameJa:"ボタンの高さ",nameEn:"buttonHeight",default:50,min:30,max:100,step:5},{type:"colorpicker",slug:"button_color",nameJa:"ボタンの文字色",nameEn:"buttonColor",default:"#000000"},{type:"colorpicker",slug:"button_background_color",nameJa:"ボタンの背景色",nameEn:"buttonBackgroundColor",default:"#ffffff"},{type:"colorpicker",slug:"button_border_color",nameJa:"ボタンの線の色",nameEn:"buttonBorderColor",default:"#000000"},{type:"colorpicker",slug:"button_hover_color",nameJa:"ボタンの文字色(ホバー時)",nameEn:"buttonHoverColor",default:"#222222"},{type:"colorpicker",slug:"button_hover_background_color",nameJa:"ボタンの背景色(ホバー時)",nameEn:"buttonHoverBackgroundColor",default:"#dddddd"},{type:"colorpicker",slug:"button_hover_border_color",nameJa:"ボタンの線の色(ホバー時)",nameEn:"buttonHoverBorderColor",default:"#222222"},{type:"range",slug:"button_radius",nameJa:"ボタンの丸み",nameEn:"buttonRadius",default:0,min:0,max:20,step:1},{type:"range",slug:"button_border_width",nameJa:"ボタンの線の太さ",nameEn:"buttonBorderWidth",default:0,min:0,max:5,step:1},{type:"fontpicker",slug:"button_font",nameJa:"ボタンのフォント",nameEn:"buttonFont",default:"helvetica_n4"},{type:"range",slug:"button_fontsize",nameJa:"ボタンのフォントサイズ",nameEn:"buttonFontSize",default:16,min:10,max:30,step:1},{type:"range",slug:"button_fontweight",nameJa:"ボタンのフォントウェイト",nameEn:"buttonFontWeight",default:400,min:100,max:900,step:100},{type:"range",slug:"button_speed",nameJa:"ボタンのアニメーション速度",nameEn:"buttonSpeed",default:.3,min:0,max:1,step:.1},{type:"select",slug:"align",nameJa:"ボタンの配置",nameEn:"align",default:"center",selectOptions:[{value:"left",label:"左寄せ"},{value:"center",label:"中央寄せ"},{value:"right",label:"右寄せ"}]}]}},247:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.StatusWidget=void 0,e.StatusWidget=class{constructor(t,e,n){this.position="beforeend",this.header=t,this.config=n,this.position=e}setParent(t){this.parent=t}render(){this.parent&&this.parent.getStatus((t=>{this.renderedWidget&&(this.renderedWidget.remove(),this.renderedWidget=void 0),this.renderedWidget=this.createWidget(t),console.log("StoreCRM: StatusWidget rendered:",this.renderedWidget),this.header.insertAdjacentElement(this.position,this.renderedWidget)}),(t=>{console.error("StoreCRM: StatusWidget render failed",t)})),this.parent||console.error("StoreCRM render: no parent. Abort.")}isLineVisible(t){return t.line_show_account&&(!t.line_debug_account||document.querySelector("#preview-bar-iframe")||window.Shopify.designMode)}createWidget(t){var e,n,o,i;const r=document.createElement("div");function s(t){const e=document.createElement("span");return e.classList.add("storecrm-off"),e.appendChild(document.createTextNode(t)),e}function a(t){const e=document.createElement("span");return e.classList.add("storecrm-on"),e.appendChild(document.createTextNode(t)),e}function c(t){const e=document.createElement("button");return e.classList.add("storecrm-button","storecrm-button-off"),e.appendChild(document.createTextNode(t)),e}function d(t){const e=document.createElement("button");return e.classList.add("storecrm-button","storecrm-button-on"),e.appendChild(document.createTextNode(t)),e}if(r.classList.add("storecrm-status-widget"),this.isLineVisible(t)){const o=document.createElement("div");o.appendChild(document.createTextNode("LINE設定: ")),o.appendChild(t.line?a("設定済"):s("未登録")),this.lineButton=t.line?c("解除する"):d("登録する"),o.appendChild(this.lineButton),r.appendChild(o),t.line?null===(e=this.lineButton)||void 0===e||e.addEventListener("click",this.lineUnsubscribe.bind(this)):null===(n=this.lineButton)||void 0===n||n.addEventListener("click",this.lineSubscribe.bind(this))}if(t.mail_show_account){const e=document.createElement("div");e.appendChild(document.createTextNode("メールマガジン: ")),e.appendChild(t.accepts_marketing?a("購読中"):s("未購読")),this.mailButton=t.accepts_marketing?c("購読解除する"):d("購読する"),e.appendChild(this.mailButton),r.appendChild(e),t.accepts_marketing?null===(o=this.mailButton)||void 0===o||o.addEventListener("click",this.unsubscribe.bind(this)):null===(i=this.mailButton)||void 0===i||i.addEventListener("click",this.subscribe.bind(this))}return r}lineSubscribe(){console.log("StoreCRM: LINE購読処理をします"),this.parent&&this.parent.lineSubscribe((function(t){alert(t)}))}lineUnsubscribe(){console.log("StoreCRM: LINE購読解除処理をします"),this.parent&&this.parent.lineUnsubscribe((function(t){alert(t)}))}subscribe(){console.log("StoreCRM: メール購読処理をします"),this.parent&&this.parent.mailSubscribe((function(t){alert(t)}))}unsubscribe(){console.log("StoreCRM: メール購読解除処理をします"),this.parent&&this.parent.mailUnsubscribe((function(t){alert(t)}))}}},398:function(t,e,n){var o=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function s(t){try{c(o.next(t))}catch(t){r(t)}}function a(t){try{c(o.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((o=o.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0});const i=n(989),r=n(898),s=n(435),a=n(247),c=n(158);n(511),e.default=class{constructor(t){this.statusWidget=void 0,this.isTokenRefreshed=!1,this.isTokenFetching=!1,this.favoriteMode="product",this.favoriteKey="products",window.storecrm_data=window.storecrm_data||{},console.log("StoreCRM initialized version 0.7.3",t),this.config=t,this.fillDefault(),this.popupManager=s.RestockPopupManager.getInstance(t.restockPopup),this.popupManager.setParent(this)}init(){(()=>{o(this,void 0,void 0,(function*(){yield this.checkCustomer(),window.localStorage.getItem("storecrm_wishlist")||(yield this.syncWishlist()),yield this.render(),window.location.pathname.startsWith("/apps/")&&(yield this.renderFavoriteList())}))})(),window.addEventListener("pageshow",(t=>{t.persisted&&this.render(!0)})),document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&this.render(!0)}))}getCurrentShopifyCustomerId(){try{return window.storecrm_data.customer_id||window.ShopifyAnalytics.meta.page.customerId}catch(t){return null}}checkCustomer(){return o(this,void 0,void 0,(function*(){if(window.storecrm_data.is_customer_checked)return;window.storecrm_data.is_customer_checked=!0;const t=(window.localStorage.getItem("storecrm_customer_id")||"").toString(),e=(this.getCurrentShopifyCustomerId()||"").toString();if(t!==e){if(e)return!t||t.startsWith("TEMP_")&&e?(console.log("StoreCRM: checkCustomer: storageCustomerId is not found",t,e),yield this.refreshToken(!1),void(yield this.syncWishlist(null,t,!0))):t!==e?(console.log("StoreCRM: checkCustomer: storageCustomerId is not same",t,e),void(yield this.refreshToken(!0))):void 0;(null==t?void 0:t.startsWith("TEMP_"))||(console.log("StoreCRM: checkCustomer: customerId is not found",t,e),yield this.refreshToken(!0))}else console.log("StoreCRM: checkCustomer: customerId is same",t,e)}))}refreshToken(){return o(this,arguments,void 0,(function*(t=!1){return t&&(window.localStorage.removeItem("storecrm_customer_id"),window.localStorage.removeItem("storecrm_wishlist")),yield this.fetchToken()}))}fillDefault(){this.config.favorite=this.config.favorite||{},i.schema.rows.forEach((t=>{this.config.favorite[t.slug]=this.config.favorite[t.slug]||t.default})),this.favoriteMode=this.config.favorite.favoriteMode||"product",this.favoriteKey="product"===this.favoriteMode?"products":"variants",console.log("StoreCRM: Current favorite mode: ",this.favoriteMode),this.config.restock=this.config.restock||{},r.schema.rows.forEach((t=>{this.config.restock[t.slug]=this.config.restock[t.slug]||t.default})),this.config.restockPopup=this.config.restockPopup||{},s.schema.rows.forEach((t=>{this.config.restockPopup[t.slug]=this.config.restockPopup[t.slug]||t.default}))}render(t=!1){this.doRender(t),t||(window.setTimeout(this.doRender.bind(this),500),window.setTimeout(this.doRender.bind(this),2e3),window.setTimeout(this.doRender.bind(this),5e3))}doRender(t=!1){window.location.pathname.startsWith("/apps")&&window.location.pathname.endsWith("/connect")&&(this.checkConnect(),this.renderStatusWidget());const e=JSON.parse(window.localStorage.getItem("storecrm_wishlist")||"{}");e[this.favoriteKey]||(e[this.favoriteKey]=[]),console.log("StoreCRM: Wishlist",e),document.querySelectorAll(".storecrm-button").forEach((t=>{if(t instanceof HTMLElement==0)return;const n=t.id||"storecrm-button-"+Math.random().toString(36).slice(-8);t.id||(t.id=n);const o=new URL(location.href),s=o.searchParams.get("variant")&&o.searchParams.get("variant"),a=t.dataset.productId,c=s||t.dataset.variantId,d=void 0!==t.dataset.variantSelector,l=JSON.parse(t.dataset.variants||"[]"),u={tags:JSON.parse(t.dataset.productTags||"[]"),id:t.dataset.productId};if(!u||!a||!c)return void console.error("StoreCRM: product or productId or variantId is not set",a,c);const h=e&&("product"==this.favoriteMode?e.products&&e.products.includes(a):e.variants&&e.variants.includes(c)),m=!!t.dataset.currentVariantAvailable,f="wishlist-button"===t.dataset.type?(0,i.render)({productId:a,variantId:c,id:n,button:t,variants:l,product:u,buttonSettings:this.config.favorite,isFavorited:h,hasVariantSelector:d}):(0,r.render)({productId:a,variantId:c,id:n,buttonSettings:this.config.restock,isOutOfStock:m,product:u,variants:l});f&&(t.innerHTML=f)})),document.querySelectorAll(".storecrm-favorite").forEach((n=>{if(n instanceof HTMLElement==0)return;if(!t&&"true"===n.dataset.isRendered)return;n.dataset.isRendered="true";const o=n.dataset.productId||"",r=n.dataset.variantId||"";if(!o)return;const s=void 0!==n.dataset.variantSelector,a=n.id||"storecrm-favorite-"+Math.random().toString(36).slice(-8);n.id||(n.id=a);const c=JSON.parse(n.dataset.variants||"[]"),d={tags:JSON.parse(n.dataset.productTags||"[]"),id:n.dataset.productId},l=e&&e.products&&e.products.includes(o);n.innerHTML=(0,i.render)({productId:o,variantId:r,button:n,id:a,buttonSettings:this.config.favorite,isFavorited:l,hasVariantSelector:s,variants:c,product:d})||""})),"/account"!==window.location.pathname&&"/account/"!==window.location.pathname||this.renderStatusWidget(),this.checkToken()}checkToken(){this.isTokenRefreshed||this.isTokenRefreshNeeded()&&this.fetchToken()}isTokenRefreshNeeded(){const t=window.localStorage.getItem("storecrm_customer_id"),e=parseInt(window.localStorage.getItem("storecrm_customer_id")||"0",10),n=window.localStorage.getItem("storecrm_token");let o=null;try{o=n?n.split("|")[1]:null}catch(t){}return this.isTokenRefreshed?(console.log("StoreCRM: Token refresh needed: false (already refreshed)"),!1):t&&n&&o?window.ShopifyAnalytics&&window.ShopifyAnalytics.meta&&window.ShopifyAnalytics.meta.page&&window.ShopifyAnalytics.meta.page.customerId&&window.ShopifyAnalytics.meta.page.customerId!==e?(console.log("StoreCRM: Token refresh needed: true (customerId mismatch)"),!0):window.ShopifyAnalytics&&window.ShopifyAnalytics.meta&&window.ShopifyAnalytics.meta.page&&window.ShopifyAnalytics.meta.page.customerId?1e3*parseFloat(o)<(new Date).getTime()&&(console.log("StoreCRM: Token refresh needed: true (expired)"),!0):(console.log("StoreCRM: Token refresh needed: true (no customerId)"),!0):(console.log("StoreCRM: Token refresh needed: true (no token)"),!0)}fetchToken(){return o(this,void 0,void 0,(function*(){if(this.isTokenFetching)return yield new Promise((t=>{const e=setInterval((()=>{this.isTokenFetching||(clearInterval(e),t(null))}),100)})),window.localStorage.getItem("storecrm_token");this.isTokenFetching=!0;const t=window.localStorage.getItem("storecrm_customer_id"),e=yield fetch(`/apps/${this.config.appProxyName}/token?current_customer_id=${t}`),n=(yield e.text()).match(/\[data\]([\s\S]*?)\[\/data\]/);if(!n)throw this.isTokenRefreshed=!0,new Error("No data from API");const o=JSON.parse(n[1]);if(!o||!o.customer)throw this.isTokenRefreshed=!0,new Error("No data from API2");return window.localStorage.setItem("storecrm_token",o.customer.token),window.localStorage.setItem("storecrm_customer_id",o.customer.id),this.isTokenRefreshed=!0,console.log("StoreCRM: fetchToken: customerId",t,o.customer.id),(null==t?void 0:t.startsWith("TEMP_"))&&o.customer.id!==t&&(yield this.syncWishlist(null,t)),this.isTokenFetching=!1,o.customer.token}))}getToken(){return o(this,void 0,void 0,(function*(){return this.isTokenFetching&&(yield this.fetchToken()),window.localStorage.getItem("storecrm_token")}))}getCustomerId(){return o(this,void 0,void 0,(function*(){return this.isTokenFetching&&(yield this.fetchToken()),window.localStorage.getItem("storecrm_customer_id")}))}request(){return o(this,arguments,void 0,(function*(t="GET",e,n=null,o=!1){const i=yield this.getCustomerId(),r=yield this.getToken(),s=window.location.href;e.includes("?")?e+=`&customer_id=${i}&host=${window.location.host}&referrer=${encodeURIComponent(s)}`:e+=`?customer_id=${i}&host=${window.location.host}&referrer=${encodeURIComponent(s)}`;const a=yield fetch(e,{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`},body:n?JSON.stringify(n):null,credentials:o?"include":"same-origin"});if(!a.ok)throw new Error("API request failed");return a.json()}))}toggleWishlist(t,e=!1,n=!1,o=""){n?this.fetchToken().then((()=>{var n=window.localStorage.getItem("storecrm_customer_id");n&&!/^TEMP_/.test(n)?this.doToggleWishlist(t,!e).then((()=>{console.log(e?"StoreCRM: Wishlist removed!":"StoreCRM: Wishlist added!")})).catch((t=>{console.error(t),alert("サーバエラーが発生しました! error: "+t.message+" しばらくたってから再度お試しください。")})):window.location.href=""===o?"/account/login":o})):this.doToggleWishlist(t,!e).then((()=>{console.log(e?"StoreCRM: Wishlist removed!":"StoreCRM: Wishlist added!")})).catch((t=>{console.error(t),alert("サーバエラーが発生しました! error: "+t.message+" しばらくたってから再度お試しください。")}))}syncWishlist(){return o(this,arguments,void 0,(function*(t=null,e=void 0,n=!1){if(!n){const t=JSON.parse(window.localStorage.getItem("storecrm_wishlist")||"{}");if(t.lastUpdated&&Date.now()-t.lastUpdated<12e5)return t}const o=t||(yield this.getWishlist(e));if(o&&this.favoriteKey in o)return window.localStorage.getItem("storecrm_wishlist"),"product"===this.favoriteMode?(window.localStorage.setItem("storecrm_wishlist",JSON.stringify({products:o.products,lastUpdated:Date.now()})),this.renderFavoriteList(),{products:o.products}):(window.localStorage.setItem("storecrm_wishlist",JSON.stringify({products:o.products,variants:o.variants,lastUpdated:Date.now()})),this.renderFavoriteList(),{products:o.products,variants:o.variants});console.error("StoreCRM: Invalid response from favorite fetch API",o)}))}renderFavoriteList(){return o(this,void 0,void 0,(function*(){const t=document.querySelector(".storecrm_favoritelist");if(!t||t instanceof HTMLElement==0)return;console.log("StoreCRM: Render Favroite List");const e=c.Renderer.getInstance(this);yield e.init(),yield e.render()}))}getWishlist(){return o(this,arguments,void 0,(function*(t=void 0){return t?this.request("GET",`${this.config.backendUrl}/frontend/favorite/?old_customer_id=${t}&mode=${this.favoriteMode}`):this.request("GET",`${this.config.backendUrl}/frontend/favorite/?mode=${this.favoriteMode}`)}))}doToggleWishlist(t){return o(this,arguments,void 0,(function*(t,e=!1){const n=t.dataset.productId;let o=t.dataset.variantId;const r=void 0!==t.dataset.variantSelector;if(!n)return void console.error("Product ID not found");const s=t.closest(".storecrm-favorite"),a=s&&JSON.parse(s.dataset.variants||"null");if("variant"==this.favoriteMode&&a&&1===a.length&&(o=a[0].id,(0,i.hideWidgetSelector)()),"variant"==this.favoriteMode&&!o){if(r){const e=JSON.parse(window.localStorage.getItem("storecrm_wishlist")||"{}");return void(0,i.renderWidgetSelector)({button:t,productId:n,variants:a,wishlist:e,buttonSettings:this.config.favorite})}return void console.error("Variant ID not found: you need to set data-variant-id (Specify variant id) or data-variant-selector(Show variant selector) attribute.")}let c={};c=e?yield this.request("POST",`${this.config.backendUrl}/frontend/favorite/`,{product_id:n,variant_id:o,mode:this.favoriteMode}):yield this.request("DELETE",`${this.config.backendUrl}/frontend/favorite/?product_id=${n}&variant_id=${o}&mode=${this.favoriteMode}`),console.log("StoreCRM response wishlist: ",c),c&&window.localStorage.setItem("storecrm_wishlist",JSON.stringify(Object.assign(Object.assign({},c),{lastUpdated:Date.now()}))),"variant"==this.favoriteMode&&r&&(0,i.renderWidgetSelector)({button:t,productId:n,variants:a,wishlist:c,buttonSettings:this.config.favorite,rerender:!0}),this.render(!0),this.renderFavoriteList()}))}showRestock(t){const e=t.dataset.id||t.id,n=r.RestockButton.getInstance(e);n?this.popupManager.show(this.config.restockPopup,n.variants,n.productId):console.error("StoreCRM Restock: restockButton not found")}storeRestock(t,e,n,o,i,r,s=void 0,a=void 0){if(!this.checkEmailFormat(t))return a&&a("メールアドレスが正しくありません。");this.doStoreRestock(e,n,t,i,o,r).then((()=>{console.log("StoreCRM: Restock saved successfully"),s&&s(this.config.restockPopup.success_text)})).catch((t=>{console.error("StoreCRM: API call failed:",t),a&&a(this.config.restockPopup.error_text)}))}doStoreRestock(t,e,n,i,r,s){return o(this,void 0,void 0,(function*(){if(i)try{yield this.doUpsertCustomerAcceptsMarketing(n,r,s),console.log("StoreCRM: Accepts marketing status saved successfully")}catch(t){console.error("API call failed:",t)}return yield this.request("POST",`${this.config.backendUrl}/frontend/restock/`,{product_id:e,variant_id:t,email:n})}))}doUpsertCustomerAcceptsMarketing(t,e,n){return o(this,void 0,void 0,(function*(){return yield this.request("POST",`${this.config.backendUrl}/frontend/accepts-marketing/`,{email:t,accepts_marketing:e,new_customer:n})}))}renderStatusWidget(){if(this.statusWidget)return void console.log("StoreCRM: warning: statusWidget already exists");const t=document.querySelector(".storecrm-status-widget-target"),e=document.querySelector("#shopify-section-header,.section-header,.section--header,header,.header-wrapper,.header,.header_nav"),n=document.querySelector("#MainContent, #main, .main, main");if(console.log("StoreCRM: renderStatusWidget",e,n),e||n||t){if(t)this.statusWidget=new a.StatusWidget(t,"beforeend",this.config);else if(n)this.statusWidget=new a.StatusWidget(n,"afterbegin",this.config);else{if(!e)return;this.statusWidget=new a.StatusWidget(e,"beforeend",this.config)}this.statusWidget.setParent(this),this.statusWidget.render()}else console.error("Shopify header not found. Please assign following class/id/element to header: #shopify-section-header,.section-header,.section--header,header,.header_nav")}getStatus(t,e){this.doGetStatus().then((e=>{t(e)})).catch((t=>{console.error(t),e("サーバエラーが発生しました。")}))}doGetStatus(){return o(this,void 0,void 0,(function*(){return yield this.request("GET",`${this.config.backendUrl}/frontend/status`)}))}lineSubscribe(t=void 0){this.doLineSubscribe()}doLineSubscribe(){return o(this,void 0,void 0,(function*(){const t=yield this.getCustomerId(),e=yield this.getToken(),n=window.location.href;location.href=`${this.config.backendUrl}/frontend/line/connect?token=${e}&customer_id=${t}&host=${window.location.host}&referrer=${encodeURIComponent(n)}`}))}lineUnsubscribe(t=void 0){this.doLineUnsubscribe().then((t=>{location.href=location.pathname+"?line_disconnect=1"})).catch((e=>{console.error(e),t?t("LINEの通知解除に失敗しました。"):alert("LINEの通知解除に失敗しました。")}))}doLineUnsubscribe(){return o(this,void 0,void 0,(function*(){return yield this.request("POST",`${this.config.backendUrl}/frontend/line/disconnect`)}))}mailSubscribe(){this.doMailSubscribe().then((t=>{console.log("StoreCRM: メールマガジンの購読に成功しました。",t),this.statusWidget&&this.statusWidget.render()})).catch((t=>{console.error(t),alert("メールマガジンの購読に失敗しました。")}))}doMailSubscribe(){return o(this,void 0,void 0,(function*(){return yield this.request("POST",`${this.config.backendUrl}/frontend/email/subscribe`)}))}mailUnsubscribe(){this.doMailUnsubscribe().then((t=>{console.log("StoreCRM: メールマガジンの解除に成功しました。",t);const e=document.getElementById("storecrm_message");e&&(e.innerHTML="メールマガジンの解除に成功しました。"),this.statusWidget&&this.statusWidget.render()})).catch((t=>{console.error(t);const e=document.getElementById("storecrm_message");e&&(e.innerHTML="メールマガジンの解除に失敗しました。","API"in t.toString()&&(e.innerHTML+='<br><a href="/account/login">解除を進めるにはログインをしてください。</a>')),alert("メールマガジンの解除に失敗しました。")}))}doMailUnsubscribe(){return o(this,void 0,void 0,(function*(){return yield this.request("POST",`${this.config.backendUrl}/frontend/email/unsubscribe`)}))}doMailCheck(t){return o(this,arguments,void 0,(function*(t,e=void 0){return this.checkEmailFormat(t)?yield this.request("GET",`${this.config.backendUrl}/frontend/accepts-marketing/?email=${encodeURIComponent(t)}`):e&&e("メールアドレスが正しくありません。")}))}birthdaySet(){}checkEmailFormat(t){return!(!t||!t.match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|.(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/))}checkConnect(){const t=new URLSearchParams(window.location.search),e=t.get("storecrm"),n=window.localStorage.getItem("storecrm_customer_id");if(n&&!n.startsWith("TEMP_")){if("line_connect"===e?this.lineSubscribe((function(){console.log("StoreCRM: LINEの通知登録に失敗しました。")})):"line_disconnect"===e?this.lineUnsubscribe():"email_subscribe"===e?this.mailSubscribe():"email_unsubscribe"===e?this.mailUnsubscribe():"birthday_set"===e&&this.birthdaySet(),t.get("line_disconnect")){const t=document.querySelector("#storecrm_message");t&&(t.innerHTML="LINEの通知を解除しました。")}if(t.get("line_connect")){const t=document.querySelector("#storecrm_message");t&&(t.innerHTML="LINEを連携しました。")}}else{const t=document.getElementById("storecrm_message");t&&(t.innerHTML='設定変更に失敗しました。<br><a href="/account/login">進めるにはログインをしてください。</a>')}}}},927:function(t,e,n){var o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const i=o(n(398));window.storecrm=new i.default(window.storecrm_config||{}),window.storecrm.init()}},e={};function n(o){var i=e[o];if(void 0!==i)return i.exports;var r=e[o]={id:o,exports:{}};return t[o].call(r.exports,r,r.exports,n),r.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var o in e)n.o(e,o)&&!n.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.nc=void 0,n(927)})();