window.storecrm_config = {"line":{"line_login_enable":false,"line_login_onlypreview":false},"favorite":{"button_text":"お気に入りに追加する","button_text_remove":"お気に入り済み","favoriteMode":"product","is_only_member":false},"favoriteListMode":"simple","favoriteList":{"list_title":"お気に入り一覧","loading_text":"読込中です...","non_item_text":"現在お気に入り中の商品はありません","show_cart":true,"insert_cart_directly":true},"restock":{"button_text":"再入荷通知を受け取る"},"restockPopup":{"popup_title":"再入荷通知","popup_description":"再入荷通知をご希望の方は以下から、ご選択ください。","emailaddress":"ご連絡メールアドレス","button_text":"再入荷通知を有効にする","success_text":"再入荷通知が登録されました。","error_text":"再入荷通知の登録に失敗しました。しばらくたってから再度お試しください。","error_text_email":"メールアドレスが正しくありません。確認の上、再度ご記入ください。","accepts_marketing_checkbox_text":"メルマガ配信に同意する","email_confirmation_text":"こちらのメールアドレスで間違いないですか?"},"lineRestock":{"button_text":"LINEで再入荷通知を受け取る"},"lineRestockPopup":{"title":"LINE再入荷通知","description_text":"この商品の再入荷をLINEでお知らせします","button_text":"再入荷通知を有効にする","success_text":"再入荷通知が登録されました!","error_text":"再入荷通知の登録に失敗しました。しばらくたってから再度お試しください。"},"locales":{},"backendUrl":"https://obake.groovymedia.co","appProxyName":"obake"}; (()=>{var t={157(t,e,o){"use strict";var n=o(42),i=o.n(n),r=o(275),s=o.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,\n.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 {\n content: '\\2715';\n}\n\n.storecrm_modal__content {\n margin-top: 2rem;\n margin-bottom: 1rem;\n line-height: 1.5;\n color: rgba(0, 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, 0.8);\n border-radius: 0.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 0.25s ease-out;\n transition: transform 0.25s ease-out;\n transition: transform 0.25s ease-out, -webkit-transform 0.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.storecrm-restock-registered {\n pointer-events: none;\n}\n\n.storecrm_login_required_modal .storecrm_modal__overlay {\n background: rgba(0, 0, 0, 0.55);\n padding: 16px;\n box-sizing: border-box;\n}\n\n.storecrm_login_required_modal .storecrm_modal__container {\n width: min(576px, 100%);\n min-width: 0;\n min-height: 0;\n max-height: calc(100vh - 32px);\n padding: 20px 16px 16px;\n border-radius: 2px;\n}\n\n.storecrm_login_required_modal .storecrm_modal__title {\n font-size: 20px;\n line-height: 1.4;\n font-weight: 600;\n}\n\n.storecrm_login_required_modal .storecrm_modal__content {\n margin-top: 14px;\n margin-bottom: 0;\n color: #111;\n font-size: 16px;\n line-height: 1.65;\n}\n\n.storecrm_login_required_actions {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 16px;\n margin-top: 28px;\n}\n\n.storecrm_login_required_login,\n.storecrm_login_required_cancel {\n min-height: 52px;\n padding: 0 16px;\n border-radius: 32px;\n font-size: 16px;\n font-weight: 600;\n line-height: 1.2;\n cursor: pointer;\n appearance: none;\n}\n\n.storecrm_login_required_login {\n color: #fff;\n background: #000;\n border: 1px solid #000;\n}\n\n.storecrm_login_required_cancel {\n color: #111;\n background: #fff;\n border: 1px solid #111;\n}\n\n@media (max-width: 480px) {\n .storecrm_login_required_actions {\n grid-template-columns: 1fr;\n gap: 12px;\n }\n}\n\n@keyframes mmfadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n\n@keyframes mmfadeOut {\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n}\n\n@keyframes mmslideIn {\n from {\n transform: translateY(15%);\n }\n to {\n transform: translateY(0);\n }\n}\n\n@keyframes mmslideOut {\n from {\n transform: translateY(0);\n }\n to {\n transform: translateY(-10%);\n }\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 0.3s cubic-bezier(0, 0, 0.2, 1);\n}\n\n.micromodal-slide[aria-hidden='false'] .storecrm_modal__container {\n animation: mmslideIn 0.3s cubic-bezier(0, 0, 0.2, 1);\n}\n\n.micromodal-slide[aria-hidden='true'] .storecrm_modal__overlay {\n animation: mmfadeOut 0.3s cubic-bezier(0, 0, 0.2, 1);\n}\n\n.micromodal-slide[aria-hidden='true'] .storecrm_modal__container {\n animation: mmslideOut 0.3s cubic-bezier(0, 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/* \u30d5\u30a7\u30fc\u30c9\u30a4\u30f3\u30fb\u30d5\u30a7\u30fc\u30c9\u30a2\u30a6\u30c8\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u7528\u306e\u30af\u30e9\u30b9 */\n.fade-out {\n animation: mmfadeOut 0.3s cubic-bezier(0, 0, 0.2, 1) forwards;\n}\n\n.fade-in {\n animation: mmfadeIn 0.3s cubic-bezier(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@media (max-width: 767px) {\n .storecrm-status-widget {\n flex-direction: column;\n max-height: none; /* Remove height restriction */\n }\n}\n\n.storecrm-status-widget button {\n margin-left: 0.5rem;\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\n.line-chat-preview {\n display: flex;\n flex-direction: column;\n width: 360px;\n height: 640px;\n border: 1px solid #ddd;\n overflow: hidden;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;\n box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);\n background-color: #92aad4;\n}\n\n.line-chat-header {\n display: flex;\n align-items: center;\n padding: 10px 16px;\n background-color: #44556f;\n color: white;\n height: 50px;\n}\n\n.line-chat-body {\n flex-grow: 1;\n overflow-y: auto;\n display: flex;\n flex-direction: column;\n gap: 8px;\n position: relative;\n scrollbar-width: none;\n -ms-overflow-style: none;\n}\n\n.line-chat-body::-webkit-scrollbar {\n display: none;\n}\n\n.line-chat-footer {\n padding: 0 16px 0 16px;\n background-color: #ffffff;\n display: flex;\n align-items: center;\n justify-content: space-between;\n height: 50px;\n}\n\n.line-chat-keyboard-icon {\n width: 22px;\n height: 22px;\n}\n\n.line-chat-chatbarText {\n flex-grow: 1;\n font-size: 14px;\n color: #000;\n text-align: center;\n}\n\n/* \u30ea\u30c3\u30c1\u30e1\u30cb\u30e5\u30fc\u8868\u793a\u6642\u306e\u30b9\u30bf\u30a4\u30eb */\n.line-chat-footer.menu-open .line-chat-chatbarText:after {\n content: '\u25bc';\n}\n\n/* \u30ea\u30c3\u30c1\u30e1\u30cb\u30e5\u30fc\u975e\u8868\u793a\u6642\u306e\u30b9\u30bf\u30a4\u30eb */\n.line-chat-footer:not(.menu-open) .line-chat-chatbarText:after {\n content: '\u25b2';\n}\n\n.line-richmenu-preview {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n background-color: #ffffff;\n transform: translateY(100%);\n transition: transform 0.3s cubic-bezier(0, 0, 0.2, 1);\n z-index: 10;\n box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);\n}\n\n.line-richmenu-preview.menu-open {\n transform: translateY(0);\n}\n\n.line-richmenu-preview.menu-closed {\n transform: translateY(100%);\n}\n\n/* LINE\u518d\u5165\u8377\u901a\u77e5\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u7528\u306e\u30b9\u30bf\u30a4\u30eb */\n.storecrm-line-restock-popup-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 opacity: 0;\n animation: mmfadeIn 0.3s cubic-bezier(0, 0, 0.2, 1) forwards;\n}\n\n.storecrm-line-restock-popup {\n background-color: #fff;\n padding: 30px;\n min-width: 320px;\n max-width: 500px;\n min-height: 150px;\n max-height: 100vh;\n border-radius: 8px;\n box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);\n box-sizing: border-box;\n text-align: center;\n overflow-y: auto;\n transform: translateY(15%);\n animation: mmslideIn 0.3s cubic-bezier(0, 0, 0.2, 1) forwards;\n will-change: transform;\n}\n\n.storecrm-line-restock-popup-text {\n font-size: 16px;\n line-height: 1.5;\n margin-bottom: 20px;\n color: rgba(0, 0, 0, 0.8);\n font-weight: 500;\n}\n\n.storecrm-line-restock-popup-button {\n display: block;\n width: 100%;\n padding: 12px 16px;\n background-color: #3b82f6;\n color: white;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n font-size: 14px;\n font-weight: 600;\n will-change: transform;\n backface-visibility: hidden;\n transform: translateZ(0);\n transition: transform 0.25s ease-out, background-color 0.2s ease;\n}\n\n.storecrm-line-restock-popup-button:hover {\n background-color: #2563eb;\n transform: scale(1.02);\n}\n\n.storecrm-line-restock-popup-button:active {\n transform: scale(0.98);\n}\n\n.storecrm-line-restock-popup-button:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n transform: none;\n}\n\n/* \u9589\u3058\u308b\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u7528\u306e\u30af\u30e9\u30b9 */\n.storecrm-line-restock-popup-overlay.fade-out {\n animation: mmfadeOut 0.3s cubic-bezier(0, 0, 0.2, 1) forwards;\n}\n\n.storecrm-line-restock-popup-overlay.fade-out .storecrm-line-restock-popup {\n animation: mmslideOut 0.3s cubic-bezier(0, 0, 0.2, 1) forwards;\n}\n\n/* \u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u5b9a\u7fa9 */\n@keyframes mmfadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n\n@keyframes mmfadeOut {\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n}\n\n@keyframes mmslideIn {\n from {\n transform: translateY(15%);\n }\n to {\n transform: translateY(0);\n }\n}\n\n@keyframes mmslideOut {\n from {\n transform: translateY(0);\n }\n to {\n transform: translateY(-10%);\n }\n}\n\n/* \u30ec\u30b9\u30dd\u30f3\u30b7\u30d6\u5bfe\u5fdc */\n@media (max-width: 480px) {\n .storecrm-line-restock-popup {\n min-width: 280px;\n max-width: 90vw;\n padding: 20px;\n margin: 0 15px;\n }\n\n .storecrm-line-restock-popup-text {\n font-size: 14px;\n margin-bottom: 15px;\n }\n\n .storecrm-line-restock-popup-button {\n padding: 10px 14px;\n font-size: 13px;\n }\n}\n",""]);const a=s;o.d(e,["A",0,a])},275(t){"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var o="",n=void 0!==e[5];return e[4]&&(o+="@supports (".concat(e[4],") {")),e[2]&&(o+="@media ".concat(e[2]," {")),n&&(o+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),o+=t(e),n&&(o+="}"),e[2]&&(o+="}"),e[4]&&(o+="}"),o}).join("")},e.i=function(t,o,n,i,r){"string"==typeof t&&(t=[[null,t,void 0]]);var s={};if(n)for(var a=0;a0?" ".concat(d[5]):""," {").concat(d[1],"}")),d[5]=r),o&&(d[2]?(d[1]="@media ".concat(d[2]," {").concat(d[1],"}"),d[2]=o):d[2]=o),i&&(d[4]?(d[1]="@supports (".concat(d[4],") {").concat(d[1],"}"),d[4]=i):d[4]="".concat(i)),e.push(d))}},e}},42(t){"use strict";t.exports=function(t){return t[1]}},132(t,e,o){"use strict";function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var o=0,n=Array(e);oa});var a=function(){var t=["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^="-"])'],e={openTrigger:"data-micromodal-trigger",identifier:"data-micromodal-id"},o={},n=[],s=0;e.generateId=function(){return"micromodal-".concat(++s)};var a=function(){function e(t){var o=t.targetModal,n=t.triggers,i=void 0===n?[]:n,r=t.onShow,s=void 0===r?function(){}:r,a=t.onClose,l=void 0===a?function(){}:a,c=t.openTrigger,d=void 0===c?"data-micromodal-trigger":c,h=t.closeTrigger,m=void 0===h?"data-micromodal-close":h,p=t.openClass,g=void 0===p?"is-open":p,f=t.disableScroll,_=void 0!==f&&f,v=t.disableFocus,b=void 0!==v&&v,y=t.awaitCloseAnimation,w=void 0!==y&&y,k=t.awaitOpenAnimation,x=void 0!==k&&k,S=t.debugMode,R=void 0!==S&&S;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),this.modal="string"==typeof o?document.getElementById(o):o,this.modalId=null,null!==this.modal?(this.config={debugMode:R,disableScroll:_,openTrigger:d,closeTrigger:m,openClass:g,onShow:s,onClose:l,awaitCloseAnimation:w,awaitOpenAnimation:x,disableFocus:b},this.showModal=this.showModal.bind(this),this.onClick=this.onClick.bind(this),this.onKeydown=this.onKeydown.bind(this),this.setFocusToFirstNode=this.setFocusToFirstNode.bind(this),this.triggers=i,this.registerTriggers()):!0===R&&u(o,R,!1)}var o,s;return o=e,s=[{key:"registerTriggers",value:function(){var t=this;this.triggers.filter(Boolean).forEach(function(e){e.addEventListener("click",t.showModal)})}},{key:"unregisterTriggers",value:function(){var t=this;this.triggers.filter(Boolean).forEach(function(e){e.removeEventListener("click",t.showModal)})}},{key:"destroy",value:function(){this.closeModal(),this.unregisterTriggers()}},{key:"showModal",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.modal.classList.contains(this.config.openClass)||(this.removeEventListeners(),this.activeElement=document.activeElement,this.modal.setAttribute("aria-hidden","false"),this.modal.classList.add(this.config.openClass),this.toggleScrolling(!1),this.addEventListeners(),this.modalId&&-1===n.indexOf(this.modalId)&&n.push(this.modalId),this.config.awaitOpenAnimation?this.modal.addEventListener("animationend",this.setFocusToFirstNode,{once:!0}):this.setFocusToFirstNode(),this.config.onShow(this.modal,this.activeElement,t))}},{key:"closeModal",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=this.modal,o=this.config.openClass;if(e.classList.contains(o)){var i=n.indexOf(this.modalId);i>-1&&n.splice(i,1),this.modal.setAttribute("aria-hidden","true"),this.removeEventListeners(),this.toggleScrolling(!0),this.activeElement&&this.activeElement.focus&&this.activeElement.focus(),this.config.onClose(this.modal,this.activeElement,t),this.config.awaitCloseAnimation?this.modal.addEventListener("animationend",function(){e.classList.remove(o)},{once:!0}):e.classList.remove(o)}}},{key:"toggleScrolling",value:function(t){if(this.config.disableScroll){var e=!t||n.length>0;document.body.style.overflow=e?"hidden":"",document.body.style.touchAction=e?"none":""}}},{key:"addEventListeners",value:function(){this.modal.addEventListener("click",this.onClick),this.modal.addEventListener("keydown",this.onKeydown),this.modalId?0===n.length&&document.addEventListener("keydown",c):document.removeEventListener("keydown",c)}},{key:"removeEventListeners",value:function(){this.modal.removeEventListener("click",this.onClick),this.modal.removeEventListener("keydown",this.onKeydown),0===n.length&&document.removeEventListener("keydown",c)}},{key:"onClick",value:function(t){var e=d(t.target,this.modal),o=t.target.closest("[".concat(this.config.closeTrigger,"]"));(t.target.hasAttribute(this.config.closeTrigger)&&e||null!==o&&!d(o,this.modal)&&!e)&&(t.preventDefault(),t.stopPropagation(),this.closeModal(t))}},{key:"onKeydown",value:function(t){"Escape"!==t.key&&27!==t.keyCode||null!==this.modal.querySelector('[role="alertdialog"]')||this.closeModal(t),"Tab"!==t.key&&9!==t.keyCode||this.retainFocus(t,"inside")}},{key:"getFocusableNodes",value:function(){return r(this.modal.querySelectorAll(t))}},{key:"setFocusToFirstNode",value:function(){var t=this;if(!this.config.disableFocus){var e=this.getFocusableNodes();if(0!==e.length){var o=e.filter(function(e){return!e.hasAttribute(t.config.closeTrigger)});o.length>0&&o[0].focus(),0===o.length&&e[0].focus()}}}},{key:"retainFocus",value:function(t,e){var o=this.getFocusableNodes();if(0!==o.length)if(o=o.filter(function(t){return null!==t.offsetParent}),"outside"===e)o[0].focus(),t.preventDefault();else{var n=o.indexOf(document.activeElement);t.shiftKey&&0===n&&(o[o.length-1].focus(),t.preventDefault()),!t.shiftKey&&o.length>0&&n===o.length-1&&(o[0].focus(),t.preventDefault())}}}],s&&i(o.prototype,s),Object.defineProperty(o,"prototype",{writable:!1}),e}(),l=function(t){if("string"==typeof t)return t;if(t instanceof HTMLElement){var o=t.getAttribute(e.identifier);return o||(t.id?t.id:(o=e.generateId(),t.setAttribute(e.identifier,o),o))}return null},c=function(t){var e=o[n[n.length-1]];e.modal.contains(document.activeElement)||("Escape"!==t.key&&27!==t.keyCode||null!==e.modal.querySelector('[role="alertdialog"]')||p(),"Tab"!==t.key&&9!==t.keyCode||e.retainFocus(t,"outside"))},d=function(t,e){return t===e||t.parentNode===e},u=function(t,e){return!!(!(arguments.length>2&&void 0!==arguments[2])||arguments[2]?void 0!==o[t]:"string"==typeof t?null!==document.getElementById(t):t instanceof HTMLElement)||(e&&console.warn("MicroModal: \u2757Seems like you have missed %c'".concat(t,"'%c ID somewhere in your code. Try the example below to resolve it.\n\n")+'%cExample:%c '),"background-color: #f8f9fa;color: #50596c;font-weight: bold;","","background-color: #f8f9fa;color: #50596c;font-weight: bold;",""),!1)},h=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=Object.assign({},e,{targetModal:t},n),r=l(t);u(i.targetModal,i.debugMode,!1)&&(o[r]||(o[r]=new a(i),o[r].modal.setAttribute(e.identifier,r),o[r].modalId=r))},m=function(t,n){var i=l(t);u(i,e.debugMode)&&Object.assign(o[i].config,n)},p=function(t){if(0!==n.length)if(t){var e=l(t);n.indexOf(e)>-1&&o[e].closeModal()}else o[n[n.length-1]].closeModal()};return{init:function(t){Object.assign(e,t);var o=r(document.querySelectorAll("[".concat(e.openTrigger,"]"))),n=function(t,e){var o=[];return t.forEach(function(t){var n=t.getAttribute(e);o[n]||(o[n]=[]),o[n].push(t)}),o}(o,e.openTrigger);!0===e.debugMode&&!1===function(t){return!(t.length<=0&&(console.warn('MicroModal: \u2757Please specify at least one %c\'micromodal-trigger\'%c data attribute.\n\n%cExample:%c Open modal',"background-color: #f8f9fa;color: #50596c;font-weight: bold;","","background-color: #f8f9fa;color: #50596c;font-weight: bold;",""),1))}(o)||Object.keys(n).forEach(function(t){var e=n[t];h(t,{targetModal:t,triggers:e})})},initModal:h,config:m,show:function(t,e){var n=l(t);o[n]?e&&m(t,e):h(n,e),o[n]&&o[n].showModal()},close:p,closeAll:function(){for(var t=n.length-1;t>=0;t--)o[n[t]].closeModal()},removeModal:function(t){var e=l(t),n=o[e];n&&(n.destroy(),delete o[e])}}}();"undefined"!=typeof window&&(window.MicroModal=a)},627(t,e,o){"use strict";o.r(e);var n=o(263),i=o.n(n),r=o(815),s=o.n(r),a=o(912),l=o.n(a),c=o(375),d=o.n(c),u=o(403),h=o.n(u),m=o(752),p=o.n(m),g=o(157),f={};f.styleTagTransform=p(),f.setAttributes=d(),f.insert=l().bind(null,"head"),f.domAPI=s(),f.insertStyleElement=h();i()(g.A,f);const _=g.A&&g.A.locals?g.A.locals:void 0;o.d(e,["default",0,_])},263(t){"use strict";var e=[];function o(t){for(var o=-1,n=0;n0?" ".concat(o.layer):""," {")),n+=o.css,i&&(n+="}"),o.media&&(n+="}"),o.supports&&(n+="}");var r=o.sourceMap;r&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(r))))," */")),e.styleTagTransform(n,t,e.options)}(e,t,o)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},752(t){"use strict";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))}}},196(t,e){"use strict";e.schema=e.iF=e.XX=void 0;e.XX=(t,e)=>{const o="ja"===e,n=o?{available:"\u5728\u5eab\u3042\u308a",unavailable:"\u5728\u5eab\u5207\u308c",cart:"\u30ab\u30fc\u30c8\u306b\u8ffd\u52a0",product:"\u5546\u54c1\u3092\u898b\u308b",remove:"\u524a\u9664",noImage:"\u753b\u50cf\u306a\u3057"}:{available:"In stock",unavailable:"Out of stock",cart:"Add to cart",product:"View product",remove:"Remove",noImage:"No image"};return(o?[{title:"\u30aa\u30fc\u30ac\u30cb\u30c3\u30af\u30b3\u30c3\u30c8\u30f3 \u30ea\u30e9\u30c3\u30af\u30b9\u30b7\u30e3\u30c4",available:!0,imageUrl:"https://placehold.jp/320x240.png?text=StoreCRM"},{title:"\u6bce\u65e5\u4f7f\u3048\u308b\u8efd\u91cf\u30ad\u30e3\u30f3\u30d0\u30b9\u30c8\u30fc\u30c8",available:!1},{title:"\u5b63\u7bc0\u9650\u5b9a\u30ab\u30e9\u30fc\u306e\u30bd\u30d5\u30c8\u30cb\u30c3\u30c8",available:!0,imageUrl:"https://placehold.jp/320x240.png?text=Favorite"}]:[{title:"Organic cotton relaxed shirt",available:!0,imageUrl:"https://placehold.jp/320x240.png?text=StoreCRM"},{title:"Lightweight everyday canvas tote",available:!1},{title:"Seasonal color soft knit",available:!0,imageUrl:"https://placehold.jp/320x240.png?text=Favorite"}]).map(e=>((t,e,o)=>{const n="product_link"===t.cart_icon?o.product:o.cart,i=e.available?"is-available":"is-unavailable";return`\n \n \n
\n \n ${e.imageUrl?`${e.title}`:`${o.noImage}`}\n \n
\n ${e.title}\n ${!1!==t.show_stock_status?`\n ${e.available?o.available:o.unavailable}\n `:""}\n
\n
\n \n \n \n \n `;var r})(t,e,n)).join("")};e.iF=t=>'\n \n',e.schema={preview:(t,o)=>{const n=t.layout_preset||"standard",i=!0===t[`show_view_controls_${n}`],r="ja"===o?{group:"\u5546\u54c1\u3054\u3068\u306bSKU\u3092\u307e\u3068\u3081\u308b",sort:"\u4e26\u3073\u9806",newest:"\u767b\u9332\u304c\u65b0\u3057\u3044\u9806",oldest:"\u767b\u9332\u304c\u53e4\u3044\u9806",asc:"\u5546\u54c1\u540d\u306e\u6607\u9806",desc:"\u5546\u54c1\u540d\u306e\u964d\u9806"}:{group:"Group SKUs by product",sort:"Sort",newest:"Newest favorites",oldest:"Oldest favorites",asc:"Product name A\u2013Z",desc:"Product name Z\u2013A"},s=t.group_by_product_text||r.group,a=t.sort_label||r.sort,l=t.sort_newest_text||r.newest,c=t.sort_oldest_text||r.oldest,d=t.sort_title_asc_text||r.asc,u=t.sort_title_desc_text||r.desc;let h=`
`;return h+=(0,e.iF)(t),h+=`

${t.list_title}

`,i&&(h+=`
\n ${"variant"===t.favoriteMode?``:""}\n \n
`),h+=`${t.loading_text}`,h+=`${t.non_item_text}`,h+="",h+="",h+=(0,e.XX)(t,o),h+="",h+="
",h+="
",h},rows:[{type:"select",slug:"layout_preset",nameJa:"\u4e00\u89a7\u30c7\u30b6\u30a4\u30f3",nameEn:"List design",default:"standard",selectOptionsJa:[{value:"standard",label:"\u6a19\u6e96\u8868\u793a"},{value:"card",label:"\u30ab\u30fc\u30c9\u8868\u793a"},{value:"horizontal",label:"\u30eb\u30c3\u30af\u30d6\u30c3\u30af\u8868\u793a"},{value:"detailed",label:"\u8a73\u7d30\u30ea\u30b9\u30c8\u8868\u793a"}],selectOptionsEn:[{value:"standard",label:"Standard"},{value:"card",label:"Cards"},{value:"horizontal",label:"Lookbook"},{value:"detailed",label:"Detailed list"}]},{type:"text",slug:"list_title",nameJa:"\u30bf\u30a4\u30c8\u30eb",nameEn:"title",defaultJa:"\u304a\u6c17\u306b\u5165\u308a\u4e00\u89a7",defaultEn:"Your favorites"},{type:"text",slug:"loading_text",nameJa:"\u8aad\u307f\u8fbc\u307f\u4e2d\u306b\u8868\u793a\u3059\u308b\u30c6\u30ad\u30b9\u30c8",nameEn:"loading text",defaultJa:"\u8aad\u8fbc\u4e2d\u3067\u3059...",defaultEn:"Loading..."},{type:"text",slug:"non_item_text",nameJa:"\u304a\u6c17\u306b\u5165\u308a\u767b\u9332\u304c\u306a\u3044\u5834\u5408\u306b\u8868\u793a\u3059\u308b\u30c6\u30ad\u30b9\u30c8",nameEn:"non item text",defaultJa:"\u73fe\u5728\u304a\u6c17\u306b\u5165\u308a\u4e2d\u306e\u5546\u54c1\u306f\u3042\u308a\u307e\u305b\u3093",defaultEn:"There are currently no favorited items."},{type:"checkbox",slug:"show_stock_status",nameJa:"\u5728\u5eab\u72b6\u6cc1\u3092\u8868\u793a\u3059\u308b",nameEn:"show stock status",descriptionJa:"\u30ab\u30fc\u30c9\u30fb\u30eb\u30c3\u30af\u30d6\u30c3\u30af\u30fb\u8a73\u7d30\u30ea\u30b9\u30c8\u306b\u300c\u5728\u5eab\u3042\u308a\uff0f\u5728\u5eab\u5207\u308c\u300d\u3092\u8868\u793a\u3057\u307e\u3059",descriptionEn:"Shows \u201cIn stock / Out of stock\u201d in cards, lookbook, and detailed list layouts",default:!0},{type:"checkbox",slug:"show_cart",nameJa:"\u30ab\u30fc\u30c8\u30dc\u30bf\u30f3\u3092\u8868\u793a\u3059\u308b",nameEn:"show cart button",default:!0},{type:"select",slug:"cart_icon",nameJa:"\u30ab\u30fc\u30c8\u30dc\u30bf\u30f3\u306e\u30a2\u30a4\u30b3\u30f3",nameEn:"cart button icon",default:"cart",depends:"show_cart",selectOptionsJa:[{value:"cart",label:"\u30ab\u30fc\u30c8"},{value:"cart_plus",label:"\u30ab\u30fc\u30c8 +"},{value:"bag",label:"\u30d0\u30c3\u30b0"},{value:"product_link",label:"\u5546\u54c1\u30da\u30fc\u30b8\u3078\u79fb\u52d5"}],selectOptionsEn:[{value:"cart",label:"Cart"},{value:"cart_plus",label:"Cart +"},{value:"bag",label:"Bag"},{value:"product_link",label:"Go to product page"}]},{type:"checkbox",slug:"insert_cart_directly",nameJa:"\u30ab\u30fc\u30c8\u30dc\u30bf\u30f3\u3067\u76f4\u63a5\u30ab\u30fc\u30c8\u306b\u5165\u308c\u308b",nameEn:"insert cart directly",default:!0,descriptionJa:"\u30d0\u30ea\u30a8\u30fc\u30b7\u30e7\u30f3\u30e2\u30fc\u30c9\u306e\u5834\u5408\u306e\u307f\u6709\u52b9\u3067\u3059\u3002\u30ab\u30fc\u30c8\u30dc\u30bf\u30f3\u3092\u62bc\u3059\u3068\u3001\u81ea\u52d5\u3067\u30ab\u30fc\u30c8\u306b\u5165\u308a\u3001\u30ab\u30fc\u30c8\u30da\u30fc\u30b8\u306b\u9077\u79fb\u3057\u307e\u3059\u3002",descriptionEn:"Only for variation mode. When you press the cart button, it will automatically be added to the cart and transition to the cart page."},{type:"checkbox",slug:"show_view_controls_standard",nameJa:"\u6a19\u6e96\u8868\u793a\uff1a\u7d5e\u308a\u8fbc\u307f\u30fb\u4e26\u3073\u66ff\u3048\u3092\u8868\u793a\u3059\u308b",nameEn:"Standard: show filters and sorting",default:!1},{type:"checkbox",slug:"show_view_controls_card",nameJa:"\u30ab\u30fc\u30c9\u8868\u793a\uff1a\u7d5e\u308a\u8fbc\u307f\u30fb\u4e26\u3073\u66ff\u3048\u3092\u8868\u793a\u3059\u308b",nameEn:"Cards: show filters and sorting",default:!1},{type:"checkbox",slug:"show_view_controls_horizontal",nameJa:"\u30eb\u30c3\u30af\u30d6\u30c3\u30af\u8868\u793a\uff1a\u7d5e\u308a\u8fbc\u307f\u30fb\u4e26\u3073\u66ff\u3048\u3092\u8868\u793a\u3059\u308b",nameEn:"Lookbook: show filters and sorting",default:!1},{type:"checkbox",slug:"show_view_controls_detailed",nameJa:"\u8a73\u7d30\u30ea\u30b9\u30c8\u8868\u793a\uff1a\u7d5e\u308a\u8fbc\u307f\u30fb\u4e26\u3073\u66ff\u3048\u3092\u8868\u793a\u3059\u308b",nameEn:"Detailed list: show filters and sorting",default:!1},{type:"text",slug:"group_by_product_text",nameJa:"SKU\u307e\u3068\u3081\u306e\u6587\u8a00",nameEn:"Group SKUs label",defaultJa:"\u5546\u54c1\u3054\u3068\u306bSKU\u3092\u307e\u3068\u3081\u308b",defaultEn:"Group SKUs by product"},{type:"text",slug:"sort_label",nameJa:"\u4e26\u3073\u9806\u306e\u6587\u8a00",nameEn:"Sort label",defaultJa:"\u4e26\u3073\u9806",defaultEn:"Sort"},{type:"text",slug:"sort_newest_text",nameJa:"\u300c\u767b\u9332\u304c\u65b0\u3057\u3044\u9806\u300d\u306e\u6587\u8a00",nameEn:"Newest option label",defaultJa:"\u767b\u9332\u304c\u65b0\u3057\u3044\u9806",defaultEn:"Newest favorites"},{type:"text",slug:"sort_oldest_text",nameJa:"\u300c\u767b\u9332\u304c\u53e4\u3044\u9806\u300d\u306e\u6587\u8a00",nameEn:"Oldest option label",defaultJa:"\u767b\u9332\u304c\u53e4\u3044\u9806",defaultEn:"Oldest favorites"},{type:"text",slug:"sort_title_asc_text",nameJa:"\u300c\u5546\u54c1\u540d\u306e\u6607\u9806\u300d\u306e\u6587\u8a00",nameEn:"Product title ascending option label",defaultJa:"\u5546\u54c1\u540d\u306e\u6607\u9806",defaultEn:"Product name A\u2013Z"},{type:"text",slug:"sort_title_desc_text",nameJa:"\u300c\u5546\u54c1\u540d\u306e\u964d\u9806\u300d\u306e\u6587\u8a00",nameEn:"Product title descending option label",defaultJa:"\u5546\u54c1\u540d\u306e\u964d\u9806",defaultEn:"Product name Z\u2013A"}]}},3(t,e,o){"use strict";e.schema=e.renderWidgetSelector=e.hideWidgetSelector=e.render=e.s=void 0;const n=o(883),i=o(978),r=t=>{const e=Object.assign({},t);return e.has_background||(e.button_width="auto",e.button_width_unit="px",e.button_height="auto",e.button_radius=0,e.button_border_width=0,e.button_background_color="transparent",e.button_border_color="transparent",e.button_hover_border_color="transparent",e.button_hover_background_color="transparent"),e};e.s=(t,e=!1)=>{let o=null;return"star"===t.buttonicon?o=e?'':'':"heart"===t.buttonicon?o=e?'':'':"tag"===t.buttonicon?o='':"clip"===t.buttonicon&&(o=''),o&&(o=o.replace("viewBox",`width="${t.icon_size}" height="${t.icon_size}" style="margin-right: ${t.icon_margin}px;" viewBox`)),o};class s{constructor(t,e,o,n,i,s=!1,a=!1,l){this.eventTriggered=!1,this.variants=o,this.buttonSettings=r(n),this.productId=e,this.button=i,this.isFavorited=s,this.hasVariantSelector=a,this.variantId=l}static getInstance(t,e,o,n,i,a=!1,l=!1,c){if(s.instances[t]){const d=s.instances[t];d.isFavorited=a,d.hasVariantSelector=l,d.buttonSettings=r(n),d.variants=o,d.button=i,d.productId=e,d.variantId=c}else s.instances[t]=new s(t,e,o,n,i,a,l,c);return s.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),o=e.searchParams.get("variant")&&e.searchParams.get("variant")||"";o&&(t.dataset.variantId=o),window.storecrm&&window.storecrm.render(!0)}})}render(t,o=!1){const n=(0,e.s)(this.buttonSettings,this.isFavorited),r=new URL(location.href),s=parseInt(r.searchParams.get("variant")||this.variantId||"0",10)||"",a=this.hasVariantSelector?"data-variant-selector":"",l=this.buttonSettings.is_only_member?"data-storecrm-member-only-wishlist":"",c=void 0!==this.button.dataset.noLabel;if(!this.eventTriggered){const e=window.navigation;if(e)e.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 d=o?"":`onclick="event.preventDefault();window.storecrm ? window.storecrm.toggleWishlist(this, ${this.isFavorited?"true":"false"}, ${this.buttonSettings.is_only_member}, '${this.buttonSettings.non_member_link||""}') : alert('\u8aad\u8fbc\u4e2d\u3067\u3059\u3002\u3057\u3070\u3089\u304f\u305f\u3063\u3066\u304b\u3089\u518d\u5ea6\u304a\u8a66\u3057\u304f\u3060\u3055\u3044\u3002');"`,u=``,h=document.querySelector("#storecrm-wishlistbutton-style");return o?(h&&h.remove(),document.body.insertAdjacentHTML("afterend",u)):h||document.body.insertAdjacentHTML("afterend",u),`
\n\n
`}}s.instances={};let a,l,c;e.render=({productId:t,variantId:e,id:o,variants:n,product:i,button:r,buttonSettings:a,isFavorited:l=!1,preview:c=!1,hasVariantSelector:d=!1})=>s.getInstance(o,t,n,a,r,l,d,e).render(o,c);e.hideWidgetSelector=()=>{a&&(a.remove(),a=void 0),document.querySelectorAll(".storecrm-variantselector-dropdown").forEach(t=>t.remove()),l=void 0,c=void 0};e.renderWidgetSelector=({button:t,productId:o,variants:i,wishlist:r,buttonSettings:s,preview:d=!1,rerender:u=!1})=>{const h=Array.isArray(null==r?void 0:r.variants)?r.variants:[];r.variants=h;const m=l===o&&c?c:i,p=a&&u&&l==o?a.style:void 0;let g=0;if(!d&&a&&u&&(g=a.scrollTop),!d&&u&&l!==o)return;if(!d&&a&&(a.remove(),a=void 0,!u))return;l=o,c=m;const f=m.map(t=>{const i=(0,n.containsShopifyId)(h,t.id),r=(0,e.s)(s,i),a=d?"":`onclick="event.preventDefault();event.stopPropagation();window.storecrm ? window.storecrm.toggleWishlist(this, ${i?"true":"false"}, ${s.is_only_member}, '${s.non_member_link||""}') : alert('\u8aad\u8fbc\u4e2d\u3067\u3059\u3002\u3057\u3070\u3089\u304f\u305f\u3063\u3066\u304b\u3089\u518d\u5ea6\u304a\u8a66\u3057\u304f\u3060\u3055\u3044\u3002');"`;return`\n ${r||(i?s.button_text_remove:s.button_text)}\n ${t.title}\n `}).join("");let _="";if(d)_="position: static;";else if(p)_=`top: ${p.top}; left: ${p.left};`;else{const e=t.getBoundingClientRect(),o=250;let n=e.left+document.documentElement.scrollLeft;n+o>window.innerWidth&&(n=window.innerWidth-o),_=`top: ${e.bottom+document.documentElement.scrollTop}px; left: ${n}px;`}const v=``;d||(document.body.insertAdjacentHTML("afterend",v),a=document.querySelector(".storecrm-variantselector-dropdown"),u&&g>0&&(a.scrollTop=g));{const t=t=>{t.target&&t.target instanceof HTMLElement&&t.target.closest("[data-variant-selector]")||a&&(a.remove(),a=void 0)};document.addEventListener("click",t),document.addEventListener("resize",t)}return v},e.schema={preview:(t,o)=>{let n=`
${"ja"===o?"\u304a\u6c17\u306b\u5165\u308a\u30dc\u30bf\u30f3(\u304a\u6c17\u306b\u5165\u308a\u524d)":"Favorite button (before it is added)"}
`;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+=`
${"ja"===o?"\u30d0\u30ea\u30a8\u30fc\u30b7\u30e7\u30f3\u30e2\u30fc\u30c9\u306e\u969b\u306e\u304a\u6c17\u306b\u5165\u308a\u30dc\u30bf\u30f3":"Favorite button for variant mode"}
`,n+=(0,e.renderWidgetSelector)({productId:"TEMP_product",variants:"ja"===o?[{id:"1",title:"\u30d0\u30ea\u30a8\u30fc\u30b7\u30e7\u30f31"},{id:"2",title:"\u30d0\u30ea\u30a8\u30fc\u30b7\u30e7\u30f32"},{id:"3",title:"\u30d0\u30ea\u30a8\u30fc\u30b7\u30e7\u30f33"}]:[{id:"1",title:"Variant 1"},{id:"2",title:"Variant 2"},{id:"3",title:"Variant 3"}],wishlist:{products:[],variants:[]},buttonSettings:t,button:document.createElement("div"),preview:!0,rerender:!1})),n+=`
${"ja"===o?"\u304a\u6c17\u306b\u5165\u308a\u30dc\u30bf\u30f3(\u304a\u6c17\u306b\u5165\u308a\u5f8c)":"Favorite button (after it is added)"}
`,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:"\u304a\u6c17\u306b\u5165\u308a\u306e\u30e2\u30fc\u30c9\u3092\u9078\u3093\u3067\u304f\u3060\u3055\u3044",nameEn:"Choose the favorite mode",default:"product",selectOptionsJa:[{value:"product",label:"\u5546\u54c1\u3054\u3068\u306b\u304a\u6c17\u306b\u5165\u308a\u3092\u3059\u308b"},{value:"variant",label:"\u30d0\u30ea\u30a8\u30fc\u30b7\u30e7\u30f3(\u5546\u54c1\u306e\u8272\u3084\u30b5\u30a4\u30ba\u306a\u3069)\u3054\u3068\u306b\u304a\u6c17\u306b\u5165\u308a\u3092\u3059\u308b"}],selectOptionsEn:[{value:"product",label:"Favorite by product"},{value:"variant",label:"Favorite by variant (such as color or size)"}],warningOnChangeJa:"\u8a2d\u5b9a\u3092\u5909\u66f4\u3059\u308b\u3068\u3001\u65e2\u5b58\u306e\u304a\u6c17\u306b\u5165\u308a\u30c7\u30fc\u30bf\u304c\u7121\u52b9\u3068\u306a\u308a\u307e\u3059\u3002\u30c7\u30fc\u30bf\u79fb\u7ba1\u3092\u3054\u5e0c\u671b\u306e\u65b9\u306f\u3053\u306e\u8a2d\u5b9a\u3092\u4fdd\u5b58\u305b\u305a\u306b\u3001\u304a\u554f\u3044\u5408\u308f\u305b\u304f\u3060\u3055\u3044\u3002",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:"\u304a\u6c17\u306b\u5165\u308a\u6a5f\u80fd\u306e\u5229\u7528\u3092\u4f1a\u54e1\u9650\u5b9a\u306b\u3059\u308b",nameEn:"Enable favorite function for sign-in customers only",default:!1,fullsize:!0},{type:"text",slug:"non_member_link",nameJa:"\u30b2\u30b9\u30c8\u304c\u304a\u6c17\u306b\u5165\u308a\u3092\u62bc\u3057\u305f\u5834\u5408\u306e\u9077\u79fb\u5148URL\u3000\u203b\u7a7a\u6b04\u306e\u5834\u5408\u30ed\u30b0\u30a4\u30f3\u753b\u9762\u306b\u9077\u79fb\u3057\u307e\u3059",nameEn:"URL to redirect to when a guest clicks the favorite button. If left blank, the login screen will be displayed.",default:"",depends:"is_only_member",fullsize:!0},{type:"select",slug:"buttonicon",nameJa:"\u30a2\u30a4\u30b3\u30f3",nameEn:"Icon",selectOptionsJa:[{value:"star",label:"\u661f\u30de\u30fc\u30af(\u2606)"},{value:"heart",label:"\u30cf\u30fc\u30c8\u30de\u30fc\u30af(\u2661)"},{value:"tag",label:"\u30bf\u30b0\u30a2\u30a4\u30b3\u30f3"},{value:"clip",label:"\u30af\u30ea\u30c3\u30d7\u30a2\u30a4\u30b3\u30f3"},{value:"none",label:"\u306a\u3057"}],selectOptionsEn:[{value:"star",label:"Star icon (\u2606)"},{value:"heart",label:"Heart icon (\u2661)"},{value:"tag",label:"Tag icon"},{value:"clip",label:"Clip icon"},{value:"none",label:"None"}],default:"star"},{type:"text",slug:"button_text",nameJa:"\u30dc\u30bf\u30f3\u306e\u30c6\u30ad\u30b9\u30c8",nameEn:"Button text",defaultJa:"\u304a\u6c17\u306b\u5165\u308a",defaultEn:"Favorite"},{type:"text",slug:"button_text_remove",nameJa:"\u30dc\u30bf\u30f3\u306e\u30c6\u30ad\u30b9\u30c8(\u304a\u6c17\u306b\u5165\u308a\u89e3\u9664)",nameEn:"Button text (when favorited)",defaultJa:"\u304a\u6c17\u306b\u5165\u308a\u6e08\u307f",defaultEn:"Favorited"},{type:"checkbox",slug:"has_background",nameJa:"\u80cc\u666f\u304c\u3042\u308b\u30dc\u30bf\u30f3\u306b\u3059\u308b",nameEn:"Show a button background",default:!1},{type:"select",slug:"button_width_unit",nameJa:"\u30dc\u30bf\u30f3\u5e45\u306e\u6307\u5b9a\u65b9\u6cd5",nameEn:"Button width unit",default:"px",depends:"has_background",selectOptionsJa:[{value:"px",label:"\u56fa\u5b9a\u5e45\uff08px\uff09"},{value:"percent",label:"\u30b3\u30f3\u30c6\u30ca\u306b\u5bfe\u3059\u308b\u5272\u5408\uff08%\uff09"}],selectOptionsEn:[{value:"px",label:"Fixed width (px)"},{value:"percent",label:"Percentage of container (%)"}]},{type:"range",slug:"button_width",nameJa:"\u30dc\u30bf\u30f3\u306e\u5e45\uff08px\uff09",nameEn:"Button width (px)",default:200,min:50,max:600,step:10,depends:"has_background",checkVisible:t=>"percent"!==t.button_width_unit},{type:"range",slug:"button_width_percent",nameJa:"\u30dc\u30bf\u30f3\u306e\u5e45\uff08%\uff09",nameEn:"Button width (%)",default:100,min:1,max:100,step:1,depends:"has_background",checkVisible:t=>"percent"===t.button_width_unit},{type:"range",slug:"button_height",nameJa:"\u30dc\u30bf\u30f3\u306e\u9ad8\u3055",nameEn:"Button height",default:50,min:30,max:100,step:10,depends:"has_background"},{type:"colorpicker",slug:"button_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u6587\u5b57\u8272",nameEn:"Button text color",default:"#000000"},{type:"colorpicker",slug:"icon_color",nameJa:"\u30a2\u30a4\u30b3\u30f3\u306e\u6587\u5b57\u8272",nameEn:"Icon color",default:"#000000"},{type:"colorpicker",slug:"button_background_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u80cc\u666f\u8272",nameEn:"Button background color",default:"#ffffff",depends:"has_background"},{type:"colorpicker",slug:"button_border_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u7dda\u306e\u8272",nameEn:"Button border color",default:"#000000",depends:"has_background"},{type:"colorpicker",slug:"button_hover_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u6587\u5b57\u8272(\u30db\u30d0\u30fc\u6642)",nameEn:"Button text color (hover)",default:"#222222"},{type:"colorpicker",slug:"icon_hover_color",nameJa:"\u30a2\u30a4\u30b3\u30f3\u306e\u6587\u5b57\u8272(\u30db\u30d0\u30fc\u6642)",nameEn:"Icon color (hover)",default:"#000000"},{type:"colorpicker",slug:"button_hover_background_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u80cc\u666f\u8272(\u30db\u30d0\u30fc\u6642)",nameEn:"Button background color (hover)",default:"#dddddd",depends:"has_background"},{type:"colorpicker",slug:"button_hover_border_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u7dda\u306e\u8272(\u30db\u30d0\u30fc\u6642)",nameEn:"Button border color (hover)",default:"#222222",depends:"has_background"},{type:"range",slug:"button_radius",nameJa:"\u30dc\u30bf\u30f3\u306e\u4e38\u307f",nameEn:"Button corner radius",default:5,min:0,max:20,step:1,depends:"has_background"},{type:"range",slug:"button_border_width",nameJa:"\u30dc\u30bf\u30f3\u306e\u7dda\u306e\u592a\u3055",nameEn:"Button border width",default:0,min:0,max:10,step:1,depends:"has_background"},{type:"fontpicker",slug:"button_font",nameJa:"\u30dc\u30bf\u30f3\u306e\u30d5\u30a9\u30f3\u30c8",nameEn:"Button font",default:"helvetica_n4"},{type:"range",slug:"button_fontsize",nameJa:"\u30dc\u30bf\u30f3\u306e\u30d5\u30a9\u30f3\u30c8\u30b5\u30a4\u30ba",nameEn:"Button font size",default:16,min:10,max:30,step:1},{type:"range",slug:"button_fontweight",nameJa:"\u30dc\u30bf\u30f3\u306e\u30d5\u30a9\u30f3\u30c8\u30a6\u30a7\u30a4\u30c8",nameEn:"Button font weight",default:400,min:100,max:900,step:100},{type:"range",slug:"icon_size",nameJa:"\u30a2\u30a4\u30b3\u30f3\u306e\u30b5\u30a4\u30ba",nameEn:"Icon size",default:16,min:10,max:30,step:1},{type:"range",slug:"icon_margin",nameJa:"\u30a2\u30a4\u30b3\u30f3\u3068\u30c6\u30ad\u30b9\u30c8\u3068\u306e\u9593\u9694",nameEn:"Space between icon and text",default:5,min:0,max:20,step:1},{type:"range",slug:"button_speed",nameJa:"\u30dc\u30bf\u30f3\u306e\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u901f\u5ea6",nameEn:"Button animation speed",default:.3,min:0,max:1,step:.1},{type:"select",slug:"align",nameJa:"\u30dc\u30bf\u30f3\u306e\u914d\u7f6e",nameEn:"Button alignment",default:"center",selectOptionsJa:[{value:"left",label:"\u5de6\u5bc4\u305b"},{value:"center",label:"\u4e2d\u592e\u5bc4\u305b"},{value:"right",label:"\u53f3\u5bc4\u305b"}],selectOptionsEn:[{value:"left",label:"Align left"},{value:"center",label:"Align center"},{value:"right",label:"Align right"}]},{type:"colorpicker",slug:"popup_text_color",nameJa:"POPUP\u306e\u30c6\u30ad\u30b9\u30c8\u8272",nameEn:"Popup text color",default:"#000000",checkVisible:t=>"variant"===t.favoriteMode},{type:"colorpicker",slug:"popup_background_color",nameJa:"POPUP\u306e\u80cc\u666f\u8272",nameEn:"Popup background color",default:"#ffffff",checkVisible:t=>"variant"===t.favoriteMode},{type:"colorpicker",slug:"popup_icon_color",nameJa:"POPUP\u306e\u30a2\u30a4\u30b3\u30f3\u8272",nameEn:"Popup icon color",default:"#000000",checkVisible:t=>"variant"===t.favoriteMode},{type:"colorpicker",slug:"popup_icon_hover_color",nameJa:"POPUP\u306e\u30a2\u30a4\u30b3\u30f3\u8272(\u30db\u30d0\u30fc\u6642)",nameEn:"Popup icon color (hover)",default:"#000000",checkVisible:t=>"variant"===t.favoriteMode},{type:"range",slug:"popup_border_width",nameJa:"POPUP\u306e\u7dda\u306e\u592a\u3055",nameEn:"Popup border width",default:0,min:0,max:10,step:1,checkVisible:t=>"variant"===t.favoriteMode},{type:"colorpicker",slug:"popup_border_color",nameJa:"POPUP\u306e\u7dda\u306e\u8272",nameEn:"Popup border color",default:"#999",checkVisible:t=>"variant"===t.favoriteMode}]}},48(t,e,o){"use strict";var n=this&&this.__awaiter||function(t,e,o,n){return new(o||(o=Promise))(function(i,r){function s(t){try{l(n.next(t))}catch(t){r(t)}}function a(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof o?e:new o(function(t){t(e)})).then(s,a)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.Renderer=void 0;const i=o(349),r=o(446),s=o(954),a={layout_preset:"standard",show_view_controls_standard:!1,show_view_controls_card:!1,show_view_controls_horizontal:!1,show_view_controls_detailed:!1,show_view_controls_advanced:!1,list_title:"\u304a\u6c17\u306b\u5165\u308a\u4e00\u89a7",loading_text:"\u8aad\u8fbc\u4e2d\u3067\u3059...",non_item_text:"\u73fe\u5728\u304a\u6c17\u306b\u5165\u308a\u4e2d\u306e\u5546\u54c1\u306f\u3042\u308a\u307e\u305b\u3093",show_stock_status:!0,show_cart:!1,insert_cart_directly:!0,cart_icon:"cart"},l="storecrm_favorite_list_view_v1";class c{static getInstance(t){return c.instance||(c.instance=new c(t)),c.instance}constructor(t){this.config=a,this.mode="product",this.favoriteListMode="simple",this.inited=!1,this.currentIds="",this.loadingNextPage=!1,this.appendedCursors=new Set,this.advancedHandlerRoots=new WeakSet,this.loadMoreButtonLabels=new WeakMap,this.loadMoreRequestSeq=0,this.canReuseServerRenderedPreview=!1,this.sort="newest",this.groupByProduct=!1,this.parent=t}getFavoriteListRoot(){const t=document.querySelector(".storecrm_favoritelist, .storecrm_customlist");if(t instanceof HTMLElement)return t;const e=document.querySelector("[data-storecrm-preview-context]");return e instanceof HTMLElement?e:null}init(){return n(this,void 0,void 0,function*(){this.inited||(this.inited=!0,yield this.loadConfig())})}loadConfig(){return n(this,void 0,void 0,function*(){this.config=Object.assign(Object.assign({},a),this.parent.config.favoriteList||{});const t=new URLSearchParams(window.location.search),e=document.querySelector("[data-storecrm-preview-context]"),o="preview"===t.get("ids")&&t.get("preview_token")||void 0;if(this.previewToken=o||(null==e?void 0:e.dataset.storecrmPreviewToken),this.canReuseServerRenderedPreview=Boolean(this.previewToken),this.favoriteListMode=this.previewToken?"advanced":this.parent.config.favoriteListMode||"simple",this.previewToken&&t.has("show_view_controls")&&(this.config.show_view_controls_advanced="false"!==t.get("show_view_controls")),this.previewToken){["group_by_product_text","sort_label","sort_newest_text","sort_oldest_text","sort_title_asc_text","sort_title_desc_text"].forEach(e=>{t.has(e)&&(this.config[e]=t.get(e)||void 0)})}this.applyConfig();const n=t.get("mode")||(null==e?void 0:e.dataset.storecrmPreviewMode);this.mode=!this.previewToken||"product"!==n&&"variant"!==n?this.parent.favoriteMode:n,this.previewToken?(this.sort="newest",this.groupByProduct=!1):this.loadViewPreferences(),this.ensureViewControls()})}applyConfig(){const t=document.getElementById("list_title"),e=document.getElementById("loading_text"),o=document.getElementById("non_item_text");t&&(t.textContent=this.config.list_title),e&&(e.textContent=this.config.loading_text),o&&(o.textContent=this.config.non_item_text);const n=this.getFavoriteListRoot();n&&("advanced"===this.favoriteListMode?(delete n.dataset.layoutPreset,n.dataset.storecrmRenderMode="advanced"):(delete n.dataset.storecrmRenderMode,n.dataset.layoutPreset=this.config.layout_preset||"standard"))}render(){return n(this,void 0,void 0,function*(){var t;this.ensureViewControls();const e=JSON.parse(localStorage.getItem("storecrm_wishlist")||"{}"),o=this.getWishlistIds(e),n=o.join(",");if("advanced"===this.favoriteListMode){const t=this.previewToken?"preview":n;return void(yield this.renderAdvancedPreview(t))}if(0===o.length){null===(t=document.querySelector(".storecrm_favoritelist table"))||void 0===t||t.remove();const e=document.querySelector(".storecrm_favoritelist_loading"),o=document.querySelector(".storecrm_favoritelist_non_item");return e&&(e.style.display="none"),void(o&&(o.style.display="block"))}const i=document.querySelector(".storecrm_favoritelist_loading");i&&(i.style.display="none"),yield this.loadProductAndRender(n)})}getWishlistIds(t){const e="variant"===this.mode?null==t?void 0:t.variants:null==t?void 0:t.products;return Array.isArray(e)?e:[]}buildAdvancedRenderUrl(t,e){const o=(0,i.getFavoriteListRequestedLocale)(),n=new URLSearchParams({ids:t,mode:this.mode});return o&&n.set("locale",o),e&&n.set("cursor",e),this.appendViewParams(n),"preview"===t&&this.previewToken&&n.set("preview_token",this.previewToken),`${(0,s.buildAppProxyUrl)("/favorites/render",{origin:window.location.origin,path:this.parent.config.appProxyPath,name:this.parent.config.appProxyName})}?${n.toString()}`}extractAdvancedHtml(t){var e;const o=t.match(/\[liquid\]([\s\S]*?)\[\/liquid\]/m);if(o)return o[1];if(this.previewToken){const o="\x3c!--storecrm-fragment-items:start--\x3e",n="\x3c!--storecrm-fragment-items:end--\x3e",i=t.indexOf(o),r=i>=0?t.indexOf(n,i+o.length):-1;if(i>=0&&r>=0){const o=r+n.length,s=null===(e=t.match(/]*data-storecrm-next-cursor)[^>]*>[\s\S]*?<\/button\s*>/i))||void 0===e?void 0:e[0];return t.slice(i,o)+(s||"")}const s=(new DOMParser).parseFromString(t,"text/html").querySelector("[data-storecrm-preview-context]");if(s){const t=s.querySelector("[data-storecrm-preview-content]"),e=s.querySelector(".storecrm_favoritelist, .storecrm_customlist"),o=(null==t?void 0:t.innerHTML)||(null==e?void 0:e.outerHTML);if(o)return o}}return t}findNextCursor(t){const e=t.querySelector("[data-storecrm-next-cursor]");return(null==e?void 0:e.dataset.storecrmNextCursor)||""}removeScripts(t){t.querySelectorAll("script").forEach(t=>t.remove())}stripExecutableScripts(t){return String(t||"").replace(/]*>[\s\S]*?<\/script\s*>/gi,"")}createAdvancedTemplate(t){const e=document.createElement("template");return e.innerHTML=this.stripExecutableScripts(t),this.removeScripts(e.content),e}getAdvancedItemsRoot(t){return t.querySelector("[data-storecrm-items]")}getAdvancedFragmentItems(t){return t.querySelector("[data-storecrm-fragment-items]")}extractMarkedFragmentHtml(t){const e=String(t||""),o="\x3c!--storecrm-fragment-items:start--\x3e",n=e.indexOf(o);if(n<0)return;const i=n+36,r=e.indexOf("\x3c!--storecrm-fragment-items:end--\x3e",i);return r<0?void 0:this.stripExecutableScripts(e.slice(i,r))}appendAdvancedFragment(t,e){const o=this.getFavoriteListRoot();if(!o)return!1;const n=this.getAdvancedItemsRoot(o),i=this.extractMarkedFragmentHtml(t);if(n&&void 0!==i)return n.insertAdjacentHTML("beforeend",i),n.querySelectorAll("script").forEach(t=>t.remove()),!0;const r=this.getAdvancedFragmentItems(e.content);if(n&&r){for(;r.firstChild;)n.appendChild(r.firstChild);return!0}const s=o.querySelector("tbody");if(s){const t=e.content.querySelectorAll("tbody tr");return t.forEach(t=>s.appendChild(t)),t.length>0}return!1}abortLoadMoreRequest(){this.loadMoreAbortController&&(this.loadMoreAbortController.abort(),this.loadMoreAbortController=void 0)}fetchWithTimeout(t){return n(this,arguments,void 0,function*(t,e=15e3){const o=new AbortController;this.loadMoreAbortController=o;const n=window.setTimeout(()=>o.abort(),e);try{return yield fetch(t,{signal:o.signal,cache:"no-store"})}finally{window.clearTimeout(n),this.loadMoreAbortController===o&&(this.loadMoreAbortController=void 0)}})}renderAdvancedPreview(t){return n(this,void 0,void 0,function*(){const e=this.getFavoriteListRoot();if(!e)return void console.warn("StoreCRM: Favorite advanced render skipped because no list root was found");const o=Boolean(this.previewToken)||"true"===e.dataset.storecrmInitialLoading;if(this.previewToken&&this.canReuseServerRenderedPreview&&this.getAdvancedItemsRoot(e))return this.canReuseServerRenderedPreview=!1,this.abortLoadMoreRequest(),this.loadMoreRequestSeq+=1,this.currentIds=t,this.nextCursor=this.findNextCursor(e)||void 0,this.loadingNextPage=!1,this.appendedCursors.clear(),this.syncLoadMoreButton(),this.bindAdvancedActionHandlers(e),void(yield this.loadRemainingPagesAutomatically());this.canReuseServerRenderedPreview=!1,this.abortLoadMoreRequest();const n=++this.loadMoreRequestSeq;this.currentIds=t,this.nextCursor=void 0,this.loadingNextPage=!1;try{const i=yield this.fetchWithTimeout(this.buildAdvancedRenderUrl(t));if(n!==this.loadMoreRequestSeq||t!==this.currentIds)return;if(!i.ok)return void console.error("StoreCRM: failed to load favorite list liquid preview",i.status);const r=this.extractAdvancedHtml(yield i.text());if(n!==this.loadMoreRequestSeq||t!==this.currentIds)return;const s=this.createAdvancedTemplate(r),a=s.content.querySelector(".storecrm_favoritelist, .storecrm_customlist");let l=e;if(a&&e.matches(".storecrm_favoritelist, .storecrm_customlist")){document.querySelectorAll("style[data-storecrm-advanced-initial-style]").forEach(t=>t.remove()),document.querySelectorAll("style[data-storecrm-advanced-list-style]").forEach(t=>t.remove()),Array.from(s.content.children).forEach(t=>{t instanceof HTMLStyleElement&&t.setAttribute("data-storecrm-advanced-list-style","true")});const t=s.content.cloneNode(!0),o=t.querySelector(".storecrm_favoritelist, .storecrm_customlist");e.replaceWith(t),o&&(l=o)}else e.replaceChildren(s.content.cloneNode(!0));this.removeScripts(l),this.ensureViewControls(l),this.nextCursor=this.findNextCursor(l)||void 0,this.appendedCursors.clear(),this.syncLoadMoreButton(),this.bindAdvancedActionHandlers(l),o&&(yield this.loadRemainingPagesAutomatically())}catch(t){if(t instanceof DOMException&&"AbortError"===t.name)return;console.error("StoreCRM: error rendering advanced favorite list",t)}})}loadRemainingPagesAutomatically(){return n(this,void 0,void 0,function*(){const t=this.getFavoriteListRoot();if(!t)return;const e=document.querySelector("[data-storecrm-preview-context]"),o=Array.from(new Set([t,e].filter(Boolean))),n=(t,e)=>{o.forEach(o=>{o.dataset.storecrmPagesLoaded=t,o.dataset.storecrmPaginationStatus=e,this.previewToken&&(o.dataset.storecrmPreviewPagesLoaded=t,o.dataset.storecrmPreviewPaginationStatus=e)})};n("1",this.nextCursor?"loading":"complete");for(let e=1;e<5&&this.nextCursor;e+=1){const o=this.nextCursor;if(yield this.loadNextPage(),this.nextCursor===o)return n(t.dataset.storecrmPagesLoaded||"1","failed"),void console.warn("StoreCRM: Favorite automatic pagination stopped",{page:e+1,reason:"cursor did not advance"});n(String(e+1),"loading")}n(t.dataset.storecrmPagesLoaded||"1",this.nextCursor?"limited":"complete")})}bindAdvancedActionHandlers(t){this.advancedHandlerRoots.has(t)||(this.advancedHandlerRoots.add(t),t.addEventListener("click",e=>{var o,n;const r=e.target;if(!(r instanceof Element))return;const s=r.closest("[data-storecrm-next-cursor]");if(s&&t.contains(s))return e.preventDefault(),void this.loadAllRemainingPages();const a=r.closest("[data-cart-variant-id], [data-cart-product-id]");if(a&&t.contains(a)){const t=a.dataset.cartVariantId,o=a.dataset.cartProductId,n=a.dataset.cartProductHandle||"",r=t||o;if(!r)return;return e.preventDefault(),void(0,i.cartFavorite)(this.mode,r,n,this.config.insert_cart_directly,t)}const l=r.closest("a[data-product-id], a[data-variant-id]");if(l&&t.contains(l)){if(!l.dataset.productId)return;e.preventDefault(),this.parent.toggleWishlist(l,!0,null===(o=this.parent.config.favorite)||void 0===o?void 0:o.is_only_member,null===(n=this.parent.config.favorite)||void 0===n?void 0:n.non_member_link)}}))}buildProductsUrl(t,e){const o=(0,i.getFavoriteListRequestedLocale)(),n=new URLSearchParams({mode:this.mode,ids:t});o&&n.set("locale",o),e&&n.set("cursor",e),this.appendViewParams(n);return`${(0,s.buildAppProxyUrl)("/favorites/products",{path:this.parent.config.appProxyPath,name:this.parent.config.appProxyName})}?${n.toString()}`}loadProductAndRender(t){return n(this,void 0,void 0,function*(){this.abortLoadMoreRequest();const e=++this.loadMoreRequestSeq;this.currentIds=t,this.loadingNextPage=!1,this.appendedCursors.clear();const o=yield fetch(this.buildProductsUrl(t));if(e!==this.loadMoreRequestSeq||t!==this.currentIds)return;const n=yield o.json();e===this.loadMoreRequestSeq&&t===this.currentIds&&(this.nextCursor=n.next_cursor||void 0,this.renderProducts(n),this.syncLoadMoreButton(),yield this.loadRemainingPagesAutomatically())})}syncLoadMoreButton(){var t;const e=this.getFavoriteListRoot();if(!e)return;let o=e.querySelector("[data-storecrm-next-cursor]");this.nextCursor?(o||(o=document.createElement("button"),o.type="button",o.classList.add("storecrm_favoritelist_load_more"),o.textContent="\u3082\u3063\u3068\u898b\u308b",e.appendChild(o)),o.dataset.storecrmNextCursor=this.nextCursor,o.style.display="block",o.disabled=this.loadingNextPage,o.setAttribute("aria-busy",this.loadingNextPage?"true":"false"),this.loadMoreButtonLabels.has(o)||this.loadMoreButtonLabels.set(o,(null===(t=o.textContent)||void 0===t?void 0:t.trim())||"\u3082\u3063\u3068\u898b\u308b"),o.textContent=this.loadingNextPage?this.config.loading_text||"\u8aad\u8fbc\u4e2d\u3067\u3059...":this.loadMoreButtonLabels.get(o)||"\u3082\u3063\u3068\u898b\u308b","advanced"!==this.favoriteListMode&&(o.onclick=()=>this.loadAllRemainingPages())):null==o||o.remove()}loadAllRemainingPages(){return n(this,void 0,void 0,function*(){if(!this.nextCursor||this.loadingNextPage||this.appendedCursors.has(this.nextCursor))return;const t=this.currentIds;this.loadingNextPage=!0,this.syncLoadMoreButton();try{for(;this.nextCursor&&t===this.currentIds;){const t=this.nextCursor;if(yield this.loadNextPage({loadingManagedExternally:!0}),this.nextCursor===t)break}}finally{t===this.currentIds&&(this.loadingNextPage=!1,this.syncLoadMoreButton())}})}loadNextPage(){return n(this,arguments,void 0,function*(t={}){const e=!0===t.loadingManagedExternally,o=this.nextCursor;if(!o||!e&&this.loadingNextPage||this.appendedCursors.has(o))return;const n=this.currentIds,i=++this.loadMoreRequestSeq;e||(this.loadingNextPage=!0,this.syncLoadMoreButton());try{if("advanced"===this.favoriteListMode){const t=yield this.fetchWithTimeout(this.buildAdvancedRenderUrl(n,o));if(!t.ok)throw new Error(`Favorite list render failed: ${t.status}`);const e=this.extractAdvancedHtml(yield t.text()),r=this.createAdvancedTemplate(e);if(i!==this.loadMoreRequestSeq||n!==this.currentIds||o!==this.nextCursor)return;if(!this.appendAdvancedFragment(e,r))throw new Error("Favorite list render fragment did not include appendable items");const s=this.findNextCursor(r.content)||void 0;this.nextCursor=s&&s!==o?s:void 0}else{const t=yield this.fetchWithTimeout(this.buildProductsUrl(n,o));if(!t.ok)throw new Error(`Favorite list products failed: ${t.status}`);const e=yield t.json();if(i!==this.loadMoreRequestSeq||n!==this.currentIds||o!==this.nextCursor)return;this.renderProducts(e,{append:!0});const r=e.next_cursor||void 0;this.nextCursor=r&&r!==o?r:void 0}this.appendedCursors.add(o)}catch(t){if(t instanceof DOMException&&"AbortError"===t.name)return;console.error("StoreCRM: failed to load next favorite list page",t)}finally{e||i!==this.loadMoreRequestSeq||(this.loadingNextPage=!1,this.syncLoadMoreButton())}})}renderProducts(t,e={}){const o=document.querySelector(".storecrm_favoritelist tbody"),n=document.querySelector(".storecrm_favoritelist_loading"),i=document.querySelector(".storecrm_favoritelist table"),r=document.querySelector(".storecrm_favoritelist_non_item");if(!(o&&n&&i&&o instanceof HTMLElement&&n instanceof HTMLElement&&i instanceof HTMLElement))return;const s="variant"===this.mode?t.variants:t.products;if(s&&0!==s.length){if(!e.append)for(;o.firstChild;)o.removeChild(o.firstChild);s.forEach(t=>o.appendChild(this.createFavoriteRow(o,t))),n.style.display="none",i.style.display="standard"===this.config.layout_preset?"table":"block",r&&(r.style.display="none")}else e.append||(i.style.display="none",n.style.display="none",r&&(r.style.display="block"))}createFavoriteRow(t,e){const o=document.createElement("tr");o.classList.add(`storecrm_favoritelist_id-${e.variant_id||e.product_id}`);const n=(0,i.getLocalePathPrefix)(),s=e.url||("product"===this.mode?`${n}/products/${e.handle}`:`${n}/products/${e.handle}?variant=${e.variant_id}`),a=document.createElement("td");a.classList.add("storecrm_favoritelist_lefttd");const l=document.createElement("div");l.classList.add("storecrm_favoritelist_item");const c=document.createElement("a");if(c.classList.add("storecrm_favoritelist_media","storecrm_favoritelist_image_link"),c.href=s,c.setAttribute("aria-label",e.title),e.thumbnail_url){const t=document.createElement("img");t.classList.add("storecrm_favoritelist_img"),t.src=e.thumbnail_url,t.alt=e.title,c.appendChild(t)}else{const t=document.createElement("span");t.classList.add("storecrm_favoritelist_image_placeholder"),t.textContent=this.getListCopy().noImage,c.appendChild(t)}l.appendChild(c);const d=document.createElement("div");d.classList.add("storecrm_favoritelist_product_info");const u=document.createElement("a");if(u.classList.add("storecrm_favoritelist_title"),u.href=s,u.textContent=e.title,d.appendChild(u),!1!==this.config.show_stock_status){const t=document.createElement("span");t.classList.add("storecrm_favoritelist_status",e.available?"is-available":"is-unavailable"),t.textContent=e.available?this.getListCopy().available:this.getListCopy().unavailable,d.appendChild(t)}l.appendChild(d),a.appendChild(l);const h=document.createElement("td");h.classList.add("storecrm_favoritelist_righttd");const m=document.createElement("div");if(m.classList.add("storecrm_favoritelist_links"),this.config.show_cart&&e.available){const t=document.createElement("a");t.classList.add("storecrm_favoritelist_link"),t.innerHTML=(0,r.getCartIcon)(this.config.cart_icon);const o="product_link"===this.config.cart_icon?this.getListCopy().product:this.getListCopy().cart;t.setAttribute("aria-label",o);const n=document.createElement("span");n.classList.add("storecrm_favoritelist_action_label"),n.textContent=o,t.appendChild(n),"product_link"===this.config.cart_icon?t.href=s:(t.href="javascript:void(0);",t.onclick=()=>(0,i.cartFavorite)(this.mode,"product"==this.mode?e.variant_id||e.product_id:e.variant_id||"",e.handle,this.config.insert_cart_directly,e.variant_id)),m.appendChild(t)}const p=document.createElement("a");p.classList.add("storecrm_favoritelist_link"),p.href="javascript:void(0);",p.innerHTML=r.iconDelete,p.setAttribute("aria-label",this.getListCopy().remove);const g=document.createElement("span");return g.classList.add("storecrm_favoritelist_action_label"),g.textContent=this.getListCopy().remove,p.appendChild(g),"product"==this.mode||(p.dataset.variantId=e.variant_id),p.dataset.productId=e.product_id,p.onclick=()=>this.parent.toggleWishlist(p,!0,this.parent.config.favorite.is_only_member,this.parent.config.favorite.non_member_link),m.appendChild(p),h.appendChild(m),o.appendChild(a),o.appendChild(h),o}getListCopy(){return((0,i.getFavoriteListRequestedLocale)()||document.documentElement.lang||"ja").toLowerCase().startsWith("ja")?{available:"\u5728\u5eab\u3042\u308a",unavailable:"\u5728\u5eab\u5207\u308c",cart:"\u30ab\u30fc\u30c8\u306b\u8ffd\u52a0",product:"\u5546\u54c1\u3092\u898b\u308b",remove:"\u524a\u9664",noImage:"\u753b\u50cf\u306a\u3057"}:{available:"In stock",unavailable:"Out of stock",cart:"Add to cart",product:"View product",remove:"Remove",noImage:"No image"}}appendViewParams(t){t.set("sort",this.sort),"variant"===this.mode&&t.set("group_by_product",this.groupByProduct?"true":"false")}loadViewPreferences(){try{const t=JSON.parse(localStorage.getItem(l)||"{}");["newest","oldest","title_asc","title_desc"].includes(t.sort)&&(this.sort=t.sort),this.groupByProduct="variant"===this.mode&&!0===t.groupByProduct}catch(t){this.sort="newest",this.groupByProduct=!1}}saveViewPreferences(){localStorage.setItem(l,JSON.stringify({sort:this.sort,groupByProduct:this.groupByProduct}))}placeViewControls(t,e){const o=Array.from(t.children),n=o.find(t=>t.matches("#list_title, [data-storecrm-list-title], h1, h2"));if(n)return void n.insertAdjacentElement("afterend",e);const i=o.find(t=>t.matches("[data-storecrm-items], .storecrm_favoritelist_loading, .storecrm_favoritelist_non_item, table")||Boolean(t.querySelector("[data-storecrm-items]")));i?t.insertBefore(e,i):t.prepend(e)}ensureViewControls(t=this.getFavoriteListRoot()){const e=this.config.layout_preset||"standard",o="advanced"===this.favoriteListMode?!0===this.config.show_view_controls_advanced:!0===this.config[`show_view_controls_${e}`];if(document.querySelectorAll(".storecrm_favorite_list_controls").forEach(e=>{(!o||t&&!t.contains(e))&&e.remove()}),!o||!t||t.querySelector(".storecrm_favorite_list_controls"))return;this.ensureViewControlsStyle();const n=((0,i.getFavoriteListRequestedLocale)()||document.documentElement.lang||"ja").toLowerCase().startsWith("ja"),r=document.createElement("div");if(r.className="storecrm_favorite_list_controls","variant"===this.mode){const t=document.createElement("label");t.className="storecrm_favorite_list_group_control";const e=document.createElement("input");e.type="checkbox",e.checked=this.groupByProduct;const o=this.config.group_by_product_text||(n?"\u5546\u54c1\u3054\u3068\u306bSKU\u3092\u307e\u3068\u3081\u308b":"Group SKUs by product");e.setAttribute("aria-label",o),e.addEventListener("change",()=>{this.groupByProduct=e.checked,this.saveViewPreferences(),this.render()}),t.append(e,document.createTextNode(o)),r.appendChild(t)}const s=document.createElement("label");s.className="storecrm_favorite_list_sort_control",s.append(document.createTextNode(`${this.config.sort_label||(n?"\u4e26\u3073\u9806":"Sort")} `));const a=document.createElement("select");[["newest",this.config.sort_newest_text||"\u767b\u9332\u304c\u65b0\u3057\u3044\u9806",this.config.sort_newest_text||"Newest favorites"],["oldest",this.config.sort_oldest_text||"\u767b\u9332\u304c\u53e4\u3044\u9806",this.config.sort_oldest_text||"Oldest favorites"],["title_asc",this.config.sort_title_asc_text||"\u5546\u54c1\u540d\u306e\u6607\u9806",this.config.sort_title_asc_text||"Product name A\u2013Z"],["title_desc",this.config.sort_title_desc_text||"\u5546\u54c1\u540d\u306e\u964d\u9806",this.config.sort_title_desc_text||"Product name Z\u2013A"]].forEach(([t,e,o])=>a.add(new Option(n?e:o,t))),a.value=this.sort,a.addEventListener("change",()=>{this.sort=a.value,this.saveViewPreferences(),this.render()}),s.appendChild(a),r.appendChild(s),this.placeViewControls(t,r)}ensureViewControlsStyle(){if(document.getElementById("storecrm-favorite-list-controls-style"))return;const t=document.createElement("style");t.id="storecrm-favorite-list-controls-style",t.textContent="\n .storecrm_favorite_list_controls { display: flex; width: 100%; box-sizing: border-box; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 12px 20px; margin: 0 0 20px; }\n .storecrm_favorite_list_group_control, .storecrm_favorite_list_sort_control { display: inline-flex; align-items: center; gap: 8px; font: inherit; }\n .storecrm_favorite_list_sort_control { margin-left: auto; }\n .storecrm_favorite_list_group_control input { width: 18px; height: 18px; margin: 0; }\n .storecrm_favorite_list_sort_control select { min-height: 40px; padding: 6px 32px 6px 10px; border: 1px solid #d1d5db; border-radius: 6px; background: #fff; color: inherit; font: inherit; }\n @media (max-width: 640px) { .storecrm_favorite_list_controls { align-items: stretch; } .storecrm_favorite_list_sort_control { justify-content: space-between; } }\n ",(document.head||document.documentElement).appendChild(t)}}e.Renderer=c,c.instance=void 0},446(t,e){"use strict";e.getCartIcon=e.b0=e.U2=e.S$=e.o6=e.iconDelete=void 0,e.iconDelete='',e.o6='',e.S$='',e.U2='',e.b0='';e.getCartIcon=t=>"cart_plus"===t?e.S$:"bag"===t?e.U2:"product_link"===t?e.b0:e.o6},349(t,e){"use strict";var o=this&&this.__awaiter||function(t,e,o,n){return new(o||(o=Promise))(function(i,r){function s(t){try{l(n.next(t))}catch(t){r(t)}}function a(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof o?e:new o(function(t){t(e)})).then(s,a)}l((n=n.apply(t,e||[])).next())})};function n(t){if("string"!=typeof t)return"";const e=t.trim();if(!e||"/"===e||"//"===e)return"";const o=/^[a-z]{2}(?:-[a-z]{2})?$/i.test(e)?`/${e}/`:e;if(!o.startsWith("/"))return"";const n=("/"+o).replace(/\/{2,}/g,"/").replace(/\/$/,"").toLowerCase();return"/"===n?"":n}function i(t){const e=window.location.pathname.toLowerCase();return e===t||e.startsWith(`${t}/`)}function r(){var t,e,o,r,s,a,l,c;const d=n((null===(e=null===(t=null===window||void 0===window?void 0:window.Shopify)||void 0===t?void 0:t.routes)||void 0===e?void 0:e.root)||(null===(r=null===(o=null===window||void 0===window?void 0:window.Shopify)||void 0===o?void 0:o.localization)||void 0===r?void 0:r.root));if(d)return i(d)?d:"";const u=n((null===(l=null===(a=null===(s=null===window||void 0===window?void 0:window.Shopify)||void 0===s?void 0:s.localization)||void 0===a?void 0:a.language)||void 0===l?void 0:l.isoCode)||(null===(c=null===window||void 0===window?void 0:window.Shopify)||void 0===c?void 0:c.locale));return u&&i(u)?u:""}function s(t){return o(this,arguments,void 0,function*(t,e=""){try{const o=yield fetch(`${e||""}/cart/add.js`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:t,quantity:1})});if(!o.ok)throw new Error(`Failed to add to cart: ${o.statusText}`);window.location.href=`${e}/cart`}catch(t){console.error("StoreCRM: \u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f:",t),alert("\u30ab\u30fc\u30c8\u306b\u8ffd\u52a0\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002")}})}Object.defineProperty(e,"__esModule",{value:!0}),e.getLocalePathPrefix=r,e.getFavoriteListRequestedLocale=function(){var t,e,o,n;return r()?String((null===(o=null===(e=null===(t=null===window||void 0===window?void 0:window.Shopify)||void 0===t?void 0:t.localization)||void 0===e?void 0:e.language)||void 0===o?void 0:o.isoCode)||(null===(n=null===window||void 0===window?void 0:window.Shopify)||void 0===n?void 0:n.locale)||""):""},e.cartFavorite=function(t,e,o,n,i){const a=r(),l=i||("variant"===t?e:"");if(l&&("variant"===t||n))return void s(l,a);const c="variant"===t?`${a}/products/${encodeURIComponent(o)}?variant=${e}`:`${a}/products/${encodeURIComponent(o)}`;window.location.href=c},e.addToCart=s},222(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});class o{constructor(t){this.loginButtonImg="/buttons/images/line_login_btn.png",this.parent=t}static isLoginOrRegisterPage(){const t=window.location.pathname,e=o.isLoginPath(t),n=o.isRegisterPath(t);if(e||n)return!0;const i=o.isLoginPage(),r=o.isRegisterPage();return!(!i&&!r)}static isLineLoginEnabled(){return window.storecrm_config.line&&window.storecrm_config.line.line_login_enable?!(window.storecrm_config.line.line_login_onlypreview&&!(window.Shopify&&window.Shopify.designMode||document.querySelector("#OnlineStorePreviewBarNextData")))||(console.info("StoreCRM: line_login_onlypreview is set, but not in Shopify designMode. LINE login will not be initialized."),!1):(console.info("StoreCRM: line_login_enable is not set or false. LINE login will not be initialized."),!1)}init(){if(o.isLineLoginEnabled())try{const t=document.querySelectorAll(`.${o.CUSTOM_CONTAINER_CLASS}`);if(t.length>0)return void t.forEach(t=>{const e=this.createLineButton(!0);t.appendChild(e)});o.isLoginPage()&&this.addLoginButton(),o.isRegisterPage()&&this.addRegisterButton(),this.clearSessionStorage()}catch(t){console.error("Error in init:",t)}}clearSessionStorage(){location.pathname.includes("/register")||(sessionStorage.removeItem("line_email"),sessionStorage.removeItem("line_lineId"))}static isLoginPage(){try{return!!document.querySelector('form[action*="login"], form[action*="sign_in"]')}catch(t){return console.error("Error in isLoginPage:",t),!1}}static isRegisterPage(){try{return!!document.querySelector('form[action^="/account"]')}catch(t){return console.error("Error in isRegisterPage:",t),!1}}addLoginButton(){var t;const e=document.querySelector('form[action*="/account/login"]');if(!e)return;let o=e.querySelector('button[type="submit"]');if(o||(o=e.querySelector("button")),!o){const t=document.createElement("div");t.className="line-login-container",t.style.marginTop="20px",t.style.textAlign="center";const o=this.createLineButton(!0);return t.appendChild(o),void e.appendChild(t)}const n=document.createElement("div");n.className="line-login-container",n.style.marginTop="20px",n.style.textAlign="center";const i=this.createLineButton(!0);n.appendChild(i),null===(t=o.parentNode)||void 0===t||t.insertBefore(n,o.nextSibling)}addRegisterButton(){var t;const e=document.querySelector('form[action^="/account"]');if(!e)return;const o=new URLSearchParams(window.location.search);let n=o.get("email"),i=o.get("line_id");if(n?sessionStorage.setItem("line_email",n):n=sessionStorage.getItem("line_email"),i?sessionStorage.setItem("line_lineId",i):i=sessionStorage.getItem("line_lineId"),n&&n.includes("@")){const t=e.querySelector('input[name="customer[email]"]');t&&(t.value=n)}if(i){let t=e.querySelector('input[name="customer[note][lineId]"]');t||(t=document.createElement("input"),t.type="hidden",t.name="customer[note][lineId]",e.appendChild(t)),t.value=i}if(i||n)try{const t=e,o=new URL(t.action,window.location.origin);i?o.searchParams.set("line_id",i):o.searchParams.delete("line_id"),n?o.searchParams.set("email",n):o.searchParams.delete("email"),t.action=o.pathname+(o.search?o.search:"")}catch(t){console.error("Failed to update form action with line_id/email:",t)}if(i){const t=document.createElement("div");return t.textContent="LINE\u30ed\u30b0\u30a4\u30f3\u3092\u884c\u3044\u307e\u3057\u305f\u3002\u9023\u643a\u3092\u884c\u3063\u3066\u4f1a\u54e1\u767b\u9332\u3092\u884c\u3046\u306b\u306f\u3001\u4ee5\u4e0b\u306e\u30d5\u30a9\u30fc\u30e0\u3088\u308a\u3054\u767b\u9332\u304f\u3060\u3055\u3044",t.style.color="#d32f2f",t.style.fontWeight="bold",t.style.fontSize="13px",t.style.marginBottom="20px",t.style.textAlign="center",void e.insertBefore(t,e.firstChild)}let r=e.querySelector('button[type="submit"]');if(r||(r=e.querySelector("button")),!r){const t=document.createElement("div");t.className="line-login-container",t.style.marginTop="20px",t.style.textAlign="center";const o=this.createLineButton(!1);return t.appendChild(o),void e.appendChild(t)}const s=document.createElement("div");s.className="line-login-container",s.style.marginTop="20px",s.style.textAlign="center";const a=this.createLineButton(!1);s.appendChild(a),null===(t=r.parentNode)||void 0===t||t.insertBefore(s,r.nextSibling)}createLineButton(t=!0){if(!document.getElementById("btn-line-login-style")){const t=document.createElement("style");t.id="btn-line-login-style",t.innerHTML=".btn-line-login::after { box-shadow: none !important; }",document.head.appendChild(t)}const e=document.createElement("button");e.type="button",e.className="btn-line-login",e.style.backgroundColor="#06C755",e.style.color="#FFFFFF",e.style.border="none",e.style.borderRadius="4px",e.style.padding="0 6px",e.style.cursor="pointer",e.style.display="flex",e.style.alignItems="center",e.style.justifyContent="center",e.style.width="auto",e.style.height="48px",e.style.marginBottom="10px",e.style.textAlign="center",e.style.fontWeight="bold",e.style.fontSize="16px",e.style.letterSpacing="0.03em",e.style.boxShadow="0 2px 4px 0 rgba(0,0,0,0.04)",e.style.transition="background 0.2s",e.style.position="relative",e.style.overflow="hidden",e.style.boxSizing="border-box",e.style.marginTop="12px",e.style.marginBottom="12px",e.style.paddingTop="0",e.style.paddingBottom="0",e.onmouseover=()=>{e.style.backgroundColor="#06C755",e.style.filter="brightness(0.95)"},e.onmouseout=()=>{e.style.backgroundColor="#06C755",e.style.filter="none"},e.onmousedown=()=>{e.style.backgroundColor="#06C755",e.style.filter="brightness(0.85)"},e.onmouseup=()=>{e.style.backgroundColor="#06C755",e.style.filter="brightness(0.95)"};const n=document.createElement("span");n.style.display="flex",n.style.alignItems="center",n.style.justifyContent="center",n.style.marginRight="12px",n.style.width="32px",n.style.height="32px",n.style.flexShrink="0",n.style.background="none";const i=document.createElement("img");i.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAsCAYAAAAehFoBAAACpUlEQVRYhe2XTYhNURzAf8cMZSQSRT4LSRaGfISNlLJ8WUiUUMrKRoqFlUyyQNnY2tnaaEI2vmZKeoo0YUE+UhYTEoN+FveOnjvn3ufNu++N9H6re+85//P/nf875577oEOHDh3+K0IzwWo3sAXYDqwDlgMLgClplxHgNfAMeADcBO6EEH40k3c8ovPUs+p7G+d9GjuvHaLT1DPqt3GIZhlJx5rWKtledagE0SxDam/ZstvUTy2QHeWTuq0s2c3qlxbKjvJF3VzPp/Atoc4GqsD8UmZfnzdAbwjhQ16HSXUG6KN9sqS5+oo65FZYXQy8ALpKlqrHT2BpCOFlrLG7IHAfY2WHgGFgY+b5C+AtsAl4BbwjOVBGeUJyiKwC7mdie4D1Nfddae5TBW5jUe9GNsbWtC1LJX1eVfen1xdq2teoS9RqJM/MyHh387yKKryqoRmO5RiwgaTqZiQrQCW9jR0cubmLNt2MBgWzTAV2AbEd/5VkaQ0DHxvJXVThZrkM7AT2kGyk34QQ+oF+SJYEcPBvBy2qcHSXNkAFOBpCuAE8rm1QD6frvQoMRGJf5Q1aVOFBYHFO24Ga66LqnFEHQwi39Y9lPECyLABmAuczcfcKxoyj7o7s3h2RfpfSvkF9qh5Su2ti3qpz1eXq40j8nEienXleRQfHFOA5sLDh2TbHc2Bl3kd+7hoOIYwAx1tlVcCRpv6RqFciP1mruNj0dNUe46de2VxXJzctnEpPV6+1UPaW2lOKbI30JPWE+rVk2auly2bEl5ms658lyJ5T2/P5qi5ST6qPxiH6Wd3dFtEc+VnqdvW4+qyO7EN1xYTJZlHX5Yh+V0+bHEj/DuraiOwDdfVEu0VR99aIDqtHbdfGGg8mn46fTd4Asyfap0OHDh3+cX4BcUOZ2CqT2BUAAAAASUVORK5CYII=",i.width=32,i.height=32,i.alt="LINE",i.style.display="block",i.style.width="32px",i.style.height="32px",n.appendChild(i);const r=document.createElement("span");r.textContent=t?o.BUTTON_TEXT:o.REGISTER_BUTTON_TEXT,r.style.display="inline-block",r.style.whiteSpace="nowrap",r.style.fontWeight="bold",r.style.fontSize="16px",r.style.lineHeight="1",r.style.letterSpacing="0.03em",r.style.userSelect="none",r.style.padding="0 32px",e.appendChild(n),e.appendChild(r);const s=document.createElement("div");s.className="line-login-container",s.style.display="flex",s.style.justifyContent="center",s.style.alignItems="center",s.style.width="100%",s.style.marginTop="20px",s.style.marginBottom="10px",s.appendChild(e),e.onclick=()=>{this.parent.doLineLogin({routeKey:"system_line_login_multipass"})};const a=new URLSearchParams(window.location.search).get("line_login_error"),l=document.createElement("div");if(l.style.display="flex",l.style.flexDirection="column",l.style.alignItems="center",l.style.width="100%",l.appendChild(s),a){const t=document.createElement("div");t.textContent=a,t.style.color="#d32f2f",t.style.fontWeight="bold",t.style.fontSize="13px",t.style.marginTop="0px",t.style.marginBottom="15px",t.style.textAlign="center",l.appendChild(t)}return l}static isLoginPath(t){return"/account/login"===t||/\blogin\b/i.test(t)}static isRegisterPath(t){return"/account/register"===t||(/\bregister\b/i.test(t)||/\bsignup\b/i.test(t))}}o.BUTTON_CLASS="line-login-button",o.CUSTOM_CONTAINER_CLASS="line-login-custom-container",o.instance=null,o.BUTTON_TEXT="LINE\u3067\u30ed\u30b0\u30a4\u30f3",o.REGISTER_BUTTON_TEXT="LINE\u3067\u767b\u9332",e.default=o},907(t,e,o){"use strict";var n=this&&this.__awaiter||function(t,e,o,n){return new(o||(o=Promise))(function(i,r){function s(t){try{l(n.next(t))}catch(t){r(t)}}function a(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof o?e:new o(function(t){t(e)})).then(s,a)}l((n=n.apply(t,e||[])).next())})},i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.schema=e.LineRestockPopupManager=void 0;const r=i(o(132)),s="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiPjxyZWN0IHdpZHRoPSIxMDAwIiBoZWlnaHQ9IjEwMDAiIGZpbGw9IiNjOWVkZmIiLz48cGF0aCBkPSJNMzA3IDY3NWM4LTc4IDM3LTExMyAxMDEtMTQzbDU3LTI3YzIyLTEwIDMyLTM0IDI3LTY4bC0xMi04MWMtMzEtMTAtNTMtMzgtNTMtNzIgMC0zMSAxNy01NSA0NC02NyAxMy04NyA3My0xMzAgMTQzLTEzMHMxMzAgNDMgMTQzIDEzMGMyNyAxMiA0NCAzNiA0NCA2NyAwIDM0LTIyIDYyLTUzIDcybC0xMiA4MWMtNSAzNCA1IDU4IDI3IDY4bDU3IDI3YzY0IDMwIDkzIDY1IDEwMSAxNDMgMiAyMy0xNSA0My0zOCA0NC0xNzcgOC0zNTUgOC01MzIgMC0yMy0xLTQwLTIxLTM4LTQ0eiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTExNCA5NikiIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2ZmZiIgc3Ryb2tlLXdpZHRoPSI1NiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+PC9zdmc+",a={"&":"&","<":"<",">":">",'"':""","'":"'"};function l(t){return String(null!=t?t:"").replace(/[&<>"']/g,t=>a[t])}class c{constructor(t,e=!1){this.preview=!1,this.inited=!1,this.container=null,this.title=null,this.content=null,this.footer=null,this.button=null,this.lineLoginButton=null,this.close=null,this.product_id=null,this.variants=[],this.line_profile=null,this.preview=e,this.config=t,this.init()}static getInstance(t,e=!1){return c.instance?(c.instance.config=t,c.instance.preview=e):c.instance=new c(t,e),c.instance}setParent(t){this.parent=t}renderTemplate(){document&&document.body?document.body.insertAdjacentHTML("beforeend",c.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",c.template),r.default.init(),this.updateElements(),this.container&&this.container.addEventListener("click",t=>{t.stopPropagation()}),this.close&&!this.preview&&this.close.addEventListener("click",t=>{r.default.close("storecrm-line-restock-modal")})}updateElements(){this.container=document.getElementById("storecrm-line-restock-modal"),this.title=document.getElementById("storecrm-line-restock-title"),this.content=document.getElementById("storecrm-line-restock-content"),this.footer=document.getElementById("storecrm-line-restock-footer"),this.close=document.getElementById("storecrm-line-restock-close")}consumeLineProfileFromURL(){try{const t=new URLSearchParams(window.location.search).get("line_profile_data");if(t){const e=atob(t),o=JSON.parse(e),n={display_name:o.displayName||"",picture_url:"string"==typeof o.pictureUrl?o.pictureUrl:null,line_customer_id:o.userId||""},i=new URL(window.location.href);return i.searchParams.delete("line_profile_data"),window.history.replaceState({},"",i.toString()),n}}catch(t){console.error("StoreCRM: Failed to parse line profile from URL",t)}}takeLineProfileFromSessionStorage(){try{const t=window.sessionStorage.getItem("storecrm_line_profile");if(t)return JSON.parse(t)}catch(t){console.error("StoreCRM: Failed to parse line profile from session storage",t)}finally{try{window.sessionStorage.removeItem("storecrm_line_profile")}catch(t){console.warn("StoreCRM: Failed to clear line profile from session storage",t)}}}clearStoredLineProfile(){this.line_profile=null;try{window.sessionStorage.removeItem("storecrm_line_profile")}catch(t){console.warn("StoreCRM: Failed to clear line profile from session storage",t)}}render(t,e,o,n={}){var i;this.preview&&this.updateElements();let r=!1;if(o||this.preview||((o=this.consumeLineProfileFromURL())?r=!0:o=this.takeLineProfileFromSessionStorage()),o&&!this.preview&&(null!=o.display_name&&null!=o.line_customer_id||(o=void 0,window.sessionStorage.removeItem("storecrm_line_profile"))),!this.title||!this.content||!this.footer)return;const a=document.createElement("button");a.className="storecrm_modal__btn storecrm_modal__btn-primary",a.innerHTML=t.button_text||"\u518d\u5165\u8377\u901a\u77e5\u3092\u6709\u52b9\u306b\u3059\u308b";const c=document.createElement("button");c.className="storecrm_modal__btn storecrm_modal__btn-primary storecrm_modal__btn-line-login",c.innerHTML="LINE\u9023\u643a\u3092\u884c\u3046",o||this.preview||(a.style.display="none",c.style.display="block"),o&&!this.preview&&(c.style.display="none",a.style.display="block"),0!==this.footer.children.length&&(this.footer.innerHTML=""),this.button=null,this.lineLoginButton=null,n.hideSubmitButton||(this.footer.appendChild(a),this.footer.appendChild(c),this.button=a,this.lineLoginButton=c),this.button&&!this.preview&&(this.button.addEventListener("click",()=>{this.handleEnableClick()}),null===(i=this.lineLoginButton)||void 0===i||i.addEventListener("click",()=>{this.handleLineSubscribeClick()})),this.config=t,this.title.innerText=t.title||"LINE\u518d\u5165\u8377\u901a\u77e5";const d=n.readOnly?' disabled aria-disabled="true"':"";let u=`\n
${t.description_text||"\u3053\u306e\u5546\u54c1\u306e\u518d\u5165\u8377\u3092LINE\u3067\u304a\u77e5\u3089\u305b\u3057\u307e\u3059"}
\n
\n `,h=n.variantId||null;if(location.search&&location.search.includes("variant")){const t=new URL(location.href);h=h||t.searchParams.get("variant")}const m=e.filter(t=>!t.available).map(t=>``).join("");if(e&&Array.isArray(e)&&e.length>1?(u=u.replace("\x3c!-- select_style --\x3e",""),u=u.replace("\x3c!-- options --\x3e",m)):(u=u.replace("\x3c!-- select_style --\x3e","display:none"),u=u.replace("\x3c!-- options --\x3e",m)),o||this.preview){this.line_profile=o||{display_name:"LINE\u9867\u5ba2\u540d",picture_url:s,line_customer_id:"preview-user"};u+=`\n
\n avatar\n
${l(this.line_profile.display_name)}
\n
`}var p;u+='
',this.content.innerHTML=u;const g=this.content.querySelector("#storecrm-line-restock-profile-image");if(g&&g.addEventListener("error",()=>{g.getAttribute("src")!==s&&(g.src=s)}),this.content.style.color=t.text_color||"#000000",this.container){const e=this.container.querySelector(".storecrm_modal__container");e&&(e.style.backgroundColor=t.background_color||"#ffffff",e.style.borderRadius=`${t.popup_radius||10}px`)}this.button&&(this.button.style.backgroundColor=t.button_background_color||"#222222",this.button.style.color=t.button_text_color||"#dddddd",this.button.style.borderRadius="4px"),this.lineLoginButton&&(this.lineLoginButton.style.backgroundColor="#06C755",this.lineLoginButton.style.color="#ffffff",this.lineLoginButton.style.borderRadius="4px"),this.close&&(this.close.style.color=t.close_text_color||"#000000"),this.resetMessage(),this.preview&&(this.success(t.success_text||"\u518d\u5165\u8377\u901a\u77e5\u304c\u767b\u9332\u3055\u308c\u307e\u3057\u305f\uff01"),this.failure(t.error_text||"\u518d\u5165\u8377\u901a\u77e5\u306e\u767b\u9332\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002"),this.container&&this.container.querySelectorAll(".storecrm_modal__overlay,.storecrm_modal__close").forEach(t=>{t.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation()})}))}handleEnableClick(){return n(this,void 0,void 0,function*(){var t,e,o;if(this.preview)return;this.resetMessage(),this.disableButton();const n=null===(t=this.content)||void 0===t?void 0:t.querySelector("#storecrm_restock_variant"),i=n?n.value:"";this.parent&&this.parent.storeLineRestock(this.product_id,i,null===(e=this.line_profile)||void 0===e?void 0:e.line_customer_id,null===(o=this.line_profile)||void 0===o?void 0:o.display_name,JSON.stringify(this.line_profile),this.success.bind(this),this.failure.bind(this))})}handleLineSubscribeClick(){return n(this,void 0,void 0,function*(){var t,e,o;if(this.preview)return;this.resetMessage(),this.disableButton();const n=null===(e=null===(t=this.content)||void 0===t?void 0:t.querySelector("#storecrm_restock_variant"))||void 0===e?void 0:e.value;try{if(null===(o=this.parent)||void 0===o?void 0:o.startLineRestockConnectFromPopup)return void(yield this.parent.startLineRestockConnectFromPopup(this.product_id,this.variants,{buttonId:this.button_id,variantId:n}));this.parent&&this.parent.lineSubscribe(function(t){alert(t)})}catch(t){this.enableButton(),alert(t)}})}resetMessage(){this.footer&&this.footer.querySelectorAll(".storecrm_modal_message").forEach(t=>t.remove())}disableButton(){this.button&&(this.button.setAttribute("disabled","disabled"),this.button.innerText="\u9001\u4fe1\u4e2d...")}enableButton(){this.button&&(this.button.removeAttribute("disabled"),this.button.innerText=this.config.button_text||"\u518d\u5165\u8377\u901a\u77e5\u3092\u6709\u52b9\u306b\u3059\u308b")}success(t){this.enableButton();const e=document.createElement("div");e.classList.add("storecrm_modal_success","storecrm_modal_message"),e.style.color=this.config.success_text_color||"#166534",e.style.backgroundColor=this.config.success_background_color||"#F0FDF4",e.style.padding="1rem",e.style.marginTop="1rem",e.style.borderRadius="4px",e.innerText=t,this.footer&&this.footer.appendChild(e)}failure(t){this.enableButton();const e=document.createElement("div");e.classList.add("storecrm_modal_error","storecrm_modal_message"),e.style.color=this.config.error_text_color||"#991B1B",e.style.backgroundColor=this.config.error_background_color||"#FEF2F2",e.style.padding="1rem",e.style.marginTop="1rem",e.style.borderRadius="4px",e.innerText=t,this.footer&&this.footer.appendChild(e)}show(t,e,o,n,i={}){this.product_id=o,this.button_id=i.buttonId,this.variants=Array.isArray(e)?e:[],this.inited?this.runShow(t,e,n,i):window.setTimeout(()=>this.show(t,e,o,n,i),100)}runShow(t,e,o,n={}){this.render(t,e,o,n);if(document.getElementById("storecrm-line-restock-modal"))try{r.default.show("storecrm-line-restock-modal",{disableFocus:!0})}catch(t){console.warn("StoreCRM: line restock popup show failed",t)}else console.warn("StoreCRM: line restock popup modal element not found, skip show")}hide(){if(document.getElementById("storecrm-line-restock-modal"))try{r.default.close("storecrm-line-restock-modal")}catch(t){console.warn("StoreCRM: line restock popup close failed",t)}}}e.LineRestockPopupManager=c,c.template='';let d=null;e.schema={preview:(t,e)=>{var o,n;return o=()=>{c.getInstance(t,!0).show(t,[],"1234567890",void 0)},n=300,clearTimeout(d),d=setTimeout(o,n),c.template},rows:[{type:"text",slug:"title",nameJa:"\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u306e\u30bf\u30a4\u30c8\u30eb",nameEn:"Popup title",defaultJa:"LINE\u518d\u5165\u8377\u901a\u77e5",defaultEn:"LINE Restock Notification"},{type:"text",slug:"description_text",nameJa:"\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u306e\u672c\u6587",nameEn:"Popup description",defaultJa:"\u3053\u306e\u5546\u54c1\u306e\u518d\u5165\u8377\u3092LINE\u3067\u304a\u77e5\u3089\u305b\u3057\u307e\u3059",defaultEn:"We will notify you via LINE when this product is restocked."},{type:"colorpicker",slug:"background_color",nameJa:"\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u306e\u80cc\u666f\u8272",nameEn:"Popup background color",default:"#ffffff"},{type:"colorpicker",slug:"text_color",nameJa:"\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u306e\u30c6\u30ad\u30b9\u30c8\u8272",nameEn:"Text color",default:"#000000"},{type:"colorpicker",slug:"close_text_color",nameJa:"\u9589\u3058\u308b\u30dc\u30bf\u30f3\u306e\u8272",nameEn:"Popup close button text color",default:"#000000"},{type:"colorpicker",slug:"button_background_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u80cc\u666f\u8272",nameEn:"Button background color",default:"#222222"},{type:"colorpicker",slug:"button_text_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u30c6\u30ad\u30b9\u30c8\u30ab\u30e9\u30fc",nameEn:"Button text color",default:"#dddddd"},{type:"text",slug:"button_text",nameJa:"\u30dc\u30bf\u30f3\u306e\u30c6\u30ad\u30b9\u30c8",nameEn:"Button text",defaultJa:"\u518d\u5165\u8377\u901a\u77e5\u3092\u6709\u52b9\u306b\u3059\u308b",defaultEn:"Enable restock notification"},{type:"text",slug:"success_text",nameJa:"\u6210\u529f\u6642\u306e\u30c6\u30ad\u30b9\u30c8",nameEn:"Success text",defaultJa:"\u518d\u5165\u8377\u901a\u77e5\u304c\u767b\u9332\u3055\u308c\u307e\u3057\u305f\uff01",defaultEn:"Restock notification registered!"},{type:"colorpicker",slug:"success_background_color",nameJa:"\u6210\u529f\u6642\u306e\u80cc\u666f\u8272",nameEn:"Success background color",default:"#F0FDF4"},{type:"colorpicker",slug:"success_text_color",nameJa:"\u6210\u529f\u6642\u306e\u6587\u5b57\u8272",nameEn:"Success text color",default:"#166534"},{type:"text",slug:"error_text",nameJa:"\u5931\u6557\u6642\u306e\u30c6\u30ad\u30b9\u30c8",nameEn:"Error text",defaultJa:"\u518d\u5165\u8377\u901a\u77e5\u306e\u767b\u9332\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002\u3057\u3070\u3089\u304f\u305f\u3063\u3066\u304b\u3089\u518d\u5ea6\u304a\u8a66\u3057\u304f\u3060\u3055\u3044\u3002",defaultEn:"Failed to register restock notification. Please try again later."},{type:"colorpicker",slug:"error_background_color",nameJa:"\u30a8\u30e9\u30fc\u6642\u306e\u80cc\u666f\u8272",nameEn:"Error background color",default:"#FEF2F2"},{type:"colorpicker",slug:"error_text_color",nameJa:"\u30a8\u30e9\u30fc\u6642\u306e\u6587\u5b57\u8272",nameEn:"Error text color",default:"#991B1B"},{type:"range",slug:"popup_radius",nameJa:"\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u306e\u4e38\u307f",nameEn:"Popup border radius",default:10,min:0,max:20,step:1}]}},738(t,e,o){"use strict";e.schema=e.render=e.generateDefaultSettings=e.LineRestockButton=void 0;const n=o(978);class i{constructor(t,e,o,n,i){this.eventTriggered=!1,this.variants=o,this.buttonSettings=n,this.productId=e,this.product=i}static getInstance(t,e=null,o=null,n=null,r=null){if(i.instances[t])n&&(i.instances[t].buttonSettings=n);else{if(!(e&&o&&n&&r))throw new Error("StoreCRM LineRestock: productId, variants, buttonSettings, product are required");i.instances[t]=new i(t,e,o,n,r)}return i.instances[t]}createScript(t,e){const o=t?"onclick=\"event.preventDefault();(function(){ const el=document.getElementById('storecrm-line-restock-modal'); if(el){ el.style.display='flex'; } })();\"":`onclick="event.preventDefault();window.storecrm ? window.storecrm.showLineRestockPopup('${e}') : alert('\u8aad\u8fbc\u4e2d\u3067\u3059\u3002\u3057\u3070\u3089\u304f\u305f\u3063\u3066\u304b\u3089\u518d\u5ea6\u304a\u8a66\u3057\u304f\u3060\u3055\u3044\u3002');"`;return`\n\n\n
\n\n
\n `}checkRender(t){document.querySelectorAll(`.storecrm-line-restock-${t}`).forEach(e=>{var o,n;if(e instanceof HTMLElement&&e.closest('[data-type="line-restock-button"]')){const i=new URL(location.href),r=(null===(o=this.variants.find(t=>t.available))||void 0===o?void 0:o.id)||this.variants[0].id||null,s=parseInt(i.searchParams.get("variant")||r,10);if(!s)return void console.error("StoreCRM Restock: variantId is not set",s);if(!this.product||!this.product.tags||this.product.tags.indexOf("storecrm-restock-hidden")>=0)return void(e.style.display="none");const a=window.Shopify&&window.Shopify.designMode||this.variants.find(t=>!t.available&&t.id===s);e.style.display=a?"inline-block":"none";const l=new URLSearchParams(window.location.search),c=l.get("line_login_error");if(c)return console.error("LINE\u30ed\u30b0\u30a4\u30f3\u95a2\u9023\u306e\u30a8\u30e9\u30fc:",c),void this.removeLineConnectResultParamsFromUrl(!0);if(l.get("line_connect"))return this.hasPendingLineRestockIntent()?void this.removeLineConnectResultParamsFromUrl():(this.removeLineConnectResultParamsFromUrl(),void(null===(n=window.storecrm)||void 0===n||n.showLineRestockPopup(t)))}})}removeLineConnectResultParamsFromUrl(t=!1){try{const e=new URL(window.location.href),o=e.toString();e.searchParams.delete("line_connect"),e.searchParams.delete("line_login_error"),t&&e.searchParams.delete("line_profile_data"),e.toString()!==o&&window.history.replaceState({},"",e.toString())}catch(t){console.warn("StoreCRM LineRestock: failed to clean LINE connect params",t)}}hasPendingLineRestockIntent(){try{const t=window.localStorage.getItem(i.PENDING_RESTOCK_INTENT_KEY);if(!t)return!1;const e=JSON.parse(t);return"line"===(null==e?void 0:e.channel)&&(!(!e.created_at||Date.now()-e.created_at>i.PENDING_RESTOCK_INTENT_TTL_MS)||(window.localStorage.removeItem(i.PENDING_RESTOCK_INTENT_KEY),!1))}catch(t){return window.localStorage.removeItem(i.PENDING_RESTOCK_INTENT_KEY),!1}}render(t,e=!1){if(e)return this.createScript(!0,t);if(this.eventTriggered)return;this.eventTriggered=!0;const o=window.navigation;if(o)o.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.LineRestockButton=i,i.instances={},i.PENDING_RESTOCK_INTENT_KEY="storecrm_pending_restock_intent",i.PENDING_RESTOCK_INTENT_TTL_MS=864e5;e.generateDefaultSettings=(t="ja")=>{const o={};return e.schema.rows.forEach(e=>{"text"===e.type?o[e.slug]="ja"===t?e.defaultJa:e.defaultEn:(e.type,o[e.slug]=e.default)}),o};e.render=({productId:t,variantId:e,variants:o,id:n,buttonSettings:r,isOutOfStock:s,product:a,preview:l=!1})=>i.getInstance(n,t,o,r,a).render(n,l);const r=t=>{const e=[`opacity: ${((t,e,o,n)=>{const i=Number(t);return Number.isFinite(i)?Math.min(n,Math.max(o,i)):e})(t.registered_button_opacity,.55,.3,1)}`,"cursor: not-allowed","pointer-events: none"];return t.registered_button_color&&e.push(`color: ${t.registered_button_color}`),t.registered_button_background_color&&e.push(`background-color: ${t.registered_button_background_color}`),t.registered_button_border_color&&e.push(`border-color: ${t.registered_button_border_color}`),e.join("; ")},s=(t,e,o)=>{const n=e.registered_button_text||("ja"===o?"LINE\u767b\u9332\u6e08\u307f":"LINE registered");return`\n
\n
${"ja"===o?"\u767b\u9332\u6e08\u307f\u8868\u793a":"Registered state"}
\n ${(t||"").replace(/]*)>[\s\S]*?<\/button>/,(t,o)=>{const i=String(o||"").replace(/\sonclick="[^"]*"/g,"");return`${s=n,String(null!=s?s:"").replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}`;var s})}\n
`};e.schema={preview:(t,o)=>((t,e,o,n)=>`\n
\n
\n
${"ja"===n?"\u901a\u5e38\u8868\u793a":"Default state"}
\n ${t||""}\n
\n ${s(e,o,n)}\n
`)((0,e.render)({productId:"TEMP_productId",id:"TEMP_line_restock",buttonSettings:t,isOutOfStock:!1,preview:!0,product:{tags:[]},variants:[]}),(0,e.render)({productId:"TEMP_productId",id:"TEMP_line_restock_registered",buttonSettings:t,isOutOfStock:!1,preview:!0,product:{tags:[]},variants:[]}),t,o),info:{textJa:"\u30ef\u30f3\u30b9\u30c6\u30c3\u30d7\u3067\u518d\u5165\u8377\u901a\u77e5\u3092LINE\u3067\u53d7\u3051\u53d6\u308c\u308b\u30dc\u30bf\u30f3\u3092\u8a2d\u7f6e\u3057\u307e\u3059\u3002",textEn:"Set up a button that allows customers to receive restock notifications via LINE in one step.",noteJa:'\u203b\u672c\u6a5f\u80fd\u3092\u6709\u52b9\u306b\u3059\u308b\u306b\u306fLINE\u9023\u643a\u8a2d\u5b9a\u304c\u5b8c\u4e86\u3057\u3066\u3044\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002',noteEn:'\u203bLINE integration settings must be completed to enable this feature.'},rows:[{type:"text",slug:"button_text",nameJa:"\u30dc\u30bf\u30f3\u306e\u30c6\u30ad\u30b9\u30c8",nameEn:"Button text",defaultJa:"LINE\u3067\u518d\u5165\u8377\u901a\u77e5\u3092\u53d7\u3051\u53d6\u308b",defaultEn:"Get LINE restock notifications"},{type:"text",slug:"registered_button_text",nameJa:"\u767b\u9332\u6e08\u307f\u6642\u306e\u30dc\u30bf\u30f3\u30c6\u30ad\u30b9\u30c8",nameEn:"Registered button text",defaultJa:"LINE\u767b\u9332\u6e08\u307f",defaultEn:"LINE registered"},{type:"select",slug:"button_width_unit",nameJa:"\u30dc\u30bf\u30f3\u5e45\u306e\u6307\u5b9a\u65b9\u6cd5",nameEn:"Button width unit",default:"px",selectOptionsJa:[{value:"px",label:"\u56fa\u5b9a\u5e45\uff08px\uff09"},{value:"percent",label:"\u30b3\u30f3\u30c6\u30ca\u306b\u5bfe\u3059\u308b\u5272\u5408\uff08%\uff09"}],selectOptionsEn:[{value:"px",label:"Fixed width (px)"},{value:"percent",label:"Percentage of container (%)"}]},{type:"range",slug:"button_width",nameJa:"\u30dc\u30bf\u30f3\u306e\u5e45\uff08px\uff09",nameEn:"Button width (px)",default:240,min:50,max:600,step:10,checkVisible:t=>"percent"!==t.button_width_unit},{type:"range",slug:"button_width_percent",nameJa:"\u30dc\u30bf\u30f3\u306e\u5e45\uff08%\uff09",nameEn:"Button width (%)",default:100,min:1,max:100,step:1,checkVisible:t=>"percent"===t.button_width_unit},{type:"range",slug:"button_height",nameJa:"\u30dc\u30bf\u30f3\u306e\u9ad8\u3055",nameEn:"Button height",default:50,min:30,max:100,step:5},{type:"colorpicker",slug:"button_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u6587\u5b57\u8272",nameEn:"Button text color",default:"#000000"},{type:"colorpicker",slug:"button_background_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u80cc\u666f\u8272",nameEn:"Button background color",default:"#ffffff"},{type:"colorpicker",slug:"button_border_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u7dda\u306e\u8272",nameEn:"Button border color",default:"#000000"},{type:"colorpicker",slug:"registered_button_color",nameJa:"\u767b\u9332\u6e08\u307f\u6642\u306e\u6587\u5b57\u8272",nameEn:"Registered text color",default:"#047857"},{type:"colorpicker",slug:"registered_button_background_color",nameJa:"\u767b\u9332\u6e08\u307f\u6642\u306e\u80cc\u666f\u8272",nameEn:"Registered background color",default:"#ecfdf5"},{type:"colorpicker",slug:"registered_button_border_color",nameJa:"\u767b\u9332\u6e08\u307f\u6642\u306e\u67a0\u7dda\u8272",nameEn:"Registered border color",default:"#a7f3d0"},{type:"colorpicker",slug:"button_hover_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u6587\u5b57\u8272(\u30db\u30d0\u30fc\u6642)",nameEn:"Button text color (hover)",default:"#222222"},{type:"colorpicker",slug:"button_hover_background_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u80cc\u666f\u8272(\u30db\u30d0\u30fc\u6642)",nameEn:"Button background color (hover)",default:"#dddddd"},{type:"colorpicker",slug:"button_hover_border_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u7dda\u306e\u8272(\u30db\u30d0\u30fc\u6642)",nameEn:"Button border color (hover)",default:"#222222"},{type:"range",slug:"button_radius",nameJa:"\u30dc\u30bf\u30f3\u306e\u4e38\u307f",nameEn:"Button corner radius",default:0,min:0,max:20,step:1},{type:"range",slug:"button_border_width",nameJa:"\u30dc\u30bf\u30f3\u306e\u7dda\u306e\u592a\u3055",nameEn:"Button border width",default:0,min:0,max:5,step:1},{type:"fontpicker",slug:"button_font",nameJa:"\u30dc\u30bf\u30f3\u306e\u30d5\u30a9\u30f3\u30c8",nameEn:"Button font",default:"helvetica_n4"},{type:"range",slug:"button_fontsize",nameJa:"\u30dc\u30bf\u30f3\u306e\u30d5\u30a9\u30f3\u30c8\u30b5\u30a4\u30ba",nameEn:"Button font size",default:16,min:10,max:30,step:1},{type:"range",slug:"button_fontweight",nameJa:"\u30dc\u30bf\u30f3\u306e\u30d5\u30a9\u30f3\u30c8\u30a6\u30a7\u30a4\u30c8",nameEn:"Button font weight",default:400,min:100,max:900,step:100},{type:"range",slug:"button_speed",nameJa:"\u30dc\u30bf\u30f3\u306e\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u901f\u5ea6",nameEn:"Button animation speed",default:.3,min:0,max:1,step:.1},{type:"range",slug:"registered_button_opacity",nameJa:"\u767b\u9332\u6e08\u307f\u6642\u306e\u900f\u660e\u5ea6",nameEn:"Registered opacity",default:.55,min:.3,max:1,step:.05},{type:"select",slug:"align",nameJa:"\u30dc\u30bf\u30f3\u306e\u914d\u7f6e",nameEn:"Button alignment",default:"center",defaultJa:"\u4e2d\u592e\u5bc4\u305b",defaultEn:"Center",selectOptionsJa:[{value:"left",label:"\u5de6\u5bc4\u305b"},{value:"center",label:"\u4e2d\u592e\u5bc4\u305b"},{value:"right",label:"\u53f3\u5bc4\u305b"}],selectOptionsEn:[{value:"left",label:"Align left"},{value:"center",label:"Align center"},{value:"right",label:"Align right"}]}]}},216(t,e){"use strict";e.schema=void 0;const o=t=>String(null!=t?t:"").replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),n=t=>"string"==typeof t&&""!==t.trim()&&"undefined"!==t,i=(t,e,o)=>n(null==t?void 0:t[e])?t[e]:o,r=(t,e,o)=>{const i=null==t?void 0:t[e];return n(i)&&/^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i.test(i)?i:o},s=(t,e,o,n,i)=>{const r=null==t?void 0:t[e],s="number"==typeof r?r:Number.parseFloat(r);return Number.isFinite(s)?Math.min(i,Math.max(n,s)):o};e.schema={preview:(t,e)=>{const n="ja"===e?{title:"\u30ed\u30b0\u30a4\u30f3\u304c\u5fc5\u8981\u3067\u3059",description:"\u518d\u5165\u8377\u901a\u77e5\u3092\u53d7\u3051\u53d6\u308b\u306b\u306f\u30ed\u30b0\u30a4\u30f3\u304c\u5fc5\u8981\u3067\u3059\u3002",login:"\u30ed\u30b0\u30a4\u30f3",cancel:"\u30ad\u30e3\u30f3\u30bb\u30eb"}:{title:"Login required",description:"Please log in to receive restock notifications.",login:"Login",cancel:"Cancel"},a=o(i(t,"login_required_modal_title",n.title)),l=o(i(t,"login_required_modal_description",n.description)),c=o(i(t,"login_required_modal_login_button_text",n.login)),d=o(i(t,"login_required_modal_cancel_button_text",n.cancel)),u=r(t,"login_required_modal_background_color","#ffffff"),h=r(t,"login_required_modal_text_color","#111111"),m=r(t,"login_required_modal_overlay_color","#000000"),p=s(t,"login_required_modal_overlay_opacity",55,0,90),g=s(t,"login_required_modal_radius",2,0,24),f=s(t,"login_required_modal_width",576,320,720),_=r(t,"login_required_modal_login_button_background_color","#000000"),v=r(t,"login_required_modal_login_button_text_color","#ffffff"),b=r(t,"login_required_modal_cancel_button_background_color","#ffffff"),y=r(t,"login_required_modal_cancel_button_text_color","#111111"),w=r(t,"login_required_modal_cancel_button_border_color","#111111"),k=s(t,"login_required_modal_button_radius",32,0,40);return`\n \n \n `},rows:[{type:"checkbox",slug:"require_login_for_restock",nameJa:"\u518d\u5165\u8377\u901a\u77e5\u306e\u5229\u7528\u3092\u4f1a\u54e1\u9650\u5b9a\u306b\u3059\u308b",nameEn:"Require sign-in for restock notifications",descriptionJa:"ON\u306b\u3059\u308b\u3068\u3001\u672a\u30ed\u30b0\u30a4\u30f3\u30e6\u30fc\u30b6\u30fc\u306f\u30e1\u30fc\u30eb\u5165\u529b\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u3067\u306f\u306a\u304f\u30ed\u30b0\u30a4\u30f3\u6848\u5185\u306b\u9032\u307f\u307e\u3059\u3002OFF\u306e\u5834\u5408\u306f\u5f93\u6765\u3069\u304a\u308a\u30b2\u30b9\u30c8\u306e\u30e1\u30fc\u30eb\u5165\u529b\u3067\u767b\u9332\u3067\u304d\u307e\u3059\u3002",descriptionEn:"When enabled, guests see the login prompt instead of the email input popup. When disabled, the existing guest email flow remains unchanged.",default:!1,fullsize:!0},{type:"checkbox",slug:"auto_register_after_login",nameJa:"\u30ed\u30b0\u30a4\u30f3\u5f8c\u306b\u518d\u5165\u8377\u901a\u77e5\u3092\u81ea\u52d5\u767b\u9332\u3059\u308b",nameEn:"Automatically register restock notification after sign-in",descriptionJa:"\u30ed\u30b0\u30a4\u30f3\u5fc5\u9808\u304cON\u306e\u3068\u304d\u3060\u3051\u6709\u52b9\u3067\u3059\u3002\u30ed\u30b0\u30a4\u30f3\u307e\u305f\u306f\u4f1a\u54e1\u767b\u9332\u5f8c\u306b\u5546\u54c1\u30da\u30fc\u30b8\u3078\u623b\u3063\u305f\u969b\u3001\u9867\u5ba2\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3067\u30e1\u30fc\u30eb\u518d\u5165\u8377\u901a\u77e5\u3092\u81ea\u52d5\u767b\u9332\u3057\u307e\u3059\u3002\u30e1\u30fc\u30eb\u304c\u53d6\u5f97\u3067\u304d\u306a\u3044\u5834\u5408\u306f\u81ea\u52d5\u767b\u9332\u305b\u305a\u3001\u518d\u64cd\u4f5c\u304c\u5fc5\u8981\u306a\u72b6\u614b\u306b\u3057\u307e\u3059\u3002",descriptionEn:"Only applies when sign-in is required. After sign-in or account creation, the customer returns to the product page and email restock is registered with their customer email. If email is unavailable, automatic registration is skipped and the customer must retry manually.",default:!1,depends:"require_login_for_restock",fullsize:!0},{type:"checkbox",slug:"one_click_when_logged_in",nameJa:"\u30ed\u30b0\u30a4\u30f3\u6e08\u307f\u9867\u5ba2\u306f\u30ef\u30f3\u30af\u30ea\u30c3\u30af\u3067\u518d\u5165\u8377\u901a\u77e5\u3092\u767b\u9332\u3059\u308b",nameEn:"Let signed-in customers register restock notifications in one click",descriptionJa:"\u30ed\u30b0\u30a4\u30f3\u6e08\u307f\u9867\u5ba2\u304c\u30e1\u30fc\u30eb\u307e\u305f\u306fLINE\u306e\u518d\u5165\u8377\u901a\u77e5\u30dc\u30bf\u30f3\u3092\u62bc\u3057\u305f\u3068\u304d\u3001\u5165\u529b\u64cd\u4f5c\u3092\u7701\u7565\u3057\u3066\u767b\u9332\u3057\u307e\u3059\u3002\u767b\u9332\u7d50\u679c\u306f\u65e2\u5b58\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u3092\u8aad\u307f\u53d6\u308a\u5c02\u7528\u306e\u5b8c\u4e86\u8868\u793a\u3068\u3057\u3066\u4f7f\u3044\u307e\u3059\u3002",descriptionEn:"When a signed-in customer clicks the email or LINE restock button, registration runs without asking for input. The existing popup is reused as a read-only completion view.",default:!1,fullsize:!0},{type:"checkbox",slug:"show_registered_status_when_logged_in",nameJa:"\u30ed\u30b0\u30a4\u30f3\u6e08\u307f\u9867\u5ba2\u306b\u518d\u5165\u8377\u901a\u77e5\u306e\u767b\u9332\u6e08\u307f\u8868\u793a\u3092\u51fa\u3059",nameEn:"Show registered state to signed-in customers",descriptionJa:"\u30ed\u30b0\u30a4\u30f3\u6e08\u307f\u9867\u5ba2\u3060\u3051\u304c\u5bfe\u8c61\u3067\u3059\u3002active\u306a\u30e1\u30fc\u30eb\u307e\u305f\u306fLINE\u518d\u5165\u8377\u901a\u77e5\u304c\u3042\u308b\u5834\u5408\u3001\u5546\u54c1\u8a73\u7d30\u30da\u30fc\u30b8\u306e\u30dc\u30bf\u30f3\u3092\u767b\u9332\u6e08\u307f\u8868\u793a\u306b\u5207\u308a\u66ff\u3048\u307e\u3059\u3002\u5546\u54c1\u8868\u793a\u6642\u3068\u30d0\u30ea\u30a8\u30fc\u30b7\u30e7\u30f3\u5207\u308a\u66ff\u3048\u6642\u306b\u72b6\u614b\u78ba\u8a8dAPI\u3092\u4f7f\u3044\u307e\u3059\u3002",descriptionEn:"Only applies to signed-in customers. When an active email or LINE restock notification exists, the product page button switches to its registered state. This uses the status API on page load and variant changes.",default:!1,fullsize:!0},{type:"text",slug:"guest_redirect_url",nameJa:"\u30b2\u30b9\u30c8\u304c\u518d\u5165\u8377\u901a\u77e5\u3092\u62bc\u3057\u305f\u5834\u5408\u306e\u9077\u79fb\u5148URL\u3000\u203b\u7a7a\u6b04\u306e\u5834\u5408\u30ed\u30b0\u30a4\u30f3\u753b\u9762\u306b\u9077\u79fb\u3057\u307e\u3059",nameEn:"URL to redirect to when a guest clicks the restock notification button. If left blank, the login screen will be displayed.",descriptionJa:"\u672a\u6307\u5b9a\u306e\u5834\u5408\u306f\u30b9\u30c8\u30a2\u306e\u30ed\u30b0\u30a4\u30f3URL\u3001\u53d6\u5f97\u3067\u304d\u306a\u3044\u5834\u5408\u306f /account/login \u306b\u9077\u79fb\u3057\u307e\u3059\u3002\u5546\u54c1\u30da\u30fc\u30b8\u3078\u623b\u308b\u305f\u3081\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u306f\u81ea\u52d5\u3067\u4ed8\u4e0e\u3057\u307e\u3059\u3002",descriptionEn:"If blank, the storefront login URL is used, falling back to /account/login. The return parameter for the product page is added automatically.",defaultJa:"",defaultEn:"",depends:"require_login_for_restock",fullsize:!0},{type:"text",slug:"login_required_modal_title",nameJa:"\u30ed\u30b0\u30a4\u30f3\u5fc5\u9808\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u306e\u30bf\u30a4\u30c8\u30eb",nameEn:"Login required popup title",defaultJa:"\u30ed\u30b0\u30a4\u30f3\u304c\u5fc5\u8981\u3067\u3059",defaultEn:"Login required",depends:"require_login_for_restock",showWithPreview:!0},{type:"text",slug:"login_required_modal_description",nameJa:"\u30ed\u30b0\u30a4\u30f3\u5fc5\u9808\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u306e\u672c\u6587",nameEn:"Login required popup description",defaultJa:"\u518d\u5165\u8377\u901a\u77e5\u3092\u53d7\u3051\u53d6\u308b\u306b\u306f\u30ed\u30b0\u30a4\u30f3\u304c\u5fc5\u8981\u3067\u3059\u3002",defaultEn:"Please log in to receive restock notifications.",depends:"require_login_for_restock",showWithPreview:!0},{type:"text",slug:"login_required_modal_login_button_text",nameJa:"\u30ed\u30b0\u30a4\u30f3\u30dc\u30bf\u30f3\u306e\u30c6\u30ad\u30b9\u30c8",nameEn:"Login button text",defaultJa:"\u30ed\u30b0\u30a4\u30f3",defaultEn:"Login",depends:"require_login_for_restock",showWithPreview:!0},{type:"text",slug:"login_required_modal_cancel_button_text",nameJa:"\u30ad\u30e3\u30f3\u30bb\u30eb\u30dc\u30bf\u30f3\u306e\u30c6\u30ad\u30b9\u30c8",nameEn:"Cancel button text",defaultJa:"\u30ad\u30e3\u30f3\u30bb\u30eb",defaultEn:"Cancel",depends:"require_login_for_restock",showWithPreview:!0},{type:"colorpicker",slug:"login_required_modal_background_color",nameJa:"\u30ed\u30b0\u30a4\u30f3\u5fc5\u9808\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u306e\u80cc\u666f\u8272",nameEn:"Login required popup background color",default:"#ffffff",depends:"require_login_for_restock",showWithPreview:!0},{type:"colorpicker",slug:"login_required_modal_text_color",nameJa:"\u30ed\u30b0\u30a4\u30f3\u5fc5\u9808\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u306e\u6587\u5b57\u8272",nameEn:"Login required popup text color",default:"#111111",depends:"require_login_for_restock",showWithPreview:!0},{type:"colorpicker",slug:"login_required_modal_overlay_color",nameJa:"\u30ed\u30b0\u30a4\u30f3\u5fc5\u9808\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u306e\u80cc\u666f\u30aa\u30fc\u30d0\u30fc\u30ec\u30a4\u8272",nameEn:"Login required popup overlay color",default:"#000000",depends:"require_login_for_restock",showWithPreview:!0},{type:"range",slug:"login_required_modal_overlay_opacity",nameJa:"\u30ed\u30b0\u30a4\u30f3\u5fc5\u9808\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u306e\u80cc\u666f\u30aa\u30fc\u30d0\u30fc\u30ec\u30a4\u6fc3\u5ea6",nameEn:"Login required popup overlay opacity",default:55,min:0,max:90,step:5,depends:"require_login_for_restock",showWithPreview:!0},{type:"range",slug:"login_required_modal_radius",nameJa:"\u30ed\u30b0\u30a4\u30f3\u5fc5\u9808\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u306e\u89d2\u4e38",nameEn:"Login required popup border radius",default:2,min:0,max:24,step:1,depends:"require_login_for_restock",showWithPreview:!0},{type:"range",slug:"login_required_modal_width",nameJa:"\u30ed\u30b0\u30a4\u30f3\u5fc5\u9808\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u306e\u5e45",nameEn:"Login required popup width",default:576,min:320,max:720,step:8,depends:"require_login_for_restock",showWithPreview:!0},{type:"colorpicker",slug:"login_required_modal_login_button_background_color",nameJa:"\u30ed\u30b0\u30a4\u30f3\u30dc\u30bf\u30f3\u306e\u80cc\u666f\u8272",nameEn:"Login button background color",default:"#000000",depends:"require_login_for_restock",showWithPreview:!0},{type:"colorpicker",slug:"login_required_modal_login_button_text_color",nameJa:"\u30ed\u30b0\u30a4\u30f3\u30dc\u30bf\u30f3\u306e\u6587\u5b57\u8272",nameEn:"Login button text color",default:"#ffffff",depends:"require_login_for_restock",showWithPreview:!0},{type:"colorpicker",slug:"login_required_modal_cancel_button_background_color",nameJa:"\u30ad\u30e3\u30f3\u30bb\u30eb\u30dc\u30bf\u30f3\u306e\u80cc\u666f\u8272",nameEn:"Cancel button background color",default:"#ffffff",depends:"require_login_for_restock",showWithPreview:!0},{type:"colorpicker",slug:"login_required_modal_cancel_button_text_color",nameJa:"\u30ad\u30e3\u30f3\u30bb\u30eb\u30dc\u30bf\u30f3\u306e\u6587\u5b57\u8272",nameEn:"Cancel button text color",default:"#111111",depends:"require_login_for_restock",showWithPreview:!0},{type:"colorpicker",slug:"login_required_modal_cancel_button_border_color",nameJa:"\u30ad\u30e3\u30f3\u30bb\u30eb\u30dc\u30bf\u30f3\u306e\u67a0\u7dda\u8272",nameEn:"Cancel button border color",default:"#111111",depends:"require_login_for_restock",showWithPreview:!0},{type:"range",slug:"login_required_modal_button_radius",nameJa:"\u30ed\u30b0\u30a4\u30f3\u5fc5\u9808\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u306e\u30dc\u30bf\u30f3\u89d2\u4e38",nameEn:"Login required popup button border radius",default:32,min:0,max:40,step:1,depends:"require_login_for_restock",showWithPreview:!0},{type:"card",slug:"allowFavorite",nameJa:"\u9867\u5ba2\u304c\u304a\u6c17\u306b\u5165\u308a\u3057\u305f\u5546\u54c1\u3082\u518d\u5165\u8377\u901a\u77e5\u3057\u307e\u3059\u304b\uff1f",nameEn:"Do you want to notify customers of restocked items that they have favorited?",default:"no",selectOptionsJa:[{value:"no",label:"\u304a\u6c17\u306b\u5165\u308a\u5546\u54c1\u306e\u518d\u5165\u8377\u901a\u77e5\u306f\u3057\u306a\u3044"},{value:"yes",label:"\u304a\u6c17\u306b\u5165\u308a\u5546\u54c1\u3082\u518d\u5165\u8377\u901a\u77e5\u3059\u308b"}],selectOptionsEn:[{value:"no",label:"Do not notify for favorited items"},{value:"yes",label:"Also notify for favorited items"}]},{type:"card",slug:"limitPolicy",nameJa:"\u9001\u4fe1\u5236\u9650\u65b9\u6cd5",nameEn:"Limit policy",default:"nolimit",descriptionJa:"\u518d\u5165\u8377\u901a\u77e5\u306e\u9001\u4fe1\u6570\u3001\u9001\u4fe1\u9593\u9694\u3092\u5236\u9650\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002",descriptionEn:"You can limit the number of restock notifications and the interval between them.",selectOptionsJa:[{value:"strict",label:"\u9001\u4fe1\u6570\u3092\u5236\u9650\u3059\u308b",description:"\u518d\u5165\u8377\u901a\u77e5\u306e\u9001\u4fe1\u6570\u3092\u6307\u5b9a\u306e\u6570\u91cf\uff08\u56fa\u5b9a\u5024\u304b\u5728\u5eab\u6570\u306b\u5bfe\u3059\u308b\u5272\u5408\u3092\u9078\u629e\u53ef\uff09\u3067\u5236\u9650\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002"},{value:"interval",label:"\u9001\u4fe1\u6570\u3001\u9001\u4fe1\u9593\u9694\u3092\u5236\u9650\u3059\u308b",description:"\u6307\u5b9a\u6570\u91cf(1\u9001\u4fe1\u6bce\u306e\u9001\u4ed8\u6570)\u3092\u6307\u5b9a\u9593\u9694\uff08\u65e5\u3001\u6642\u9593\u5358\u4f4d\uff09\u3067\u9001\u4fe1\u3057\u7d9a\u3051\u307e\u3059\u3002\u5728\u5eab\u304c\u8a2d\u5b9a\u3055\u308c\u305f\u5728\u5eab\u6570\u3092\u3057\u305f\u307e\u308f\u308b\u304b\u3001\u518d\u5165\u8377\u901a\u77e5\u767b\u9332\u8005\u5168\u54e1\u306b\u9001\u4fe1\u3057\u7d42\u308f\u308b\u3068\u51e6\u7406\u3092\u7d42\u4e86\u3057\u307e\u3059\u3002"},{value:"nolimit",label:"\u5236\u9650\u3057\u306a\u3044",description:"\u6570\u91cf\u3001\u9593\u9694\u3092\u6307\u5b9a\u305b\u305a\u3001\u518d\u5165\u8377\u901a\u77e5\u767b\u9332\u8005\u5168\u54e1\u306b\u9001\u4fe1\u3057\u307e\u3059\u30021\u5ea6\u306b\u9001\u4fe1\u3067\u304d\u308b\u91cf\u306f5000\u4ef6\u7a0b\u5ea6\u3067\u305d\u308c\u3092\u8d85\u3048\u308b\u767b\u9332\u6570\u306e\u5834\u5408\u8907\u6570\u56de\u306b\u5206\u3051\u3066\u9001\u4fe1\u3055\u308c\u307e\u3059\u3002"}],selectOptionsEn:[{value:"strict",label:"Limit the number of notifications",description:"You can limit the number of restock notifications by a specified quantity (either a fixed value or a percentage of stock)."},{value:"interval",label:"Limit the number and interval of notifications",description:"Continue sending at a specified quantity (per send) at specified intervals (days or hours). The process ends when the stock falls below the set amount or all registrants have been notified."},{value:"nolimit",label:"No limit",description:"Send to all registrants without specifying quantity or interval. If the number exceeds about 5000, it will be sent in multiple batches."}]},{type:"card",slug:"limitBasis",nameJa:"\u9001\u4fe1\u6570\u8a08\u7b97\u65b9\u6cd5",nameEn:"Limit calculation method",default:"static",selectOptionsJa:[{value:"static",label:"\u56fa\u5b9a\u5024"},{value:"stock_amount",label:"\u5728\u5eab\u6570\xd7\u25cb\u25cb\uff05\u4ef6\u9001\u4fe1\u3059\u308b\uff081\u56de\u306e\u9001\u4fe1\u6570\uff09\u3000"}],selectOptionsEn:[{value:"static",label:"Fixed value"},{value:"stock_amount",label:"Send as a percentage of stock per batch"}],checkVisible:t=>"nolimit"!==t.limitPolicy},{type:"number",slug:"limitAmount",nameJa:"1\u56de\u306e\u9001\u4fe1\u6570 \u307e\u305f\u306f \u5728\u5eab\u6570\u306b\u304b\u3051\u308b\u30d1\u30fc\u30bb\u30f3\u30c8",nameEn:"Limit amount or percentage of stock",default:100,min:0,max:1e3,step:1,checkVisible:t=>"nolimit"!==t.limitPolicy&&"nolimit"!==t.limitBasis,customize:(t,e)=>{const o="strict"===t.limitPolicy,n="stock_amount"===t.limitBasis;return Object.assign(Object.assign({},e),{nameJa:o?n?"\u3053\u306e\u518d\u5165\u8377\u3067\u9001\u4fe1\u3059\u308b\u5408\u8a08\u4e0a\u9650\uff08\u5728\u5eab\u6570\xd7\u30d1\u30fc\u30bb\u30f3\u30c8\uff09":"\u3053\u306e\u518d\u5165\u8377\u3067\u9001\u4fe1\u3059\u308b\u5408\u8a08\u4e0a\u9650":n?"1\u56de\u3042\u305f\u308a\u306e\u9001\u4fe1\u6570\uff08\u5728\u5eab\u6570\xd7\u30d1\u30fc\u30bb\u30f3\u30c8\uff09":"1\u56de\u3042\u305f\u308a\u306e\u9001\u4fe1\u6570",nameEn:o?n?"Total limit for this restock (percentage of stock)":"Total limit for this restock":n?"Notifications per send (percentage of stock)":"Notifications per send"})}},{type:"interval",slug:"interval",nameJa:"\u9001\u4fe1\u9593\u9694",nameEn:"Sending interval",default:{count:1,term:"day"},checkVisible:t=>"strict"!==t.limitPolicy&&"nolimit"!==t.limitPolicy},{type:"card",slug:"sendingOrder",nameJa:"\u9001\u4fe1\u9806\u5e8f",nameEn:"Sending order",default:"requested",selectOptionsJa:[{value:"requested",label:"\u30ea\u30af\u30a8\u30b9\u30c8\u9806(\u53e4\u3044\u9806)",description:"\u518d\u5165\u8377\u901a\u77e5\u767b\u9332\u3092\u3057\u305f\u9806\uff08\u767b\u9332\u3057\u305f\u65e5\u6642\u304c\u53e4\u3044\u9806\uff09\u306b\u9001\u4fe1\u3057\u307e\u3059\u3002"},{value:"requestedDesc",label:"\u30ea\u30af\u30a8\u30b9\u30c8\u9006\u9806(\u65b0\u3057\u3044\u9806)",description:"\u518d\u5165\u8377\u901a\u77e5\u767b\u9332\u3092\u3057\u305f\u9006\u9806\uff08\u767b\u9332\u3057\u305f\u65e5\u6642\u304c\u65b0\u3057\u3044\u9806\uff09\u306b\u9001\u4fe1\u3057\u307e\u3059\u3002"}],selectOptionsEn:[{value:"requested",label:"Order of request (oldest first)",description:"Send in the order of registration (oldest registration date first)."},{value:"requestedDesc",label:"Reverse order of request (newest first)",description:"Send in the reverse order of registration (newest registration date first)."}]},{type:"card",slug:"sendingOrderPreferType",nameJa:"\u30ea\u30d4\u30fc\u30bf\u30fc\u306e\u9001\u4fe1\u9806\u5e8f",nameEn:"Sending order of repeaters",default:"none",selectOptionsJa:[{value:"repeater",label:"\u30ea\u30d4\u30fc\u30bf\u30fc\u3092\u512a\u5148",description:"\u518d\u5165\u8377\u901a\u77e5\u767b\u9332\u3092\u3057\u305f\u9867\u5ba2\u306e\u4e2d\u3067\u30ea\u30d4\u30fc\u30bf\u30fc\uff08\u904e\u53bb\u8cfc\u5165\u3057\u305f\u3053\u3068\u304c\u3042\u308b\u9867\u5ba2\uff09\u304b\u3089\u512a\u5148\u3057\u3066\u9001\u4fe1\u3055\u308c\u307e\u3059\u3002\u30ea\u30d4\u30fc\u30bf\u30fc\u5185\u3001\u672a\u8cfc\u5165\u8005\u5185\u3067\u306e\u9001\u4fe1\u9806\u756a\u306f\u3001\u9001\u4fe1\u9806\u5e8f\u306e\u8a2d\u5b9a\u306b\u57fa\u3065\u3044\u3066\u9001\u4fe1\u3055\u308c\u307e\u3059\u3002"},{value:"nonbuyer",label:"\u672a\u8cfc\u5165\u8005\u3092\u512a\u5148",description:"\u518d\u5165\u8377\u901a\u77e5\u767b\u9332\u3092\u3057\u305f\u9867\u5ba2\u306e\u4e2d\u3067\u672a\u8cfc\u5165\u8005\u5185\u304b\u3089\u512a\u5148\u3057\u3066\u9001\u4fe1\u3055\u308c\u307e\u3059\u3002\u672a\u8cfc\u5165\u8005\u5185\u3001\u30ea\u30d4\u30fc\u30bf\u30fc\u5185\uff08\u904e\u53bb\u8cfc\u5165\u3057\u305f\u3053\u3068\u304c\u3042\u308b\u9867\u5ba2\uff09\u3067\u306e\u9001\u4fe1\u9806\u756a\u306f\u3001\u9001\u4fe1\u9806\u5e8f\u306e\u8a2d\u5b9a\u306b\u57fa\u3065\u3044\u3066\u9001\u4fe1\u3055\u308c\u307e\u3059\u3002"},{value:"none",label:"\u30ea\u30d4\u30fc\u30bf\u30fc\u30fb\u672a\u8cfc\u5165\u8005\u3069\u3061\u3089\u3082\u512a\u5148\u3057\u306a\u3044",description:"\u30ea\u30d4\u30fc\u30bf\u30fc\u306b\u57fa\u3065\u304f\u9001\u4fe1\u9806\u756a\u8a2d\u5b9a\u3092\u7121\u52b9\u306b\u3057\u307e\u3059\u3002\u3053\u306e\u5834\u5408\u3001\u30ea\u30d4\u30fc\u30bf\u30fc\u3001\u672a\u8cfc\u5165\u8005\u554f\u308f\u305a\u9001\u4ed8\u9806\u5e8f\u306e\u8a2d\u5b9a\u306b\u57fa\u3065\u3044\u3066\u9001\u4fe1\u3055\u308c\u307e\u3059\u3002"}],selectOptionsEn:[{value:"repeater",label:"Prioritize repeaters",description:"Prioritize customers who have purchased before. Within repeaters and non-buyers, the sending order is based on the sending order setting."},{value:"nonbuyer",label:"Prioritize non-buyers",description:"Prioritize non-buyers among registrants. Within non-buyers and repeaters, the sending order is based on the sending order setting."},{value:"none",label:"Do not prioritize either",description:"Disable sending order based on repeaters. In this case, the sending order setting applies regardless of repeater status."}]},{type:"card",slug:"resendPolicy",nameJa:"\u518d\u9001\u4fe1\u30dd\u30ea\u30b7\u30fc(\u518d\u5165\u8377\u901a\u77e5\u53ca\u3073\u304a\u6c17\u306b\u5165\u308a)",nameEn:"Resend policy",default:"none",selectOptionsJa:[{value:"none",label:"\u518d\u9001\u4fe1\u3057\u306a\u3044(1\u5ea6\u3057\u304b\u9001\u3089\u306a\u3044)",description:"\u4e00\u5ea6\u518d\u5165\u8377\u901a\u77e5\u3092\u9001\u3063\u3066\u3044\u308b\u9867\u5ba2\u306e\u5834\u5408\u3001\u518d\u5ea6\u540c\u3058\u5546\u54c1\u3001\u540c\u3058\u30d0\u30ea\u30a8\u30fc\u30b7\u30e7\u30f3\u3092\u518d\u5165\u8377\u3057\u305f\u969b\u306f\u518d\u5165\u8377\u901a\u77e5\u3092\u9001\u4fe1\u3057\u307e\u305b\u3093\u3002"},{value:"always",label:"\u5e38\u306b\u518d\u9001\u4fe1\u3059\u308b",description:"\u4e00\u5ea6\u518d\u5165\u8377\u901a\u77e5\u3092\u9001\u3063\u305f\u9867\u5ba2\u3067\u3082\u3001\u518d\u5ea6\u540c\u3058\u5546\u54c1\u3001\u540c\u3058\u30d0\u30ea\u30a8\u30fc\u30b7\u30e7\u30f3\u3092\u518d\u5165\u8377\u3057\u305f\u5834\u5408\u306b\u4f55\u5ea6\u3067\u3082\u518d\u5165\u8377\u901a\u77e5\u3092\u9001\u4fe1\u3057\u307e\u3059\u3002\u52d5\u4f5c\u78ba\u8a8d\u7b49\u691c\u8a3c\u306e\u969b\u306b\u3054\u5229\u7528\u304f\u3060\u3055\u3044\u3002"},{value:"interval",label:"\u6307\u5b9a\u306e\u9593\u9694\u3067\u518d\u9001\u4fe1\u3059\u308b",description:"\u4e00\u5ea6\u518d\u5165\u8377\u901a\u77e5\u3092\u9001\u3063\u305f\u9867\u5ba2\u3067\u3082\u8a2d\u5b9a\u3057\u305f\u65e5\u6570\u3001\u6642\u9593\u4ee5\u4e0a\u7d4c\u904e\u3057\u3066\u3044\u308c\u3070\u3001\u901a\u5e38\u901a\u308a\u518d\u5165\u8377\u901a\u77e5\u3092\u9001\u4fe1\u3057\u307e\u3059\u3002\u524d\u56de\u306e\u901a\u77e5\u304b\u3089\u306e\u7d4c\u904e\u6642\u9593\u304c\u8a2d\u5b9a\u3057\u305f\u65e5\u6570\u3001\u6642\u9593\u672a\u6e80\u306e\u5834\u5408\u306f\u518d\u5165\u8377\u901a\u77e5\u3092\u9001\u4fe1\u3057\u307e\u305b\u3093\u3002\u9593\u9694\u306f\u6642\u9593\u5358\u4f4d\u304b\u65e5\u6570\u5358\u4f4d\u3067\u6307\u5b9a\u53ef\u80fd\u3067\u3059\u3002"},{value:"24hours",label:"24\u6642\u9593\u6bce\u306b\u518d\u9001\u4fe1\u3059\u308b",description:"\u4e00\u5ea6\u518d\u5165\u8377\u901a\u77e5\u3092\u9001\u3063\u305f\u9867\u5ba2\u3067\u3082\u3001\u524d\u56de\u306e\u901a\u77e5\u304b\u308924\u6642\u9593\u4ee5\u4e0a\u7d4c\u904e\u3057\u3066\u3044\u308c\u3070\u3001\u901a\u5e38\u901a\u308a\u518d\u5165\u8377\u901a\u77e5\u3092\u9001\u4fe1\u3057\u307e\u3059\u3002\u524d\u56de\u306e\u901a\u77e5\u304b\u3089\u306e\u7d4c\u904e\u6642\u9593\u304c24\u6642\u9593\u672a\u6e80\u306e\u5834\u5408\u306f\u518d\u5165\u8377\u901a\u77e5\u3092\u9001\u4fe1\u3057\u307e\u305b\u3093\u3002"}],selectOptionsEn:[{value:"none",label:"Do not resend (only once)",description:"If a customer has already received a restock notification, no further notifications will be sent for the same product/variant."},{value:"always",label:"Always resend",description:"Even if a customer has already received a notification, notifications will be sent every time the same product/variant is restocked. Useful for testing."},{value:"interval",label:"Resend at specified intervals",description:"If the set number of days/hours has passed since the last notification, a new notification will be sent. Otherwise, no notification will be sent. The interval can be specified in hours or days."},{value:"24hours",label:"Resend every 24 hours",description:"If 24 hours have passed since the last notification, a new notification will be sent. Otherwise, no notification will be sent."}]},{type:"interval",slug:"resendPolicyInterval",nameJa:"\u518d\u9001\u4fe1\u9593\u9694",nameEn:"Resend interval",default:{count:1,term:"day"},checkVisible:t=>"interval"===t.resendPolicy},{type:"number",slug:"restockMinimumStock",nameJa:"\u518d\u5165\u8377\u901a\u77e5\u3092\u9001\u4fe1\u3059\u308b\u305f\u3081\u306b\u5fc5\u8981\u306a\u5728\u5eab\u6570",nameEn:"Minimum stock for restock notification",descriptionJa:"\u518d\u5165\u8377\u901a\u77e5\u51e6\u7406\u304c\u52d5\u4f5c\u3059\u308b\u305f\u3081\u306e\u6700\u4f4e\u5728\u5eab\u6570\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002\u4f8b\u3048\u30705\u3067\u8a2d\u5b9a\u3059\u308b\u3068\u3001\u5728\u5eab\u6570\u304c5\u672a\u6e80\u306e\u72b6\u614b\u304b\u3089\u30015\u4ee5\u4e0a\u306b\u5897\u3048\u305f\u5834\u5408\u306b\u518d\u5165\u8377\u901a\u77e5\u51e6\u7406\u304c\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002",descriptionEn:"Set the minimum stock required for the restock notification process to operate. For example, if you set it to 5, the restock notification process will be executed when the stock quantity increases from less than 5 to 5 or more.",default:1,min:1,max:1e3,step:1},{type:"card",slug:"favoriteVariantPolicy",nameJa:"\u304a\u6c17\u306b\u5165\u308a\u304b\u3089\u306e\u518d\u5165\u8377\u901a\u77e5\u306e\u91cd\u8907\u9001\u4fe1\u8a2d\u5b9a",nameEn:"Variation rule for restock notification from favorites",default:"always",selectOptionsJa:[{value:"always",label:"\u5e38\u306b\u9001\u4fe1\u3059\u308b",description:"\u304a\u6c17\u306b\u5165\u308a\u767b\u9332\u3092\u3057\u3066\u3044\u308b\u3059\u3079\u3066\u306e\u5546\u54c1\u30fb\u30d0\u30ea\u30a8\u30fc\u30b7\u30e7\u30f3\u3092\u5bfe\u8c61\u306b\u3001\u5728\u5eab\u304c\u5165\u3063\u305f\u30bf\u30a4\u30df\u30f3\u30b0\u3067\u518d\u5165\u8377\u901a\u77e5\u304c\u9001\u4fe1\u3055\u308c\u307e\u3059\u3002\uff08\u4f8b\uff1a\u540c\u3058\u5546\u54c1\u306eS\u30b5\u30a4\u30ba\u30fbM\u30b5\u30a4\u30ba\u4e21\u65b9\u3092\u304a\u6c17\u306b\u5165\u308a\u767b\u9332\u3057\u3066\u3044\u308b\u5834\u5408\u3001\u305d\u308c\u305e\u308c\u5165\u5eab\u3057\u305f\u30bf\u30a4\u30df\u30f3\u30b0\u3067\u518d\u5165\u8377\u901a\u77e5\u304c\u9001\u4fe1\u3055\u308c\u307e\u3059\uff09"},{value:"none",label:"\u9001\u4fe1\u3057\u306a\u3044",description:"\u540c\u3058\u5546\u54c1\u306e\u8907\u6570\u30d0\u30ea\u30a8\u30fc\u30b7\u30e7\u30f3\u3092\u304a\u6c17\u306b\u5165\u308a\u767b\u9332\u3057\u3066\u304a\u308a\u3001\u3044\u305a\u308c\u304b\u306e\u30d0\u30ea\u30a8\u30fc\u30b7\u30e7\u30f3\u3067\u518d\u5165\u8377\u901a\u77e5\u304c\u9001\u4fe1\u3055\u308c\u305f\u5834\u5408\u3001\u305d\u308c\u4ee5\u964d\u306e\u518d\u5165\u8377\u901a\u77e5\u306f\u9001\u4fe1\u3055\u308c\u307e\u305b\u3093\u3002\uff08\u4f8b\uff1a\u540c\u3058\u5546\u54c1\u306eS\u30b5\u30a4\u30ba\u30fbM\u30b5\u30a4\u30ba\u4e21\u65b9\u3092\u304a\u6c17\u306b\u5165\u308a\u767b\u9332\u3057\u3066\u3044\u308b\u5834\u5408\u3001S\u30b5\u30a4\u30ba\u306e\u5165\u5eab\u3067\u518d\u5165\u8377\u901a\u77e5\u304c\u9001\u4fe1\u3055\u308c\u308b\u3068\u3001M\u30b5\u30a4\u30ba\u304c\u5165\u5eab\u3057\u3066\u3082\u518d\u5165\u8377\u901a\u77e5\u306f\u9001\u4fe1\u3055\u308c\u307e\u305b\u3093\uff09"}],selectOptionsEn:[{value:"always",label:"Always send",description:"Even if a customer has already received a restock notification for another variation, a notification will be sent again. (e.g., S size T-shirt restocked, then M size restocked the next day)"},{value:"none",label:"Do not send",description:"If a customer has already received a restock notification for any variation, no further notifications will be sent."}]}]}},209(t,e,o){"use strict";var n=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=n(o(132));class r{constructor(t,e=!1){this.content=null,this.title=null,this.secondTitle=null,this.popup=null,this.button=null,this.footer=null,this.secondFooter=null,this.preview=!1,this.showSecondPopup=!1,this.container=null,this.secondContainer=null,this.secondContent=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.config=t,r.instance.preview=e):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.updateElements(),this.container&&this.container.addEventListener("click",t=>{t.stopPropagation()}),this.close=this.container&&this.container.querySelectorAll(".storecrm_modal__close"),this.close&&!this.preview&&this.close.forEach(t=>{t.addEventListener("click",t=>{i.default.close("storecrm-modal")})})}updateElements(){this.popup=document.getElementById("storecrm-modal"),this.content=document.getElementById("storecrm-modal-content"),this.secondContent=document.getElementById("storecrm-modal-second-content"),this.title=document.getElementById("storecrm-modal-title"),this.secondTitle=document.getElementById("storecrm-modal-second-title"),this.footer=document.querySelector(".storecrm_modal__footer"),this.secondFooter=document.getElementById("storecrm-modal-second-footer"),this.container=document.querySelector(".storecrm_modal__container"),this.secondContainer=document.getElementById("storecrm-modal-second-popup-preview")}render(t,e,o={}){var n,i,r,s;if(this.preview&&this.updateElements(),this.showSecondPopup=t.add_accepts_marketing_checkbox&&this.preview,this.footer&&0!==this.footer.children.length&&(this.footer.innerHTML=""),this.button=null,!o.hideSubmitButton){const e=document.createElement("button");e.className="storecrm_modal__btn storecrm_modal__btn-primary",e.innerHTML=t.button_text,null===(n=this.footer)||void 0===n||n.appendChild(e),this.button=e}this.button&&!this.preview&&this.button.addEventListener("click",()=>{this.checkAcceptsMarketingStatusAndClearMessages()}),this.config=t;const a=o.email||(null===(i=window.storecrm_data)||void 0===i?void 0:i.customer_email)||window.localStorage.getItem("storecrm_restock_email")||"",l=o.readOnly?' disabled aria-disabled="true"':"",c=o.readOnly?' readonly aria-readonly="true"':"";if(this.title&&this.content&&this.popup){this.title.innerText=t.popup_title;let n=`\n
${t.popup_description}
\n
\n
${t.emailaddress}
\n${t.add_accepts_marketing_checkbox?``:""}\n${t.add_accepts_marketing_checkbox?``:""}\n
\n`.trim(),i=o.variantId||null;if(location.search&&location.search.includes("variant")){const t=new URL(location.href);i=i||t.searchParams.get("variant")}console.error("RestockPopupManager: render: variants",e,i);const r=e.filter(t=>!t.available).map(t=>``).join("");e&&Array.isArray(e)&&e.length>1?(n=n.replace("\x3c!-- select_style --\x3e",""),n=n.replace("\x3c!-- options --\x3e",r)):(n=n.replace("\x3c!-- select_style --\x3e","display:none"),n=n.replace("\x3c!-- options --\x3e",r)),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.container.style.width="100%"),this.button&&(this.button.style.backgroundColor=t.button_background_color,this.button.style.color=t.button_text_color),this.close&&this.close.forEach(e=>{e.style.color=t.close_text_color})}if(this.resetMessage(),this.showSecondPopup&&this.secondTitle&&this.secondContent&&this.secondContainer){this.secondContainer.style.display="block",this.secondTitle.innerText=t.popup_title;let e="";e=`\n
${t.email_confirmation_text}
hogehoge@hoge.com
\n
`,this.secondContent.innerHTML=e,this.secondContent.style.color=t.text_color,this.secondContainer.style.backgroundColor=t.background_color,this.secondContainer.style.borderRadius=`${t.button_radius}px`,this.secondContainer.style.marginTop="20px",this.secondContainer.style.width="100%",this.secondFooter&&0!==this.secondFooter.children.length&&(this.secondFooter.innerHTML="");const o=document.createElement("button");o.className="storecrm_modal__btn storecrm_modal__btn-primary",o.innerHTML=t.button_text,o.style.backgroundColor=t.button_background_color,o.style.color=t.button_text_color,null===(r=this.secondFooter)||void 0===r||r.appendChild(o)}else this.secondContainer&&(this.secondContainer.style.display="none");this.preview||null===(s=document.getElementById("storecrm-modal-second-popup-preview"))||void 0===s||s.remove(),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,e;this.footer&&(null===(t=this.footer)||void 0===t||t.querySelectorAll(".storecrm_modal_message").forEach(t=>t.remove())),this.preview&&this.secondFooter&&(null===(e=this.secondFooter)||void 0===e||e.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,o,n;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===(o=this.content)||void 0===o?void 0:o.querySelector("#storecrm_restock_variant"),s=null===(n=this.content)||void 0===n?void 0:n.querySelector("#storecrm_restock_accepts_marketing"),a=i?i.value:"",l=r?r.value:"",c=this.product_id,d=s?s.checked:null;this.parent&&this.parent.storeRestock(a,l,c,d,this.config.add_accepts_marketing_checkbox,t,this.success.bind(this),this.failure.bind(this))}show(t,e,o,n={}){this.product_id=o,this.inited?this.runShow(t,e,n):window.setTimeout(()=>this.show(t,e,o,n),100)}runShow(t,e,o={}){this.render(t,e,o);if(document.getElementById("storecrm-modal"))try{i.default.show("storecrm-modal")}catch(t){console.warn("StoreCRM: MicroModal show failed",t)}else console.warn("StoreCRM: restock popup modal element not found, skip show")}hide(){if(document.getElementById("storecrm-modal"))try{i.default.close("storecrm-modal")}catch(t){console.warn("StoreCRM: MicroModal close failed",t)}}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.showSecondPopup?this.secondFooter&&this.secondFooter.appendChild(e):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.showSecondPopup?this.secondFooter&&this.secondFooter.appendChild(e):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 o=document.getElementById("storecrm-modal-content"),n=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(!o||!i||!r)return;r.innerHTML=this.config.email_confirmation_text+"
"+n.value;const s=Array.from(o.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="block"},300),r.classList.add("fade-in"),setTimeout(()=>{r.style.display="block"},300),this.switchSubmitButton(t)}switchSubmitButton(t){var e;this.footer&&(this.footer.innerHTML="");const o=document.createElement("button");o.className="storecrm_modal__btn storecrm_modal__btn-primary",o.style.color=this.config.button_text_color,o.style.backgroundColor=this.config.button_background_color,o.innerHTML=this.config.button_text,this.footer&&this.footer.appendChild(o),this.button=o,null===(e=this.button)||void 0===e||e.addEventListener("click",()=>{this.submit(t)})}}e.RestockPopupManager=r,r.template='';let s=null;e.schema={preview:(t,e)=>{var o,n;return o=()=>{r.getInstance(t,!0).show(t,[],"1234567890")},n=300,clearTimeout(s),s=setTimeout(o,n),r.template},rows:[{type:"text",slug:"popup_title",nameJa:"\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u306e\u30bf\u30a4\u30c8\u30eb",nameEn:"Popup title",defaultJa:"\u518d\u5165\u8377\u901a\u77e5",defaultEn:"Restock Notification"},{type:"text",slug:"popup_description",nameJa:"\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u306e\u672c\u6587",nameEn:"Popup description",defaultJa:"\u518d\u5165\u8377\u901a\u77e5\u3092\u3054\u5e0c\u671b\u306e\u65b9\u306f\u4ee5\u4e0b\u304b\u3089\u3001\u3054\u9078\u629e\u304f\u3060\u3055\u3044\u3002",defaultEn:"If you would like to receive a restock notification, please select from below."},{type:"text",slug:"emailaddress",nameJa:"\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u30d5\u30a9\u30fc\u30e0\u540d",nameEn:"Email address form name",defaultJa:"\u3054\u9023\u7d61\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9",defaultEn:"Contact Email Address"},{type:"colorpicker",slug:"background_color",nameJa:"\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u306e\u80cc\u666f\u8272",nameEn:"Popup background color",default:"#ffffff"},{type:"colorpicker",slug:"text_color",nameJa:"\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u306e\u30c6\u30ad\u30b9\u30c8\u8272",nameEn:"Popup text color",default:"#000000"},{type:"colorpicker",slug:"close_text_color",nameJa:"\u9589\u3058\u308b\u30dc\u30bf\u30f3\u306e\u8272",nameEn:"Popup close button text color",default:"#000000"},{type:"colorpicker",slug:"button_background_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u80cc\u666f\u8272",nameEn:"Button background color",default:"#222222"},{type:"colorpicker",slug:"button_text_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u30c6\u30ad\u30b9\u30c8\u30ab\u30e9\u30fc",nameEn:"Button text color",default:"#dddddd"},{type:"text",slug:"button_text",nameJa:"\u30dc\u30bf\u30f3\u306e\u30c6\u30ad\u30b9\u30c8",nameEn:"Button text",defaultJa:"\u518d\u5165\u8377\u901a\u77e5\u3092\u6709\u52b9\u306b\u3059\u308b",defaultEn:"Enable restock notification"},{type:"text",slug:"success_text",nameJa:"\u6210\u529f\u6642\u306e\u30c6\u30ad\u30b9\u30c8",nameEn:"Success text",defaultJa:"\u518d\u5165\u8377\u901a\u77e5\u304c\u767b\u9332\u3055\u308c\u307e\u3057\u305f\u3002",defaultEn:"Restock notification has been registered."},{type:"colorpicker",slug:"success_background_color",nameJa:"\u6210\u529f\u6642\u306e\u80cc\u666f\u8272",nameEn:"Success background color",default:"#F0FDF4"},{type:"colorpicker",slug:"success_text_color",nameJa:"\u6210\u529f\u6642\u306e\u6587\u5b57\u8272",nameEn:"Success text color",default:"#166534"},{type:"text",slug:"error_text",nameJa:"\u5931\u6557\u6642\u306e\u30c6\u30ad\u30b9\u30c8",nameEn:"Error text",defaultJa:"\u518d\u5165\u8377\u901a\u77e5\u306e\u767b\u9332\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002\u3057\u3070\u3089\u304f\u305f\u3063\u3066\u304b\u3089\u518d\u5ea6\u304a\u8a66\u3057\u304f\u3060\u3055\u3044\u3002",defaultEn:"Failed to register restock notification. Please try again later."},{type:"text",slug:"error_text_email",nameJa:"\u5931\u6557\u6642\u306e\u30c6\u30ad\u30b9\u30c8(\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u306e\u5224\u5b9a)",nameEn:"Error text",defaultJa:"\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u304c\u6b63\u3057\u304f\u3042\u308a\u307e\u305b\u3093\u3002\u78ba\u8a8d\u306e\u4e0a\u3001\u518d\u5ea6\u3054\u8a18\u5165\u304f\u3060\u3055\u3044\u3002",defaultEn:"The email address is incorrect. Please check and re-enter."},{type:"colorpicker",slug:"failure_background_color",nameJa:"\u30a8\u30e9\u30fc\u6642\u306e\u80cc\u666f\u8272",nameEn:"Success background color",default:"#FEF2F2"},{type:"colorpicker",slug:"failure_text_color",nameJa:"\u30a8\u30e9\u30fc\u6642\u306e\u6587\u5b57\u8272",nameEn:"Success text color",default:"#991B1B"},{type:"range",slug:"button_radius",nameJa:"\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u306e\u4e38\u307f",nameEn:"Popup corner radius",default:10,min:0,max:40,step:1},{type:"checkbox",slug:"add_accepts_marketing_checkbox",nameJa:"\u30e1\u30eb\u30de\u30ac\u914d\u4fe1\u30c1\u30a7\u30c3\u30af\u30dc\u30c3\u30af\u30b9\u3092\u6709\u52b9\u5316",nameEn:"Add accepts marketing checkbox",default:!1},{type:"text",slug:"accepts_marketing_checkbox_text",nameJa:"\u30e1\u30eb\u30de\u30ac\u914d\u4fe1\u30c1\u30a7\u30c3\u30af\u30dc\u30c3\u30af\u30b9\u306e\u30c6\u30ad\u30b9\u30c8",nameEn:"Accepts marketing checkbox text",defaultJa:"\u30e1\u30eb\u30de\u30ac\u914d\u4fe1\u306b\u540c\u610f\u3059\u308b",defaultEn:"I agree to receive marketing emails"},{type:"text",slug:"email_confirmation_text",nameJa:"\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u78ba\u8a8d\u30c6\u30ad\u30b9\u30c8",nameEn:"Email confirmation text",defaultJa:"\u3053\u3061\u3089\u306e\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3067\u9593\u9055\u3044\u306a\u3044\u3067\u3059\u304b\uff1f",defaultEn:"Is this the correct email address?"},{type:"checkbox",slug:"create_shopify_customer",nameJa:"\u30e1\u30eb\u30de\u30ac\u8cfc\u8aad\u72b6\u6cc1\u306b\u304b\u304b\u308f\u3089\u305aShopify\u9867\u5ba2\u3092\u4f5c\u6210\u3059\u308b",nameEn:"Create Shopify customer regardless of marketing subscription status",calloutJa:"\u518d\u5165\u8377\u901a\u77e5\u3092\u767b\u9332\u3057\u305f\u4eba\u306f\u81ea\u52d5\u3067StoreCRM\u5185\u306e\u9867\u5ba2\u3068\u3057\u3066\u767b\u9332\u3055\u308c\u307e\u3059\u3002\u30e1\u30eb\u30de\u30ac\u8cfc\u8aad\u3092ON\u306b\u3057\u305f\u5834\u5408\u306f\u81ea\u52d5\u3067Shopify\u3068\u3082\u9023\u52d5\u3057\u307e\u3059\u304c\u3001OFF\u306e\u5834\u5408\u3082Shopify\u3068\u9023\u52d5\u3057\u305f\u3044\u5834\u5408\u306f\u3053\u306e\u30c1\u30a7\u30c3\u30af\u30dc\u30c3\u30af\u30b9\u3092ON\u306b\u3057\u3066\u304f\u3060\u3055\u3044\u3002",calloutEn:"People who register for restock notifications are automatically added as customers in StoreCRM. When email marketing subscription is enabled, they are also automatically synced with Shopify. If it is disabled and you still want to sync them with Shopify, enable this checkbox.",default:!1,checkVisible:t=>!0===t.add_accepts_marketing_checkbox},{type:"text",slug:"create_shopify_customer_tags",nameJa:"Shopify\u9867\u5ba2\u4f5c\u6210\u6642\u306b\u4ed8\u4e0e\u3059\u308b\u30bf\u30b0\uff08\u30ab\u30f3\u30de\u533a\u5207\u308a\uff09",nameEn:"Tags to add when creating Shopify customer (comma separated)",defaultJa:"",defaultEn:"",checkVisible:t=>!0===t.add_accepts_marketing_checkbox&&!0===t.create_shopify_customer}]}},960(t,e,o){"use strict";e.schema=e.render=e.RestockButton=void 0;const n=o(978);class i{constructor(t,e,o,n,i){this.eventTriggered=!1,this.variants=o,this.buttonSettings=n,this.productId=e,this.product=i}static getInstance(t,e=null,o=null,n=null,r=null){if(i.instances[t])n&&(i.instances[t].buttonSettings=n);else{if(!(e&&o&&n&&r))throw new Error("StoreCRM Restock: productId, variants, buttonSettings, product are required");i.instances[t]=new i(t,e,o,n,r)}return i.instances[t]}createScript(t,e){const o=t?"":"onclick=\"event.preventDefault();window.storecrm ? window.storecrm.showRestock(this) : alert('\u8aad\u8fbc\u4e2d\u3067\u3059\u3002\u3057\u3070\u3089\u304f\u305f\u3063\u3066\u304b\u3089\u518d\u5ea6\u304a\u8a66\u3057\u304f\u3060\u3055\u3044\u3002');\"";return`\n\n\n
\n\n
\n `}checkRender(t){document.querySelectorAll(`.storecrm-restock-${t}`).forEach(t=>{var e;if(t instanceof HTMLElement&&t.closest('[data-type="restock-button"]')){const o=new URL(location.href),n=(null===(e=this.variants.find(t=>t.available))||void 0===e?void 0:e.id)||this.variants[0].id||null,i=parseInt(o.searchParams.get("variant")||n,10);if(!i)return void console.error("StoreCRM Restock: variantId is not set",i);if(!this.product||!this.product.tags||this.product.tags.indexOf("storecrm-restock-hidden")>=0)return console.error("StoreCRM: Restock:product not found or hidden"),void(t.style.display="none");const r=window.Shopify&&window.Shopify.designMode||this.variants.find(t=>!t.available&&t.id===i);t.style.display=r?"inline-block":"none"}})}render(t,e=!1){if(e)return this.createScript(!0,t);if(this.eventTriggered)return;this.eventTriggered=!0;const o=window.navigation;if(o)o.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=i,i.instances={};e.render=({productId:t,variantId:e,variants:o,id:n,buttonSettings:r,isOutOfStock:s,product:a,preview:l=!1})=>i.getInstance(n,t,o,r,a).render(n,l);const r=t=>{const e=[`opacity: ${((t,e,o,n)=>{const i=Number(t);return Number.isFinite(i)?Math.min(n,Math.max(o,i)):e})(t.registered_button_opacity,.55,.3,1)}`,"cursor: not-allowed","pointer-events: none"];return t.registered_button_color&&e.push(`color: ${t.registered_button_color}`),t.registered_button_background_color&&e.push(`background-color: ${t.registered_button_background_color}`),t.registered_button_border_color&&e.push(`border-color: ${t.registered_button_border_color}`),e.join("; ")},s=(t,e,o)=>{const n=e.registered_button_text||("ja"===o?"\u767b\u9332\u6e08\u307f":"Registered");return`\n
\n
${"ja"===o?"\u767b\u9332\u6e08\u307f\u8868\u793a":"Registered state"}
\n ${(t||"").replace(/]*)>[\s\S]*?<\/button>/,(t,o)=>{const i=String(o||"").replace(/\sonclick="[^"]*"/g,"");return`${s=n,String(null!=s?s:"").replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}`;var s})}\n
`};e.schema={preview:(t,o)=>((t,e,o,n)=>`\n
\n
\n
${"ja"===n?"\u901a\u5e38\u8868\u793a":"Default state"}
\n ${t||""}\n
\n ${s(e,o,n)}\n
`)((0,e.render)({productId:"TEMP_productId",id:"TEMP_restock",buttonSettings:t,isOutOfStock:!1,preview:!0,product:{tags:[]},variants:[]}),(0,e.render)({productId:"TEMP_productId",id:"TEMP_restock_registered",buttonSettings:t,isOutOfStock:!1,preview:!0,product:{tags:[]},variants:[]}),t,o),rows:[{type:"text",slug:"button_text",nameJa:"\u30dc\u30bf\u30f3\u306e\u30c6\u30ad\u30b9\u30c8",nameEn:"Button text",defaultJa:"\u518d\u5165\u8377\u901a\u77e5\u3092\u53d7\u3051\u53d6\u308b",defaultEn:"Notify restock"},{type:"text",slug:"registered_button_text",nameJa:"\u767b\u9332\u6e08\u307f\u6642\u306e\u30dc\u30bf\u30f3\u30c6\u30ad\u30b9\u30c8",nameEn:"Registered button text",defaultJa:"\u767b\u9332\u6e08\u307f",defaultEn:"Registered"},{type:"select",slug:"button_width_unit",nameJa:"\u30dc\u30bf\u30f3\u5e45\u306e\u6307\u5b9a\u65b9\u6cd5",nameEn:"Button width unit",default:"px",selectOptionsJa:[{value:"px",label:"\u56fa\u5b9a\u5e45\uff08px\uff09"},{value:"percent",label:"\u30b3\u30f3\u30c6\u30ca\u306b\u5bfe\u3059\u308b\u5272\u5408\uff08%\uff09"}],selectOptionsEn:[{value:"px",label:"Fixed width (px)"},{value:"percent",label:"Percentage of container (%)"}]},{type:"range",slug:"button_width",nameJa:"\u30dc\u30bf\u30f3\u306e\u5e45\uff08px\uff09",nameEn:"Button width (px)",default:200,min:50,max:600,step:10,checkVisible:t=>"percent"!==t.button_width_unit},{type:"range",slug:"button_width_percent",nameJa:"\u30dc\u30bf\u30f3\u306e\u5e45\uff08%\uff09",nameEn:"Button width (%)",default:100,min:1,max:100,step:1,checkVisible:t=>"percent"===t.button_width_unit},{type:"range",slug:"button_height",nameJa:"\u30dc\u30bf\u30f3\u306e\u9ad8\u3055",nameEn:"Button height",default:50,min:30,max:100,step:5},{type:"colorpicker",slug:"button_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u6587\u5b57\u8272",nameEn:"Button text color",default:"#000000"},{type:"colorpicker",slug:"button_background_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u80cc\u666f\u8272",nameEn:"Button background color",default:"#ffffff"},{type:"colorpicker",slug:"button_border_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u7dda\u306e\u8272",nameEn:"Button border color",default:"#000000"},{type:"colorpicker",slug:"registered_button_color",nameJa:"\u767b\u9332\u6e08\u307f\u6642\u306e\u6587\u5b57\u8272",nameEn:"Registered text color",default:"#666666"},{type:"colorpicker",slug:"registered_button_background_color",nameJa:"\u767b\u9332\u6e08\u307f\u6642\u306e\u80cc\u666f\u8272",nameEn:"Registered background color",default:"#f3f4f6"},{type:"colorpicker",slug:"registered_button_border_color",nameJa:"\u767b\u9332\u6e08\u307f\u6642\u306e\u67a0\u7dda\u8272",nameEn:"Registered border color",default:"#d1d5db"},{type:"colorpicker",slug:"button_hover_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u6587\u5b57\u8272(\u30db\u30d0\u30fc\u6642)",nameEn:"Button text color (hover)",default:"#222222"},{type:"colorpicker",slug:"button_hover_background_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u80cc\u666f\u8272(\u30db\u30d0\u30fc\u6642)",nameEn:"Button background color (hover)",default:"#dddddd"},{type:"colorpicker",slug:"button_hover_border_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u7dda\u306e\u8272(\u30db\u30d0\u30fc\u6642)",nameEn:"Button border color (hover)",default:"#222222"},{type:"range",slug:"button_radius",nameJa:"\u30dc\u30bf\u30f3\u306e\u4e38\u307f",nameEn:"Button corner radius",default:0,min:0,max:20,step:1},{type:"range",slug:"button_border_width",nameJa:"\u30dc\u30bf\u30f3\u306e\u7dda\u306e\u592a\u3055",nameEn:"Button border width",default:0,min:0,max:5,step:1},{type:"fontpicker",slug:"button_font",nameJa:"\u30dc\u30bf\u30f3\u306e\u30d5\u30a9\u30f3\u30c8",nameEn:"Button font",default:"helvetica_n4"},{type:"range",slug:"button_fontsize",nameJa:"\u30dc\u30bf\u30f3\u306e\u30d5\u30a9\u30f3\u30c8\u30b5\u30a4\u30ba",nameEn:"Button font size",default:16,min:10,max:30,step:1},{type:"range",slug:"button_fontweight",nameJa:"\u30dc\u30bf\u30f3\u306e\u30d5\u30a9\u30f3\u30c8\u30a6\u30a7\u30a4\u30c8",nameEn:"Button font weight",default:400,min:100,max:900,step:100},{type:"range",slug:"button_speed",nameJa:"\u30dc\u30bf\u30f3\u306e\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u901f\u5ea6",nameEn:"Button animation speed",default:.3,min:0,max:1,step:.1},{type:"range",slug:"registered_button_opacity",nameJa:"\u767b\u9332\u6e08\u307f\u6642\u306e\u900f\u660e\u5ea6",nameEn:"Registered opacity",default:.55,min:.3,max:1,step:.05},{type:"select",slug:"align",nameJa:"\u30dc\u30bf\u30f3\u306e\u914d\u7f6e",nameEn:"Button alignment",default:"center",defaultJa:"\u4e2d\u592e\u5bc4\u305b",defaultEn:"Center",selectOptionsJa:[{value:"left",label:"\u5de6\u5bc4\u305b"},{value:"center",label:"\u4e2d\u592e\u5bc4\u305b"},{value:"right",label:"\u53f3\u5bc4\u305b"}],selectOptionsEn:[{value:"left",label:"Align left"},{value:"center",label:"Align center"},{value:"right",label:"Align right"}]}]}},589(t,e,o){"use strict";e.StatusWidget=void 0;const n=o(444);e.StatusWidget=class{getMessages(){var t;const e=(null===(t=null===window||void 0===window?void 0:window.Shopify)||void 0===t?void 0:t.locale)||"";return"string"==typeof e&&e.toLowerCase().startsWith("ja")?{lineTitle:"LINE\u8a2d\u5b9a: ",lineOn:"\u8a2d\u5b9a\u6e08",lineOff:"\u672a\u767b\u9332",lineConnect:"\u767b\u9332\u3059\u308b",lineDisconnect:"\u89e3\u9664\u3059\u308b",mailTitle:"\u30e1\u30fc\u30eb\u30de\u30ac\u30b8\u30f3: ",mailOn:"\u8cfc\u8aad\u4e2d",mailOff:"\u672a\u8cfc\u8aad",mailSubscribe:"\u8cfc\u8aad\u3059\u308b",mailUnsubscribe:"\u8cfc\u8aad\u89e3\u9664\u3059\u308b"}:{lineTitle:"LINE settings: ",lineOn:"Connected",lineOff:"Not connected",lineConnect:"Connect",lineDisconnect:"Disconnect",mailTitle:"Newsletter: ",mailOn:"Subscribed",mailOff:"Not subscribed",mailSubscribe:"Subscribe",mailUnsubscribe:"Unsubscribe"}}constructor(t,e,o){this.position="beforeend",this.header=t,this.config=o,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),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("#OnlineStorePreviewBarNextData")||window.Shopify.designMode)}createWidget(t){var e,o,n,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 l(t){const e=document.createElement("button");return e.classList.add("storecrm-button","storecrm-button-off"),e.appendChild(document.createTextNode(t)),e}function c(t){const e=document.createElement("button");return e.classList.add("storecrm-button","storecrm-button-on"),e.appendChild(document.createTextNode(t)),e}r.classList.add("storecrm-status-widget");const d=this.getMessages();if(this.isLineVisible(t)){const n=document.createElement("div");n.appendChild(document.createTextNode(d.lineTitle)),n.appendChild(t.line?a(d.lineOn):s(d.lineOff)),this.lineButton=t.line?l(d.lineDisconnect):c(d.lineConnect),n.appendChild(this.lineButton),r.appendChild(n),t.line?null===(e=this.lineButton)||void 0===e||e.addEventListener("click",this.lineUnsubscribe.bind(this)):null===(o=this.lineButton)||void 0===o||o.addEventListener("click",this.lineSubscribe.bind(this))}if(t.mail_show_account){const e=document.createElement("div");e.appendChild(document.createTextNode(d.mailTitle)),e.appendChild(t.accepts_marketing?a(d.mailOn):s(d.mailOff)),this.mailButton=t.accepts_marketing?l(d.mailUnsubscribe):c(d.mailSubscribe),e.appendChild(this.mailButton),r.appendChild(e),t.accepts_marketing?null===(n=this.mailButton)||void 0===n||n.addEventListener("click",this.unsubscribe.bind(this)):null===(i=this.mailButton)||void 0===i||i.addEventListener("click",this.subscribe.bind(this))}return r}lineSubscribe(){this.parent&&this.parent.lineSubscribe(function(t){alert(t)},{routeKey:n.LINE_CONNECTION_SYSTEM_ROUTE_KEYS.classicAccount})}lineUnsubscribe(){this.parent&&this.parent.lineUnsubscribe(function(t){alert(t)})}subscribe(){this.parent&&this.parent.mailSubscribe(function(t){alert(t)})}unsubscribe(){this.parent&&this.parent.mailUnsubscribe(function(t){alert(t)})}}},280(t,e,o){"use strict";var n=this&&this.__awaiter||function(t,e,o,n){return new(o||(o=Promise))(function(i,r){function s(t){try{l(n.next(t))}catch(t){r(t)}}function a(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof o?e:new o(function(t){t(e)})).then(s,a)}l((n=n.apply(t,e||[])).next())})},i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const r=o(3),s=o(196),a=o(960),l=o(738),c=o(209),d=o(216),u=o(907),h=o(589),m=o(48),p=i(o(222)),g=o(883),f=o(954),_=o(156);o(627);class v{constructor(t){this.statusWidget=void 0,this.isTokenRefreshed=!1,this.isTokenFetching=!1,this.favoriteMode="product",this.favoriteKey="products",this.checkConnectExecuted=!1,this.widgetTemplates={},this.widgetTemplateLoaded=!1,this.pendingRestockIntentProcessing=!1,this.pendingRestockRetryAttempts=0,this.pendingLineRestockConnectRedirectStarted=!1,this.pendingLineConnectResultDetected=!1,this.restockStatusCache=new Map,this.restockStatusRequests=new Map,this.optimisticRestockRegistered=new Map,this.restockStateWatcherStarted=!1,this.lastRestockStateHref="",this.restockButtonVariantByKey=new Map,window.storecrm_data=window.storecrm_data||{},console.log("StoreCRM initialized version 0.7.197",t),this.config=this.applyLocaleOverrides(t),this.currentLocale=this.detectLocale(),this.applyDefaults(),this.popupManager=c.RestockPopupManager.getInstance(this.config.restockPopup),this.popupManager.setParent(this),this.lineRestockPopupManager=u.LineRestockPopupManager.getInstance(this.config.lineRestockPopup),this.lineRestockPopupManager.setParent(this),this.captureLineConnectResultFromUrl(!0)}resolveConfig(t){return this.applyLocaleOverrides(t||{})}static resolveConfig(t){return Object.create(v.prototype).applyLocaleOverrides(t||{})}init(){this.checkPendingRestockIntentAfterPageReturn(),(()=>{n(this,void 0,void 0,function*(){try{if(document.querySelector("[data-storecrm-preview-context]"))return console.log("StoreCRM: Favorite preview context detected; skipping customer and token initialization"),void(yield this.renderFavoriteList());if(this.isConnectProxyPage())return yield this.checkCustomer({syncWishlist:!1}),void this.checkConnect();yield this.bootstrapTemplates(),yield this.checkCustomer(),yield this.syncWishlist()}catch(t){console.error("StoreCRM: init: error",t)}yield this.render(),yield this.handlePendingRestockIntent();const t=document.querySelector("[data-storecrm-preview-context]"),e=(0,f.isAppProxyPathname)(window.location.pathname,this.config.appProxyPath,this.config.appProxyName);console.log("StoreCRM: Favorite list page detection",{hasPreviewContext:Boolean(t),isFavoriteProxyPage:e,pathname:window.location.pathname,appProxyPath:this.config.appProxyPath,appProxyName:this.config.appProxyName}),(t||e)&&(yield this.renderFavoriteList())})})(),window.addEventListener("pageshow",t=>{t.persisted&&(this.render(!0),this.pendingLineRestockConnectRedirectStarted=!1),this.checkPendingRestockIntentAfterPageReturn()}),window.addEventListener("focus",()=>{this.checkPendingRestockIntentAfterPageReturn()}),window.addEventListener("storecrm:locationchange",()=>{this.checkPendingRestockIntentAfterPageReturn()}),document.addEventListener("visibilitychange",()=>{"visible"===document.visibilityState&&(this.render(!0),this.handlePendingRestockIntent().catch(t=>{console.warn("StoreCRM: pending restock check after visibilitychange failed",t)}))}),this.initLineLogin(),this.initRestockStateWatcher(),this.initDynamicRenderObserver()}isConnectProxyPage(){return window.location.pathname.includes("/apps")&&window.location.pathname.endsWith("/connect")}initLineLogin(){"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{this.executeLineLoginInit()}):this.executeLineLoginInit()}executeLineLoginInit(){if(p.default.isLoginOrRegisterPage()){new p.default(this).init()}}getCurrentShopifyCustomerId(){try{return window.storecrm_data.customer_id||window.ShopifyAnalytics.meta.page.customerId}catch(t){return null}}checkCustomer(){return n(this,arguments,void 0,function*(t={}){if(window.storecrm_data.is_customer_checked)return;window.storecrm_data.is_customer_checked=!0;const e=(window.localStorage.getItem("storecrm_customer_id")||"").toString(),o=(this.getCurrentShopifyCustomerId()||"").toString();if(e!==o){if(o)return!e||e.startsWith("TEMP_")&&o?(yield this.refreshToken(!1,t),void(!1!==t.syncWishlist&&(yield this.syncWishlist(null,e,!0)))):void(e===o||(yield this.refreshToken(!0)));(null==e?void 0:e.startsWith("TEMP_"))||(yield this.refreshToken(!0))}})}refreshToken(){return n(this,arguments,void 0,function*(t=!1,e={}){return t&&(window.localStorage.removeItem("storecrm_customer_id"),window.localStorage.removeItem("storecrm_wishlist")),yield this.fetchToken(e)})}detectLocale(){var t,e;return([window.Shopify&&(window.Shopify.locale||(null===(e=null===(t=window.Shopify.localization)||void 0===t?void 0:t.language)||void 0===e?void 0:e.isoCode)),document.documentElement.getAttribute("lang"),navigator.language].find(t=>"string"==typeof t&&t.length>0)||"en").replace("_","-")}normalizeLocaleValue(t){if("string"==typeof t)return t.replace("_","-").toLowerCase()}findLocaleFromConfig(t){var e;const o=this.normalizeLocaleValue(null===(e=window.Shopify)||void 0===e?void 0:e.locale);if(!t||!o)return;const n=Object.entries(t).map(([t,e])=>({normalizedKey:this.normalizeLocaleValue(t),value:e})).filter(t=>t.normalizedKey),i=n.find(t=>t.normalizedKey===o);if(i)return i.value;const r=o.split("-")[0],s=n.find(t=>t.normalizedKey&&t.normalizedKey.split("-")[0]===r);if(s)return s.value;const a=n.find(t=>t.normalizedKey&&t.normalizedKey.startsWith(r));return a?a.value:void 0}isPlainObject(t){return"[object Object]"===Object.prototype.toString.call(t)}deepMergeConfig(t,e){if(!this.isPlainObject(e)&&!Array.isArray(e))return e;if(Array.isArray(e))return e.slice();const o=this.isPlainObject(t)?Object.assign({},t):{};return Object.keys(e||{}).forEach(t=>{const n=o[t],i=e[t];"favoriteMode"!==t&&(this.isPlainObject(n)&&this.isPlainObject(i)?o[t]=this.deepMergeConfig(n,i):this.isPlainObject(i)?o[t]=this.deepMergeConfig({},i):Array.isArray(i)?o[t]=i.slice():o[t]=i)}),o}applyLocaleOverrides(t){const e=t.locales,o=Object.assign({},t),n=this.findLocaleFromConfig(e);if(!n)return o;const i=this.deepMergeConfig(o,n);return e&&(i.locales=e),i}getSchemaDefault(t){const e=(this.currentLocale||"en").toLowerCase();if(null==t)return;const o=t=>null!=t;return void 0!==t.default&&null!==t.default&&"text"!==t.type?t.default:e.startsWith("ja")&&o(t.defaultJa)?t.defaultJa:e.startsWith("en")&&o(t.defaultEn)?t.defaultEn:o(t.default)?t.default:o(t.defaultEn)?t.defaultEn:o(t.defaultJa)?t.defaultJa:""}mergeWidgetConfig(t,e,o){const n=Object.assign({},e||{});return(t&&t.rows||[]).forEach(t=>{const e=t.slug;if(e){if(o&&Object.prototype.hasOwnProperty.call(o,e)){const i=o[e];if(!Object.prototype.hasOwnProperty.call(n,e))return void(n[e]=i);const r=n[e],s=this.getSchemaDefault(t);return void(null!=r&&""!==r&&r!==s||(n[e]=i))}Object.prototype.hasOwnProperty.call(n,e)||(n[e]=this.getSchemaDefault(t))}}),n}applyDefaults(t){const e=t||this.widgetTemplates||{};this.config.favorite=this.mergeWidgetConfig(r.schema,this.config.favorite,e.favorite),this.config.favoriteList=this.mergeWidgetConfig(s.schema,this.config.favoriteList,e["favorite-list"]),this.config.restock=this.mergeWidgetConfig(a.schema,this.config.restock,e.restock),this.config.lineRestock=this.mergeWidgetConfig((()=>{try{return o(738).schema||{rows:[]}}catch(t){return{rows:[]}}})(),this.config.lineRestock,e["line-restock"]),this.config.restockPopup=this.mergeWidgetConfig(c.schema,this.config.restockPopup,e["restock-popup"]),this.config.restockOption=this.mergeWidgetConfig(d.schema,this.config.restockOption,void 0),this.config.lineRestockPopup=this.mergeWidgetConfig(u.schema,this.config.lineRestockPopup,e["line-restock-popup"]),this.favoriteMode=this.config.favorite.favoriteMode||"product",this.favoriteKey="product"===this.favoriteMode?"products":"variants",console.log("StoreCRM: Current favorite mode: ",this.favoriteMode)}bootstrapTemplates(){return n(this,void 0,void 0,function*(){if(this.widgetTemplateLoaded)return;const t=encodeURIComponent(this.currentLocale||"en"),e=Object.entries({favorite:"favorite",restock:"restock","restock-popup":"restock-popup","line-restock":"line-restock","line-restock-popup":"line-restock-popup"}),o=yield Promise.all(e.map(e=>n(this,[e],void 0,function*([e,o]){try{const n=yield fetch(`${this.config.backendUrl}/widget/templates/${o}?locale=${t}`,{credentials:"same-origin"});if(!n.ok)return[e,void 0];return[e,(yield n.json()).template||{}]}catch(t){return console.warn("StoreCRM: Failed to load widget template",o,t),[e,void 0]}}))),i={};o.forEach(([t,e])=>{e&&(i[t]=e)}),this.widgetTemplates=i,this.applyDefaults(i),this.popupManager.config=this.config.restockPopup,this.lineRestockPopupManager.config=this.config.lineRestockPopup,this.widgetTemplateLoaded=!0})}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))}initDynamicRenderObserver(){if(this.dynamicRenderObserver||"undefined"==typeof MutationObserver)return;const t=document.body||document.documentElement;t?(this.dynamicRenderObserver=new MutationObserver(t=>{t.some(t=>Array.from(t.addedNodes).some(t=>this.isStorecrmRenderableNode(t)))&&this.scheduleDynamicRender()}),this.dynamicRenderObserver.observe(t,{childList:!0,subtree:!0})):document.addEventListener("DOMContentLoaded",()=>this.initDynamicRenderObserver(),{once:!0})}isStorecrmRenderableNode(t){if(!(t instanceof Element))return!1;const e=".storecrm-button[data-type], .storecrm-favorite, .storecrm_favoritelist";return t.matches(e)||Boolean(t.querySelector(e))}scheduleDynamicRender(t=50){void 0===this.dynamicRenderTimer&&(this.dynamicRenderTimer=window.setTimeout(()=>{this.dynamicRenderTimer=void 0,this.render(!0),this.handlePendingRestockIntent().catch(t=>{console.warn("StoreCRM: pending restock check after dynamic render failed",t)})},t))}doRender(t=!1){window.location.pathname.includes("/apps")&&window.location.pathname.endsWith("/connect")&&this.checkConnect();const e=JSON.parse(window.localStorage.getItem("storecrm_wishlist")||"{}");e.products||(e.products=[]),e.variants||(e.variants=[]),document.querySelectorAll(".storecrm-button").forEach(t=>{if(t instanceof HTMLElement==!1)return;const o=t.id||"storecrm-button-"+Math.random().toString(36).slice(-8);t.id||(t.id=o);const n=new URL(location.href),i=n.searchParams.get("variant")&&n.searchParams.get("variant"),s=t.dataset.productId,c=i||t.dataset.variantId,d=void 0!==t.dataset.variantSelector,u=JSON.parse(t.dataset.variants||"[]"),h={tags:JSON.parse(t.dataset.productTags||"[]"),id:t.dataset.productId};if(!h||!s||!c)return;const m=e&&("product"===this.favoriteMode?(0,g.containsShopifyId)(e.products,s):(0,g.containsShopifyId)(e.variants,c)),p=!!t.dataset.currentVariantAvailable,f="wishlist-button"===t.dataset.type?(0,r.render)({productId:s,variantId:c,id:o,button:t,variants:u,product:h,buttonSettings:this.config.favorite,isFavorited:m,hasVariantSelector:d}):"line-restock-button"===t.dataset.type?(0,l.render)({productId:s,variantId:c,id:o,buttonSettings:this.config.lineRestock||(0,l.generateDefaultSettings)(),isOutOfStock:p,product:h,variants:u}):(0,a.render)({productId:s,variantId:c,id:o,buttonSettings:this.config.restock,isOutOfStock:p,product:h,variants:u});f&&(t.innerHTML=f)}),this.refreshAllRestockButtonStates(),document.querySelectorAll(".storecrm-favorite").forEach(o=>{if(o instanceof HTMLElement==!1)return;if(!t&&"true"===o.dataset.isRendered)return;o.dataset.isRendered="true";const n=o.dataset.productId||"",i=o.dataset.variantId||"";if(!n)return;const s=void 0!==o.dataset.variantSelector,a=o.id||"storecrm-favorite-"+Math.random().toString(36).slice(-8);o.id||(o.id=a);const l=JSON.parse(o.dataset.variants||"[]"),c={tags:JSON.parse(o.dataset.productTags||"[]"),id:o.dataset.productId},d=e&&(0,g.containsShopifyId)(e.products,n);o.innerHTML=(0,r.render)({productId:n,variantId:i,button:o,id:a,buttonSettings:this.config.favorite,isFavorited:d,hasVariantSelector:s,variants:l,product:c})||""}),this.shouldRenderStatusWidget(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),o=window.localStorage.getItem("storecrm_token");let n=null;try{n=o?o.split("|")[1]:null}catch(t){}return this.isTokenRefreshed?(console.log("StoreCRM: Token refresh needed: false (already refreshed)"),!1):t&&o&&n?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(n)<(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)}shouldRenderStatusWidget(t){try{const e=this.normalizePathname(t);if(!e)return!1;const o=this.getAccountPathIndex(e);if(-1===o)return!1;const n=(e.split("/")[o+1]||"").toLowerCase();return!this.getExcludedAccountPages().has(n)}catch(e){return console.warn("StoreCRM: Invalid pathname for widget rendering:",t,e),!1}}getExcludedAccountPages(){return new Set(this.config.excludedAccountPages||v.DEFAULT_EXCLUDED_ACCOUNT_PAGES)}getAccountPathIndex(t){const e=this.normalizePathname(t);if(!e)return-1;const o=e.split("/"),n=(o[0]||"").toLowerCase();if("account"===n)return 0;const i=(o[1]||"").toLowerCase();return o.length>=2&&v.LOCALE_PATTERN.test(n)&&"account"===i?1:-1}normalizePathname(t){if("string"!=typeof t)throw new TypeError("Expected pathname to be a string, but received "+typeof t);return t.replace(/\/{2,}/g,"/").replace(/^\/|\/$/g,"")||null}fetchToken(){return n(this,arguments,void 0,function*(t={}){if(this.isTokenFetching)return yield new Promise(t=>{const e=Date.now(),o=setInterval(()=>{(!this.isTokenFetching||Date.now()-e>=1e4)&&(clearInterval(o),t(null))},100)}),window.localStorage.getItem("storecrm_token");this.isTokenFetching=!0;try{const e=window.localStorage.getItem("storecrm_customer_id"),o=(0,f.buildAppProxyUrl)("/token",{path:this.config.appProxyPath,name:this.config.appProxyName}),n=yield fetch(`${o}?current_customer_id=${e}`),i=(yield n.text()).match(/\[data\]([\s\S]*?)\[\/data\]/);if(!i)throw this.isTokenRefreshed=!0,new Error("No data from API");const r=JSON.parse(i[1]);if(!r||!r.customer)throw this.isTokenRefreshed=!0,new Error("No data from API2");return window.localStorage.setItem("storecrm_token",r.customer.token),window.localStorage.setItem("storecrm_customer_id",r.customer.id),this.isTokenRefreshed=!0,!1!==t.syncWishlist&&(null==e?void 0:e.startsWith("TEMP_"))&&r.customer.id!==e&&(yield this.syncWishlist(null,e)),r.customer.token}finally{this.isTokenFetching=!1}})}getToken(){return n(this,void 0,void 0,function*(){this.isTokenFetching&&(yield this.fetchToken());let t=window.localStorage.getItem("storecrm_token");return this.isValidStoreCRMToken(t)||(t=yield this.fetchToken()),t})}getCustomerId(){return n(this,void 0,void 0,function*(){return this.isTokenFetching&&(yield this.fetchToken()),window.localStorage.getItem("storecrm_customer_id")})}isValidStoreCRMToken(t){return Boolean(t&&3===t.split("|").length&&t.split("|")[2])}getShopDomainFromStoreCRMToken(t){return this.isValidStoreCRMToken(t)&&t.split("|")[2]||window.location.host}request(){return n(this,arguments,void 0,function*(t="GET",e,o=null,i=!1){const r=window.location.href,s=t=>n(this,void 0,void 0,function*(){const o=yield this.getCustomerId(),n=this.getShopDomainFromStoreCRMToken(t),i=e.includes("?")?"&":"?";return`${e}${i}customer_id=${o}&host=${n}&referrer=${encodeURIComponent(r)}`});let a=null;for(let n=0;n<=2;n++){const r=yield this.getToken();if(a=yield fetch(yield s(r),{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`},body:o?JSON.stringify(o):null,credentials:i?"include":"same-origin"}),401!==a.status||2===n)break;console.warn("StoreCRM: API request unauthorized. Refreshing token and retrying.",{url:e,retryCount:n}),yield this.fetchToken()}if(!a||!a.ok)throw new Error("API request failed"+(a?`: ${a.status}`:""));return a.json()})}toggleWishlist(t,e=!1,o=!1,n=""){o?this.fetchToken().then(()=>{var o=window.localStorage.getItem("storecrm_customer_id");o&&!/^TEMP_/.test(o)?this.doToggleWishlist(t,!e).then(()=>{}).catch(t=>{console.error(t),alert("\u30b5\u30fc\u30d0\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f\uff01 error: "+t.message+" \u3057\u3070\u3089\u304f\u305f\u3063\u3066\u304b\u3089\u518d\u5ea6\u304a\u8a66\u3057\u304f\u3060\u3055\u3044\u3002")}):window.location.href=n&&""!==n&&"undefined"!==n&&void 0!==n?n:"/account/login"}):this.doToggleWishlist(t,!e).then(()=>{}).catch(t=>{console.error(t),alert("\u30b5\u30fc\u30d0\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f\uff01 error: "+t.message+" \u3057\u3070\u3089\u304f\u305f\u3063\u3066\u304b\u3089\u518d\u5ea6\u304a\u8a66\u3057\u304f\u3060\u3055\u3044\u3002")})}syncWishlist(){return n(this,arguments,void 0,function*(t=null,e=void 0,o=!1){if(!o){const t=JSON.parse(window.localStorage.getItem("storecrm_wishlist")||"{}"),e=6e4;if(t.lastUpdated&&Date.now()-t.lastUpdated{console.error("StoreCRM Restock: click flow failed",t),this.popupManager.show(this.config.restockPopup,o.variants,o.productId)}):console.error("StoreCRM Restock: restockButton not found")}isRestockLoginRequired(){var t;return this.toBoolean(null===(t=this.config.restockOption)||void 0===t?void 0:t.require_login_for_restock)}shouldAutoRegisterRestockAfterLogin(){var t;return this.toBoolean(null===(t=this.config.restockOption)||void 0===t?void 0:t.auto_register_after_login)}shouldOneClickRestockWhenLoggedIn(){var t;return this.toBoolean(null===(t=this.config.restockOption)||void 0===t?void 0:t.one_click_when_logged_in)}shouldShowRestockRegisteredState(){var t;return this.toBoolean(null===(t=this.config.restockOption)||void 0===t?void 0:t.show_registered_status_when_logged_in)}getRestockRegistrationMode(t=[],e=""){return e||Array.isArray(t)&&t.length>1?"variant":this.favoriteMode}toBoolean(t){return!0===t||"true"===t||1===t||"1"===t}handleRestockButtonClick(t,e){return n(this,void 0,void 0,function*(){var o;const n=yield this.isLoggedInCustomer(),i=this.getCurrentRestockVariantId(e.variants),r=this.getRestockRegistrationMode(e.variants,i);if(n){if(this.shouldShowRestockRegisteredState()){const n=yield this.getRestockStatus(e.productId,i,r,!0);if(null===(o=null==n?void 0:n.email)||void 0===o?void 0:o.registered)return void this.applyRestockButtonRegisteredState("email",t,!0)}if(this.shouldOneClickRestockWhenLoggedIn())return void(yield this.registerEmailRestockOneClick(t,e,i))}if(this.isRestockLoginRequired()&&!n){const o=this.buildPendingRestockIntent(t,e);return void this.showRestockLoginRequiredModal(o)}this.popupManager.show(this.config.restockPopup,e.variants,e.productId)})}registerEmailRestockOneClick(t,e,o){return n(this,void 0,void 0,function*(){var n;const i=null===(n=window.storecrm_data)||void 0===n?void 0:n.customer_email;if(!i||!this.checkEmailFormat(i))return this.popupManager.show(this.config.restockPopup,e.variants,e.productId),void this.popupManager.failure("\u30ed\u30b0\u30a4\u30f3\u4e2d\u306e\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3092\u53d6\u5f97\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3092\u5165\u529b\u3057\u3066\u767b\u9332\u3057\u3066\u304f\u3060\u3055\u3044\u3002");try{const n=this.getRestockRegistrationMode(e.variants,o);yield this.doStoreRestock(o,e.productId,i,!1,!1,!1,n),this.shouldShowRestockRegisteredState()?(this.markRestockStatusCacheRegistered("email",e.productId,o,n),this.applyRestockButtonRegisteredState("email",t,!0),this.refreshAllRestockButtonStates(!1)):this.invalidateRestockStatusCache(e.productId,o,n),this.popupManager.show(this.config.restockPopup,e.variants,e.productId,{readOnly:!0,hideSubmitButton:!0,variantId:o,email:i}),this.popupManager.success(this.config.restockPopup.success_text)}catch(t){console.error("StoreCRM Restock: one-click registration failed",t),this.popupManager.show(this.config.restockPopup,e.variants,e.productId),this.popupManager.failure(this.config.restockPopup.error_text)}})}handleLoginRequiredRestockClick(t,e){return n(this,void 0,void 0,function*(){if(yield this.isLoggedInCustomer())return void this.popupManager.show(this.config.restockPopup,e.variants,e.productId);const o=this.buildPendingRestockIntent(t,e);this.showRestockLoginRequiredModal(o)})}buildPendingRestockIntent(t,e,o="email"){return{version:1,channel:o,product_id:String(e.productId),variant_id:this.getCurrentRestockVariantId(e.variants),pdp_url:window.location.href,button_id:t,clicked_at:(new Date).toISOString(),created_at:Date.now(),auto_register_after_login:this.shouldAutoRegisterRestockAfterLogin(),mode:this.getRestockRegistrationMode(e.variants,this.getCurrentRestockVariantId(e.variants))}}getCurrentRestockVariantId(t){const e=new URL(window.location.href).searchParams.get("variant");if(e)return String(e);const o=this.getSelectedProductFormVariantId(t);if(o)return o;const n=(t||[]).find(t=>!t.available)||(t||[])[0];return n&&n.id?String(n.id):""}getSelectedProductFormVariantId(t){if(!document||!Array.isArray(t)||0===t.length)return"";const e=new Set(t.map(t=>String(t.id))),o=['form[action*="/cart/add"] input[name="id"]','form[action*="/cart/add"] select[name="id"]','product-form input[name="id"]','product-form select[name="id"]','input[name="id"]','select[name="id"]'];for(const t of o){const o=Array.from(document.querySelectorAll(t)).find(t=>{const o=String(t.value||"");return o&&e.has(o)});if(o)return String(o.value)}return""}initRestockStateWatcher(){if(this.restockStateWatcherStarted)return;this.restockStateWatcherStarted=!0,this.lastRestockStateHref=window.location.href;const t=()=>{this.refreshAllRestockButtonStates(!1)},e=()=>{this.refreshAllRestockButtonStates(!0)},o=()=>{t(),window.setTimeout(t,60),window.setTimeout(e,250),this.checkPendingRestockIntentAfterPageReturn()},n=window.navigation;n&&n.addEventListener("navigate",()=>{o()}),this.patchHistoryForRestockStateWatcher(),window.addEventListener("storecrm:locationchange",o),window.addEventListener("popstate",o),document.addEventListener("change",t=>{this.isVariantChangeTarget(t.target)&&o()},!0),["variant:change","variant:changed","product:variant-change","shopify:section:load"].forEach(t=>{document.addEventListener(t,o)}),window.setInterval(()=>{this.lastRestockStateHref!==window.location.href&&(this.lastRestockStateHref=window.location.href,o())},1e3)}patchHistoryForRestockStateWatcher(){const t="__storecrmRestockHistoryPatched";window[t]||(window[t]=!0,["pushState","replaceState"].forEach(t=>{const e=window.history[t];window.history[t]=(...t)=>{const o=e.apply(window.history,t);return window.dispatchEvent(new Event("storecrm:locationchange")),o}}))}isVariantChangeTarget(t){if(!(t instanceof HTMLElement))return!1;if(t.matches('input[name="id"], select[name="id"]'))return!0;const e=t.name||t.getAttribute("name")||"";return!!/options?\[|option-|variant/i.test(e)||Boolean(t.closest('variant-selects, variant-radios, product-form, .product-form, [data-product-form], [data-section*="product"]')&&t.matches("input, select"))}refreshAllRestockButtonStates(t=!1){"undefined"!=typeof document&&document.querySelectorAll(".storecrm-button").forEach(e=>{if(!(e instanceof HTMLElement))return;const o=e.id;if(o)try{if("restock-button"===e.dataset.type){const e=a.RestockButton.getInstance(o);this.refreshRestockButtonState("email",o,e.productId,e.variants,this.getRestockRegistrationMode(e.variants,this.getCurrentRestockVariantId(e.variants)),t)}else if("line-restock-button"===e.dataset.type){const e=l.LineRestockButton.getInstance(o);this.refreshRestockButtonState("line",o,e.productId,e.variants,this.getRestockRegistrationMode(e.variants,this.getCurrentRestockVariantId(e.variants)),t)}}catch(t){}})}refreshRestockButtonState(t,e,o,i,r){return n(this,arguments,void 0,function*(t,e,o,n,i,r=!1){let s="";try{if(s=this.prepareRestockButtonStateRefresh(t,e,o,n,i),!this.shouldApplyRestockRegisteredState())return this.applyRestockButtonLoadingState(t,e,!1),void this.applyRestockButtonRegisteredState(t,e,!1);const a=this.getFreshCachedRestockStatus(o,s,i);if(a&&(this.applyRestockButtonLoadingState(t,e,!1),this.applyRestockButtonRegisteredState(t,e,this.isRestockStatusRegistered(t,o,s,i,a)),!r))return;const l=yield this.isLoggedInCustomer(),c=this.getCurrentRestockVariantId(n);if(c!==s)return void this.refreshRestockButtonState(t,e,o,n,this.getRestockRegistrationMode(n,c),!0);if(!l)return this.applyRestockButtonLoadingState(t,e,!1),void this.applyRestockButtonRegisteredState(t,e,!1);const d=yield this.getRestockStatus(o,s,i,r),u=this.getCurrentRestockVariantId(n);if(u!==s)return void this.refreshRestockButtonState(t,e,o,n,this.getRestockRegistrationMode(n,u),!0);this.applyRestockButtonLoadingState(t,e,!1),this.applyRestockButtonRegisteredState(t,e,this.isRestockStatusRegistered(t,o,s,i,d))}catch(o){s&&this.getCurrentRestockVariantId(n)===s&&this.applyRestockButtonLoadingState(t,e,!1),console.warn("StoreCRM Restock: failed to refresh registration status",o)}})}prepareRestockButtonStateRefresh(t,e,o,n,i){const r=this.getCurrentRestockVariantId(n),s=`${t}:${e}`,a=this.restockButtonVariantByKey.get(s),l=Boolean(a&&a!==r);l&&this.applyRestockButtonRegisteredState(t,e,!1),this.restockButtonVariantByKey.set(s,r);return this.getFreshCachedRestockStatus(o,r,i)?this.applyRestockButtonLoadingState(t,e,!1):l&&(this.applyRestockButtonRegisteredState(t,e,!1),this.applyRestockButtonLoadingState(t,e,!0)),r}getRestockStatusCacheKey(t,e,o){return`${o}:${t}:${e||""}`}getOptimisticRestockRegisteredKey(t,e,o,n){return`${t}:${this.getRestockStatusCacheKey(e,o,n)}`}isOptimisticRestockRegistered(t,e,o,n){const i=this.getOptimisticRestockRegisteredKey(t,e,o,n),r=this.optimisticRestockRegistered.get(i);return!!r&&(!(Date.now()-r>=3e4)||(this.optimisticRestockRegistered.delete(i),!1))}isRestockStatusRegistered(t,e,o,n,i){var r;return Boolean(null===(r=null==i?void 0:i[t])||void 0===r?void 0:r.registered)||this.isOptimisticRestockRegistered(t,e,o,n)}shouldApplyRestockRegisteredState(){return this.shouldShowRestockRegisteredState()}getFreshCachedRestockStatus(t,e,o){const n=this.restockStatusCache.get(this.getRestockStatusCacheKey(t,e,o));return!n||Date.now()-n.fetchedAt>=3e4?null:n.value}invalidateRestockStatusCache(t,e,o){this.restockStatusCache.delete(this.getRestockStatusCacheKey(t,e,o))}markRestockStatusCacheRegistered(t,e,o,n){this.optimisticRestockRegistered.set(this.getOptimisticRestockRegisteredKey(t,e,o,n),Date.now());const i=this.getFreshCachedRestockStatus(e,o,n)||{mode:n,product_id:e,variant_id:o||null,email:{registered:!1,customer_restock_id:null},line:{registered:!1,customer_restock_id:null,line_connected:!1}};i[t]=Object.assign(Object.assign({},i[t]),{registered:!0}),this.restockStatusCache.set(this.getRestockStatusCacheKey(e,o,n),{value:i,fetchedAt:Date.now()})}getRestockStatus(t,e,o){return n(this,arguments,void 0,function*(t,e,o,n=!1){var i;if(!t||"variant"===o&&!e)return null;const r=this.getRestockStatusCacheKey(t,e,o),s=this.getFreshCachedRestockStatus(t,e,o);if(!n&&s)return s;const a=this.restockStatusRequests.get(r);if(a)return a;const l=new URLSearchParams({product_id:t,mode:o});e&&l.set("variant_id",e);const c=null===(i=window.storecrm_data)||void 0===i?void 0:i.customer_email;c&&this.checkEmailFormat(c)&&l.set("email",c);const d=this.request("GET",`${this.config.backendUrl}/frontend/restock/status?${l.toString()}`).then(t=>(this.restockStatusCache.set(r,{value:t,fetchedAt:Date.now()}),t)).catch(t=>(console.warn("StoreCRM Restock: status request failed",t),null)).finally(()=>{this.restockStatusRequests.delete(r)});return this.restockStatusRequests.set(r,d),d})}getRestockButtonSettings(t){return"line"===t?this.config.lineRestock||{}:this.config.restock||{}}getNonEmptyRestockButtonSetting(t,e){var o;const n=null===(o=this.getRestockButtonSettings(t))||void 0===o?void 0:o[e];return"string"==typeof n&&""!==n.trim()?n:void 0}getRegisteredRestockButtonText(t){const e=this.getNonEmptyRestockButtonSetting(t,"registered_button_text");return e||(/^ja\b/i.test(this.currentLocale||"")?"\u767b\u9332\u6e08\u307f":"Registered")}getRegisteredRestockButtonOpacity(t){var e;const o=null===(e=this.getRestockButtonSettings(t))||void 0===e?void 0:e.registered_button_opacity,n="number"==typeof o?o:parseFloat(String(null!=o?o:""));return Number.isFinite(n)?String(Math.min(1,Math.max(.3,n))):"0.55"}getRestockButtonLoadingLabel(){return/^ja\b/i.test(this.currentLocale||"")?"\u78ba\u8a8d\u4e2d":"Checking"}ensureRestockLoadingStyle(){if(document.getElementById(v.RESTOCK_LOADING_STYLE_ID))return;const t=document.createElement("style");t.id=v.RESTOCK_LOADING_STYLE_ID,t.textContent="\n @keyframes storecrm-restock-spin {\n to { transform: rotate(360deg); }\n }\n .storecrm-restock-loading {\n position: relative;\n }\n .storecrm-restock-loading-spinner {\n width: 1.15em;\n height: 1.15em;\n border: 2px solid currentColor;\n border-top-color: transparent;\n border-radius: 999px;\n display: inline-block;\n animation: storecrm-restock-spin 0.75s linear infinite;\n }\n .storecrm-restock-loading-label {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n }\n ",(document.head||document.body||document.documentElement).appendChild(t)}getRestockButtonLoadingHtml(){return`${this.getRestockButtonLoadingLabel()}`}rememberRestockButtonInlineStyles(t){"true"!==t.dataset.storecrmOriginalStyleSaved&&(t.dataset.storecrmOriginalStyleSaved="true",t.dataset.storecrmOriginalColor=t.style.color||"",t.dataset.storecrmOriginalBackgroundColor=t.style.backgroundColor||"",t.dataset.storecrmOriginalBorderColor=t.style.borderColor||"",t.dataset.storecrmOriginalOpacity=t.style.opacity||"",t.dataset.storecrmOriginalCursor=t.style.cursor||"",t.dataset.storecrmOriginalMinWidth=t.style.minWidth||"")}restoreRestockButtonInlineStyles(t){t.style.color=t.dataset.storecrmOriginalColor||"",t.style.backgroundColor=t.dataset.storecrmOriginalBackgroundColor||"",t.style.borderColor=t.dataset.storecrmOriginalBorderColor||"",t.style.opacity=t.dataset.storecrmOriginalOpacity||"",t.style.cursor=t.dataset.storecrmOriginalCursor||"",t.style.minWidth=t.dataset.storecrmOriginalMinWidth||"",delete t.dataset.storecrmOriginalStyleSaved,delete t.dataset.storecrmOriginalColor,delete t.dataset.storecrmOriginalBackgroundColor,delete t.dataset.storecrmOriginalBorderColor,delete t.dataset.storecrmOriginalOpacity,delete t.dataset.storecrmOriginalCursor,delete t.dataset.storecrmOriginalMinWidth}escapeCssIdentifier(t){return String(t).replace(/([^\w-])/g,"\\$1")}getRestockButtonSelector(t,e){return`.${"line"===t?"storecrm-line-restock":"storecrm-restock"}-${this.escapeCssIdentifier(e)}`}applyRestockButtonLoadingState(t,e,o){const n=this.getRestockButtonSelector(t,e);document.querySelectorAll(n).forEach(t=>{if(t instanceof HTMLButtonElement){if(t.dataset.storecrmOriginalText||(t.dataset.storecrmOriginalText=t.textContent||""),o)return this.ensureRestockLoadingStyle(),this.rememberRestockButtonInlineStyles(t),t.dataset.storecrmRestockLoading="true",t.dataset.storecrmRestockOriginalHtml||(t.dataset.storecrmRestockOriginalHtml=t.innerHTML),t.offsetWidth>0&&(t.style.minWidth=`${t.offsetWidth}px`),t.innerHTML=this.getRestockButtonLoadingHtml(),t.setAttribute("disabled","disabled"),t.setAttribute("aria-disabled","true"),t.setAttribute("aria-busy","true"),t.classList.add("storecrm-restock-loading"),void(t.style.cursor="progress");"true"===t.dataset.storecrmRestockLoading&&(t.removeAttribute("aria-busy"),t.classList.remove("storecrm-restock-loading"),delete t.dataset.storecrmRestockLoading,"true"!==t.dataset.storecrmRegistered&&(t.removeAttribute("disabled"),t.removeAttribute("aria-disabled"),t.innerHTML=t.dataset.storecrmRestockOriginalHtml||t.dataset.storecrmOriginalText||t.innerHTML||"",this.restoreRestockButtonInlineStyles(t)),delete t.dataset.storecrmRestockOriginalHtml)}})}applyRestockButtonRegisteredState(t,e,o){const n=this.getRestockButtonSelector(t,e);document.querySelectorAll(n).forEach(e=>{if(e instanceof HTMLButtonElement){if(e.dataset.storecrmOriginalText||(e.dataset.storecrmOriginalText=e.textContent||""),o)return this.rememberRestockButtonInlineStyles(e),e.dataset.storecrmStateDisabled="true",e.dataset.storecrmRegistered="true",e.textContent=this.getRegisteredRestockButtonText(t),e.setAttribute("disabled","disabled"),e.setAttribute("aria-disabled","true"),e.classList.add("storecrm-restock-registered"),e.style.color=this.getNonEmptyRestockButtonSetting(t,"registered_button_color")||e.style.color,e.style.backgroundColor=this.getNonEmptyRestockButtonSetting(t,"registered_button_background_color")||e.style.backgroundColor,e.style.borderColor=this.getNonEmptyRestockButtonSetting(t,"registered_button_border_color")||e.style.borderColor,e.style.opacity=this.getRegisteredRestockButtonOpacity(t),void(e.style.cursor="not-allowed");"true"===e.dataset.storecrmStateDisabled&&(e.removeAttribute("disabled"),e.removeAttribute("aria-disabled"),e.classList.remove("storecrm-restock-registered"),e.textContent=e.dataset.storecrmOriginalText||e.textContent||"",delete e.dataset.storecrmStateDisabled,delete e.dataset.storecrmRegistered,this.restoreRestockButtonInlineStyles(e))}})}buildGuestRestockRedirectUrl(t){var e;const o=null===(e=this.config.restockOption)||void 0===e?void 0:e.guest_redirect_url;if(this.isNonEmptyOption(o))return this.buildConfiguredGuestRestockRedirectUrl(o,t);const n=this.toGuestRestockReturnPath(t);try{const t=new URL(this.getStoreAccountLoginUrl(),window.location.origin);return t.searchParams.set(this.getGuestRestockReturnParamName(t),n),t.origin===window.location.origin?`${t.pathname}${t.search}${t.hash}`:t.toString()}catch(t){return`/account/login?return_url=${encodeURIComponent(n)}`}}buildConfiguredGuestRestockRedirectUrl(t,e){const o=this.toGuestRestockReturnPath(e);try{const e=new URL(t,window.location.origin);return e.searchParams.set(this.getConfiguredGuestRestockReturnParamName(e),o),e.origin===window.location.origin?`${e.pathname}${e.search}${e.hash}`:e.toString()}catch(e){return t.trim()}}getConfiguredGuestRestockReturnParamName(t){return t.searchParams.has("return_to")||t.pathname.includes("/customer_authentication/login")?"return_to":"return_url"}getStoreAccountLoginUrl(){var t,e;const o=null===(t=window.storecrm_data)||void 0===t?void 0:t.account_login_url,n=null===(e=window.storecrm_data)||void 0===e?void 0:e.storefront_login_url;return this.isNewCustomerAccountsStore()?this.isNonEmptyOption(n)?n:this.isNonEmptyOption(o)?o:"/account/login":this.isNonEmptyOption(o)?o:this.isNonEmptyOption(n)?n:"/account/login"}isNewCustomerAccountsStore(){const t=this.config.shopifyCustomerAccountsIsClassic;if(!1===t||"false"===t||"0"===t)return!0;const e=String(this.config.shopifyCustomerAccountsVersion||"").toUpperCase();return"NEW"===e||"NEW_CUSTOMER_ACCOUNTS"===e}getGuestRestockReturnParamName(t){return t.searchParams.has("return_to")||t.pathname.includes("/customer_authentication/login")?"return_to":"return_url"}isNonEmptyOption(t){return"string"==typeof t&&""!==t.trim()&&"undefined"!==t}toGuestRestockReturnPath(t){try{const e=new URL(t,window.location.origin);return e.origin===window.location.origin||/(^|\/)products\//.test(e.pathname)?`${e.pathname}${e.search}${e.hash}`:e.toString()}catch(t){return window.location.pathname+window.location.search+window.location.hash}}setPendingRestockIntent(t){window.localStorage.setItem(v.PENDING_RESTOCK_INTENT_KEY,JSON.stringify(t))}getPendingRestockIntent(){const t=window.localStorage.getItem(v.PENDING_RESTOCK_INTENT_KEY);if(!t)return null;try{const e=JSON.parse(t);return e&&e.product_id&&e.pdp_url&&e.created_at?Object.assign(Object.assign({},e),{channel:"line"===e.channel?"line":"email"}):(this.clearPendingRestockIntent(),null)}catch(t){return this.clearPendingRestockIntent(),null}}clearPendingRestockIntent(){this.clearPendingRestockRetryTimer(),this.pendingLineRestockConnectRedirectStarted=!1,this.pendingLineConnectResultDetected=!1,this.pendingLineProfileFromConnectReturn=void 0,this.lineRestockPopupManager.clearStoredLineProfile(),window.localStorage.removeItem(v.PENDING_RESTOCK_INTENT_KEY)}getPendingRestockVariants(t){return t.variant_id?[{id:t.variant_id,title:"",available:!1}]:[]}getUrlWithoutLineConnectResultParams(t,e=!1){const o=new URL(t);return o.searchParams.delete("line_connect"),o.searchParams.delete("line_login_error"),e&&o.searchParams.delete("line_profile_data"),o.toString()}removeLineConnectResultParamsFromUrl(t=!1){try{const e=window.location.href,o=this.getUrlWithoutLineConnectResultParams(e,t);o!==e&&window.history.replaceState({},"",o)}catch(t){console.warn("StoreCRM LineRestock: failed to clean LINE connect params",t)}}hasLineConnectResultParams(){try{const t=new URL(window.location.href);return t.searchParams.has("line_connect")||t.searchParams.has("line_profile_data")||t.searchParams.has("line_login_error")}catch(t){return!1}}captureLineConnectResultFromUrl(t=!1){if(!this.hasLineConnectResultParams())return void(t&&this.lineRestockPopupManager.clearStoredLineProfile());let e;try{e=this.lineRestockPopupManager.consumeLineProfileFromURL(),e||this.lineRestockPopupManager.clearStoredLineProfile()}catch(t){console.warn("StoreCRM LineRestock: failed to preserve LINE connect profile",t),this.lineRestockPopupManager.clearStoredLineProfile()}finally{this.pendingLineConnectResultDetected=!0,this.pendingLineProfileFromConnectReturn=e,this.pendingLineRestockConnectRedirectStarted=!1,this.removeLineConnectResultParamsFromUrl(!0)}}clearPendingRestockRetryTimer(){void 0!==this.pendingRestockRetryTimer&&(window.clearTimeout(this.pendingRestockRetryTimer),this.pendingRestockRetryTimer=void 0),this.pendingRestockRetryAttempts=0}schedulePendingRestockIntentRetry(t=600){void 0===this.pendingRestockRetryTimer&&(this.pendingRestockRetryAttempts>=v.PENDING_RESTOCK_RETRY_LIMIT||(this.pendingRestockRetryAttempts+=1,this.pendingRestockRetryTimer=window.setTimeout(()=>{this.pendingRestockRetryTimer=void 0,this.handlePendingRestockIntent().catch(t=>{console.warn("StoreCRM: pending restock retry failed",t)})},t)))}checkPendingRestockIntentAfterPageReturn(){this.getPendingRestockIntent()&&this.handlePendingRestockIntent().catch(t=>{console.warn("StoreCRM: pending restock check after page return failed",t)})}showRestockLoginRequiredModal(t){this.pendingRestockLoginIntent=t,this.clearPendingRestockIntent();const e=this.ensureRestockLoginRequiredModal();if(!e)return this.setPendingRestockIntent(t),void(window.location.href=this.buildGuestRestockRedirectUrl(t.pdp_url));e.classList.add("is-open"),e.setAttribute("aria-hidden","false"),void 0===this.restockLoginRequiredPreviousOverflow&&(this.restockLoginRequiredPreviousOverflow=document.documentElement.style.overflow),document.documentElement.style.overflow="hidden";const o=e.querySelector('[data-storecrm-restock-login-action="login"]');null==o||o.focus()}hideRestockLoginRequiredModal(){const t=document.getElementById(v.RESTOCK_LOGIN_REQUIRED_MODAL_ID);t&&(t.classList.remove("is-open"),t.setAttribute("aria-hidden","true"),document.documentElement.style.overflow=this.restockLoginRequiredPreviousOverflow||"",this.restockLoginRequiredPreviousOverflow=void 0)}ensureRestockLoginRequiredModal(){if(!document||!document.body)return null;let t=document.getElementById(v.RESTOCK_LOGIN_REQUIRED_MODAL_ID);return t||(document.body.insertAdjacentHTML("beforeend",``),t=document.getElementById(v.RESTOCK_LOGIN_REQUIRED_MODAL_ID),this.bindRestockLoginRequiredModal(t)),t&&this.applyRestockLoginRequiredModalSettings(t),t}bindRestockLoginRequiredModal(t){t&&"true"!==t.dataset.storecrmBound&&(t.dataset.storecrmBound="true",t.addEventListener("click",t=>{var e;const o=t.target,n=null===(e=null==o?void 0:o.closest("[data-storecrm-restock-login-action]"))||void 0===e?void 0:e.getAttribute("data-storecrm-restock-login-action");if(n){if("login"===n){t.preventDefault();const e=this.pendingRestockLoginIntent;return e?(this.setPendingRestockIntent(e),this.hideRestockLoginRequiredModal(),void(window.location.href=this.buildGuestRestockRedirectUrl(e.pdp_url))):void this.hideRestockLoginRequiredModal()}t.preventDefault(),this.pendingRestockLoginIntent=void 0,this.clearPendingRestockIntent(),this.hideRestockLoginRequiredModal()}}))}getRestockLoginRequiredCopy(){const t=/^ja\b/i.test(this.currentLocale||"")?{title:"\u30ed\u30b0\u30a4\u30f3\u304c\u5fc5\u8981\u3067\u3059",description:"\u518d\u5165\u8377\u901a\u77e5\u3092\u53d7\u3051\u53d6\u308b\u306b\u306f\u30ed\u30b0\u30a4\u30f3\u304c\u5fc5\u8981\u3067\u3059\u3002",login:"\u30ed\u30b0\u30a4\u30f3",cancel:"\u30ad\u30e3\u30f3\u30bb\u30eb"}:{title:"Login required",description:"Please log in to receive restock notifications.",login:"Login",cancel:"Cancel"};return{title:this.getRestockLoginRequiredTextOption("login_required_modal_title",t.title),description:this.getRestockLoginRequiredTextOption("login_required_modal_description",t.description),login:this.getRestockLoginRequiredTextOption("login_required_modal_login_button_text",t.login),cancel:this.getRestockLoginRequiredTextOption("login_required_modal_cancel_button_text",t.cancel)}}getRestockLoginRequiredTextOption(t,e){var o;const n=null===(o=this.config.restockOption)||void 0===o?void 0:o[t];return this.isNonEmptyOption(n)?n:e}getRestockLoginRequiredColorOption(t,e){var o;const n=null===(o=this.config.restockOption)||void 0===o?void 0:o[t];return this.isNonEmptyOption(n)?n:e}getRestockLoginRequiredNumberOption(t,e,o,n){var i;const r=null===(i=this.config.restockOption)||void 0===i?void 0:i[t],s="number"==typeof r?r:Number.parseFloat(r);return Number.isFinite(s)?Math.min(n,Math.max(o,s)):e}applyRestockLoginRequiredModalSettings(t){const e=this.getRestockLoginRequiredCopy(),o=t.querySelector(".storecrm_modal__overlay"),n=t.querySelector(".storecrm_modal__container"),i=t.querySelector("#storecrm-restock-login-required-title"),r=t.querySelector("#storecrm-restock-login-required-content"),s=t.querySelector(".storecrm_login_required_login"),a=t.querySelector(".storecrm_login_required_cancel");i&&(i.textContent=e.title),r&&(r.textContent=e.description),s&&(s.textContent=e.login),a&&(a.textContent=e.cancel);const l=this.getRestockLoginRequiredColorOption("login_required_modal_overlay_color","#000000"),c=this.getRestockLoginRequiredNumberOption("login_required_modal_overlay_opacity",55,0,90),d=this.getRestockLoginRequiredColorOption("login_required_modal_text_color","#111111"),u=this.getRestockLoginRequiredNumberOption("login_required_modal_width",576,320,720),h=this.getRestockLoginRequiredNumberOption("login_required_modal_radius",2,0,24),m=this.getRestockLoginRequiredNumberOption("login_required_modal_button_radius",32,0,40),p=this.getRestockLoginRequiredColorOption("login_required_modal_login_button_background_color","#000000"),g=this.getRestockLoginRequiredColorOption("login_required_modal_login_button_text_color","#ffffff"),f=this.getRestockLoginRequiredColorOption("login_required_modal_cancel_button_background_color","#ffffff"),_=this.getRestockLoginRequiredColorOption("login_required_modal_cancel_button_text_color","#111111"),v=this.getRestockLoginRequiredColorOption("login_required_modal_cancel_button_border_color","#111111");o&&(o.style.backgroundColor=this.toRgba(l,c/100)),n&&(n.style.backgroundColor=this.getRestockLoginRequiredColorOption("login_required_modal_background_color","#ffffff"),n.style.color=d,n.style.width=`${u}px`,n.style.maxWidth="100%",n.style.borderRadius=`${h}px`),i&&(i.style.color=d),r&&(r.style.color=d),s&&(s.style.backgroundColor=p,s.style.borderColor=p,s.style.color=g,s.style.borderRadius=`${m}px`),a&&(a.style.backgroundColor=f,a.style.borderColor=v,a.style.color=_,a.style.borderRadius=`${m}px`)}toRgba(t,e){const o=Math.min(1,Math.max(0,e)),n=t.trim(),i=n.match(/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i),r=n.match(/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i);if(i){const[,t,e,n]=i;return`rgba(${parseInt(t+t,16)}, ${parseInt(e+e,16)}, ${parseInt(n+n,16)}, ${o})`}if(r){const[,t,e,n]=r;return`rgba(${parseInt(t,16)}, ${parseInt(e,16)}, ${parseInt(n,16)}, ${o})`}return`rgba(0, 0, 0, ${o})`}isPendingRestockIntentExpired(t){return!t.created_at||Date.now()-t.created_at>v.PENDING_RESTOCK_INTENT_TTL_MS}isLoggedInCustomer(){return n(this,void 0,void 0,function*(){const t=(this.getCurrentShopifyCustomerId()||"").toString();if(!t)return!1;let e=(window.localStorage.getItem("storecrm_customer_id")||"").toString();if(!e||/^TEMP_/.test(e)||e!==t){try{yield this.fetchToken({syncWishlist:!1})}catch(t){console.warn("StoreCRM: failed to refresh token for restock login check",t)}e=(window.localStorage.getItem("storecrm_customer_id")||"").toString()}return!!e&&!/^TEMP_/.test(e)&&e===t})}isCurrentPageSameAsPendingPdp(t){try{const e=new URL(window.location.href,window.location.origin),o=new URL(t.pdp_url,window.location.origin);return e.origin===o.origin&&e.pathname===o.pathname&&("line"===t.channel&&(e.searchParams.delete("line_connect"),e.searchParams.delete("line_profile_data"),e.searchParams.delete("line_login_error")),e.search===o.search)}catch(t){return!1}}isAccountPage(){return-1!==this.getAccountPathIndex(window.location.pathname)}showPendingRestockPopup(t,e={}){this.popupManager.show(this.config.restockPopup,this.getPendingRestockVariants(t),t.product_id,e)}showPendingLineRestockPopup(t,e){this.lineRestockPopupManager.show(this.config.lineRestockPopup,this.getPendingRestockVariants(t),t.product_id,e,{buttonId:t.button_id,variantId:t.variant_id})}handlePendingRestockIntent(){return n(this,void 0,void 0,function*(){var t;if(this.pendingRestockIntentProcessing)return;this.captureLineConnectResultFromUrl();const e=this.pendingLineConnectResultDetected,o=this.pendingLineProfileFromConnectReturn,n=this.getPendingRestockIntent();if(n)if(this.isPendingRestockIntentExpired(n))this.clearPendingRestockIntent();else{this.pendingRestockIntentProcessing=!0;try{const i=yield this.isLoggedInCustomer(),r="line"!==n.channel||this.isRestockLoginRequired();if(!i&&r)return void(this.isAccountPage()||this.schedulePendingRestockIntentRetry());if(!this.isCurrentPageSameAsPendingPdp(n))return void(window.location.href=n.pdp_url);if("line"===n.channel)return void(yield this.handlePendingLineRestockIntent(n,e,o));if(!n.auto_register_after_login)return void this.clearPendingRestockIntent();const s=null===(t=window.storecrm_data)||void 0===t?void 0:t.customer_email;if(this.clearPendingRestockIntent(),!s||!this.checkEmailFormat(s))return this.showPendingRestockPopup(n),void this.popupManager.failure("\u30ed\u30b0\u30a4\u30f3\u4e2d\u306e\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3092\u53d6\u5f97\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002\u518d\u5165\u8377\u901a\u77e5\u30dc\u30bf\u30f3\u304b\u3089\u3082\u3046\u4e00\u5ea6\u767b\u9332\u3057\u3066\u304f\u3060\u3055\u3044\u3002");yield this.doStoreRestock(n.variant_id,n.product_id,s,!1,!1,!1,n.mode),this.shouldShowRestockRegisteredState()?(this.markRestockStatusCacheRegistered("email",n.product_id,n.variant_id,n.mode),n.button_id&&this.applyRestockButtonRegisteredState("email",n.button_id,!0),this.refreshAllRestockButtonStates(!1)):this.invalidateRestockStatusCache(n.product_id,n.variant_id,n.mode),this.showPendingRestockPopup(n,{readOnly:!0,hideSubmitButton:!0,variantId:n.variant_id,email:s}),this.popupManager.success(this.config.restockPopup.success_text)}catch(t){if(this.clearPendingRestockIntent(),console.error("StoreCRM: pending restock auto registration failed",t),n){if("line"===n.channel)return this.showPendingLineRestockPopup(n),void this.lineRestockPopupManager.failure(this.config.lineRestockPopup.error_text);this.showPendingRestockPopup(n)}this.popupManager.failure(this.config.restockPopup.error_text)}finally{this.pendingRestockIntentProcessing=!1}}})}handlePendingLineRestockIntent(t,e,o){return n(this,void 0,void 0,function*(){var n,i;const r=yield this.getRestockStatus(t.product_id,t.variant_id,t.mode,!0);if(null===(n=null==r?void 0:r.line)||void 0===n?void 0:n.registered)return this.clearPendingRestockIntent(),this.removeLineConnectResultParamsFromUrl(!0),this.markRestockStatusCacheRegistered("line",t.product_id,t.variant_id,t.mode),t.button_id&&this.applyRestockButtonRegisteredState("line",t.button_id,!0),void this.refreshAllRestockButtonStates(!1);const s=o||(yield this.tryGetLineProfile());if(!(null==s?void 0:s.line_customer_id)&&!(null===(i=null==r?void 0:r.line)||void 0===i?void 0:i.line_connected)){if(!e){if(this.pendingLineRestockConnectRedirectStarted)return;if(t.line_connect_started_at)return this.clearPendingRestockIntent(),void this.showPendingLineRestockPopup(t,s);this.pendingLineRestockConnectRedirectStarted=!0,this.setPendingRestockIntent(Object.assign(Object.assign({},t),{line_connect_started_at:Date.now()}));try{yield this.doLineSubscribe()}catch(t){throw this.pendingLineRestockConnectRedirectStarted=!1,t}return}return this.clearPendingRestockIntent(),void this.showPendingLineRestockPopup(t,s)}if(this.clearPendingRestockIntent(),!t.auto_register_after_login)return this.removeLineConnectResultParamsFromUrl(!0),void this.showPendingLineRestockPopup(t,s);yield this.registerLineRestockOneClick(t.button_id,t.product_id,this.getPendingRestockVariants(t),t.variant_id,t.mode,s),this.removeLineConnectResultParamsFromUrl(!0)})}registerLineRestockOneClick(t,e,o,i,r,s){return n(this,void 0,void 0,function*(){const n=Boolean(null==s?void 0:s.line_customer_id)||Boolean(null==s?void 0:s.display_name)||Boolean(null==s?void 0:s.picture_url);yield this.doStoreLineRestock(e,i,(null==s?void 0:s.line_customer_id)||"",(null==s?void 0:s.display_name)||"",n?JSON.stringify(s):"",r),this.shouldShowRestockRegisteredState()?(this.markRestockStatusCacheRegistered("line",e,i,r),t&&this.applyRestockButtonRegisteredState("line",t,!0),this.refreshAllRestockButtonStates(!1)):this.invalidateRestockStatusCache(e,i,r),this.lineRestockPopupManager.show(this.config.lineRestockPopup,o,e,s,{readOnly:!0,hideSubmitButton:!0,variantId:i}),this.lineRestockPopupManager.success(this.config.lineRestockPopup.success_text)})}showLineRestockPopup(t){return n(this,void 0,void 0,function*(){var e,o,n;const i=l.LineRestockButton.getInstance(t);if(!i)return void console.error("StoreCRM LineRestock: lineRestockButton not found");const r=yield this.isLoggedInCustomer(),s=this.getCurrentRestockVariantId(i.variants),a=this.getRestockRegistrationMode(i.variants,s),c=this.buildPendingRestockIntent(t,i,"line");if(this.isRestockLoginRequired()&&!r)return void this.showRestockLoginRequiredModal(c);let d,u=!1,h=null;if(r){if((this.shouldShowRestockRegisteredState()||this.shouldOneClickRestockWhenLoggedIn()||this.shouldAutoRegisterRestockAfterLogin())&&(h=yield this.getRestockStatus(i.productId,s,a,!0)),this.shouldShowRestockRegisteredState()&&(null===(e=null==h?void 0:h.line)||void 0===e?void 0:e.registered))return void this.applyRestockButtonRegisteredState("line",t,!0);if(this.shouldOneClickRestockWhenLoggedIn()){const e=yield this.tryGetLineProfile();if(d=e,u=!0,(null==e?void 0:e.line_customer_id)||(null===(o=null==h?void 0:h.line)||void 0===o?void 0:o.line_connected))try{return void(yield this.registerLineRestockOneClick(t,i.productId,i.variants,s,a,e))}catch(o){return console.error("StoreCRM LineRestock: one-click registration failed",o),this.lineRestockPopupManager.show(this.config.lineRestockPopup,i.variants,i.productId,e,{buttonId:t,variantId:s}),void this.lineRestockPopupManager.failure(this.config.lineRestockPopup.error_text)}}}if(null===(n=window.storecrm_data)||void 0===n?void 0:n.customer_id){const e=u?d:yield this.tryGetLineProfile();this.lineRestockPopupManager.show(this.config.lineRestockPopup,i.variants,i.productId,e,{buttonId:t,variantId:s})}else this.lineRestockPopupManager.show(this.config.lineRestockPopup,i.variants,i.productId,void 0,{buttonId:t,variantId:s})})}startLineRestockConnectFromPopup(t){return n(this,arguments,void 0,function*(t,e=[],o={}){if(!t)throw new Error("StoreCRM LineRestock: productId is required");this.pendingLineConnectResultDetected=!1,this.pendingLineProfileFromConnectReturn=void 0,this.lineRestockPopupManager.clearStoredLineProfile();let n=window.location.href;try{n=this.getUrlWithoutLineConnectResultParams(window.location.href,!0)}catch(t){console.warn("StoreCRM LineRestock: failed to sanitize pending restock URL",t)}this.removeLineConnectResultParamsFromUrl(!0);const i=o.variantId||this.getCurrentRestockVariantId(e),r=this.getRestockRegistrationMode(e,i),s={version:1,channel:"line",product_id:t,variant_id:i,pdp_url:n,button_id:o.buttonId,clicked_at:(new Date).toISOString(),created_at:Date.now(),line_connect_started_at:Date.now(),auto_register_after_login:this.shouldOneClickRestockWhenLoggedIn(),mode:r};this.setPendingRestockIntent(s),this.pendingLineRestockConnectRedirectStarted=!0;try{yield this.doLineSubscribe()}catch(t){throw this.clearPendingRestockIntent(),t}})}tryGetLineProfile(){return n(this,void 0,void 0,function*(){try{return yield this.doGetLineProfile()}catch(t){return void console.warn("StoreCRM LineRestock: failed to get LINE profile",t)}})}storeRestock(t,e,o,n,i,r,s=void 0,a=void 0){if(!this.checkEmailFormat(t))return a&&a("\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u304c\u6b63\u3057\u304f\u3042\u308a\u307e\u305b\u3093\u3002");const l=this.getRestockRegistrationMode([],e);this.doStoreRestock(e,o,t,i,n,r,l).then(()=>{this.invalidateRestockStatusCache(o,e,l),this.refreshAllRestockButtonStates(!0),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,o,i,r,s){return n(this,arguments,void 0,function*(t,e,o,n,i,r,s=this.favoriteMode){var a,l;if(n)try{const t=(null===(a=this.config.restockPopup)||void 0===a?void 0:a.create_shopify_customer)||!1,e=t&&(null===(l=this.config.restockPopup)||void 0===l?void 0:l.create_shopify_customer_tags)||void 0;yield this.doUpsertCustomerAcceptsMarketing(o,i,r,e,t)}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:o,mode:s})})}storeLineRestock(t,e,o,n,i,r=void 0,s=void 0){const a=this.getRestockRegistrationMode([],e);this.doStoreLineRestock(t,e,o,n,i,a).then(()=>{this.invalidateRestockStatusCache(t,e,a),this.refreshAllRestockButtonStates(!0),r&&r(this.config.lineRestockPopup.success_text)}).catch(t=>{console.error("StoreCRM: API call failed:",t),s&&s(this.config.lineRestockPopup.error_text)})}doStoreLineRestock(t,e,o,i,r){return n(this,arguments,void 0,function*(t,e,o,n,i,r=this.favoriteMode){return yield this.request("POST",`${this.config.backendUrl}/frontend/line/restock/`,{product_id:t,variant_id:e,line_customer_id:o,line_name:n,line_profile:i,mode:r})})}doUpsertCustomerAcceptsMarketing(t,e,o,i,r){return n(this,void 0,void 0,function*(){const n={email:t,accepts_marketing:e,new_customer:o,create_shopify_customer:r||!1};i&&(n.tags=i);return yield this.request("POST",`${this.config.backendUrl}/frontend/accepts-marketing/`,n)})}doGetLineProfile(){return n(this,void 0,void 0,function*(){return yield this.request("GET",`${this.config.backendUrl}/frontend/line/profile`)})}renderStatusWidget(){if(this.statusWidget)return;const t=document.querySelector(".storecrm-status-widget-target"),e=document.querySelector("#shopify-section-header,.section-header,.section--header,header,.header-wrapper,.header,.header_nav"),o=document.querySelector("#MainContent, #main, .main, main");if(e||o||t){if(t)this.statusWidget=new h.StatusWidget(t,"beforeend",this.config);else if(o)this.statusWidget=new h.StatusWidget(o,"afterbegin",this.config);else{if(!e)return;this.statusWidget=new h.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("\u30b5\u30fc\u30d0\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002")})}doGetStatus(){return n(this,void 0,void 0,function*(){return yield this.request("GET",`${this.config.backendUrl}/frontend/status`)})}lineSubscribe(t=void 0,e){this.doLineSubscribe(e)}doLineSubscribe(t){return n(this,void 0,void 0,function*(){var e;const o=yield this.getToken(),n=yield this.getCustomerId(),i=window.location.href,r=this.getShopDomainFromStoreCRMToken(o),s=null===(e=null==t?void 0:t.routeKey)||void 0===e?void 0:e.trim(),a=s?`&route_key=${encodeURIComponent(s)}`:"";location.href=`${this.config.backendUrl}/frontend/line/connect?token=${o}&customer_id=${n}&host=${r}&referrer=${encodeURIComponent(i)}${a}`})}doLineLogin(t){return n(this,void 0,void 0,function*(){var e;const o=yield this.getCustomerId(),n=yield this.getToken(),i=window.location.href,r=this.getShopDomainFromStoreCRMToken(n),s=(null===(e=null==t?void 0:t.routeKey)||void 0===e?void 0:e.trim())||"system_line_login_multipass";location.href=`${this.config.backendUrl}/frontend/line/connect?is_multipass=true&token=${n}&customer_id=${o}&host=${r}&referrer=${encodeURIComponent(i)}&route_key=${encodeURIComponent(s)}`})}lineUnsubscribe(t=void 0){this.doLineUnsubscribe().then(t=>{t&&"string"==typeof t.redirect_url&&t.redirect_url?location.href=t.redirect_url:location.href=location.pathname+"?line_disconnect=1"}).catch(e=>{console.error(e),t?t("LINE\u306e\u901a\u77e5\u89e3\u9664\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002"):alert("LINE\u306e\u901a\u77e5\u89e3\u9664\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002")})}doLineUnsubscribe(){return n(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: \u30e1\u30fc\u30eb\u30de\u30ac\u30b8\u30f3\u306e\u8cfc\u8aad\u306b\u6210\u529f\u3057\u307e\u3057\u305f\u3002",t);const e=document.getElementById("storecrm_message");e&&(e.innerHTML="\u30e1\u30fc\u30eb\u30de\u30ac\u30b8\u30f3\u306e\u8cfc\u8aad\u306b\u6210\u529f\u3057\u307e\u3057\u305f\u3002"),this.statusWidget&&this.statusWidget.render()}).catch(t=>{console.error(t),alert("\u30e1\u30fc\u30eb\u30de\u30ac\u30b8\u30f3\u306e\u8cfc\u8aad\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002")})}doMailSubscribe(){return n(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: \u30e1\u30fc\u30eb\u30de\u30ac\u30b8\u30f3\u306e\u89e3\u9664\u306b\u6210\u529f\u3057\u307e\u3057\u305f\u3002",t);const e=document.getElementById("storecrm_message");e&&(e.innerHTML="\u30e1\u30fc\u30eb\u30de\u30ac\u30b8\u30f3\u306e\u89e3\u9664\u306b\u6210\u529f\u3057\u307e\u3057\u305f\u3002"),this.statusWidget&&this.statusWidget.render()}).catch(t=>{console.error(t);const e=document.getElementById("storecrm_message");e&&(e.innerHTML="\u30e1\u30fc\u30eb\u30de\u30ac\u30b8\u30f3\u306e\u89e3\u9664\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002",t.toString().includes("401")&&(e.innerHTML+='
\u89e3\u9664\u3092\u9032\u3081\u308b\u306b\u306f\u30ed\u30b0\u30a4\u30f3\u3092\u3057\u3066\u304f\u3060\u3055\u3044\u3002')),alert("\u30e1\u30fc\u30eb\u30de\u30ac\u30b8\u30f3\u306e\u89e3\u9664\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002")})}doMailUnsubscribe(){return n(this,void 0,void 0,function*(){return yield this.request("POST",`${this.config.backendUrl}/frontend/email/unsubscribe`)})}doMailCheck(t){return n(this,arguments,void 0,function*(t,e=void 0){if(!this.checkEmailFormat(t))return e&&e("\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u304c\u6b63\u3057\u304f\u3042\u308a\u307e\u305b\u3093\u3002");return yield this.request("GET",`${this.config.backendUrl}/frontend/accepts-marketing/?email=${encodeURIComponent(t)}`)})}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"),o=window.localStorage.getItem("storecrm_customer_id");if(!o||o.startsWith("TEMP_")){const t=document.getElementById("storecrm_message");return void(t&&(t.innerHTML='\u8a2d\u5b9a\u5909\u66f4\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002
\u9032\u3081\u308b\u306b\u306f\u30ed\u30b0\u30a4\u30f3\u3092\u3057\u3066\u304f\u3060\u3055\u3044\u3002'))}if(!this.checkConnectExecuted){if(this.checkConnectExecuted=!0,"line_connect"===e?this.lineSubscribe(function(){console.log("StoreCRM: LINE\u306e\u901a\u77e5\u767b\u9332\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002")}):"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\u306e\u9023\u643a\u3092\u89e3\u9664\u3057\u307e\u3057\u305f\u3002")}if(t.get("line_connect")){const t=document.querySelector("#storecrm_message");t&&(t.innerHTML="LINE\u3092\u9023\u643a\u3057\u307e\u3057\u305f\u3002")}}}}v.PENDING_RESTOCK_INTENT_KEY="storecrm_pending_restock_intent",v.PENDING_RESTOCK_INTENT_TTL_MS=864e5,v.PENDING_RESTOCK_RETRY_LIMIT=120,v.RESTOCK_LOGIN_REQUIRED_MODAL_ID="storecrm-restock-login-required-modal",v.RESTOCK_LOADING_STYLE_ID="storecrm-restock-loading-style",v.LOCALE_PATTERN=/^[a-z]{2}(?:-[a-z0-9]{2,8})?$/i,v.DEFAULT_EXCLUDED_ACCOUNT_PAGES=[_.ExcludedAccountPage.LOGIN,_.ExcludedAccountPage.REGISTER,_.ExcludedAccountPage.RECOVER,_.ExcludedAccountPage.ACTIVATE,_.ExcludedAccountPage.RESET],e.default=v},883(t,e){"use strict";e.containsShopifyId=e.Q=void 0;e.Q=t=>{if(null==t)return null;const e=String(t),o=e.match(/\/(\d+)$/);return o?o[1]:e};e.containsShopifyId=(t,o)=>{const n=(0,e.Q)(o);return!(!n||!Array.isArray(t))&&t.some(t=>(0,e.Q)(t)===n)}},954(t,e){"use strict";e.isAppProxyPathname=e.buildAppProxyUrl=e.Fo=e._t=void 0;const o=/^\/(?:a|apps|community|tools)\/[A-Za-z0-9_-]{1,30}$/,n=/^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{2,8})?$/,i=new Set(["admin","services","password","login"]);e._t=t=>{let e=String(null!=t?t:"").trim().replace(/^https?:\/\/[^/]+/i,"").split(/[?#]/)[0].replace(/\/+$/,"");if(!e)return null;e=e.startsWith("/")?e:`/${e}`;const r=e.split("/").filter(Boolean);if(3===r.length&&n.test(r[0])&&(e=`/${r.slice(1).join("/")}`),!o.test(e))return null;const s=e.split("/")[2];return i.has(s.toLowerCase())?null:e};e.Fo=(t,o)=>{const n=(0,e._t)(t);if(n)return n;return`/apps/${String(null!=o?o:"obake").trim().replace(/^\/+|\/+$/g,"")||"obake"}`};e.buildAppProxyUrl=(t,o)=>{var n,i;const r=(0,e.Fo)(o.path,o.name),s=t.startsWith("/")?t:`/${t}`;return`${null!==(i=null===(n=o.origin)||void 0===n?void 0:n.replace(/\/$/,""))&&void 0!==i?i:""}${r}${s}`};e.isAppProxyPathname=(t,o,i)=>{const r=(0,e.Fo)(o,i),s=String(t||"").split("/").filter(Boolean);s.length>=3&&n.test(s[0])&&s.shift();const a=`/${s.join("/")}`;return a===r||a.startsWith(`${r}/`)}},978(t,e){"use strict";e.getPercentageButtonSizingCss=e.getButtonWidthCss=void 0;e.getButtonWidthCss=(t,e,o=!1)=>{if(o||"auto"===t.button_width)return"auto";if("percent"===t.button_width_unit){const e=Number(t.button_width_percent);return`${n=Number.isFinite(e)?e:100,i=1,r=100,Math.min(r,Math.max(i,n))}%`}var n,i,r;const s=Number(t.button_width);return`${Number.isFinite(s)?s:e}px`};e.getPercentageButtonSizingCss=(t,e=!1)=>e||"auto"===t.button_width||"percent"!==t.button_width_unit?"":"\nmax-width: 100%;\nbox-sizing: border-box;"},444(t,e){"use strict";e.LINE_CONNECTION_SYSTEM_ROUTE_KEYS=void 0,e.LINE_CONNECTION_SYSTEM_ROUTE_KEYS={classicAccount:"system_classic_account",customerAccountProfile:"system_customer_account_profile",customerAccountMyPage:"system_customer_account_mypage",thankYouStatus:"system_thank_you_status",orderStatusStatus:"system_order_status_status",thankYouBanner:"system_thank_you_banner",orderStatusBanner:"system_order_status_banner"}},297(t,e,o){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const i=n(o(280)),{bootstrapStoreCRM:r}=o(647);r(window,i.default)},156(t,e){"use strict";var o;e.ExcludedAccountPage=void 0,function(t){t.LOGIN="login",t.REGISTER="register",t.RECOVER="recover",t.ACTIVATE="activate",t.RESET="reset"}(o||(e.ExcludedAccountPage=o={}))},647(t){function e(t,e,o){if(e){var n=t.storecrmConfigsByOrigin;n||(n=Object.create(null),t.storecrmConfigsByOrigin=n),n[e]||(n[e]=o)}}t.exports={bootstrapStoreCRM:function(t,o){if(!t||"object"!=typeof t)throw new TypeError("bootstrapStoreCRM: window object is required");if("function"!=typeof o)throw new TypeError("bootstrapStoreCRM: StoreCRM class is required");var n=function(t){var e=t&&t.document,o=e&&e.currentScript;if(!o||!o.src)return null;try{return new URL(o.src).origin}catch(t){return null}}(t),i=t.storecrm;if(i&&"function"==typeof i.init)return e(t,n,function(t,e,o,n){return e&&"function"==typeof e.resolveConfig?e.resolveConfig(n)||n:o&&"function"==typeof o.resolveConfig&&o.resolveConfig(n)||n}(0,o,i,t.storecrm_config||i.config)),i;var r=new o(t.storecrm_config||{});return t.storecrm=r,e(t,n,r.config),r.init(),r}}}};const e={};function o(n){const i=e[n];if(void 0!==i)return i.exports;const r=e[n]={id:n,exports:{}};return t[n].call(r.exports,r,r.exports,o),r.exports}o.n=t=>{const e=t&&t.__esModule?()=>t.default:()=>t;return o.d(e,{a:e}),e},o.d=(t,e)=>{if(Array.isArray(e))for(var n=0;nObject.prototype.hasOwnProperty.call(t,e),o.r=t=>{Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.nc=void 0;o(297)})();