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={532(t,e,n){"use strict";var o=n(573),i=n.n(o),r=n(926),s=n.n(r)()(i());s.push([t.id,".storecrm_modal {\n display: none;\n}\n\n.storecrm_modal.is-open {\n display: block;\n}\n\n.storecrm_modal_line {\n margin: 1rem 0;\n}\n\n.storecrm_modal_line label {\n display: flex;\n align-items: center;\n}\n\n#storecrm_restock_accepts_marketing {\n margin: 0 5px 0 0;\n max-width: 15px;\n}\n\n@media (hover: hover) {\n .storecrm_modal_line label:hover {\n cursor: pointer;\n }\n #storecrm_restock_accepts_marketing:hover {\n cursor: pointer;\n }\n}\n\n.storecrm_modal input,\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;n.d(e,["A",0,a])},926(t){"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var n="",o=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),o&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),o&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n}).join("")},e.i=function(t,n,o,i,r){"string"==typeof t&&(t=[[null,t,void 0]]);var s={};if(o)for(var a=0;a0?" ".concat(d[5]):""," {").concat(d[1],"}")),d[5]=r),n&&(d[2]?(d[1]="@media ".concat(d[2]," {").concat(d[1],"}"),d[2]=n):d[2]=n),i&&(d[4]?(d[1]="@supports (".concat(d[4],") {").concat(d[1],"}"),d[4]=i):d[4]="".concat(i)),e.push(d))}},e}},573(t){"use strict";t.exports=function(t){return t[1]}},127(t,e,n){"use strict";function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=Array(e);na});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"},n={},o=[],s=0;e.generateId=function(){return"micromodal-".concat(++s)};var a=function(){function e(t){var n=t.targetModal,o=t.triggers,i=void 0===o?[]:o,r=t.onShow,s=void 0===r?function(){}:r,a=t.onClose,c=void 0===a?function(){}:a,l=t.openTrigger,d=void 0===l?"data-micromodal-trigger":l,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 n?document.getElementById(n):n,this.modalId=null,null!==this.modal?(this.config={debugMode:R,disableScroll:_,openTrigger:d,closeTrigger:m,openClass:g,onShow:s,onClose:c,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(n,R,!1)}var n,s;return n=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===o.indexOf(this.modalId)&&o.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,n=this.config.openClass;if(e.classList.contains(n)){var i=o.indexOf(this.modalId);i>-1&&o.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(n)},{once:!0}):e.classList.remove(n)}}},{key:"toggleScrolling",value:function(t){if(this.config.disableScroll){var e=!t||o.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===o.length&&document.addEventListener("keydown",l):document.removeEventListener("keydown",l)}},{key:"removeEventListeners",value:function(){this.modal.removeEventListener("click",this.onClick),this.modal.removeEventListener("keydown",this.onKeydown),0===o.length&&document.removeEventListener("keydown",l)}},{key:"onClick",value:function(t){var e=d(t.target,this.modal),n=t.target.closest("[".concat(this.config.closeTrigger,"]"));(t.target.hasAttribute(this.config.closeTrigger)&&e||null!==n&&!d(n,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 n=e.filter(function(e){return!e.hasAttribute(t.config.closeTrigger)});n.length>0&&n[0].focus(),0===n.length&&e[0].focus()}}}},{key:"retainFocus",value:function(t,e){var n=this.getFocusableNodes();if(0!==n.length)if(n=n.filter(function(t){return null!==t.offsetParent}),"outside"===e)n[0].focus(),t.preventDefault();else{var o=n.indexOf(document.activeElement);t.shiftKey&&0===o&&(n[n.length-1].focus(),t.preventDefault()),!t.shiftKey&&n.length>0&&o===n.length-1&&(n[0].focus(),t.preventDefault())}}}],s&&i(n.prototype,s),Object.defineProperty(n,"prototype",{writable:!1}),e}(),c=function(t){if("string"==typeof t)return t;if(t instanceof HTMLElement){var n=t.getAttribute(e.identifier);return n||(t.id?t.id:(n=e.generateId(),t.setAttribute(e.identifier,n),n))}return null},l=function(t){var e=n[o[o.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!==n[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 o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=Object.assign({},e,{targetModal:t},o),r=c(t);u(i.targetModal,i.debugMode,!1)&&(n[r]||(n[r]=new a(i),n[r].modal.setAttribute(e.identifier,r),n[r].modalId=r))},m=function(t,o){var i=c(t);u(i,e.debugMode)&&Object.assign(n[i].config,o)},p=function(t){if(0!==o.length)if(t){var e=c(t);o.indexOf(e)>-1&&n[e].closeModal()}else n[o[o.length-1]].closeModal()};return{init:function(t){Object.assign(e,t);var n=r(document.querySelectorAll("[".concat(e.openTrigger,"]"))),o=function(t,e){var n=[];return t.forEach(function(t){var o=t.getAttribute(e);n[o]||(n[o]=[]),n[o].push(t)}),n}(n,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))}(n)||Object.keys(o).forEach(function(t){var e=o[t];h(t,{targetModal:t,triggers:e})})},initModal:h,config:m,show:function(t,e){var o=c(t);n[o]?e&&m(t,e):h(o,e),n[o]&&n[o].showModal()},close:p,closeAll:function(){for(var t=o.length-1;t>=0;t--)n[o[t]].closeModal()},removeModal:function(t){var e=c(t),o=n[e];o&&(o.destroy(),delete n[e])}}}();"undefined"!=typeof window&&(window.MicroModal=a)},741(t,e,n){"use strict";var o=n.cw(function(t,e){var n=[];function o(t){for(var e=-1,o=0;o0?" ".concat(n.layer):""," {")),o+=n.css,i&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var r=n.sourceMap;r&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(r))))," */")),e.styleTagTransform(o,t,e.options)}(e,t,n)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}}),c=n.cw(function(t,e){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))}}});o(),a(),i(),s(),r(),c();var l=n(532),d={};d.styleTagTransform=function t(){return t.c||(t.c=n.n(c()))}()(),d.setAttributes=function t(){return t.c||(t.c=n.n(s()))}()(),d.insert=function t(){return t.c||(t.c=n.n(i()))}()().bind(null,"head"),d.domAPI=function t(){return t.c||(t.c=n.n(a()))}()(),d.insertStyleElement=function t(){return t.c||(t.c=n.n(r()))}()();(function t(){return t.c||(t.c=n.n(o()))})()()(l.A,d);l.A&&l.A.locals&&l.A.locals},666(t,e){"use strict";e.schema=e.iF=e.XX=void 0;e.XX=(t,e)=>{const n="ja"===e,o=n?{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(n?[{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,n)=>{const o="product_link"===t.cart_icon?n.product:n.cart,i=e.available?"is-available":"is-unavailable";return`\n \n \n
\n \n ${e.imageUrl?`${e.title}`:`${n.noImage}`}\n \n
\n ${e.title}\n ${!1!==t.show_stock_status?`\n ${e.available?n.available:n.unavailable}\n `:""}\n
\n
\n \n \n \n \n `;var r})(t,e,o)).join("")};e.iF=t=>'\n \n',e.schema={preview:(t,n)=>{const o=t.layout_preset||"standard",i=!0===t[`show_view_controls_${o}`],r="ja"===n?{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,c=t.sort_newest_text||r.newest,l=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,n),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"}]}},850(t,e){"use strict";var n=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))(function(i,r){function s(t){try{c(o.next(t))}catch(t){r(t)}}function a(t){try{c(o.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}c((o=o.apply(t,e||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.FavoriteCountRenderer=e.collectFavoriteCountTargets=e.resolveFavoriteCount=e.recordFavoriteCountToggle=e.writeFavoriteCountCorrections=e.readFavoriteCountCorrections=e.isTruthyAttribute=e.formatFavoriteCountText=e.buildFavoriteCountKey=e.normalizeShopifyNumericId=e.FAVORITE_COUNT_VALUE_SELECTOR=e.FAVORITE_COUNT_SELECTOR=e.FAVORITE_COUNT_DEFAULT_TEXT=e.FAVORITE_COUNT_CORRECTION_STORAGE_KEY=e.FAVORITE_COUNT_CORRECTION_TTL_MS=e.FAVORITE_COUNT_MAX_CONCURRENT_REQUESTS=e.FAVORITE_COUNT_REQUEST_TIMEOUT_MS=e.FAVORITE_COUNT_CACHE_TTL_MS=void 0,e.FAVORITE_COUNT_CACHE_TTL_MS=6e4,e.FAVORITE_COUNT_REQUEST_TIMEOUT_MS=5e3,e.FAVORITE_COUNT_MAX_CONCURRENT_REQUESTS=6,e.FAVORITE_COUNT_CORRECTION_TTL_MS=18e5,e.FAVORITE_COUNT_CORRECTION_STORAGE_KEY="storecrm_favorite_count_corrections",e.FAVORITE_COUNT_DEFAULT_TEXT="\u304a\u6c17\u306b\u5165\u308a {count}\u4ef6",e.FAVORITE_COUNT_SELECTOR="[data-storecrm-favorite-count]",e.FAVORITE_COUNT_VALUE_SELECTOR="[data-storecrm-favorite-count-value]";e.normalizeShopifyNumericId=t=>{if(null==t)return"";const e=String(t).trim();if(!e)return"";const n=e.split("/");return n[n.length-1].trim()};e.buildFavoriteCountKey=(t,n,o)=>[t,(0,e.normalizeShopifyNumericId)(n),"variant"===t?(0,e.normalizeShopifyNumericId)(o):""].join(":");e.formatFavoriteCountText=(t,n)=>(t&&t.trim()?t:e.FAVORITE_COUNT_DEFAULT_TEXT).replace(/\{count\}/g,String(n));e.isTruthyAttribute=t=>""===t||"true"===t||"1"===t;const o=()=>{try{return"undefined"==typeof window?void 0:window.localStorage}catch(t){return}};e.readFavoriteCountCorrections=(t=o(),n=Date.now())=>{if(!t)return{};try{const o=JSON.parse(t.getItem(e.FAVORITE_COUNT_CORRECTION_STORAGE_KEY)||"{}");if(!o||"object"!=typeof o)return{};const i={};return Object.entries(o).forEach(([t,o])=>{var r;if(!o||"object"!=typeof o)return;const s=Number(o.updatedAt),a=Number(o.delta);Number.isFinite(s)&&Number.isFinite(a)&&0!==a&&(n-s>e.FAVORITE_COUNT_CORRECTION_TTL_MS||(i[t]={delta:a,updatedAt:s,lastSyncedAt:null!==(r=o.lastSyncedAt)&&void 0!==r?r:null}))}),i}catch(t){return{}}};e.writeFavoriteCountCorrections=(t,n=o())=>{if(n)try{n.setItem(e.FAVORITE_COUNT_CORRECTION_STORAGE_KEY,JSON.stringify(t))}catch(t){console.warn("StoreCRM: failed to persist favorite count corrections",t)}};e.recordFavoriteCountToggle=(t,n,i,r,s=Date.now(),a=o(),c=null)=>{var l;const d=(0,e.buildFavoriteCountKey)(t,n,i);if(!d||!r)return(0,e.readFavoriteCountCorrections)(a,s);const u=(0,e.readFavoriteCountCorrections)(a,s),h=u[d],m=(null!==(l=null==h?void 0:h.delta)&&void 0!==l?l:0)+r;return 0===m?delete u[d]:u[d]={delta:m,updatedAt:s,lastSyncedAt:c},(0,e.writeFavoriteCountCorrections)(u,a),u};e.resolveFavoriteCount=(t,e,n)=>{if(!e)return{count:Math.max(0,t),correction:null};const o=n?Date.parse(n):NaN,i=e.lastSyncedAt?Date.parse(e.lastSyncedAt):NaN;return Number.isFinite(o)&&o>=e.updatedAt&&(!Number.isFinite(i)||o>i)?{count:Math.max(0,t),correction:null}:{count:Math.max(0,t+e.delta),correction:e}};e.collectFavoriteCountTargets=(t,n)=>Array.from(t.querySelectorAll(e.FAVORITE_COUNT_SELECTOR)).filter(t=>t instanceof HTMLElement).map(t=>{const o=t.dataset.productId||"",i=("undefined"==typeof window?"":new URL(window.location.href).searchParams.get("variant")||"")||t.dataset.variantId||"";return{element:t,productId:o,variantId:i,mode:n,key:(0,e.buildFavoriteCountKey)(n,o,i),countText:t.dataset.countText,hideWhenZero:(0,e.isTruthyAttribute)(t.dataset.hideWhenZero)}});class i{constructor(){this.mode="product",this.cache=new Map,this.inflight=new Map,this.activeRequests=0,this.waitingRequests=[]}static getInstance(){return i.instance||(i.instance=new i),i.instance}configure({fetcher:t,mode:e}){t&&(this.fetcher=t),e&&(this.mode=e)}getMode(){return this.mode}hasTargets(t=document){return null!==t.querySelector(e.FAVORITE_COUNT_SELECTOR)}render(){return n(this,arguments,void 0,function*(t=document,o=Date.now()){if(!this.fetcher)return;const i=(0,e.collectFavoriteCountTargets)(t,this.mode);if(!i.length)return;const r=new Map;i.forEach(t=>{const e=r.get(t.key)||[];e.push(t),r.set(t.key,e)}),yield Promise.all(Array.from(r.entries()).map(t=>n(this,[t],void 0,function*([t,n]){var i;const r=n[0];if(r.productId&&("variant"!==r.mode||r.variantId))try{const s=yield this.fetchCount(r,o),a=(0,e.readFavoriteCountCorrections)(),c=(0,e.resolveFavoriteCount)(Number(s.favorite_count)||0,a[t],null!==(i=s.last_synced_at)&&void 0!==i?i:null);!c.correction&&a[t]&&(delete a[t],(0,e.writeFavoriteCountCorrections)(a)),n.forEach(t=>this.applyTarget(t,c.count))}catch(t){console.warn("StoreCRM: failed to load favorite count",t),n.forEach(t=>this.applyTarget(t,null))}else n.forEach(t=>this.applyTarget(t,null))})))})}withRequestSlot(t){return n(this,void 0,void 0,function*(){this.activeRequests>=e.FAVORITE_COUNT_MAX_CONCURRENT_REQUESTS?yield new Promise(t=>this.waitingRequests.push(t)):this.activeRequests++;try{return yield t()}finally{const t=this.waitingRequests.shift();t?t():this.activeRequests--}})}recordToggle({productId:t,variantId:n,delta:i,mode:r}){var s,a;const c=null!=r?r:this.mode,l=(0,e.buildFavoriteCountKey)(c,t,n);(0,e.recordFavoriteCountToggle)(c,t,n,i,Date.now(),o(),null!==(a=null===(s=this.cache.get(l))||void 0===s?void 0:s.value.last_synced_at)&&void 0!==a?a:null),this.render()}reset(){this.cache.clear(),this.inflight.clear()}fetchCount(t,o){return n(this,void 0,void 0,function*(){const i=this.cache.get(t.key);if(i&&o-i.fetchedAtn(this,void 0,void 0,function*(){const n=new AbortController;let o;try{return yield Promise.race([s({productId:t.productId,variantId:t.variantId,mode:t.mode,signal:n.signal}),new Promise((t,i)=>{o=setTimeout(()=>{n.abort(),i(new Error("favorite count request timed out"))},e.FAVORITE_COUNT_REQUEST_TIMEOUT_MS)})])}finally{clearTimeout(o)}})).then(e=>(this.cache.set(t.key,{value:e,fetchedAt:Date.now()}),e)).finally(()=>{this.inflight.delete(t.key)});return this.inflight.set(t.key,a),a})}applyTarget(t,n){const{element:o}=t;if(null===n)return void o.setAttribute("hidden","");const i=Math.max(0,n);if(0===i&&t.hideWhenZero)return void o.setAttribute("hidden","");const r=o.querySelector(e.FAVORITE_COUNT_VALUE_SELECTOR),s=(0,e.formatFavoriteCountText)(t.countText,i);r?r.textContent=s:o.textContent=s,o.removeAttribute("hidden")}}e.FavoriteCountRenderer=i},61(t,e,n){"use strict";e.schema=e.renderWidgetSelector=e.hideWidgetSelector=e.render=e.s=void 0;const o=n(73),i=n(80),r=n(850),s=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 n=null;return"star"===t.buttonicon?n=e?'':'':"heart"===t.buttonicon?n=e?'':'':"tag"===t.buttonicon?n='':"clip"===t.buttonicon&&(n=''),n&&(n=n.replace("viewBox",`width="${t.icon_size}" height="${t.icon_size}" style="margin-right: ${t.icon_margin}px;" viewBox`)),n};class a{constructor(t,e,n,o,i,r=!1,a=!1,c){this.eventTriggered=!1,this.variants=n,this.buttonSettings=s(o),this.productId=e,this.button=i,this.isFavorited=r,this.hasVariantSelector=a,this.variantId=c}static getInstance(t,e,n,o,i,r=!1,c=!1,l){if(a.instances[t]){const d=a.instances[t];d.isFavorited=r,d.hasVariantSelector=c,d.buttonSettings=s(o),d.variants=n,d.button=i,d.productId=e,d.variantId=l}else a.instances[t]=new a(t,e,n,o,i,r,c,l);return a.instances[t]}checkRender(t){document.querySelectorAll(`.storecrm-wishlistbutton-${t}`).forEach(t=>{if(t instanceof HTMLElement&&t.closest('[data-type="wishlist-button"]')){const e=new URL(location.href),n=e.searchParams.get("variant")&&e.searchParams.get("variant")||"";n&&(t.dataset.variantId=n),window.storecrm&&window.storecrm.render(!0)}})}render(t,n=!1){var o;const r=null!==(o=(0,e.s)(this.buttonSettings,this.isFavorited))&&void 0!==o?o:"",s=new URL(location.href),a=parseInt(s.searchParams.get("variant")||this.variantId||"0",10)||"",c=this.hasVariantSelector?"data-variant-selector":"",l=this.buttonSettings.is_only_member?"data-storecrm-member-only-wishlist":"",d=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 u=n?"":`onclick="event.preventDefault();window.storecrm ? window.storecrm.toggleWishlist(this, ${this.isFavorited?"true":"false"}, ${this.buttonSettings.is_only_member}, '${this.buttonSettings.non_member_link||""}') : alert('\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');"`,h=``,m=document.querySelector("#storecrm-wishlistbutton-style");n?(m&&m.remove(),document.body.insertAdjacentHTML("afterend",h)):m||document.body.insertAdjacentHTML("afterend",h);const p=this.getFavoriteCountPosition(),g="storecrm-wishlistbuttonwrapper"+(this.buttonSettings.show_favorite_count?` storecrm-wishlistbuttonwrapper--count-${p}`:""),f=this.renderFavoriteCountElement(n,a),_=p.startsWith("inside_"),v=d?"":this.isFavorited?this.buttonSettings.button_text_remove:this.buttonSettings.button_text,b=`${r}${v}`;return`
\n\n${_?"":f}\n
`}getCountAlign(){return"left"===this.buttonSettings.align?"flex-start":"right"===this.buttonSettings.align?"flex-end":"center"}getFavoriteCountPosition(){const t=this.buttonSettings.favorite_count_position||"button_right";return["button_top","button_bottom","button_left","button_right","inside_top","inside_bottom","inside_left","inside_right"].includes(t)?t:"button_right"}getFavoriteCountGap(){const t=this.buttonSettings.favorite_count_gap;return null==t?"button_bottom"===this.getFavoriteCountPosition()?4:8:Number.isFinite(Number(t))?Math.min(100,Math.max(0,Number(t))):8}escapeAttribute(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(//g,">")}renderFavoriteCountElement(t,e){if(!this.buttonSettings.show_favorite_count)return"";const n=this.buttonSettings.favorite_count_text||"\u304a\u6c17\u306b\u5165\u308a {count}\u4ef6",o=t?(0,r.formatFavoriteCountText)(n,12):"";return`${o}`}}a.instances={};let c,l,d;e.render=({productId:t,variantId:e,id:n,variants:o,product:i,button:r,buttonSettings:s,isFavorited:c=!1,preview:l=!1,hasVariantSelector:d=!1})=>a.getInstance(n,t,o,s,r,c,d,e).render(n,l);e.hideWidgetSelector=()=>{c&&(c.remove(),c=void 0),document.querySelectorAll(".storecrm-variantselector-dropdown").forEach(t=>t.remove()),l=void 0,d=void 0};e.renderWidgetSelector=({button:t,productId:n,variants:i,wishlist:r,buttonSettings:s,preview:a=!1,rerender:u=!1})=>{const h=Array.isArray(null==r?void 0:r.variants)?r.variants:[];r.variants=h;const m=l===n&&d?d:i,p=c&&u&&l==n?c.style:void 0;let g=0;if(!a&&c&&u&&(g=c.scrollTop),!a&&u&&l!==n)return;if(!a&&c&&(c.remove(),c=void 0,!u))return;l=n,d=m;const f=m.map(t=>{const i=(0,o.containsShopifyId)(h,t.id),r=(0,e.s)(s,i),c=a?"":`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(a)_="position: static;";else if(p)_=`top: ${p.top}; left: ${p.left};`;else{const e=t.getBoundingClientRect(),n=250;let o=e.left+document.documentElement.scrollLeft;o+n>window.innerWidth&&(o=window.innerWidth-n),_=`top: ${e.bottom+document.documentElement.scrollTop}px; left: ${o}px;`}const v=``;a||(document.body.insertAdjacentHTML("afterend",v),c=document.querySelector(".storecrm-variantselector-dropdown"),u&&g>0&&(c.scrollTop=g));{const t=t=>{t.target&&t.target instanceof HTMLElement&&t.target.closest("[data-variant-selector]")||c&&(c.remove(),c=void 0)};document.addEventListener("click",t),document.addEventListener("resize",t)}return v},e.schema={preview:(t,n)=>{let o=`
${"ja"===n?"\u304a\u6c17\u306b\u5165\u308a\u30dc\u30bf\u30f3(\u304a\u6c17\u306b\u5165\u308a\u524d)":"Favorite button (before it is added)"}
`;return o+=(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&&(o+=`
${"ja"===n?"\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"}
`,o+=(0,e.renderWidgetSelector)({productId:"TEMP_product",variants:"ja"===n?[{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})),o+=`
${"ja"===n?"\u304a\u6c17\u306b\u5165\u308a\u30dc\u30bf\u30f3(\u304a\u6c17\u306b\u5165\u308a\u5f8c)":"Favorite button (after it is added)"}
`,o+=(0,e.render)({productId:"TEMP_product",id:"TEMP_favorite2",buttonSettings:t,button:document.createElement("div"),isFavorited:!0,preview:!0,variants:[],product:null}),o},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},{type:"checkbox",slug:"show_favorite_count",nameJa:"\u304a\u6c17\u306b\u5165\u308a\u6570\u3092\u8868\u793a\u3059\u308b",nameEn:"Show the favorite count",default:!1,calloutJa:"\u8868\u793a\u3059\u308b\u4ef6\u6570\u306f\u96c6\u8a08\u30c7\u30fc\u30bf\u3092\u3082\u3068\u306b\u3057\u3066\u3044\u307e\u3059\u3002\u4ed6\u306e\u304a\u5ba2\u69d8\u306e\u64cd\u4f5c\u306f\u901a\u5e385\u5206\u7a0b\u5ea6\uff08\u6700\u592710\u5206\u7a0b\u5ea6\uff09\u3067\u53cd\u6620\u3055\u308c\u307e\u3059\u3002\u5546\u54c1\u30da\u30fc\u30b8\u3092\u8868\u793a\u3059\u308b\u305f\u3073\u306b\u767b\u9332\u8005\u6570\u3092\u6570\u3048\u76f4\u3059\u3053\u3068\u306f\u3042\u308a\u307e\u305b\u3093\u3002",calloutEn:"The count uses aggregated data. Other customers\u2019 activity is reflected in about 5 minutes (up to about 10 minutes). The count is not recalculated on every product page view."},{type:"text",slug:"favorite_count_text",nameJa:"\u304a\u6c17\u306b\u5165\u308a\u6570\u306e\u8868\u793a\u6587\u8a00\uff08{count} \u304c\u4ef6\u6570\u306b\u7f6e\u304d\u63db\u308f\u308a\u307e\u3059\uff09",nameEn:"Favorite count text ({count} is replaced with the number)",defaultJa:"\u304a\u6c17\u306b\u5165\u308a {count}\u4ef6",defaultEn:"Favorites: {count}",checkVisible:t=>!0===t.show_favorite_count},{type:"select",slug:"favorite_count_position",nameJa:"\u304a\u6c17\u306b\u5165\u308a\u6570\u306e\u8868\u793a\u4f4d\u7f6e",nameEn:"Favorite count position",default:"button_right",selectOptionsJa:[{value:"button_top",label:"\u30dc\u30bf\u30f3\u306e\u5916\u5074\u30fb\u4e0a"},{value:"button_bottom",label:"\u30dc\u30bf\u30f3\u306e\u5916\u5074\u30fb\u4e0b"},{value:"button_left",label:"\u30dc\u30bf\u30f3\u306e\u5916\u5074\u30fb\u5de6"},{value:"button_right",label:"\u30dc\u30bf\u30f3\u306e\u5916\u5074\u30fb\u53f3"},{value:"inside_top",label:"\u30dc\u30bf\u30f3\u306e\u5185\u5074\u30fb\u4e0a"},{value:"inside_bottom",label:"\u30dc\u30bf\u30f3\u306e\u5185\u5074\u30fb\u4e0b"},{value:"inside_left",label:"\u30dc\u30bf\u30f3\u306e\u5185\u5074\u30fb\u5de6"},{value:"inside_right",label:"\u30dc\u30bf\u30f3\u306e\u5185\u5074\u30fb\u53f3"}],selectOptionsEn:[{value:"button_top",label:"Outside the button \xb7 top"},{value:"button_bottom",label:"Outside the button \xb7 bottom"},{value:"button_left",label:"Outside the button \xb7 left"},{value:"button_right",label:"Outside the button \xb7 right"},{value:"inside_top",label:"Inside the button \xb7 top"},{value:"inside_bottom",label:"Inside the button \xb7 bottom"},{value:"inside_left",label:"Inside the button \xb7 left"},{value:"inside_right",label:"Inside the button \xb7 right"}],checkVisible:t=>!0===t.show_favorite_count},{type:"range",slug:"favorite_count_gap",nameJa:"\u304a\u6c17\u306b\u5165\u308a\u6570\u3068\u306e\u9593\u9694\uff08px\uff09",nameEn:"Favorite count spacing (px)",default:8,min:0,max:100,step:1,checkVisible:t=>!0===t.show_favorite_count},{type:"checkbox",slug:"hide_favorite_count_when_zero",nameJa:"0\u4ef6\u306e\u3068\u304d\u306f\u8868\u793a\u3057\u306a\u3044",nameEn:"Hide the count when it is zero",default:!1,checkVisible:t=>!0===t.show_favorite_count}]}},934(t,e,n){"use strict";var o=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))(function(i,r){function s(t){try{c(o.next(t))}catch(t){r(t)}}function a(t){try{c(o.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}c((o=o.apply(t,e||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.Renderer=void 0;const i=n(839),r=n(128),s=n(476),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"},c="storecrm_favorite_list_view_v1";class l{static getInstance(t){return l.instance||(l.instance=new l(t)),l.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 o(this,void 0,void 0,function*(){this.inited||(this.inited=!0,yield this.loadConfig())})}loadConfig(){return o(this,void 0,void 0,function*(){this.config=Object.assign(Object.assign({},a),this.parent.config.favoriteList||{});const t=new URLSearchParams(window.location.search),e=document.querySelector("[data-storecrm-preview-context]"),n="preview"===t.get("ids")&&t.get("preview_token")||void 0;if(this.previewToken=n||(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 o=t.get("mode")||(null==e?void 0:e.dataset.storecrmPreviewMode);this.mode=!this.previewToken||"product"!==o&&"variant"!==o?this.parent.favoriteMode:o,this.previewToken?(this.sort="newest",this.groupByProduct=!1):this.loadViewPreferences(),this.ensureViewControls()})}applyConfig(){const t=document.getElementById("list_title"),e=document.getElementById("loading_text"),n=document.getElementById("non_item_text");t&&(t.textContent=this.config.list_title),e&&(e.textContent=this.config.loading_text),n&&(n.textContent=this.config.non_item_text);const o=this.getFavoriteListRoot();o&&("advanced"===this.favoriteListMode?(delete o.dataset.layoutPreset,o.dataset.storecrmRenderMode="advanced"):(delete o.dataset.storecrmRenderMode,o.dataset.layoutPreset=this.config.layout_preset||"standard"))}render(){return o(this,void 0,void 0,function*(){var t;this.ensureViewControls();const e=JSON.parse(localStorage.getItem("storecrm_wishlist")||"{}"),n=this.getWishlistIds(e),o=n.join(",");if("advanced"===this.favoriteListMode){const t=this.previewToken?"preview":o;return void(yield this.renderAdvancedPreview(t))}if(0===n.length){null===(t=document.querySelector(".storecrm_favoritelist table"))||void 0===t||t.remove();const e=document.querySelector(".storecrm_favoritelist_loading"),n=document.querySelector(".storecrm_favoritelist_non_item");return e&&(e.style.display="none"),void(n&&(n.style.display="block"))}const i=document.querySelector(".storecrm_favoritelist_loading");i&&(i.style.display="none"),yield this.loadProductAndRender(o)})}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 n=(0,i.getFavoriteListRequestedLocale)(),o=new URLSearchParams({ids:t,mode:this.mode});return n&&o.set("locale",n),e&&o.set("cursor",e),this.appendViewParams(o),"preview"===t&&this.previewToken&&o.set("preview_token",this.previewToken),`${(0,s.buildAppProxyUrl)("/favorites/render",{origin:window.location.origin,path:this.parent.config.appProxyPath,name:this.parent.config.appProxyName})}?${o.toString()}`}extractAdvancedHtml(t){var e;const n=t.match(/\[liquid\]([\s\S]*?)\[\/liquid\]/m);if(n)return n[1];if(this.previewToken){const n="\x3c!--storecrm-fragment-items:start--\x3e",o="\x3c!--storecrm-fragment-items:end--\x3e",i=t.indexOf(n),r=i>=0?t.indexOf(o,i+n.length):-1;if(i>=0&&r>=0){const n=r+o.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,n)+(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"),n=(null==t?void 0:t.innerHTML)||(null==e?void 0:e.outerHTML);if(n)return n}}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||""),n="\x3c!--storecrm-fragment-items:start--\x3e",o=e.indexOf(n);if(o<0)return;const i=o+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 n=this.getFavoriteListRoot();if(!n)return!1;const o=this.getAdvancedItemsRoot(n),i=this.extractMarkedFragmentHtml(t);if(o&&void 0!==i)return o.insertAdjacentHTML("beforeend",i),o.querySelectorAll("script").forEach(t=>t.remove()),!0;const r=this.getAdvancedFragmentItems(e.content);if(o&&r){for(;r.firstChild;)o.appendChild(r.firstChild);return!0}const s=n.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 o(this,arguments,void 0,function*(t,e=15e3){const n=new AbortController;this.loadMoreAbortController=n;const o=window.setTimeout(()=>n.abort(),e);try{return yield fetch(t,{signal:n.signal,cache:"no-store"})}finally{window.clearTimeout(o),this.loadMoreAbortController===n&&(this.loadMoreAbortController=void 0)}})}renderAdvancedPreview(t){return o(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 n=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 o=++this.loadMoreRequestSeq;this.currentIds=t,this.nextCursor=void 0,this.loadingNextPage=!1;try{const i=yield this.fetchWithTimeout(this.buildAdvancedRenderUrl(t));if(o!==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(o!==this.loadMoreRequestSeq||t!==this.currentIds)return;const s=this.createAdvancedTemplate(r),a=s.content.querySelector(".storecrm_favoritelist, .storecrm_customlist");let c=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),n=t.querySelector(".storecrm_favoritelist, .storecrm_customlist");e.replaceWith(t),n&&(c=n)}else e.replaceChildren(s.content.cloneNode(!0));this.removeScripts(c),this.ensureViewControls(c),this.nextCursor=this.findNextCursor(c)||void 0,this.appendedCursors.clear(),this.syncLoadMoreButton(),this.bindAdvancedActionHandlers(c),n&&(yield this.loadRemainingPagesAutomatically())}catch(t){if(t instanceof DOMException&&"AbortError"===t.name)return;console.error("StoreCRM: error rendering advanced favorite list",t)}})}loadRemainingPagesAutomatically(){return o(this,void 0,void 0,function*(){const t=this.getFavoriteListRoot();if(!t)return;const e=document.querySelector("[data-storecrm-preview-context]"),n=Array.from(new Set([t,e].filter(Boolean))),o=(t,e)=>{n.forEach(n=>{n.dataset.storecrmPagesLoaded=t,n.dataset.storecrmPaginationStatus=e,this.previewToken&&(n.dataset.storecrmPreviewPagesLoaded=t,n.dataset.storecrmPreviewPaginationStatus=e)})};o("1",this.nextCursor?"loading":"complete");for(let e=1;e<5&&this.nextCursor;e+=1){const n=this.nextCursor;if(yield this.loadNextPage(),this.nextCursor===n)return o(t.dataset.storecrmPagesLoaded||"1","failed"),void console.warn("StoreCRM: Favorite automatic pagination stopped",{page:e+1,reason:"cursor did not advance"});o(String(e+1),"loading")}o(t.dataset.storecrmPagesLoaded||"1",this.nextCursor?"limited":"complete")})}bindAdvancedActionHandlers(t){this.advancedHandlerRoots.has(t)||(this.advancedHandlerRoots.add(t),t.addEventListener("click",e=>{var n,o;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,n=a.dataset.cartProductId,o=a.dataset.cartProductHandle||"",r=t||n;if(!r)return;return e.preventDefault(),void(0,i.cartFavorite)(this.mode,r,o,this.config.insert_cart_directly,t)}const c=r.closest("a[data-product-id], a[data-variant-id]");if(c&&t.contains(c)){if(!c.dataset.productId)return;e.preventDefault(),this.parent.toggleWishlist(c,!0,null===(n=this.parent.config.favorite)||void 0===n?void 0:n.is_only_member,null===(o=this.parent.config.favorite)||void 0===o?void 0:o.non_member_link)}}))}buildProductsUrl(t,e){const n=(0,i.getFavoriteListRequestedLocale)(),o=new URLSearchParams({mode:this.mode,ids:t});n&&o.set("locale",n),e&&o.set("cursor",e),this.appendViewParams(o);return`${(0,s.buildAppProxyUrl)("/favorites/products",{path:this.parent.config.appProxyPath,name:this.parent.config.appProxyName})}?${o.toString()}`}loadProductAndRender(t){return o(this,void 0,void 0,function*(){this.abortLoadMoreRequest();const e=++this.loadMoreRequestSeq;this.currentIds=t,this.loadingNextPage=!1,this.appendedCursors.clear();const n=yield fetch(this.buildProductsUrl(t));if(e!==this.loadMoreRequestSeq||t!==this.currentIds)return;const o=yield n.json();e===this.loadMoreRequestSeq&&t===this.currentIds&&(this.nextCursor=o.next_cursor||void 0,this.renderProducts(o),this.syncLoadMoreButton(),yield this.loadRemainingPagesAutomatically())})}syncLoadMoreButton(){var t;const e=this.getFavoriteListRoot();if(!e)return;let n=e.querySelector("[data-storecrm-next-cursor]");this.nextCursor?(n||(n=document.createElement("button"),n.type="button",n.classList.add("storecrm_favoritelist_load_more"),n.textContent="\u3082\u3063\u3068\u898b\u308b",e.appendChild(n)),n.dataset.storecrmNextCursor=this.nextCursor,n.style.display="block",n.disabled=this.loadingNextPage,n.setAttribute("aria-busy",this.loadingNextPage?"true":"false"),this.loadMoreButtonLabels.has(n)||this.loadMoreButtonLabels.set(n,(null===(t=n.textContent)||void 0===t?void 0:t.trim())||"\u3082\u3063\u3068\u898b\u308b"),n.textContent=this.loadingNextPage?this.config.loading_text||"\u8aad\u8fbc\u4e2d\u3067\u3059...":this.loadMoreButtonLabels.get(n)||"\u3082\u3063\u3068\u898b\u308b","advanced"!==this.favoriteListMode&&(n.onclick=()=>this.loadAllRemainingPages())):null==n||n.remove()}loadAllRemainingPages(){return o(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 o(this,arguments,void 0,function*(t={}){const e=!0===t.loadingManagedExternally,n=this.nextCursor;if(!n||!e&&this.loadingNextPage||this.appendedCursors.has(n))return;const o=this.currentIds,i=++this.loadMoreRequestSeq;e||(this.loadingNextPage=!0,this.syncLoadMoreButton());try{if("advanced"===this.favoriteListMode){const t=yield this.fetchWithTimeout(this.buildAdvancedRenderUrl(o,n));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||o!==this.currentIds||n!==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!==n?s:void 0}else{const t=yield this.fetchWithTimeout(this.buildProductsUrl(o,n));if(!t.ok)throw new Error(`Favorite list products failed: ${t.status}`);const e=yield t.json();if(i!==this.loadMoreRequestSeq||o!==this.currentIds||n!==this.nextCursor)return;this.renderProducts(e,{append:!0});const r=e.next_cursor||void 0;this.nextCursor=r&&r!==n?r:void 0}this.appendedCursors.add(n)}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 n=document.querySelector(".storecrm_favoritelist tbody"),o=document.querySelector(".storecrm_favoritelist_loading"),i=document.querySelector(".storecrm_favoritelist table"),r=document.querySelector(".storecrm_favoritelist_non_item");if(!(n&&o&&i&&n instanceof HTMLElement&&o instanceof HTMLElement&&i instanceof HTMLElement))return;const s="variant"===this.mode?t.variants:t.products;if(s&&0!==s.length){if(!e.append)for(;n.firstChild;)n.removeChild(n.firstChild);s.forEach(t=>n.appendChild(this.createFavoriteRow(n,t))),o.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",o.style.display="none",r&&(r.style.display="block"))}createFavoriteRow(t,e){const n=document.createElement("tr");n.classList.add(`storecrm_favoritelist_id-${e.variant_id||e.product_id}`);const o=(0,i.getLocalePathPrefix)(),s=e.url||("product"===this.mode?`${o}/products/${e.handle}`:`${o}/products/${e.handle}?variant=${e.variant_id}`),a=document.createElement("td");a.classList.add("storecrm_favoritelist_lefttd");const c=document.createElement("div");c.classList.add("storecrm_favoritelist_item");const l=document.createElement("a");if(l.classList.add("storecrm_favoritelist_media","storecrm_favoritelist_image_link"),l.href=s,l.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,l.appendChild(t)}else{const t=document.createElement("span");t.classList.add("storecrm_favoritelist_image_placeholder"),t.textContent=this.getListCopy().noImage,l.appendChild(t)}c.appendChild(l);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)}c.appendChild(d),a.appendChild(c);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 n="product_link"===this.config.cart_icon?this.getListCopy().product:this.getListCopy().cart;t.setAttribute("aria-label",n);const o=document.createElement("span");o.classList.add("storecrm_favoritelist_action_label"),o.textContent=n,t.appendChild(o),"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),n.appendChild(a),n.appendChild(h),n}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(c)||"{}");["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(c,JSON.stringify({sort:this.sort,groupByProduct:this.groupByProduct}))}placeViewControls(t,e){const n=Array.from(t.children),o=n.find(t=>t.matches("#list_title, [data-storecrm-list-title], h1, h2"));if(o)return void o.insertAdjacentElement("afterend",e);const i=n.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",n="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=>{(!n||t&&!t.contains(e))&&e.remove()}),!n||!t||t.querySelector(".storecrm_favorite_list_controls"))return;this.ensureViewControlsStyle();const o=((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 n=this.config.group_by_product_text||(o?"\u5546\u54c1\u3054\u3068\u306bSKU\u3092\u307e\u3068\u3081\u308b":"Group SKUs by product");e.setAttribute("aria-label",n),e.addEventListener("change",()=>{this.groupByProduct=e.checked,this.saveViewPreferences(),this.render()}),t.append(e,document.createTextNode(n)),r.appendChild(t)}const s=document.createElement("label");s.className="storecrm_favorite_list_sort_control",s.append(document.createTextNode(`${this.config.sort_label||(o?"\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,n])=>a.add(new Option(o?e:n,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=l,l.instance=void 0},128(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},839(t,e){"use strict";var n=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))(function(i,r){function s(t){try{c(o.next(t))}catch(t){r(t)}}function a(t){try{c(o.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}c((o=o.apply(t,e||[])).next())})};function o(t){if("string"!=typeof t)return"";const e=t.trim();if(!e||"/"===e||"//"===e)return"";const n=/^[a-z]{2}(?:-[a-z]{2})?$/i.test(e)?`/${e}/`:e;if(!n.startsWith("/"))return"";const o=("/"+n).replace(/\/{2,}/g,"/").replace(/\/$/,"").toLowerCase();return"/"===o?"":o}function i(t){const e=window.location.pathname.toLowerCase();return e===t||e.startsWith(`${t}/`)}function r(){var t,e,n,r,s,a,c,l;const d=o((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===(n=null===window||void 0===window?void 0:window.Shopify)||void 0===n?void 0:n.localization)||void 0===r?void 0:r.root));if(d)return i(d)?d:"";const u=o((null===(c=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===c?void 0:c.isoCode)||(null===(l=null===window||void 0===window?void 0:window.Shopify)||void 0===l?void 0:l.locale));return u&&i(u)?u:""}function s(t){return n(this,arguments,void 0,function*(t,e=""){try{const n=yield fetch(`${e||""}/cart/add.js`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:t,quantity:1})});if(!n.ok)throw new Error(`Failed to add to cart: ${n.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,n,o;return r()?String((null===(n=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===n?void 0:n.isoCode)||(null===(o=null===window||void 0===window?void 0:window.Shopify)||void 0===o?void 0:o.locale)||""):""},e.cartFavorite=function(t,e,n,o,i){const a=r(),c=i||("variant"===t?e:"");if(c&&("variant"===t||o))return void s(c,a);const l="variant"===t?`${a}/products/${encodeURIComponent(n)}?variant=${e}`:`${a}/products/${encodeURIComponent(n)}`;window.location.href=l},e.addToCart=s},164(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});class n{constructor(t){this.loginButtonImg="/buttons/images/line_login_btn.png",this.parent=t}static isLoginOrRegisterPage(){const t=window.location.pathname,e=n.isLoginPath(t),o=n.isRegisterPath(t);if(e||o)return!0;const i=n.isLoginPage(),r=n.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(n.isLineLoginEnabled())try{const t=document.querySelectorAll(`.${n.CUSTOM_CONTAINER_CLASS}`);if(t.length>0)return void t.forEach(t=>{const e=this.createLineButton(!0);t.appendChild(e)});n.isLoginPage()&&this.addLoginButton(),n.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 n=e.querySelector('button[type="submit"]');if(n||(n=e.querySelector("button")),!n){const t=document.createElement("div");t.className="line-login-container",t.style.marginTop="20px",t.style.textAlign="center";const n=this.createLineButton(!0);return t.appendChild(n),void e.appendChild(t)}const o=document.createElement("div");o.className="line-login-container",o.style.marginTop="20px",o.style.textAlign="center";const i=this.createLineButton(!0);o.appendChild(i),null===(t=n.parentNode)||void 0===t||t.insertBefore(o,n.nextSibling)}addRegisterButton(){var t;const e=document.querySelector('form[action^="/account"]');if(!e)return;const n=new URLSearchParams(window.location.search);let o=n.get("email"),i=n.get("line_id");if(o?sessionStorage.setItem("line_email",o):o=sessionStorage.getItem("line_email"),i?sessionStorage.setItem("line_lineId",i):i=sessionStorage.getItem("line_lineId"),o&&o.includes("@")){const t=e.querySelector('input[name="customer[email]"]');t&&(t.value=o)}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||o)try{const t=e,n=new URL(t.action,window.location.origin);i?n.searchParams.set("line_id",i):n.searchParams.delete("line_id"),o?n.searchParams.set("email",o):n.searchParams.delete("email"),t.action=n.pathname+(n.search?n.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 n=this.createLineButton(!1);return t.appendChild(n),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 o=document.createElement("span");o.style.display="flex",o.style.alignItems="center",o.style.justifyContent="center",o.style.marginRight="12px",o.style.width="32px",o.style.height="32px",o.style.flexShrink="0",o.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",o.appendChild(i);const r=document.createElement("span");r.textContent=t?n.BUTTON_TEXT:n.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(o),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"),c=document.createElement("div");if(c.style.display="flex",c.style.flexDirection="column",c.style.alignItems="center",c.style.width="100%",c.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",c.appendChild(t)}return c}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))}}n.BUTTON_CLASS="line-login-button",n.CUSTOM_CONTAINER_CLASS="line-login-custom-container",n.instance=null,n.BUTTON_TEXT="LINE\u3067\u30ed\u30b0\u30a4\u30f3",n.REGISTER_BUTTON_TEXT="LINE\u3067\u767b\u9332",e.default=n},449(t,e,n){"use strict";var o=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))(function(i,r){function s(t){try{c(o.next(t))}catch(t){r(t)}}function a(t){try{c(o.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}c((o=o.apply(t,e||[])).next())})},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(n(127)),s="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiPjxyZWN0IHdpZHRoPSIxMDAwIiBoZWlnaHQ9IjEwMDAiIGZpbGw9IiNjOWVkZmIiLz48cGF0aCBkPSJNMzA3IDY3NWM4LTc4IDM3LTExMyAxMDEtMTQzbDU3LTI3YzIyLTEwIDMyLTM0IDI3LTY4bC0xMi04MWMtMzEtMTAtNTMtMzgtNTMtNzIgMC0zMSAxNy01NSA0NC02NyAxMy04NyA3My0xMzAgMTQzLTEzMHMxMzAgNDMgMTQzIDEzMGMyNyAxMiA0NCAzNiA0NCA2NyAwIDM0LTIyIDYyLTUzIDcybC0xMiA4MWMtNSAzNCA1IDU4IDI3IDY4bDU3IDI3YzY0IDMwIDkzIDY1IDEwMSAxNDMgMiAyMy0xNSA0My0zOCA0NC0xNzcgOC0zNTUgOC01MzIgMC0yMy0xLTQwLTIxLTM4LTQ0eiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTExNCA5NikiIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2ZmZiIgc3Ryb2tlLXdpZHRoPSI1NiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+PC9zdmc+",a={"&":"&","<":"<",">":">",'"':""","'":"'"};function c(t){return String(null!=t?t:"").replace(/[&<>"']/g,t=>a[t])}class l{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 l.instance?(l.instance.config=t,l.instance.preview=e):l.instance=new l(t,e),l.instance}setParent(t){this.parent=t}renderTemplate(){document&&document.body?document.body.insertAdjacentHTML("beforeend",l.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",l.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),n=JSON.parse(e),o={display_name:n.displayName||"",picture_url:"string"==typeof n.pictureUrl?n.pictureUrl:null,line_customer_id:n.userId||""},i=new URL(window.location.href);return i.searchParams.delete("line_profile_data"),window.history.replaceState({},"",i.toString()),o}}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,n,o={}){var i,r,a;this.preview&&this.updateElements();let l=!1;if(n||this.preview||((n=this.consumeLineProfileFromURL())?l=!0:n=this.takeLineProfileFromSessionStorage()),n&&!this.preview&&(null!=n.display_name&&null!=n.line_customer_id||(n=void 0,window.sessionStorage.removeItem("storecrm_line_profile"))),!this.title||!this.content||!this.footer)return;const d=document.createElement("button");d.className="storecrm_modal__btn storecrm_modal__btn-primary",d.textContent=t.button_text||"\u518d\u5165\u8377\u901a\u77e5\u3092\u6709\u52b9\u306b\u3059\u308b";const u=document.createElement("button");u.className="storecrm_modal__btn storecrm_modal__btn-primary storecrm_modal__btn-line-login";const h=(this.preview?this.previewLocale:null===(i=this.parent)||void 0===i?void 0:i.currentLocale)||(null===(r=window.Shopify)||void 0===r?void 0:r.locale)||document.documentElement.lang||navigator.language;u.textContent=t.line_connect_button_text||(/^ja\b/i.test(h||"")?"LINE\u9023\u643a\u3092\u884c\u3046":"Connect with LINE"),n||this.preview||(d.style.display="none",u.style.display="block"),n&&!this.preview&&(u.style.display="none",d.style.display="block"),0!==this.footer.children.length&&(this.footer.innerHTML=""),this.button=null,this.lineLoginButton=null,o.hideSubmitButton||(this.footer.appendChild(d),this.footer.appendChild(u),this.button=d,this.lineLoginButton=u),this.button&&!this.preview&&(this.button.addEventListener("click",()=>{this.handleEnableClick()}),null===(a=this.lineLoginButton)||void 0===a||a.addEventListener("click",()=>{this.handleLineSubscribeClick()})),this.config=t,this.title.innerText=t.title||"LINE\u518d\u5165\u8377\u901a\u77e5";const m=o.readOnly?' disabled aria-disabled="true"':"";let p=`\n
${t.description_text||"\u3053\u306e\u5546\u54c1\u306e\u518d\u5165\u8377\u3092LINE\u3067\u304a\u77e5\u3089\u305b\u3057\u307e\u3059"}
\n
\n `,g=o.variantId||null;if(location.search&&location.search.includes("variant")){const t=new URL(location.href);g=g||t.searchParams.get("variant")}const f=e.filter(t=>!t.available).map(t=>``).join("");if(e&&Array.isArray(e)&&e.length>1?(p=p.replace("\x3c!-- select_style --\x3e",""),p=p.replace("\x3c!-- options --\x3e",f)):(p=p.replace("\x3c!-- select_style --\x3e","display:none"),p=p.replace("\x3c!-- options --\x3e",f)),n||this.preview){this.line_profile=n||{display_name:"LINE\u9867\u5ba2\u540d",picture_url:s,line_customer_id:"preview-user"};p+=`\n
\n avatar\n
${c(this.line_profile.display_name)}
\n
`}var _;p+='
',this.content.innerHTML=p;const v=this.content.querySelector("#storecrm-line-restock-profile-image");if(v&&v.addEventListener("error",()=>{v.getAttribute("src")!==s&&(v.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 o(this,void 0,void 0,function*(){var t,e,n;if(this.preview)return;this.resetMessage(),this.disableButton();const o=null===(t=this.content)||void 0===t?void 0:t.querySelector("#storecrm_restock_variant"),i=o?o.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===(n=this.line_profile)||void 0===n?void 0:n.display_name,JSON.stringify(this.line_profile),this.success.bind(this),this.failure.bind(this))})}handleLineSubscribeClick(){return o(this,void 0,void 0,function*(){var t,e,n;if(this.preview)return;this.resetMessage(),this.disableButton();const o=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===(n=this.parent)||void 0===n?void 0:n.startLineRestockConnectFromPopup)return void(yield this.parent.startLineRestockConnectFromPopup(this.product_id,this.variants,{buttonId:this.button_id,variantId:o}));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.textContent="\u9001\u4fe1\u4e2d...")}enableButton(){this.button&&(this.button.removeAttribute("disabled"),this.button.textContent=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,n,o,i={}){this.product_id=n,this.button_id=i.buttonId,this.variants=Array.isArray(e)?e:[],this.inited?this.runShow(t,e,o,i):window.setTimeout(()=>this.show(t,e,n,o,i),100)}runShow(t,e,n,o={}){this.render(t,e,n,o);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=l,l.template='';let d=null;e.schema={preview:(t,e,n=e)=>{var o,i;return o=()=>{const e=l.getInstance(t,!0);e.previewLocale=n,e.show(t,[],"1234567890",void 0)},i=300,clearTimeout(d),d=setTimeout(o,i),l.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:"line_connect_button_text",nameJa:"LINE\u9023\u643a\u30dc\u30bf\u30f3\u306e\u30c6\u30ad\u30b9\u30c8",nameEn:"LINE connection button text",defaultJa:"LINE\u9023\u643a\u3092\u884c\u3046",defaultEn:"Connect with LINE"},{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}]}},840(t,e,n){"use strict";e.schema=e.render=e.generateDefaultSettings=e.LineRestockButton=void 0;const o=n(80);class i{constructor(t,e,n,o,i){this.eventTriggered=!1,this.variants=n,this.buttonSettings=o,this.productId=e,this.product=i}static getInstance(t,e=null,n=null,o=null,r=null){if(i.instances[t])o&&(i.instances[t].buttonSettings=o);else{if(!(e&&n&&o&&r))throw new Error("StoreCRM LineRestock: productId, variants, buttonSettings, product are required");i.instances[t]=new i(t,e,n,o,r)}return i.instances[t]}createScript(t,e){const n=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 n,o;if(e instanceof HTMLElement&&e.closest('[data-type="line-restock-button"]')){const i=new URL(location.href),r=(null===(n=this.variants.find(t=>t.available))||void 0===n?void 0:n.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 c=new URLSearchParams(window.location.search),l=c.get("line_login_error");if(l)return console.error("LINE\u30ed\u30b0\u30a4\u30f3\u95a2\u9023\u306e\u30a8\u30e9\u30fc:",l),void this.removeLineConnectResultParamsFromUrl(!0);if(c.get("line_connect"))return this.hasPendingLineRestockIntent()?void this.removeLineConnectResultParamsFromUrl():(this.removeLineConnectResultParamsFromUrl(),void(null===(o=window.storecrm)||void 0===o||o.showLineRestockPopup(t)))}})}removeLineConnectResultParamsFromUrl(t=!1){try{const e=new URL(window.location.href),n=e.toString();e.searchParams.delete("line_connect"),e.searchParams.delete("line_login_error"),t&&e.searchParams.delete("line_profile_data"),e.toString()!==n&&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 n=window.navigation;if(n)n.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 n={};return e.schema.rows.forEach(e=>{"text"===e.type?n[e.slug]="ja"===t?e.defaultJa:e.defaultEn:(e.type,n[e.slug]=e.default)}),n};e.render=({productId:t,variantId:e,variants:n,id:o,buttonSettings:r,isOutOfStock:s,product:a,preview:c=!1})=>i.getInstance(o,t,n,r,a).render(o,c);const r=t=>{const e=[`opacity: ${((t,e,n,o)=>{const i=Number(t);return Number.isFinite(i)?Math.min(o,Math.max(n,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,n)=>{const o=e.registered_button_text||("ja"===n?"LINE\u767b\u9332\u6e08\u307f":"LINE registered");return`\n
\n
${"ja"===n?"\u767b\u9332\u6e08\u307f\u8868\u793a":"Registered state"}
\n ${(t||"").replace(/]*)>[\s\S]*?<\/button>/,(t,n)=>{const i=String(n||"").replace(/\sonclick="[^"]*"/g,"");return`${s=o,String(null!=s?s:"").replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}`;var s})}\n
`};e.schema={preview:(t,n)=>((t,e,n,o)=>`\n
\n
\n
${"ja"===o?"\u901a\u5e38\u8868\u793a":"Default state"}
\n ${t||""}\n
\n ${s(e,n,o)}\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,n),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"}]}]}},198(t,e){"use strict";e.schema=void 0;const n=t=>String(null!=t?t:"").replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),o=t=>"string"==typeof t&&""!==t.trim()&&"undefined"!==t,i=(t,e,n)=>o(null==t?void 0:t[e])?t[e]:n,r=(t,e,n)=>{const i=null==t?void 0:t[e];return o(i)&&/^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i.test(i)?i:n},s=(t,e,n,o,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(o,s)):n};e.schema={preview:(t,e)=>{const o="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=n(i(t,"login_required_modal_title",o.title)),c=n(i(t,"login_required_modal_description",o.description)),l=n(i(t,"login_required_modal_login_button_text",o.login)),d=n(i(t,"login_required_modal_cancel_button_text",o.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:1,max:1e3,step:1,options:{min:1,max:1e3,step:1},checkVisible:t=>"nolimit"!==t.limitPolicy&&"nolimit"!==t.limitBasis,customize:(t,e)=>{const n="strict"===t.limitPolicy,o="stock_amount"===t.limitBasis;return Object.assign(Object.assign({},e),{nameJa:n?o?"\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":o?"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:n?o?"Total limit for this restock (percentage of stock)":"Total limit for this restock":o?"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"},min:1,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."}]}]}},827(t,e,n){"use strict";var o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.schema=e.RestockPopupManager=void 0;const i=o(n(127));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,n={}){var o,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,!n.hideSubmitButton){const e=document.createElement("button");e.className="storecrm_modal__btn storecrm_modal__btn-primary",e.innerHTML=t.button_text,null===(o=this.footer)||void 0===o||o.appendChild(e),this.button=e}this.button&&!this.preview&&this.button.addEventListener("click",()=>{this.checkAcceptsMarketingStatusAndClearMessages()}),this.config=t;const a=n.email||(null===(i=window.storecrm_data)||void 0===i?void 0:i.customer_email)||window.localStorage.getItem("storecrm_restock_email")||"",c=n.readOnly?' disabled aria-disabled="true"':"",l=n.readOnly?' readonly aria-readonly="true"':"";if(this.title&&this.content&&this.popup){this.title.innerText=t.popup_title;let o=`\n
${t.popup_description}
\n
\n
${t.emailaddress}
\n${t.add_accepts_marketing_checkbox?``:""}\n${t.add_accepts_marketing_checkbox?``:""}\n
\n`.trim(),i=n.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?(o=o.replace("\x3c!-- select_style --\x3e",""),o=o.replace("\x3c!-- options --\x3e",r)):(o=o.replace("\x3c!-- select_style --\x3e","display:none"),o=o.replace("\x3c!-- options --\x3e",r)),this.content.innerHTML=o,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 n=document.createElement("button");n.className="storecrm_modal__btn storecrm_modal__btn-primary",n.innerHTML=t.button_text,n.style.backgroundColor=t.button_background_color,n.style.color=t.button_text_color,null===(r=this.secondFooter)||void 0===r||r.appendChild(n)}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,n,o;if(this.preview)return;this.resetMessage(),this.disableButton();const i=null===(e=this.content)||void 0===e?void 0:e.querySelector("#storecrm_restock_email"),r=null===(n=this.content)||void 0===n?void 0:n.querySelector("#storecrm_restock_variant"),s=null===(o=this.content)||void 0===o?void 0:o.querySelector("#storecrm_restock_accepts_marketing"),a=i?i.value:"",c=r?r.value:"",l=this.product_id,d=s?s.checked:null;this.parent&&this.parent.storeRestock(a,c,l,d,this.config.add_accepts_marketing_checkbox,t,this.success.bind(this),this.failure.bind(this))}show(t,e,n,o={}){this.product_id=n,this.inited?this.runShow(t,e,o):window.setTimeout(()=>this.show(t,e,n,o),100)}runShow(t,e,n={}){this.render(t,e,n);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 n=document.getElementById("storecrm-modal-content"),o=null===(e=this.content)||void 0===e?void 0:e.querySelector("#storecrm_restock_email"),i=document.getElementById("accepts_marketing_checkbox_container"),r=document.getElementById("email_confirmation_container");if(!n||!i||!r)return;r.innerHTML=this.config.email_confirmation_text+"
"+o.value;const s=Array.from(n.children);s.forEach(t=>{"none"!==t.style.display&&t.classList.add("fade-out")}),setTimeout(()=>{s.forEach(t=>{t.style.display="none"})},300),i.classList.add("fade-in"),setTimeout(()=>{i.style.display="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 n=document.createElement("button");n.className="storecrm_modal__btn storecrm_modal__btn-primary",n.style.color=this.config.button_text_color,n.style.backgroundColor=this.config.button_background_color,n.innerHTML=this.config.button_text,this.footer&&this.footer.appendChild(n),this.button=n,null===(e=this.button)||void 0===e||e.addEventListener("click",()=>{this.submit(t)})}}e.RestockPopupManager=r,r.template='';let s=null;e.schema={preview:(t,e)=>{var n,o;return n=()=>{r.getInstance(t,!0).show(t,[],"1234567890")},o=300,clearTimeout(s),s=setTimeout(n,o),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}]}},10(t,e,n){"use strict";e.schema=e.render=e.RestockButton=void 0;const o=n(80);class i{constructor(t,e,n,o,i){this.eventTriggered=!1,this.variants=n,this.buttonSettings=o,this.productId=e,this.product=i}static getInstance(t,e=null,n=null,o=null,r=null){if(i.instances[t])o&&(i.instances[t].buttonSettings=o);else{if(!(e&&n&&o&&r))throw new Error("StoreCRM Restock: productId, variants, buttonSettings, product are required");i.instances[t]=new i(t,e,n,o,r)}return i.instances[t]}createScript(t,e){const n=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 n=new URL(location.href),o=(null===(e=this.variants.find(t=>t.available))||void 0===e?void 0:e.id)||this.variants[0].id||null,i=parseInt(n.searchParams.get("variant")||o,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 n=window.navigation;if(n)n.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:n,id:o,buttonSettings:r,isOutOfStock:s,product:a,preview:c=!1})=>i.getInstance(o,t,n,r,a).render(o,c);const r=t=>{const e=[`opacity: ${((t,e,n,o)=>{const i=Number(t);return Number.isFinite(i)?Math.min(o,Math.max(n,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,n)=>{const o=e.registered_button_text||("ja"===n?"\u767b\u9332\u6e08\u307f":"Registered");return`\n
\n
${"ja"===n?"\u767b\u9332\u6e08\u307f\u8868\u793a":"Registered state"}
\n ${(t||"").replace(/]*)>[\s\S]*?<\/button>/,(t,n)=>{const i=String(n||"").replace(/\sonclick="[^"]*"/g,"");return`${s=o,String(null!=s?s:"").replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}`;var s})}\n
`};e.schema={preview:(t,n)=>((t,e,n,o)=>`\n
\n
\n
${"ja"===o?"\u901a\u5e38\u8868\u793a":"Default state"}
\n ${t||""}\n
\n ${s(e,n,o)}\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,n),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"}]}]}},263(t,e,n){"use strict";e.StatusWidget=void 0;const o=n(2);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,n){this.position="beforeend",this.header=t,this.config=n,this.position=e}setParent(t){this.parent=t}render(){this.parent&&this.parent.getStatus(t=>{this.renderedWidget&&(this.renderedWidget.remove(),this.renderedWidget=void 0),this.renderedWidget=this.createWidget(t),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,n,o,i;const r=document.createElement("div");function s(t){const e=document.createElement("span");return e.classList.add("storecrm-off"),e.appendChild(document.createTextNode(t)),e}function a(t){const e=document.createElement("span");return e.classList.add("storecrm-on"),e.appendChild(document.createTextNode(t)),e}function c(t){const e=document.createElement("button");return e.classList.add("storecrm-button","storecrm-button-off"),e.appendChild(document.createTextNode(t)),e}function l(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 o=document.createElement("div");o.appendChild(document.createTextNode(d.lineTitle)),o.appendChild(t.line?a(d.lineOn):s(d.lineOff)),this.lineButton=t.line?c(d.lineDisconnect):l(d.lineConnect),o.appendChild(this.lineButton),r.appendChild(o),t.line?null===(e=this.lineButton)||void 0===e||e.addEventListener("click",this.lineUnsubscribe.bind(this)):null===(n=this.lineButton)||void 0===n||n.addEventListener("click",this.lineSubscribe.bind(this))}if(t.mail_show_account){const e=document.createElement("div");e.appendChild(document.createTextNode(d.mailTitle)),e.appendChild(t.accepts_marketing?a(d.mailOn):s(d.mailOff)),this.mailButton=t.accepts_marketing?c(d.mailUnsubscribe):l(d.mailSubscribe),e.appendChild(this.mailButton),r.appendChild(e),t.accepts_marketing?null===(o=this.mailButton)||void 0===o||o.addEventListener("click",this.unsubscribe.bind(this)):null===(i=this.mailButton)||void 0===i||i.addEventListener("click",this.subscribe.bind(this))}return r}lineSubscribe(){this.parent&&this.parent.lineSubscribe(function(t){alert(t)},{routeKey:o.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)})}}},718(t,e,n){"use strict";var o=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))(function(i,r){function s(t){try{c(o.next(t))}catch(t){r(t)}}function a(t){try{c(o.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}c((o=o.apply(t,e||[])).next())})},i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const r=n(61),s=n(666),a=n(10),c=n(840),l=n(827),d=n(198),u=n(449),h=n(263),m=n(934),p=i(n(164)),g=n(73),f=n(645),_=n(260),v=n(476),b=n(850),y=n(854);n(741);const w="storecrm_guest_favorite_merge_v1";class k{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.favoriteCountRenderer=b.FavoriteCountRenderer.getInstance(),this.optimisticRestockRegistered=new Map,this.restockStateWatcherStarted=!1,this.lastRestockStateHref="",this.restockButtonVariantByKey=new Map,this.exclusionResults=new Map,this.exclusionPending=new Set,this.exclusionFailures=new Map,window.storecrm_data=window.storecrm_data||{},console.log("StoreCRM initialized version 0.7.247",t),this.config=this.applyLocaleOverrides(t),this.currentLocale=this.detectLocale(),this.applyDefaults(),this.popupManager=l.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(k.prototype).applyLocaleOverrides(t||{})}init(){this.checkPendingRestockIntentAfterPageReturn(),(()=>{o(this,void 0,void 0,function*(){var t,e,n,o;try{if("loading"===document.readyState&&(yield new Promise(t=>{document.addEventListener("DOMContentLoaded",()=>t(),{once:!0})})),document.querySelector("[data-storecrm-preview-context]"))return console.log("StoreCRM: Favorite preview context detected; skipping customer and token initialization"),void(yield this.renderFavoriteList());if(null===(t=window.__storecrmCartResync)||void 0===t||t.bootstrap(this.config),null===(e=window.__storecrmIdentityRefresh)||void 0===e||e.bootstrap({allowAutomatic:!0,config:this.config}),this.isConnectProxyPage())return yield this.checkCustomer({syncWishlist:!1}),null===(n=window.__storecrmIdentityRefresh)||void 0===n||n.bootstrap({allowAutomatic:!0,config:this.config}),void this.checkConnect();yield this.bootstrapTemplates(),yield this.checkCustomer(),null===(o=window.__storecrmIdentityRefresh)||void 0===o||o.bootstrap({allowAutomatic:!0,config:this.config}),yield this.syncWishlist()}catch(t){console.error("StoreCRM: init: error",t)}yield this.render(),yield this.handlePendingRestockIntent();const i=document.querySelector("[data-storecrm-preview-context]"),r=(0,v.isAppProxyPathname)(window.location.pathname,this.config.appProxyPath,this.config.appProxyName);console.log("StoreCRM: Favorite list page detection",{hasPreviewContext:Boolean(i),isFavoriteProxyPage:r,pathname:window.location.pathname,appProxyPath:this.config.appProxyPath,appProxyName:this.config.appProxyName}),(i||r)&&(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(){var t,e,n,o;try{return(null===(t=window.storecrm_data)||void 0===t?void 0:t.customer_id)||(null===(o=null===(n=null===(e=window.ShopifyAnalytics)||void 0===e?void 0:e.meta)||void 0===n?void 0:n.page)||void 0===o?void 0:o.customerId)}catch(t){return null}}checkCustomer(){return o(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(),n=(this.getCurrentShopifyCustomerId()||"").toString();if(e!==n){if(n)return!e||e.startsWith("TEMP_")&&n?(yield this.refreshToken(!1,t),void(!1!==t.syncWishlist&&(yield this.syncWishlist(null,void 0,!0)))):void(e===n||(yield this.refreshToken(!0)));(null==e?void 0:e.startsWith("TEMP_"))||(yield this.refreshToken(!0))}})}refreshToken(){return o(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 n=this.normalizeLocaleValue(null===(e=window.Shopify)||void 0===e?void 0:e.locale);if(!t||!n)return;const o=Object.entries(t).map(([t,e])=>({normalizedKey:this.normalizeLocaleValue(t),value:e})).filter(t=>t.normalizedKey),i=o.find(t=>t.normalizedKey===n);if(i)return i.value;const r=n.split("-")[0],s=o.find(t=>t.normalizedKey&&t.normalizedKey.split("-")[0]===r);if(s)return s.value;const a=o.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 n=this.isPlainObject(t)?Object.assign({},t):{};return Object.keys(e||{}).forEach(t=>{const o=n[t],i=e[t];"favoriteMode"!==t&&(this.isPlainObject(o)&&this.isPlainObject(i)?n[t]=this.deepMergeConfig(o,i):this.isPlainObject(i)?n[t]=this.deepMergeConfig({},i):Array.isArray(i)?n[t]=i.slice():n[t]=i)}),n}applyLocaleOverrides(t){const e=t.locales,n=Object.assign({},t),o=this.findLocaleFromConfig(e);if(!o)return n;const i=this.deepMergeConfig(n,o);return e&&(i.locales=e),i}getSchemaDefault(t){const e=(this.currentLocale||"en").toLowerCase();if(null==t)return;const n=t=>null!=t;return void 0!==t.default&&null!==t.default&&"text"!==t.type?t.default:e.startsWith("ja")&&n(t.defaultJa)?t.defaultJa:e.startsWith("en")&&n(t.defaultEn)?t.defaultEn:n(t.default)?t.default:n(t.defaultEn)?t.defaultEn:n(t.defaultJa)?t.defaultJa:""}mergeWidgetConfig(t,e,n){const o=Object.assign({},e||{});return(t&&t.rows||[]).forEach(t=>{const e=t.slug;if(e){if(n&&Object.prototype.hasOwnProperty.call(n,e)){const i=n[e];if(!Object.prototype.hasOwnProperty.call(o,e))return void(o[e]=i);const r=o[e],s=this.getSchemaDefault(t);return void(null!=r&&""!==r&&r!==s||(o[e]=i))}Object.prototype.hasOwnProperty.call(o,e)||(o[e]=this.getSchemaDefault(t))}}),o}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 n(840).schema||{rows:[]}}catch(t){return{rows:[]}}})(),this.config.lineRestock,e["line-restock"]),this.config.restockPopup=this.mergeWidgetConfig(l.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 o(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"}),n=yield Promise.all(e.map(e=>o(this,[e],void 0,function*([e,n]){try{const o=yield fetch(`${this.config.backendUrl}/widget/templates/${n}?locale=${t}`,{credentials:"same-origin"});if(!o.ok)return[e,void 0];return[e,(yield o.json()).template||{}]}catch(t){return console.warn("StoreCRM: Failed to load widget template",n,t),[e,void 0]}}))),i={};n.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";if(t.matches(e)||t.querySelector(e))return!0;return(t.matches("[data-storecrm-favorite-count]")?[t]:Array.from(t.querySelectorAll("[data-storecrm-favorite-count]"))).some(t=>!t.closest(".storecrm-wishlistbuttonwrapper"))}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 n=t.id||"storecrm-button-"+Math.random().toString(36).slice(-8);t.id||(t.id=n);const o=new URL(location.href),i=o.searchParams.get("variant")&&o.searchParams.get("variant"),s=t.dataset.productId,l=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||!l)return;const m=e&&("product"===this.favoriteMode?(0,g.containsShopifyId)(e.products,s):(0,g.containsShopifyId)(e.variants,l)),p=!!t.dataset.currentVariantAvailable,f="wishlist-button"===t.dataset.type?(0,r.render)({productId:s,variantId:l,id:n,button:t,variants:u,product:h,buttonSettings:this.config.favorite,isFavorited:m,hasVariantSelector:d}):"line-restock-button"===t.dataset.type?(0,c.render)({productId:s,variantId:l,id:n,buttonSettings:this.config.lineRestock||(0,c.generateDefaultSettings)(),isOutOfStock:p,product:h,variants:u}):(0,a.render)({productId:s,variantId:l,id:n,buttonSettings:this.config.restock,isOutOfStock:p,product:h,variants:u});f&&(t.innerHTML=f),this.isRestockButtonType(t.dataset.type)&&this.applyRestockButtonExcludedState(t,this.isRestockVariantExcluded(l))}),this.refreshAllRestockButtonStates(),document.querySelectorAll(".storecrm-favorite").forEach(n=>{if(n instanceof HTMLElement==!1)return;if(!t&&"true"===n.dataset.isRendered)return;n.dataset.isRendered="true";const o=n.dataset.productId||"",i=new URL(location.href).searchParams.get("variant")||n.dataset.variantId||"";if(!o)return;const s=void 0!==n.dataset.variantSelector,a=n.id||"storecrm-favorite-"+Math.random().toString(36).slice(-8);n.id||(n.id=a);const c=JSON.parse(n.dataset.variants||"[]"),l={tags:JSON.parse(n.dataset.productTags||"[]"),id:n.dataset.productId},d=e&&("variant"===this.favoriteMode&&i?(0,g.containsShopifyId)(e.variants,i):(0,g.containsShopifyId)(e.products,o));n.innerHTML=(0,r.render)({productId:o,variantId:i,button:n,id:a,buttonSettings:this.config.favorite,isFavorited:d,hasVariantSelector:s,variants:c,product:l})||""}),this.shouldRenderStatusWidget(window.location.pathname)&&this.renderStatusWidget(),this.favoriteCountRenderer.hasTargets()&&(this.configureFavoriteCount(),this.favoriteCountRenderer.render()),this.checkToken()}checkToken(){this.isTokenRefreshed||this.isTokenRefreshNeeded()&&this.fetchToken()}isTokenRefreshNeeded(){const t=window.localStorage.getItem("storecrm_customer_id"),e=parseInt(window.localStorage.getItem("storecrm_customer_id")||"0",10),n=window.localStorage.getItem("storecrm_token");let o=null;try{o=n?n.split("|")[1]:null}catch(t){}return this.isTokenRefreshed?(console.log("StoreCRM: Token refresh needed: false (already refreshed)"),!1):t&&n&&o?window.ShopifyAnalytics&&window.ShopifyAnalytics.meta&&window.ShopifyAnalytics.meta.page&&window.ShopifyAnalytics.meta.page.customerId&&window.ShopifyAnalytics.meta.page.customerId!==e?(console.log("StoreCRM: Token refresh needed: true (customerId mismatch)"),!0):window.ShopifyAnalytics&&window.ShopifyAnalytics.meta&&window.ShopifyAnalytics.meta.page&&window.ShopifyAnalytics.meta.page.customerId?1e3*parseFloat(o)<(new Date).getTime()&&(console.log("StoreCRM: Token refresh needed: true (expired)"),!0):(console.log("StoreCRM: Token refresh needed: true (no customerId)"),!0):(console.log("StoreCRM: Token refresh needed: true (no token)"),!0)}shouldRenderStatusWidget(t){try{const e=this.normalizePathname(t);if(!e)return!1;const n=this.getAccountPathIndex(e);if(-1===n)return!1;const o=(e.split("/")[n+1]||"").toLowerCase();return!this.getExcludedAccountPages().has(o)}catch(e){return console.warn("StoreCRM: Invalid pathname for widget rendering:",t,e),!1}}getExcludedAccountPages(){return new Set(this.config.excludedAccountPages||k.DEFAULT_EXCLUDED_ACCOUNT_PAGES)}getAccountPathIndex(t){const e=this.normalizePathname(t);if(!e)return-1;const n=e.split("/"),o=(n[0]||"").toLowerCase();if("account"===o)return 0;const i=(n[1]||"").toLowerCase();return n.length>=2&&k.LOCALE_PATTERN.test(o)&&"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 o(this,arguments,void 0,function*(t={}){if(this.isTokenFetching)return yield new Promise(t=>{const e=Date.now(),n=setInterval(()=>{(!this.isTokenFetching||Date.now()-e>=1e4)&&(clearInterval(n),t(null))},100)}),window.localStorage.getItem("storecrm_token");let e;this.isTokenFetching=!0;try{const t=window.localStorage.getItem("storecrm_customer_id"),n=(0,v.buildAppProxyUrl)("/token",{path:this.config.appProxyPath,name:this.config.appProxyName}),o=yield fetch(`${n}?current_customer_id=${t}`),i=(yield o.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");this.rememberGuestFavoriteMerge(t,r.customer.id,r.customer.token),this.verifiedShopifyCustomerId=r.customer.id,window.localStorage.setItem("storecrm_token",r.customer.token),window.localStorage.setItem("storecrm_customer_id",r.customer.id),this.isTokenRefreshed=!0,e=r.customer.token}finally{this.isTokenFetching=!1}return!1!==t.syncWishlist&&this.getPendingGuestFavoriteMerge()&&(yield this.syncWishlist()),e})}rememberGuestFavoriteMerge(t,e,n){const o=window.localStorage.getItem(w);if(o)try{const t=JSON.parse(o);t.targetId===e&&t.shop===n.split("|")[2]||window.localStorage.removeItem(w)}catch(t){window.localStorage.removeItem(w)}if(!(null==t?void 0:t.startsWith("TEMP_"))||!/^\d+$/.test(e))return;const i=n.split("|")[2];i&&window.localStorage.setItem(w,JSON.stringify({sourceId:t,targetId:e,shop:i,mode:this.favoriteMode}))}getPendingGuestFavoriteMerge(){const t=window.localStorage.getItem(w);if(!t)return null;try{const e=JSON.parse(t),n=window.localStorage.getItem("storecrm_customer_id"),o=window.localStorage.getItem("storecrm_token"),i=String(this.getCurrentShopifyCustomerId()||this.verifiedShopifyCustomerId||"");return i?"string"==typeof e.sourceId&&e.sourceId.startsWith("TEMP_")&&/^\d+$/.test(e.targetId)?e.targetId!==n||e.shop!==(null==o?void 0:o.split("|")[2])||i!==e.targetId?null:e.mode===this.favoriteMode?e:null:(window.localStorage.removeItem(w),null):null}catch(t){return window.localStorage.removeItem(w),null}}getToken(){return o(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 o(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 o(this,arguments,void 0,function*(t="GET",e,n=null,i=!1,r,s){const a=window.location.href,c=t=>o(this,void 0,void 0,function*(){const n=(null==s?void 0:s.customerId)||(yield this.getCustomerId()),o=this.getShopDomainFromStoreCRMToken(t),i=e.includes("?")?"&":"?";return`${e}${i}customer_id=${n}&host=${o}&referrer=${encodeURIComponent(a)}`});let l=null;for(let o=0;o<=2;o++){const a=(null==s?void 0:s.token)||(yield this.getToken());if(l=yield fetch(yield c(a),{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:n?JSON.stringify(n):null,credentials:i?"include":"same-origin",signal:r}),401!==l.status||2===o)break;if(console.warn("StoreCRM: API request unauthorized. Refreshing token and retrying.",{url:e,retryCount:o}),s){const t=yield this.fetchToken({syncWishlist:!1});if(!this.isValidStoreCRMToken(t)||window.localStorage.getItem("storecrm_customer_id")!==s.customerId||t.split("|")[2]!==s.token.split("|")[2])throw new f.ApiRequestError(401);s=Object.assign(Object.assign({},s),{token:t})}else yield this.fetchToken()}if(!l||!l.ok)throw new f.ApiRequestError(l?l.status:null);return l.json()})}toggleWishlist(t,e=!1,n=!1,o=""){n?this.fetchToken().then(()=>{var n=window.localStorage.getItem("storecrm_customer_id");n&&!/^TEMP_/.test(n)?this.doToggleWishlist(t,!e).then(t=>{}).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=o&&""!==o&&"undefined"!==o&&void 0!==o?o:"/account/login"}):this.doToggleWishlist(t,!e).then(t=>{}).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 o(this,arguments,void 0,function*(t=null,e=void 0,n=!1){var o,i;const r=this.getPendingGuestFavoriteMerge();e=e||(null==r?void 0:r.sourceId);const s=r&&e===r.sourceId?{customerId:r.targetId,token:window.localStorage.getItem("storecrm_token")}:void 0;if(e&&(n=!0),!n){const t=JSON.parse(window.localStorage.getItem("storecrm_wishlist")||"{}"),e=6e4;if(t.lastUpdated&&Date.now()-t.lastUpdatedo(this,[t],void 0,function*({productId:t,variantId:e,mode:n,signal:o}){const i=new URLSearchParams({product_id:t,mode:n});return e&&i.set("variant_id",e),this.request("GET",`${this.config.backendUrl}/frontend/favorite/count?${i.toString()}`,null,!1,o)})})}recordFavoriteCountToggle({productId:t,variantId:e},n){t&&this.favoriteCountRenderer.recordToggle({productId:t,variantId:e,delta:n?-1:1,mode:this.favoriteMode})}renderFavoriteList(){return o(this,void 0,void 0,function*(){const t=document.querySelector(".storecrm_favoritelist"),e=document.querySelector("[data-storecrm-preview-context]"),n=t||e;if(console.log("StoreCRM: Favorite list render entry",{elementFound:Boolean(n),standardElementFound:Boolean(t),previewContextFound:Boolean(e),isHtmlElement:n instanceof HTMLElement,loadMoreButtons:document.querySelectorAll("[data-storecrm-next-cursor]").length}),!n||n instanceof HTMLElement==!1)return;console.log("StoreCRM: Render Favorite List");const o=m.Renderer.getInstance(this);yield o.init(),yield o.render()})}getWishlist(){return o(this,arguments,void 0,function*(t=void 0,e){return t?this.request("GET",`${this.config.backendUrl}/frontend/favorite?old_customer_id=${t}&mode=${this.favoriteMode}`,null,!1,void 0,e):this.request("GET",`${this.config.backendUrl}/frontend/favorite?mode=${this.favoriteMode}`)})}doToggleWishlist(t){return o(this,arguments,void 0,function*(t,e=!1){const n=t.dataset.productId;let o=t.dataset.variantId;const i=void 0!==t.dataset.variantSelector;if(!n)return console.error("Product ID not found"),!1;const s=t.closest(".storecrm-favorite"),a=s&&JSON.parse(s.dataset.variants||"null");if("variant"===this.favoriteMode&&a&&1===a.length&&(o=a[0].id,(0,r.hideWidgetSelector)()),"variant"===this.favoriteMode&&!o){if(i){const e=JSON.parse(window.localStorage.getItem("storecrm_wishlist")||"{}");return(0,r.renderWidgetSelector)({button:t,productId:n,variants:a,wishlist:e,buttonSettings:this.config.favorite}),!1}return console.error("Variant ID not found: you need to set data-variant-id (Specify variant id) or data-variant-selector(Show variant selector) attribute."),!1}let c={};return c=e?yield this.request("POST",`${this.config.backendUrl}/frontend/favorite`,{product_id:n,variant_id:o,mode:this.favoriteMode}):yield this.request("DELETE",`${this.config.backendUrl}/frontend/favorite?product_id=${n}&variant_id=${o}&mode=${this.favoriteMode}`),this.recordFavoriteCountToggle({productId:n,variantId:o},!e),c&&window.localStorage.setItem("storecrm_wishlist",JSON.stringify(Object.assign(Object.assign({},c),{lastUpdated:Date.now()}))),"variant"===this.favoriteMode&&i&&(0,r.renderWidgetSelector)({button:t,productId:n,variants:a,wishlist:c,buttonSettings:this.config.favorite,rerender:!0}),this.render(!0),this.renderFavoriteList(),!0})}showRestock(t){const e=t.dataset.id||t.id,n=a.RestockButton.getInstance(e);n?this.handleRestockButtonClick(e,n).catch(t=>{console.error("StoreCRM Restock: click flow failed",t),this.popupManager.show(this.config.restockPopup,n.variants,n.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 o(this,void 0,void 0,function*(){var n;const o=yield this.isLoggedInCustomer(),i=this.getCurrentRestockVariantId(e.variants),r=this.getRestockRegistrationMode(e.variants,i);if(o){if(this.shouldShowRestockRegisteredState()){const o=yield this.getRestockStatus(e.productId,i,r,!0);if(null===(n=null==o?void 0:o.email)||void 0===n?void 0:n.registered)return void this.applyRestockButtonRegisteredState("email",t,!0)}if(this.shouldOneClickRestockWhenLoggedIn())return void(yield this.registerEmailRestockOneClick(t,e,i))}if(this.isRestockLoginRequired()&&!o){const n=this.buildPendingRestockIntent(t,e);return void this.showRestockLoginRequiredModal(n)}this.popupManager.show(this.config.restockPopup,e.variants,e.productId)})}registerEmailRestockOneClick(t,e,n){return o(this,void 0,void 0,function*(){var o;const i=null===(o=window.storecrm_data)||void 0===o?void 0:o.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 o=this.getRestockRegistrationMode(e.variants,n);yield this.doStoreRestock(n,e.productId,i,!1,!1,!1,o),this.shouldShowRestockRegisteredState()?(this.markRestockStatusCacheRegistered("email",e.productId,n,o),this.applyRestockButtonRegisteredState("email",t,!0),this.refreshAllRestockButtonStates(!1)):this.invalidateRestockStatusCache(e.productId,n,o),this.popupManager.show(this.config.restockPopup,e.variants,e.productId,{readOnly:!0,hideSubmitButton:!0,variantId:n,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 o(this,void 0,void 0,function*(){if(yield this.isLoggedInCustomer())return void this.popupManager.show(this.config.restockPopup,e.variants,e.productId);const n=this.buildPendingRestockIntent(t,e);this.showRestockLoginRequiredModal(n)})}buildPendingRestockIntent(t,e,n="email"){return{version:1,channel:n,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 n=this.getSelectedProductFormVariantId(t);if(n)return n;const o=(t||[]).find(t=>!t.available)||(t||[])[0];return o&&o.id?String(o.id):""}getSelectedProductFormVariantId(t){if(!document||!Array.isArray(t)||0===t.length)return"";const e=new Set(t.map(t=>String(t.id))),n=['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 n){const n=Array.from(document.querySelectorAll(t)).find(t=>{const n=String(t.value||"");return n&&e.has(n)});if(n)return String(n.value)}return""}initRestockStateWatcher(){if(this.restockStateWatcherStarted)return;this.restockStateWatcherStarted=!0,this.lastRestockStateHref=window.location.href;const t=()=>{this.refreshAllRestockButtonStates(!1)},e=()=>{this.refreshAllRestockButtonStates(!0)},n=()=>{t(),window.setTimeout(t,60),window.setTimeout(e,250),this.checkPendingRestockIntentAfterPageReturn()},o=window.navigation;o&&o.addEventListener("navigate",()=>{n()}),this.patchHistoryForRestockStateWatcher(),window.addEventListener("storecrm:locationchange",n),window.addEventListener("popstate",n),document.addEventListener("change",t=>{this.isVariantChangeTarget(t.target)&&n()},!0),["variant:change","variant:changed","product:variant-change","shopify:section:load"].forEach(t=>{document.addEventListener(t,n)}),window.setInterval(()=>{this.lastRestockStateHref!==window.location.href&&(this.lastRestockStateHref=window.location.href,n())},1e3)}patchHistoryForRestockStateWatcher(){const t="__storecrmRestockHistoryPatched";window[t]||(window[t]=!0,["pushState","replaceState"].forEach(t=>{const e=window.history[t];window.history[t]=(...t)=>{const n=e.apply(window.history,t);return window.dispatchEvent(new Event("storecrm:locationchange")),n}}))}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 n=e.id;if(n)try{if("restock-button"===e.dataset.type){const o=a.RestockButton.getInstance(n);if(this.applyRestockButtonExcludedStateIfNeeded(e,this.getCurrentRestockVariantId(o.variants)))return;this.refreshRestockButtonState("email",n,o.productId,o.variants,this.getRestockRegistrationMode(o.variants,this.getCurrentRestockVariantId(o.variants)),t)}else if("line-restock-button"===e.dataset.type){const o=c.LineRestockButton.getInstance(n);if(this.applyRestockButtonExcludedStateIfNeeded(e,this.getCurrentRestockVariantId(o.variants)))return;this.refreshRestockButtonState("line",n,o.productId,o.variants,this.getRestockRegistrationMode(o.variants,this.getCurrentRestockVariantId(o.variants)),t)}}catch(t){}})}refreshRestockButtonState(t,e,n,i,r){return o(this,arguments,void 0,function*(t,e,n,o,i,r=!1){let s="";try{if(s=this.prepareRestockButtonStateRefresh(t,e,n,o,i),!this.shouldApplyRestockRegisteredState())return this.applyRestockButtonLoadingState(t,e,!1),void this.applyRestockButtonRegisteredState(t,e,!1);const a=this.getFreshCachedRestockStatus(n,s,i);if(a&&(this.applyRestockButtonLoadingState(t,e,!1),this.applyRestockButtonRegisteredState(t,e,this.isRestockStatusRegistered(t,n,s,i,a)),!r))return;const c=yield this.isLoggedInCustomer(),l=this.getCurrentRestockVariantId(o);if(l!==s)return void this.refreshRestockButtonState(t,e,n,o,this.getRestockRegistrationMode(o,l),!0);if(!c)return this.applyRestockButtonLoadingState(t,e,!1),void this.applyRestockButtonRegisteredState(t,e,!1);const d=yield this.getRestockStatus(n,s,i,r),u=this.getCurrentRestockVariantId(o);if(u!==s)return void this.refreshRestockButtonState(t,e,n,o,this.getRestockRegistrationMode(o,u),!0);this.applyRestockButtonLoadingState(t,e,!1),this.applyRestockButtonRegisteredState(t,e,this.isRestockStatusRegistered(t,n,s,i,d))}catch(n){s&&this.getCurrentRestockVariantId(o)===s&&this.applyRestockButtonLoadingState(t,e,!1),console.warn("StoreCRM Restock: failed to refresh registration status",n)}})}prepareRestockButtonStateRefresh(t,e,n,o,i){const r=this.getCurrentRestockVariantId(o),s=`${t}:${e}`,a=this.restockButtonVariantByKey.get(s),c=Boolean(a&&a!==r);c&&this.applyRestockButtonRegisteredState(t,e,!1),this.restockButtonVariantByKey.set(s,r);return this.getFreshCachedRestockStatus(n,r,i)?this.applyRestockButtonLoadingState(t,e,!1):c&&(this.applyRestockButtonRegisteredState(t,e,!1),this.applyRestockButtonLoadingState(t,e,!0)),r}getRestockStatusCacheKey(t,e,n){return`${n}:${t}:${e||""}`}getOptimisticRestockRegisteredKey(t,e,n,o){return`${t}:${this.getRestockStatusCacheKey(e,n,o)}`}isOptimisticRestockRegistered(t,e,n,o){const i=this.getOptimisticRestockRegisteredKey(t,e,n,o),r=this.optimisticRestockRegistered.get(i);return!!r&&(!(Date.now()-r>=3e4)||(this.optimisticRestockRegistered.delete(i),!1))}isRestockStatusRegistered(t,e,n,o,i){var r;return Boolean(null===(r=null==i?void 0:i[t])||void 0===r?void 0:r.registered)||this.isOptimisticRestockRegistered(t,e,n,o)}shouldApplyRestockRegisteredState(){return this.shouldShowRestockRegisteredState()}getFreshCachedRestockStatus(t,e,n){const o=this.restockStatusCache.get(this.getRestockStatusCacheKey(t,e,n));return!o||Date.now()-o.fetchedAt>=3e4?null:o.value}invalidateRestockStatusCache(t,e,n){this.restockStatusCache.delete(this.getRestockStatusCacheKey(t,e,n))}markRestockStatusCacheRegistered(t,e,n,o){this.optimisticRestockRegistered.set(this.getOptimisticRestockRegisteredKey(t,e,n,o),Date.now());const i=this.getFreshCachedRestockStatus(e,n,o)||{mode:o,product_id:e,variant_id:n||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,n,o),{value:i,fetchedAt:Date.now()})}getRestockStatus(t,e,n){return o(this,arguments,void 0,function*(t,e,n,o=!1){var i;if(!t||"variant"===n&&!e)return null;const r=this.getRestockStatusCacheKey(t,e,n),s=this.getFreshCachedRestockStatus(t,e,n);if(!o&&s)return s;const a=this.restockStatusRequests.get(r);if(a)return a;const c=new URLSearchParams({product_id:t,mode:n});e&&c.set("variant_id",e);const l=null===(i=window.storecrm_data)||void 0===i?void 0:i.customer_email;l&&this.checkEmailFormat(l)&&c.set("email",l);const d=this.request("GET",`${this.config.backendUrl}/frontend/restock/status?${c.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 n;const o=null===(n=this.getRestockButtonSettings(t))||void 0===n?void 0:n[e];return"string"==typeof o&&""!==o.trim()?o: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 n=null===(e=this.getRestockButtonSettings(t))||void 0===e?void 0:e.registered_button_opacity,o="number"==typeof n?n:parseFloat(String(null!=n?n:""));return Number.isFinite(o)?String(Math.min(1,Math.max(.3,o))):"0.55"}getRestockButtonLoadingLabel(){return/^ja\b/i.test(this.currentLocale||"")?"\u78ba\u8a8d\u4e2d":"Checking"}ensureRestockLoadingStyle(){if(document.getElementById(k.RESTOCK_LOADING_STYLE_ID))return;const t=document.createElement("style");t.id=k.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)}`}isRestockButtonType(t){return"restock-button"===t||"line-restock-button"===t}isRestockVariantExcluded(t){var e,n;const o=null===(e=this.config.restockOption)||void 0===e?void 0:e.excludedVariantProjection;if(o&&t){const e=String(t);return this.exclusionResults.has(e)?this.exclusionResults.get(e):(this.exclusionPending.has(e)||(this.exclusionLookup||(this.exclusionLookup=new _.RestockExclusionLookup(o)),this.exclusionPending.add(e),this.exclusionLookup.contains(t).then(t=>{this.exclusionResults.set(e,t),this.exclusionPending.delete(e),this.refreshAllRestockButtonStates()}).catch(t=>{console.warn("StoreCRM: exclusion lookup failed",t);const n=(this.exclusionFailures.get(e)||0)+1;this.exclusionFailures.set(e,n),n<3?window.setTimeout(()=>{this.exclusionPending.delete(e),this.refreshAllRestockButtonStates()},1e3*Math.pow(2,n)):(this.exclusionResults.set(e,!1),this.exclusionPending.delete(e),this.refreshAllRestockButtonStates())})),!0)}return(0,_.isRestockVariantExcluded)(null===(n=this.config.restockOption)||void 0===n?void 0:n.excludedVariantIds,t)}applyRestockButtonExcludedState(t,e){if(e)return t.dataset.storecrmVariantExcluded="true",void(t.style.display="none");"true"===t.dataset.storecrmVariantExcluded&&(delete t.dataset.storecrmVariantExcluded,t.style.removeProperty("display"))}applyRestockButtonExcludedStateIfNeeded(t,e){const n=this.isRestockVariantExcluded(e);return this.applyRestockButtonExcludedState(t,n),n}applyRestockButtonLoadingState(t,e,n){const o=this.getRestockButtonSelector(t,e);document.querySelectorAll(o).forEach(t=>{if(t instanceof HTMLButtonElement){if(t.dataset.storecrmOriginalText||(t.dataset.storecrmOriginalText=t.textContent||""),n)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,n){const o=this.getRestockButtonSelector(t,e);document.querySelectorAll(o).forEach(e=>{if(e instanceof HTMLButtonElement){if(e.dataset.storecrmOriginalText||(e.dataset.storecrmOriginalText=e.textContent||""),n)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 n=null===(e=this.config.restockOption)||void 0===e?void 0:e.guest_redirect_url;if(this.isNonEmptyOption(n))return this.buildConfiguredGuestRestockRedirectUrl(n,t);const o=this.toGuestRestockReturnPath(t);try{const t=new URL(this.getStoreAccountLoginUrl(),window.location.origin);return t.searchParams.set(this.getGuestRestockReturnParamName(t),o),t.origin===window.location.origin?`${t.pathname}${t.search}${t.hash}`:t.toString()}catch(t){return`/account/login?return_url=${encodeURIComponent(o)}`}}buildConfiguredGuestRestockRedirectUrl(t,e){const n=this.toGuestRestockReturnPath(e);try{const e=new URL(t,window.location.origin);return e.searchParams.set(this.getConfiguredGuestRestockReturnParamName(e),n),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 n=null===(t=window.storecrm_data)||void 0===t?void 0:t.account_login_url,o=null===(e=window.storecrm_data)||void 0===e?void 0:e.storefront_login_url;return this.isNewCustomerAccountsStore()?this.isNonEmptyOption(o)?o:this.isNonEmptyOption(n)?n:"/account/login":this.isNonEmptyOption(n)?n:this.isNonEmptyOption(o)?o:"/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(k.PENDING_RESTOCK_INTENT_KEY,JSON.stringify(t))}getPendingRestockIntent(){const t=window.localStorage.getItem(k.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(k.PENDING_RESTOCK_INTENT_KEY)}getPendingRestockVariants(t){return t.variant_id?[{id:t.variant_id,title:"",available:!1}]:[]}getUrlWithoutLineConnectResultParams(t,e=!1){const n=new URL(t);return n.searchParams.delete("line_connect"),n.searchParams.delete("line_login_error"),e&&n.searchParams.delete("line_profile_data"),n.toString()}removeLineConnectResultParamsFromUrl(t=!1){try{const e=window.location.href,n=this.getUrlWithoutLineConnectResultParams(e,t);n!==e&&window.history.replaceState({},"",n)}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>=k.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 n=e.querySelector('[data-storecrm-restock-login-action="login"]');null==n||n.focus()}hideRestockLoginRequiredModal(){const t=document.getElementById(k.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(k.RESTOCK_LOGIN_REQUIRED_MODAL_ID);return t||(document.body.insertAdjacentHTML("beforeend",``),t=document.getElementById(k.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 n=t.target,o=null===(e=null==n?void 0:n.closest("[data-storecrm-restock-login-action]"))||void 0===e?void 0:e.getAttribute("data-storecrm-restock-login-action");if(o){if("login"===o){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 n;const o=null===(n=this.config.restockOption)||void 0===n?void 0:n[t];return this.isNonEmptyOption(o)?o:e}getRestockLoginRequiredColorOption(t,e){var n;const o=null===(n=this.config.restockOption)||void 0===n?void 0:n[t];return this.isNonEmptyOption(o)?o:e}getRestockLoginRequiredNumberOption(t,e,n,o){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(o,Math.max(n,s)):e}applyRestockLoginRequiredModalSettings(t){const e=this.getRestockLoginRequiredCopy(),n=t.querySelector(".storecrm_modal__overlay"),o=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 c=this.getRestockLoginRequiredColorOption("login_required_modal_overlay_color","#000000"),l=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");n&&(n.style.backgroundColor=this.toRgba(c,l/100)),o&&(o.style.backgroundColor=this.getRestockLoginRequiredColorOption("login_required_modal_background_color","#ffffff"),o.style.color=d,o.style.width=`${u}px`,o.style.maxWidth="100%",o.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 n=Math.min(1,Math.max(0,e)),o=t.trim(),i=o.match(/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i),r=o.match(/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i);if(i){const[,t,e,o]=i;return`rgba(${parseInt(t+t,16)}, ${parseInt(e+e,16)}, ${parseInt(o+o,16)}, ${n})`}if(r){const[,t,e,o]=r;return`rgba(${parseInt(t,16)}, ${parseInt(e,16)}, ${parseInt(o,16)}, ${n})`}return`rgba(0, 0, 0, ${n})`}isPendingRestockIntentExpired(t){return!t.created_at||Date.now()-t.created_at>k.PENDING_RESTOCK_INTENT_TTL_MS}isLoggedInCustomer(){return o(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),n=new URL(t.pdp_url,window.location.origin);return e.origin===n.origin&&e.pathname===n.pathname&&("line"===t.channel&&(e.searchParams.delete("line_connect"),e.searchParams.delete("line_profile_data"),e.searchParams.delete("line_login_error")),e.search===n.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 o(this,void 0,void 0,function*(){var t;if(this.pendingRestockIntentProcessing)return;this.captureLineConnectResultFromUrl();const e=this.pendingLineConnectResultDetected,n=this.pendingLineProfileFromConnectReturn,o=this.getPendingRestockIntent();if(o)if(this.isPendingRestockIntentExpired(o))this.clearPendingRestockIntent();else{this.pendingRestockIntentProcessing=!0;try{const i=yield this.isLoggedInCustomer(),r="line"!==o.channel||this.isRestockLoginRequired();if(!i&&r)return void(this.isAccountPage()||this.schedulePendingRestockIntentRetry());if(!this.isCurrentPageSameAsPendingPdp(o))return void(window.location.href=o.pdp_url);if("line"===o.channel)return void(yield this.handlePendingLineRestockIntent(o,e,n));if(!o.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(o),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(o.variant_id,o.product_id,s,!1,!1,!1,o.mode),this.shouldShowRestockRegisteredState()?(this.markRestockStatusCacheRegistered("email",o.product_id,o.variant_id,o.mode),o.button_id&&this.applyRestockButtonRegisteredState("email",o.button_id,!0),this.refreshAllRestockButtonStates(!1)):this.invalidateRestockStatusCache(o.product_id,o.variant_id,o.mode),this.showPendingRestockPopup(o,{readOnly:!0,hideSubmitButton:!0,variantId:o.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),o){if("line"===o.channel)return this.showPendingLineRestockPopup(o),void this.lineRestockPopupManager.failure(this.config.lineRestockPopup.error_text);this.showPendingRestockPopup(o)}this.popupManager.failure(this.config.restockPopup.error_text)}finally{this.pendingRestockIntentProcessing=!1}}})}handlePendingLineRestockIntent(t,e,n){return o(this,void 0,void 0,function*(){var o,i;const r=yield this.getRestockStatus(t.product_id,t.variant_id,t.mode,!0);if(null===(o=null==r?void 0:r.line)||void 0===o?void 0:o.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=n||(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,n,i,r,s){return o(this,void 0,void 0,function*(){const o=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)||"",o?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,n,e,s,{readOnly:!0,hideSubmitButton:!0,variantId:i}),this.lineRestockPopupManager.success(this.config.lineRestockPopup.success_text)})}showLineRestockPopup(t){return o(this,void 0,void 0,function*(){var e,n,o;const i=c.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),l=this.buildPendingRestockIntent(t,i,"line");if(this.isRestockLoginRequired()&&!r)return void this.showRestockLoginRequiredModal(l);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===(n=null==h?void 0:h.line)||void 0===n?void 0:n.line_connected))try{return void(yield this.registerLineRestockOneClick(t,i.productId,i.variants,s,a,e))}catch(n){return console.error("StoreCRM LineRestock: one-click registration failed",n),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===(o=window.storecrm_data)||void 0===o?void 0:o.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 o(this,arguments,void 0,function*(t,e=[],n={}){if(!t)throw new Error("StoreCRM LineRestock: productId is required");this.pendingLineConnectResultDetected=!1,this.pendingLineProfileFromConnectReturn=void 0,this.lineRestockPopupManager.clearStoredLineProfile();let o=window.location.href;try{o=this.getUrlWithoutLineConnectResultParams(window.location.href,!0)}catch(t){console.warn("StoreCRM LineRestock: failed to sanitize pending restock URL",t)}this.removeLineConnectResultParamsFromUrl(!0);const i=n.variantId||this.getCurrentRestockVariantId(e),r=this.getRestockRegistrationMode(e,i),s={version:1,channel:"line",product_id:t,variant_id:i,pdp_url:o,button_id:n.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 o(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,n,o,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 c=this.getRestockRegistrationMode([],e);this.doStoreRestock(e,n,t,i,o,r,c).then(()=>{this.invalidateRestockStatusCache(n,e,c),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,n,i,r,s){return o(this,arguments,void 0,function*(t,e,n,o,i,r,s=this.favoriteMode){var a,c;if(o)try{const t=(null===(a=this.config.restockPopup)||void 0===a?void 0:a.create_shopify_customer)||!1,e=t&&(null===(c=this.config.restockPopup)||void 0===c?void 0:c.create_shopify_customer_tags)||void 0;yield this.doUpsertCustomerAcceptsMarketing(n,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:n,mode:s})})}storeLineRestock(t,e,n,o,i,r=void 0,s=void 0){const a=this.getRestockRegistrationMode([],e);this.doStoreLineRestock(t,e,n,o,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,n,i,r){return o(this,arguments,void 0,function*(t,e,n,o,i,r=this.favoriteMode){return yield this.request("POST",`${this.config.backendUrl}/frontend/line/restock/`,{product_id:t,variant_id:e,line_customer_id:n,line_name:o,line_profile:i,mode:r})})}doUpsertCustomerAcceptsMarketing(t,e,n,i,r){return o(this,void 0,void 0,function*(){const o={email:t,accepts_marketing:e,new_customer:n,create_shopify_customer:r||!1};i&&(o.tags=i);return yield this.request("POST",`${this.config.backendUrl}/frontend/accepts-marketing/`,o)})}doGetLineProfile(){return o(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"),n=document.querySelector("#MainContent")||document.querySelector("#main")||document.querySelector(".main")||document.querySelector("main");if(e||n||t){if(t)this.statusWidget=new h.StatusWidget(t,"beforeend",this.config);else if(n)this.statusWidget=new h.StatusWidget(n,"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){(0,f.runCustomerReflectionRetry)(()=>this.doGetStatus(),{onRetry:({attempt:t,elapsedMs:e,delayMs:n})=>{console.warn("StoreCRM: customer is not reflected yet. Retrying status.",{attempt:t,elapsedMs:e,delayMs:n})}}).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 o(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 o(this,void 0,void 0,function*(){var e;const n=yield this.getToken(),o=yield this.getCustomerId(),i=window.location.href,r=this.getShopDomainFromStoreCRMToken(n),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=${n}&customer_id=${o}&host=${r}&referrer=${encodeURIComponent(i)}${a}`})}doLineLogin(t){return o(this,void 0,void 0,function*(){var e;const n=yield this.getCustomerId(),o=yield this.getToken(),i=window.location.href,r=this.getShopDomainFromStoreCRMToken(o),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=${o}&customer_id=${n}&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 o(this,void 0,void 0,function*(){return yield this.request("POST",`${this.config.backendUrl}/frontend/line/disconnect`)})}mailSubscribe(){this.doMailSubscribe().then(t=>{console.log("StoreCRM: \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 o(this,void 0,void 0,function*(){return yield this.request("POST",`${this.config.backendUrl}/frontend/email/subscribe`)})}mailUnsubscribe(){this.doMailUnsubscribe().then(t=>{console.log("StoreCRM: \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 o(this,void 0,void 0,function*(){return yield this.request("POST",`${this.config.backendUrl}/frontend/email/unsubscribe`)})}doMailCheck(t){return o(this,arguments,void 0,function*(t,e=void 0){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"),n=window.localStorage.getItem("storecrm_customer_id");if(!n||n.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")}}}}k.PENDING_RESTOCK_INTENT_KEY="storecrm_pending_restock_intent",k.PENDING_RESTOCK_INTENT_TTL_MS=864e5,k.PENDING_RESTOCK_RETRY_LIMIT=120,k.RESTOCK_LOGIN_REQUIRED_MODAL_ID="storecrm-restock-login-required-modal",k.RESTOCK_LOADING_STYLE_ID="storecrm-restock-loading-style",k.LOCALE_PATTERN=/^[a-z]{2}(?:-[a-z0-9]{2,8})?$/i,k.DEFAULT_EXCLUDED_ACCOUNT_PAGES=[y.ExcludedAccountPage.LOGIN,y.ExcludedAccountPage.REGISTER,y.ExcludedAccountPage.RECOVER,y.ExcludedAccountPage.ACTIVATE,y.ExcludedAccountPage.RESET],e.default=k},260(t,e,n){"use strict";var o=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))(function(i,r){function s(t){try{c(o.next(t))}catch(t){r(t)}}function a(t){try{c(o.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}c((o=o.apply(t,e||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.RestockExclusionLookup=e.isRestockVariantExcluded=void 0;const i=n(73);e.isRestockVariantExcluded=(t,e)=>!(!e||!Array.isArray(t)||0===t.length)&&(0,i.containsShopifyId)(t,e);const r=window,s=r.__storecrmRestockProjectionV1||(r.__storecrmRestockProjectionV1={pending:new Map,scripts:new Map}),{pending:a,scripts:c}=s,l=/^[a-f0-9]{64}$/,d=new Set(["https://image-dev.storecrm.com","https://image.storecrm.com"]),u="__storecrmRestockProjectionLoaded";function h(t,e){const n=new URL(t);if(!d.has(n.origin)||"/widget_settings/restock_exclusions/nodes/"!==n.pathname||n.search||n.hash||n.username||n.password||!l.test(e))return Promise.reject(new Error("Invalid exclusion CDN"));const o=new URL(e+".js",n).href,i=c.get(o);if(i)return i;const r=new Promise((t,n)=>{const i=document.createElement("script"),r=window.setTimeout(()=>d(new Error("Exclusion script timeout")),1e4),l=()=>{window.clearTimeout(r),i.remove(),a.delete(o)},d=t=>{l(),c.delete(o),n(t)};a.set(o,{key:e,resolve:e=>{l(),t(e)},reject:d});const h=window;if(!s.callback||h[u]!==s.callback){const t=h[u];s.callback=(e,n)=>{var o;const i=null===(o=document.currentScript)||void 0===o?void 0:o.src,r=i?a.get(i):void 0;r&&r.key===e&&r.resolve(n),"function"==typeof t&&t(e,n)},h[u]=s.callback}i.src=o,i.async=!0,i.onerror=()=>d(new Error("Exclusion script unavailable")),i.onload=()=>{a.has(o)&&d(new Error("Missing exclusion callback"))},document.head.appendChild(i)});return c.set(o,r),r}function m(t){return Array.isArray(t)?"["+t.map(m).join(",")+"]":t&&"object"==typeof t?"{"+Object.keys(t).sort().map(e=>JSON.stringify(e)+":"+m(t[e])).join(",")+"}":JSON.stringify(t)}function p(t,e){return o(this,void 0,void 0,function*(){const n=t;if(!n||"object"!=typeof n)throw new Error("Invalid exclusion node");const o=Object.keys(n);if(n.ids){if(1!==o.length||!Array.isArray(n.ids)||n.ids.length>512||!n.ids.every(t=>"string"==typeof t&&/^\d{1,20}$/.test(t)))throw new Error("Invalid exclusion leaf")}else if(!n.children||o.some(t=>"children"!==t&&"exact"!==t)||void 0!==n.exact&&"boolean"!=typeof n.exact||Object.entries(n.children).some(([t,e])=>!/^\d$/.test(t)||"string"!=typeof e||!l.test(e)))throw new Error("Invalid exclusion branch");const i=(new TextEncoder).encode(m(n));if(Array.from(new Uint8Array(yield crypto.subtle.digest("SHA-256",i))).map(t=>t.toString(16).padStart(2,"0")).join("")!==e)throw new Error("Invalid exclusion digest");return n})}e.RestockExclusionLookup=class{constructor(t){this.nodes=new Map,this.projection=t}contains(t){return o(this,void 0,void 0,function*(){const e=String(t||"").replace("gid://shopify/ProductVariant/","");if(!/^\d{1,20}$/.test(e))return!1;if(!l.test(this.projection.root))throw new Error("Exclusion projection not published");this.head=Promise.resolve(this.projection.root);let n=yield this.head;for(let t=0;t<=e.length;t++){let o=this.nodes.get(n);if(!o){const t=n;o=h(this.projection.base_url,t).then(e=>p(e,t)).catch(e=>{throw this.nodes.delete(t),c.delete(this.projection.base_url+t+".js"),e}),this.nodes.set(t,o)}const i=yield o;if(i.ids)return i.ids.includes(e);if(t===e.length)return!0===i.exact;const r=i.children[e[t]];if(!r)return!1;n=r}return!1})}}},73(t,e){"use strict";e.containsShopifyId=e.Q=void 0;e.Q=t=>{if(null==t)return null;const e=String(t),n=e.match(/\/(\d+)$/);return n?n[1]:e};e.containsShopifyId=(t,n)=>{const o=(0,e.Q)(n);return!(!o||!Array.isArray(t))&&t.some(t=>(0,e.Q)(t)===o)}},645(t,e){"use strict";var n=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))(function(i,r){function s(t){try{c(o.next(t))}catch(t){r(t)}}function a(t){try{c(o.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}c((o=o.apply(t,e||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.runCustomerReflectionRetry=e.STATUS_REFLECTION_RETRY_DEFAULTS=e.isCustomerNotReflectedError=e.getApiErrorStatus=e.CUSTOMER_NOT_REFLECTED_STATUS=e.ApiRequestError=void 0;class o extends Error{constructor(t){super("API request failed"+(null===t?"":`: ${t}`)),this.name="ApiRequestError",this.status=t}}e.ApiRequestError=o,e.CUSTOMER_NOT_REFLECTED_STATUS=409;e.getApiErrorStatus=t=>t instanceof o?t.status:null;e.isCustomerNotReflectedError=t=>(0,e.getApiErrorStatus)(t)===e.CUSTOMER_NOT_REFLECTED_STATUS,e.STATUS_REFLECTION_RETRY_DEFAULTS={deadlineMs:9e4,initialDelayMs:1e3,maxDelayMs:1e4,backoffFactor:1.5};const i=t=>new Promise(e=>{setTimeout(e,t)});e.runCustomerReflectionRetry=(t,...o)=>n(void 0,[t,...o],void 0,function*(t,n={}){var o,r,s,a,c,l,d;const u=null!==(o=n.deadlineMs)&&void 0!==o?o:e.STATUS_REFLECTION_RETRY_DEFAULTS.deadlineMs,h=null!==(r=n.maxDelayMs)&&void 0!==r?r:e.STATUS_REFLECTION_RETRY_DEFAULTS.maxDelayMs,m=null!==(s=n.backoffFactor)&&void 0!==s?s:e.STATUS_REFLECTION_RETRY_DEFAULTS.backoffFactor,p=null!==(a=n.sleep)&&void 0!==a?a:i,g=null!==(c=n.now)&&void 0!==c?c:()=>Date.now(),f=g();let _=null!==(l=n.initialDelayMs)&&void 0!==l?l:e.STATUS_REFLECTION_RETRY_DEFAULTS.initialDelayMs,v=0;for(;;){v+=1;try{return yield t()}catch(t){if(!(0,e.isCustomerNotReflectedError)(t))throw t;const o=g()-f;if(o>=u)throw t;const i=Math.min(_,u-o);null===(d=n.onRetry)||void 0===d||d.call(n,{attempt:v,elapsedMs:o,delayMs:i}),yield p(i),_=Math.min(Math.round(_*m),h)}}})},476(t,e){"use strict";e.isAppProxyPathname=e.buildAppProxyUrl=e.Fo=e._t=void 0;const n=/^\/(?:a|apps|community|tools)\/[A-Za-z0-9_-]{1,30}$/,o=/^[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&&o.test(r[0])&&(e=`/${r.slice(1).join("/")}`),!n.test(e))return null;const s=e.split("/")[2];return i.has(s.toLowerCase())?null:e};e.Fo=(t,n)=>{const o=(0,e._t)(t);if(o)return o;return`/apps/${String(null!=n?n:"obake").trim().replace(/^\/+|\/+$/g,"")||"obake"}`};e.buildAppProxyUrl=(t,n)=>{var o,i;const r=(0,e.Fo)(n.path,n.name),s=t.startsWith("/")?t:`/${t}`;return`${null!==(i=null===(o=n.origin)||void 0===o?void 0:o.replace(/\/$/,""))&&void 0!==i?i:""}${r}${s}`};e.isAppProxyPathname=(t,n,i)=>{const r=(0,e.Fo)(n,i),s=String(t||"").split("/").filter(Boolean);s.length>=3&&o.test(s[0])&&s.shift();const a=`/${s.join("/")}`;return a===r||a.startsWith(`${r}/`)}},80(t,e){"use strict";e.getPercentageButtonSizingCss=e.getButtonWidthCss=void 0;e.getButtonWidthCss=(t,e,n=!1)=>{if(n||"auto"===t.button_width)return"auto";if("percent"===t.button_width_unit){const e=Number(t.button_width_percent);return`${o=Number.isFinite(e)?e:100,i=1,r=100,Math.min(r,Math.max(i,o))}%`}var o,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;"},2(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"}},239(t,e,n){"use strict";var o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const i=o(n(718)),{bootstrapStoreCRM:r}=n(647);n(341),n(50),r(window,i.default)},854(t,e){"use strict";var n;e.ExcludedAccountPage=void 0,function(t){t.LOGIN="login",t.REGISTER="register",t.RECOVER="recover",t.ACTIVATE="activate",t.RESET="reset"}(n||(e.ExcludedAccountPage=n={}))},50(t){!function(e){function n(t){var e,n,o=!1,i=0,r=null,s=null,a=0,c=new Map,l=new Set,d=new Map,u=new Set,h=!1,m=!1,p=!1,g="idle",f=null,_=null,v=null,b=null,y=null,w=null,k=!1,x=!1,S=!1,R=!1,E=!1,C=null,I=0,L=0,T=null,P=0,M=0,A={},O={},N=null;function q(e,n){A[e]=Math.min(255,(A[e]||0)+1),N=e,n&&!O[e]&&(O[e]=!0,X(function(){t.console&&"function"==typeof t.console.warn&&t.console.warn("StoreCRM cart resync",{reason:e,count:1})}))}function $(){null!==C&&t.clearInterval(C),C=null}function B(){P+=1,null!==T&&t.clearTimeout(T),T=null,"loading"===g&&(g="failed")}function F(){R&&!S&&(o?(H(),W()?(j(),nt()):(m=!1,z(),G())):ht({cartResyncEnabled:!0}))}function J(){try{return t.sessionStorage.getItem("storecrm_cart_resync_delta_v1")}catch(t){return null}}function U(t){try{if("string"!=typeof t||t.length>512)return null;var e=JSON.parse(t),n=Date.now();return!e||"nonce,observed_ms,schema_version"!==Object.keys(e).sort().join(",")||1!==e.schema_version||!Number.isSafeInteger(e.observed_ms)||e.observed_ms<=0||e.observed_ms>n||n-e.observed_ms>3e4||"string"!=typeof e.nonce||!/^[a-zA-Z0-9:._-]{1,128}$/.test(e.nonce)?null:e}catch(t){return null}}function z(){null!==v&&t.clearInterval(v),v=null,k=!1,w=null,x=!1}function D(){if(k&&W()){var t=J(),e=t!==y?U(t):null;if(y=t,e&&e.nonce!==b){if(b=e.nonce,q("hint_received",!1),null!==_&&e.observed_ms<_)return;w=e.observed_ms,G(),x=!0}}}function j(){if(!S&&W()&&!k&&"function"==typeof t.setInterval&&"function"==typeof t.clearInterval){var e=U(y=J());b=e?e.nonce:null,k=!0;try{v=t.setInterval(function(){X(function(){if(!W())return m=!1,z(),void G();D(),x&&nt()})},250)}catch(t){z()}}}function W(){if(!R||S||"ready"!==g)return!1;try{return!0===t.Shopify.customerPrivacy.analyticsProcessingAllowed()}catch(t){return!1}}function V(){return!(!t.Shopify||!t.Shopify.customerPrivacy||"function"!=typeof t.Shopify.customerPrivacy.analyticsProcessingAllowed)}function H(){if(V())return B(),g="ready",void j();if("loading"!==g)if(q("privacy_unready",!1),t.Shopify&&"function"==typeof t.Shopify.loadFeatures)if(M>=3)q("privacy_retry_exhausted",!0);else{M+=1,g="loading";var e=++P,n=!1;T=t.setTimeout(function(){e===P&&(n=!0,T=null,g="failed",q("privacy_load_failed",!0))},3e3);try{t.Shopify.loadFeatures([{name:"consent-tracking-api",version:"0.1"}],function(o){X(function(){!function(o){n||e!==P||S||!R||(n=!0,t.clearTimeout(T),T=null,"failed"==(g=!o&&V()?"ready":"failed")&&q("privacy_load_failed",!0),j(),nt())}(o)})})}catch(e){n=!0,t.clearTimeout(T),T=null,g="failed",q("privacy_load_failed",!0),G()}}else g="failed"}function G(){return i+=1,r&&r.abort(),r=null,i}function K(){var e=t.Shopify&&t.Shopify.routes&&t.Shopify.routes.root;return"string"==typeof e&&/^\/(?:[a-zA-Z0-9_-]+\/)*$/.test(e)?e:null}function Y(e,n){try{var o="object"==typeof e&&null!==e&&"url"in e,i=n&&n.method||o&&e.method||"GET";if("POST"!==String(i).toUpperCase())return!1;var r=new URL(o?e.url:e,t.location.href),s=K();return null!==s&&r.origin===t.location.origin&&(new RegExp("^"+s+"cart/(add|change|update|clear)(\\.js)?$").test(r.pathname)||/^\/cart\/(add|change|update|clear)(\.js)?$/.test(r.pathname))}catch(t){return!1}}function Z(t){try{s&&s.postMessage(t)}catch(t){}}function Q(e){try{return"string"==typeof e&&e.length>0&&new URL(e).origin===t.location.origin}catch(t){return!1}}function X(t){try{return t()}catch(t){return null}}function tt(){var t=Date.now();f=null===f?t:Math.max(f,t)}function et(){return!(l.size||c.size||p||h)}function nt(){D(),!m&&!x||et()||q("operation_barrier",!0),!m&&!x||W()||q("privacy_unready",!1),!r&&(m||x)&&et()&&W()&&(null===w||Date.now()>w)&&async function(e){for(var o=0;o<3;o+=1){if(i!==e||!et()||!W())return;var s=K();if(!s)return;if(null!==f&&Date.now()<=f&&!await dt(e))return;if(i!==e||!et()||!W())return;var a=Date.now();if(null!==w&&a<=w)return;if(null!==f&&a<=f)return;x=!1;var c=new t.AbortController;r=c;var l=t.setTimeout(function(){c.abort()},1500),d=new Date(a).toISOString(),u=!0,h="snapshot_fetch_failed";try{var p=await lt(n.call(t,s+"cart.js",{method:"GET",cache:"no-store",signal:c.signal}),c.signal);if(!Q(p.url))return void q("snapshot_invalid",!0);if(!p.ok)throw u=429===p.status||p.status>=500,new Error("Cart snapshot unavailable");u=!1,h="snapshot_invalid";var g=await lt(p.json(),c.signal),v=ct(g);if(!v)return void q("snapshot_invalid",!0);var b=await lt(t.crypto.subtle.digest("SHA-256",(new TextEncoder).encode(g.token)),c.signal),y="ajax-sha256:"+Array.from(new Uint8Array(b),function(t){return t.toString(16).padStart(2,"0")}).join("");if(i!==e||!et()||!W()||c.signal.aborted)return;if(u=!0,h="sdk_publish_failed",!1!==await lt(t.Shopify.analytics.publish("storecrm_cart_snapshot_v1",{schema_version:1,cart_key:y,observed_at:d,cart_lines:v}),c.signal))return q("sdk_publish_success",!1),void(i===e&&(m=!1,_=a));q("sdk_publish_failed",!0)}catch(t){i===e&&W()&&q(h,!0)}finally{t.clearTimeout(l),r===c&&(r=null)}if(!u||i!==e||!et()||!W())return;o<2&&await new Promise(function(e){t.setTimeout(e,100*(o+1))})}q("snapshot_retry_exhausted",!0)}(i).catch(function(){})}function ot(){G();var t={id:e+":"+ ++a};return l.add(t.id),Z({type:"start",operation_id:t.id}),t}function it(t,e){if(l.delete(t.id)){G();var n=e&&!t.standard;if(n&&(m=!0),Z({type:"complete",operation_id:t.id,success:n}),t.standard)return t.standard.networkDone=!0,t.standard.networkSuccess=e,void st(t.standard);nt()}}function rt(){var t=[];u.forEach(function(e){0===e.event.eventPhase&&null===e.event.currentTarget&&t.push(e)});var e=ot();if(1===u.size&&1===t.length){var n=t[0];u.delete(n),n.event=null,n.networkDone=!1,e.standard=n}return e}function st(t){t.taskDone&&t.networkDone&&d.has(t.operation.id)&&(d.delete(t.operation.id),u.delete(t),it(t.operation,t.promiseSuccess&&t.networkSuccess))}function at(t,e){if("number"==typeof t){if(!Number.isSafeInteger(t)||t<=0)return null;t=String(t)}return"string"==typeof t&&/^\d{1,64}$/.test(t)&&(t=t.replace(/^0+/,""))?"gid://shopify/"+e+"/"+t:null}function ct(t){if(!t||"string"!=typeof t.token||!t.token||t.token.length>4096||!Array.isArray(t.items)||t.items.length>100||!Number.isInteger(t.item_count)||t.item_count<0)return null;var e=new Map,n=0;for(var o of t.items){var i=at(o&&o.product_id,"Product"),r=at(o&&o.variant_id,"ProductVariant"),s=o&&o.quantity;if(!i||!r||!Number.isInteger(s)||s<0||s>1e6)return null;var a=e.get(r);if(a&&(a.product_gid!==i||a.absolute_quantity+s>1e6))return null;e.set(r,{product_gid:i,variant_gid:r,absolute_quantity:s+(a?a.absolute_quantity:0)}),n+=s}return n===t.item_count?Array.from(e.values()).filter(function(t){return t.absolute_quantity>0}):null}function lt(t,e){return new Promise(function(n,o){var i=function(){o(new Error("Snapshot timeout"))};if(e.aborted)return i();e.addEventListener("abort",i,{once:!0}),Promise.resolve(t).then(n,o).finally(function(){e.removeEventListener("abort",i)})})}async function dt(e){for(var n=0;n<3;n+=1){if(Date.now()>f)return!0;if(await new Promise(function(e){t.setTimeout(e,1)}),i!==e||!et()||!W())return!1}return Date.now()>f}function ut(){return!!(K()&&t.Shopify&&(V()||"function"==typeof t.Shopify.loadFeatures)&&"function"==typeof t.fetch&&"function"==typeof t.AbortController&&t.crypto&&t.crypto.subtle&&"function"==typeof t.crypto.subtle.digest&&"function"==typeof t.crypto.randomUUID&&"function"==typeof TextEncoder)}function ht(i){if(!i||!0!==i.cartResyncEnabled)return R=!1,$(),B(),z(),G(),q("config_off",!1),!1;if(t.document.querySelector("[data-storecrm-preview-context]"))return R=!1,$(),B(),z(),G(),q("preview",!1),!1;if(R=!0,E||(E=!0,t.document.addEventListener("visitorConsentCollected",function(){X(F)}),"function"==typeof t.addEventListener&&(t.addEventListener("pagehide",function(){S=!0,$(),B(),z(),G()}),t.addEventListener("pageshow",function(){S=!1,X(F)}))),S)return!1;if(o)return F(),!1;if(!ut())return null===C&&(q("bootstrap_waiting",!0),I=0,L=Date.now()+3e4,"function"==typeof t.setInterval&&"function"==typeof t.clearInterval&&(C=t.setInterval(function(){X(function(){I+=1,!S&&R?I>=120||Date.now()>=L?($(),q("bootstrap_timeout",!0)):ut()&&($(),ht({cartResyncEnabled:!0})):$()})},250))),!1;$();try{e=t.crypto.randomUUID()}catch(t){return!1}o=!0,n=t.fetch,t.fetch=function(t,e){var o,i=Y(t,e)?X(rt):null;try{o=n.apply(this,arguments)}catch(t){throw i&&X(function(){it(i,!1)}),t}return i&&o.then(function(t){X(function(){it(i,!0===t.ok&&Q(t.url))})},function(){X(function(){it(i,!1)})}),o};var r=t.XMLHttpRequest&&t.XMLHttpRequest.prototype;if(r){var a=r.open,l=r.send,g=new WeakMap;r.open=function(t,e){var n=a.apply(this,arguments);return g.set(this,Y(e,{method:t})),n},r.send=function(){var t=this,e=g.get(t)?X(rt):null,n=function(){X(function(){it(e,t.status>=200&&t.status<300&&Q(t.responseURL))})};e&&t.addEventListener("loadend",n,{once:!0});try{return l.apply(t,arguments)}catch(o){throw e&&(t.removeEventListener("loadend",n),X(function(){it(e,!1)})),o}}}t.document.addEventListener("shopify:cart:lines-update",function(e){X(function(){!function(e){if(["add","remove","update"].includes(e.action)&&e.promise&&"function"==typeof e.promise.then){if(d.size>=64)return h=!0,void G();var n={operation:ot(),event:e,taskDone:!1,promiseSuccess:!1,networkDone:!0,networkSuccess:!0};d.set(n.operation.id,n),u.add(n),Promise.resolve().then(function(){u.delete(n),n.event=null}),Promise.resolve(e.promise).then(function(t){X(function(){o(t,!1)})},function(){X(function(){o(null,!0)})})}function o(e,o){t.setTimeout(function(){X(function(){n.taskDone=!0,tt(),n.promiseSuccess=!0===X(function(){return!o&&null!==e&&"object"==typeof e&&!Array.isArray(e)&&"cart"in e&&(void 0===e.userErrors||Array.isArray(e.userErrors)&&0===e.userErrors.length)}),st(n)})},0)}}(e)})},!0);try{(s=new t.BroadcastChannel("storecrm_cart_resync_v1")).onmessage=function(t){X(function(){var e=t.data;if(e&&"string"==typeof e.operation_id&&!(e.operation_id.length>128))if("start"===e.type){if(c.has(e.operation_id))return;G(),c.size>=64?p=!0:c.set(e.operation_id,Date.now())}else if("complete"===e.type){if(!c.delete(e.operation_id))return;tt(),G(),!0===e.success&&(m=!0),nt()}})}}catch(t){}return H(),!0}return{bootstrap:ht,normalize:ct,isMutation:Y,getDiagnostics:function(){return{installed:o,waitingPrerequisites:null!==C,privacyState:g,counters:Object.assign({},A),lastReason:N}}}}t.exports&&(t.exports={createCartResync:n}),e&&!e.__storecrmCartResync&&(e.__storecrmCartResync=n(e))}("undefined"==typeof window?null:window)},341(){!function(){"use strict";var t="sc_identity_refresh",e="storecrm_identity_refresh",n="__storecrmIdentityRefreshState",o=/[^A-Za-z0-9._:-]/g,i=/^\/(?:a|apps|community|tools)\/[A-Za-z0-9_-]{1,30}$/;function r(){var t=window[n];return t&&"object"==typeof t||(t={started:!1,succeeded:!1},window[n]=t),t}function s(t){var e=String(t??"").trim().replace(o,"");return e?e.slice(0,128):null}function a(t){if("string"!=typeof t||"/"!==t.charAt(0))return null;var e=t.split(/[?#]/)[0].split("/").filter(Boolean);if(e.length>=3&&/^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{2,8})?$/.test(e[0])&&e.shift(),e.length<2)return null;var n=e[0].toLowerCase();return"a"!==n&&"apps"!==n&&"community"!==n&&"tools"!==n?null:/^[A-Za-z0-9_-]{1,30}$/.test(e[1])?"/"+n+"/"+e[1]:null}function c(t,e){var n,o,r=(n=(t=t||{}).appProxyPath,(o=String(n||"").trim().replace(/^https?:\/\/[^/]+/i,"").split(/[?#]/)[0].replace(/\/+$/,""))?("/"!==o.charAt(0)&&(o="/"+o),i.test(o)?o:null):null);if(r)return r;var s=a(e);if(s)return s;var c=String(t.appProxyName||"obake").replace(/^\/+|\/+$/g,"");return/^[A-Za-z0-9_-]{1,30}$/.test(c)||(c="obake"),"/apps/"+c}function l(t,e){return t+"/identity/assertion?marker="+encodeURIComponent(e)}function d(t,e){return new Promise(function(n,o){var i=e&&e.analytics;if(i&&"function"==typeof i.publish){var r;try{r=i.publish("storecrm_identity_resolved_v1",{resolution_id:t})}catch(t){return void o(t)}r&&"function"==typeof r.then?r.then(function(t){!1===t?o(new Error("analytics publish returned false")):n(t)},o):!1!==r?n(r):o(new Error("analytics publish returned false"))}else o(new Error("analytics publish unavailable"))})}function u(t,e){return e(t,{method:"GET",credentials:"same-origin",headers:{Accept:"application/json"}}).then(function(t){if(204===t.status)return null;if(!t.ok)throw new Error("assertion fetch failed: "+t.status);return t.json().then(function(t){if(!t||"string"!=typeof t.resolution_id||!t.resolution_id)throw new Error("resolution id missing");return t.resolution_id})})}function h(t){var e=s((t=t||{}).marker);if(!e)return Promise.resolve(!1);var n=t.fetchImpl||window.fetch.bind(window),o=void 0!==t.pathname?t.pathname:window.location.pathname,i=t.config,r=t.maxAttempts||3,a=t.schedule||function(t,e){window.setTimeout(t,e)};return function s(h){return u(t.endpoint?t.endpoint:l(c(void 0!==i?i:window.storecrm_config,o),e),n).then(function(e){return null!==e&&d(e,t.shopify||window.Shopify).then(function(){return!0})}).catch(function(){return!(h+1>=r)&&new Promise(function(t){a(function(){t(s(h+1))},1e3*Math.pow(2,h))})})}(0)}function m(){return Date.now()}function p(){try{window.sessionStorage.removeItem(e)}catch(t){}}function g(){try{var n=new URL(window.location.href),o=n.searchParams.get(t);if(!o)return null;n.searchParams.delete(t),window.history.replaceState(window.history.state,"",n.pathname+(n.search?n.search:"")+n.hash);var i=s(o);return i?(function(t){try{window.sessionStorage.setItem(e,JSON.stringify({marker:t,at:m()}))}catch(t){}}(i),i):null}catch(t){return null}}function f(t){t=t||{};var n=r();if(n.started)return n.promise||Promise.resolve(!1);var o=g();o||(o=function(){try{var t=JSON.parse(window.sessionStorage.getItem(e)||"null");return t&&"string"==typeof t.marker&&"number"==typeof t.at?m()-t.at>3e5?(window.sessionStorage.removeItem(e),null):t.marker:null}catch(t){return null}}());var i=Boolean(o);return!o&&t.allowAutomatic&&(o=function(){if(document.querySelector("[data-storecrm-preview-context]"))return null;var t=window.storecrm_data,e=window.ShopifyAnalytics,n=t&&t.customer_id||e&&e.meta&&e.meta.page&&e.meta.page.customerId;if(!/^[0-9]+$/.test(String(n??""))||/^0+$/.test(String(n)))return null;try{return window.crypto&&"function"==typeof window.crypto.randomUUID?window.crypto.randomUUID():null}catch(t){return null}}()),o?(n.started=!0,n.promise=h({marker:o,config:t.config}).then(function(t){return!!t&&(n.succeeded=!0,i&&p(),!0)},function(){return!1}),n.promise):Promise.resolve(!1)}window.__storecrmIdentityRefresh={bootstrap:f,normalizeMarker:s,extractAppProxyPathFromPathname:a,resolveAppProxyPath:c,buildAssertionEndpoint:l,publishResolution:d,fetchResolutionId:u,runIdentityRefresh:h,getSharedState:r,clearSessionMarker:p},f()}()},647(t){function e(t,e,n){if(e){var o=t.storecrmConfigsByOrigin;o||(o=Object.create(null),t.storecrmConfigsByOrigin=o),o[e]||(o[e]=n)}}t.exports={bootstrapStoreCRM:function(t,n){if(!t||"object"!=typeof t)throw new TypeError("bootstrapStoreCRM: window object is required");if("function"!=typeof n)throw new TypeError("bootstrapStoreCRM: StoreCRM class is required");var o=function(t){var e=t&&t.document,n=e&&e.currentScript;if(!n||!n.src)return null;try{return new URL(n.src).origin}catch(t){return null}}(t),i=t.storecrm;if(i&&"function"==typeof i.init)return e(t,o,function(t,e,n,o){return e&&"function"==typeof e.resolveConfig?e.resolveConfig(o)||o:n&&"function"==typeof n.resolveConfig&&n.resolveConfig(o)||o}(0,n,i,t.storecrm_config||i.config)),i;var r=new n(t.storecrm_config||{});return t.storecrm=r,e(t,o,r.config),r.init(),r}}}};const e={};function n(o){const i=e[o];if(void 0!==i)return i.exports;const r=e[o]={id:o,exports:{}};return t[o].call(r.exports,r,r.exports,n),r.exports}n.n=t=>{const e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.cw=t=>{var e;return()=>{if(t){var n=t;t=0,e={exports:{}},n.call(e.exports,e,e.exports)}return e.exports}},n.d=(t,e)=>{if(Array.isArray(e))for(var o=0;oObject.prototype.hasOwnProperty.call(t,e),n.r=t=>{Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.nc=void 0;n(239)})();