${"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"}
${"ja"===n?"\u304a\u6c17\u306b\u5165\u308a\u30dc\u30bf\u30f3(\u304a\u6c17\u306b\u5165\u308a\u5f8c)":"Favorite button (after it is added)"}
`,o+=(0,t.render)({productId:"TEMP_product",id:"TEMP_favorite2",buttonSettings:e,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:"buttonIcon",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:"buttonText",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:"buttonTextRemove",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:"hasBackground",default:!1},{type:"range",slug:"button_width",nameJa:"\u30dc\u30bf\u30f3\u306e\u5e45",nameEn:"buttonWidth",default:200,min:50,max:600,step:10,depends:"has_background"},{type:"range",slug:"button_height",nameJa:"\u30dc\u30bf\u30f3\u306e\u9ad8\u3055",nameEn:"buttonHeight",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:"buttonColor",default:"#000000"},{type:"colorpicker",slug:"icon_color",nameJa:"\u30a2\u30a4\u30b3\u30f3\u306e\u6587\u5b57\u8272",nameEn:"iconColor",default:"#000000"},{type:"colorpicker",slug:"button_background_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u80cc\u666f\u8272",nameEn:"buttonBackgroundColor",default:"#ffffff",depends:"has_background"},{type:"colorpicker",slug:"button_border_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u7dda\u306e\u8272",nameEn:"buttonBorderColor",default:"#000000",depends:"has_background"},{type:"colorpicker",slug:"button_hover_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u6587\u5b57\u8272(\u30db\u30d0\u30fc\u6642)",nameEn:"buttonHoverColor",default:"#222222"},{type:"colorpicker",slug:"icon_hover_color",nameJa:"\u30a2\u30a4\u30b3\u30f3\u306e\u6587\u5b57\u8272(\u30db\u30d0\u30fc\u6642)",nameEn:"iconHoverColor",default:"#000000"},{type:"colorpicker",slug:"button_hover_background_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u80cc\u666f\u8272(\u30db\u30d0\u30fc\u6642)",nameEn:"buttonHoverBackgroundColor",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:"buttonHoverBorderColor",default:"#222222",depends:"has_background"},{type:"range",slug:"button_radius",nameJa:"\u30dc\u30bf\u30f3\u306e\u4e38\u307f",nameEn:"buttonRadius",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:"buttonBorderWidth",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:"buttonFont",default:"helvetica_n4"},{type:"range",slug:"button_fontsize",nameJa:"\u30dc\u30bf\u30f3\u306e\u30d5\u30a9\u30f3\u30c8\u30b5\u30a4\u30ba",nameEn:"buttonFontSize",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:"buttonFontWeight",default:400,min:100,max:900,step:100},{type:"range",slug:"icon_size",nameJa:"\u30a2\u30a4\u30b3\u30f3\u306e\u30b5\u30a4\u30ba",nameEn:"iconSize",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:"iconMargin",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:"buttonSpeed",default:.3,min:0,max:1,step:.1},{type:"select",slug:"align",nameJa:"\u30dc\u30bf\u30f3\u306e\u914d\u7f6e",nameEn:"align",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:"popupTextColor",default:"#000000",checkVisible:e=>"variant"===e.favoriteMode},{type:"colorpicker",slug:"popup_background_color",nameJa:"POPUP\u306e\u80cc\u666f\u8272",nameEn:"popupBackgroundColor",default:"#ffffff",checkVisible:e=>"variant"===e.favoriteMode},{type:"colorpicker",slug:"popup_icon_color",nameJa:"POPUP\u306e\u30a2\u30a4\u30b3\u30f3\u8272",nameEn:"popupIconColor",default:"#000000",checkVisible:e=>"variant"===e.favoriteMode},{type:"colorpicker",slug:"popup_icon_hover_color",nameJa:"POPUP\u306e\u30a2\u30a4\u30b3\u30f3\u8272(\u30db\u30d0\u30fc\u6642)",nameEn:"popupIconHoverColor",default:"#000000",checkVisible:e=>"variant"===e.favoriteMode},{type:"range",slug:"popup_border_width",nameJa:"POPUP\u306e\u7dda\u306e\u592a\u3055",nameEn:"popupBorderWidth",default:0,min:0,max:10,step:1,checkVisible:e=>"variant"===e.favoriteMode},{type:"colorpicker",slug:"popup_border_color",nameJa:"POPUP\u306e\u7dda\u306e\u8272",nameEn:"popupBorderColor",default:"#999",checkVisible:e=>"variant"===e.favoriteMode}]}},259(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.schema=t.generateDefaultSettings=t.render=t.RestockButton=void 0;class n{constructor(e,t,n,o,i){this.eventTriggered=!1,this.variants=n,this.buttonSettings=o,this.productId=t,this.product=i}static getInstance(e,t=null,o=null,i=null,r=null){if(n.instances[e])i&&(n.instances[e].buttonSettings=i);else{if(!(t&&o&&i&&r))throw new Error("StoreCRM Restock: productId, variants, buttonSettings, product are required");n.instances[e]=new n(e,t,o,i,r)}return n.instances[e]}createScript(e,t){const n=e?"":"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(e){document.querySelectorAll(`.storecrm-restock-${e}`).forEach(e=>{var t;if(e instanceof HTMLElement&&e.closest('[data-type="restock-button"]')){const n=new URL(location.href),o=(null===(t=this.variants.find(e=>e.available))||void 0===t?void 0:t.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(e.style.display="none");const r=window.Shopify&&window.Shopify.designMode||this.variants.find(e=>!e.available&&e.id===i);e.style.display=r?"inline-block":"none"}})}render(e,t=!1){if(t)return this.createScript(!0,e);if(!this.eventTriggered){if(this.eventTriggered=!0,window.navigation)window.navigation.addEventListener("navigate",()=>{window.setTimeout(()=>this.checkRender(e),100)}),window.setTimeout(()=>this.checkRender(e),100),window.setTimeout(()=>this.checkRender(e),1e3);else{let t=location.href;window.setInterval(()=>{t!==location.href&&(t=location.href,this.checkRender(e))},1e3),window.setTimeout(()=>this.checkRender(e),100),window.setTimeout(()=>this.checkRender(e),1e3)}return this.createScript(!1,e)}}}t.RestockButton=n,n.instances={};t.render=({productId:e,variantId:t,variants:o,id:i,buttonSettings:r,isOutOfStock:s,product:a,preview:c=!1})=>n.getInstance(i,e,o,r,a).render(i,c);t.generateDefaultSettings=(e="ja")=>{const n={};return t.schema.rows.forEach(t=>{"text"===t.type?n[t.slug]="ja"===e?t.defaultJa:t.defaultEn:(t.type,n[t.slug]=t.default)}),n};const o=e=>{const t=[`opacity: ${((e,t,n,o)=>{const i=Number(e);return Number.isFinite(i)?Math.min(o,Math.max(n,i)):t})(e.registered_button_opacity,.55,.3,1)}`,"cursor: not-allowed","pointer-events: none"];return e.registered_button_color&&t.push(`color: ${e.registered_button_color}`),e.registered_button_background_color&&t.push(`background-color: ${e.registered_button_background_color}`),e.registered_button_border_color&&t.push(`border-color: ${e.registered_button_border_color}`),t.join("; ")},i=(e,t,n)=>{const i=t.registered_button_text||("ja"===n?"\u767b\u9332\u6e08\u307f":"Registered");return`\n
",o},rows:[{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_cart",nameJa:"\u30ab\u30fc\u30c8\u30dc\u30bf\u30f3\u3092\u8868\u793a\u3059\u308b",nameEn:"show cart button",default:!0},{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."}]}},600(e,t,n){var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=o(n(805));window.storecrm=new i.default(window.storecrm_config||{}),window.storecrm.init()},669(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.schema=t.render=t.generateDefaultSettings=t.LineRestockButton=void 0;class n{constructor(e,t,n,o,i){this.eventTriggered=!1,this.variants=n,this.buttonSettings=o,this.productId=t,this.product=i}static getInstance(e,t=null,o=null,i=null,r=null){if(n.instances[e])i&&(n.instances[e].buttonSettings=i);else{if(!(t&&o&&i&&r))throw new Error("StoreCRM LineRestock: productId, variants, buttonSettings, product are required");n.instances[e]=new n(e,t,o,i,r)}return n.instances[e]}createScript(e,t){const n=e?"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('${t}') : 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
';let s=null;t.schema={preview:(e,t)=>{var n,o;return n=()=>{r.getInstance(e,!0).show(e,[],"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:"buttonHoverColor",default:"#222222"},{type:"colorpicker",slug:"button_text_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u30c6\u30ad\u30b9\u30c8\u30ab\u30e9\u30fc",nameEn:"buttonHoverBackgroundColor",default:"#dddddd"},{type:"text",slug:"button_text",nameJa:"\u30dc\u30bf\u30f3\u306e\u30c6\u30ad\u30b9\u30c8",nameEn:"buttonText",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:"buttonRadius",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\u8aadON\u6642\u306bShopify\u9867\u5ba2\u3092\u4f5c\u6210\u3059\u308b",nameEn:"Create Shopify customer when marketing is subscribed",default:!1,checkVisible:e=>!0===e.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:e=>!0===e.add_accepts_marketing_checkbox&&!0===e.create_shopify_customer}]}},785(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.schema=void 0;const n=e=>String(null!=e?e:"").replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),o=e=>"string"==typeof e&&""!==e.trim()&&"undefined"!==e,i=(e,t,n)=>o(null==e?void 0:e[t])?e[t]:n,r=(e,t,n)=>{const i=null==e?void 0:e[t];return o(i)&&/^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i.test(i)?i:n},s=(e,t,n,o,i)=>{const r=null==e?void 0:e[t],s="number"==typeof r?r:Number.parseFloat(r);return Number.isFinite(s)?Math.min(i,Math.max(o,s)):n};t.schema={preview:(e,t)=>{const o="ja"===t?{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(e,"login_required_modal_title",o.title)),c=n(i(e,"login_required_modal_description",o.description)),l=n(i(e,"login_required_modal_login_button_text",o.login)),d=n(i(e,"login_required_modal_cancel_button_text",o.cancel)),u=r(e,"login_required_modal_background_color","#ffffff"),h=r(e,"login_required_modal_text_color","#111111"),m=r(e,"login_required_modal_overlay_color","#000000"),g=s(e,"login_required_modal_overlay_opacity",55,0,90),p=s(e,"login_required_modal_radius",2,0,24),f=s(e,"login_required_modal_width",576,320,720),_=r(e,"login_required_modal_login_button_background_color","#000000"),v=r(e,"login_required_modal_login_button_text_color","#ffffff"),b=r(e,"login_required_modal_cancel_button_background_color","#ffffff"),y=r(e,"login_required_modal_cancel_button_text_color","#111111"),k=r(e,"login_required_modal_cancel_button_border_color","#111111"),w=s(e,"login_required_modal_button_radius",32,0,40);return`\n \n
\n
\n \n
\n \n \n \n \n
\n
\n
\n
\n
\n
${a}
\n \xd7\n
\n
${c}
\n
\n ${l}\n ${d}\n
\n
\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:e=>"nolimit"!==e.limitPolicy},{type:"number",slug:"limitAmount",nameJa:"1\u56de\u306e\u9001\u4fe1\u6570 \u307e\u305f\u306f \u5728\u5eab\u6570\u306b\u304b\u3051\u308b\u30d1\u30fc\u30bb\u30f3\u30c8",nameEn:"Limit amount or percentage of stock",default:100,min:0,max:1e3,step:1,checkVisible:e=>"nolimit"!==e.limitPolicy&&"nolimit"!==e.limitBasis,customize:(e,t)=>Object.assign(Object.assign({},t),{nameJa:"stock_amount"===e.limitBasis?"\u5728\u5eab\u6570\xd7\u30d1\u30fc\u30bb\u30f3\u30c8\u4ef6\u9001\u308b":"1\u56de\u306e\u9001\u4fe1\u6570",nameEn:"stock_amount"===e.limitBasis?"Percentage of stock":"Limit amount"})},{type:"interval",slug:"interval",nameJa:"\u9001\u4fe1\u9593\u9694",nameEn:"Sending interval",default:{count:1,term:"day"},checkVisible:e=>"strict"!==e.limitPolicy&&"nolimit"!==e.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:e=>"interval"===e.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:"\u9867\u5ba2\u304c\u3068\u3042\u308b\u5546\u54c1\u3092\u304a\u6c17\u306b\u5165\u308a\u767b\u9332\u3067\u3001\u3059\u3067\u306b\u5225\u306e\u30d0\u30ea\u30a8\u30fc\u30b7\u30e7\u30f3\u304c\u518d\u5165\u8377\u901a\u77e5\u9001\u4ed8\u3055\u308c\u3066\u3044\u305f\u5834\u5408\u3067\u3082\u3001\u518d\u5165\u8377\u901a\u77e5\u9023\u7d61\u3092\u9001\u308a\u307e\u3059\u3002\uff08\u4f8b\uff1aS\u306eT\u30b7\u30e3\u30c4\u304c\u5165\u5eab\u3057\u305f\u3000\u7fcc\u65e5M\u306eT\u30b7\u30e3\u30c4\u304c\u5165\u5eab\u3057\u305f\u30b1\u30fc\u30b9\uff09"},{value:"none",label:"\u9001\u4fe1\u3057\u306a\u3044",description:"\u9867\u5ba2\u304c\u3068\u3042\u308b\u5546\u54c1\u3092\u304a\u6c17\u306b\u5165\u308a\u767b\u9332\u3092\u3057\u3066\u3001\u4e00\u5ea6\u3067\u3082\u3044\u305a\u308c\u304b\u306e\u30d0\u30ea\u30a8\u30fc\u30b7\u30e7\u30f3\u3067\u518d\u5165\u8377\u901a\u77e5\u304c\u9001\u3089\u308c\u305f\u5834\u5408\u3001\u518d\u5165\u8377\u901a\u77e5\u306f\u4ee5\u5f8c\u9001\u3089\u308c\u307e\u305b\u3093\u3002"}],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."}]}]}},805(e,t,n){var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))(function(i,r){function s(e){try{c(o.next(e))}catch(e){r(e)}}function a(e){try{c(o.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}c((o=o.apply(e,t||[])).next())})},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=n(250),s=n(575),a=n(259),c=n(669),l=n(754),d=n(785),u=n(900),h=n(556),m=n(895),g=i(n(745)),p=n(13);n(729);class f{constructor(e){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.restockStatusCache=new Map,this.restockStatusRequests=new Map,this.optimisticRestockRegistered=new Map,this.restockStateWatcherStarted=!1,this.lastRestockStateHref="",this.restockButtonVariantByKey=new Map,window.storecrm_data=window.storecrm_data||{},console.log("StoreCRM initialized version 0.7.97",e),this.config=this.applyLocaleOverrides(e),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)}init(){(()=>{o(this,void 0,void 0,function*(){try{yield this.bootstrapTemplates(),yield this.checkCustomer(),yield this.syncWishlist()}catch(e){console.error("StoreCRM: init: error",e)}yield this.render(),yield this.handlePendingRestockIntent(),window.location.pathname.includes("/apps/")&&(yield this.renderFavoriteList())})})(),window.addEventListener("pageshow",e=>{e.persisted&&(this.render(!0),this.handlePendingRestockIntent().catch(e=>{console.warn("StoreCRM: pending restock check after pageshow failed",e)}))}),document.addEventListener("visibilitychange",()=>{"visible"===document.visibilityState&&(this.render(!0),this.handlePendingRestockIntent().catch(e=>{console.warn("StoreCRM: pending restock check after visibilitychange failed",e)}))}),this.initLineLogin(),this.initRestockStateWatcher(),this.initDynamicRenderObserver()}initLineLogin(){"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{this.executeLineLoginInit()}):this.executeLineLoginInit()}executeLineLoginInit(){if(g.default.isLoginOrRegisterPage()){new g.default(this).init()}}getCurrentShopifyCustomerId(){try{return window.storecrm_data.customer_id||window.ShopifyAnalytics.meta.page.customerId}catch(e){return null}}checkCustomer(){return o(this,void 0,void 0,function*(){if(window.storecrm_data.is_customer_checked)return;window.storecrm_data.is_customer_checked=!0;const e=(window.localStorage.getItem("storecrm_customer_id")||"").toString(),t=(this.getCurrentShopifyCustomerId()||"").toString();if(e!==t){if(t)return!e||e.startsWith("TEMP_")&&t?(yield this.refreshToken(!1),void(yield this.syncWishlist(null,e,!0))):void(e===t||(yield this.refreshToken(!0)));(null==e?void 0:e.startsWith("TEMP_"))||(yield this.refreshToken(!0))}})}refreshToken(){return o(this,arguments,void 0,function*(e=!1){return e&&(window.localStorage.removeItem("storecrm_customer_id"),window.localStorage.removeItem("storecrm_wishlist")),yield this.fetchToken()})}detectLocale(){var e,t;return([window.Shopify&&(window.Shopify.locale||(null===(t=null===(e=window.Shopify.localization)||void 0===e?void 0:e.language)||void 0===t?void 0:t.isoCode)),document.documentElement.getAttribute("lang"),navigator.language].find(e=>"string"==typeof e&&e.length>0)||"en").replace("_","-")}normalizeLocaleValue(e){if("string"==typeof e)return e.replace("_","-").toLowerCase()}findLocaleFromConfig(e){var t;const n=this.normalizeLocaleValue(null===(t=window.Shopify)||void 0===t?void 0:t.locale);if(!e||!n)return;const o=Object.entries(e).map(([e,t])=>({normalizedKey:this.normalizeLocaleValue(e),value:t})).filter(e=>e.normalizedKey),i=o.find(e=>e.normalizedKey===n);if(i)return i.value;const r=n.split("-")[0],s=o.find(e=>e.normalizedKey&&e.normalizedKey.split("-")[0]===r);if(s)return s.value;const a=o.find(e=>e.normalizedKey&&e.normalizedKey.startsWith(r));return a?a.value:void 0}isPlainObject(e){return"[object Object]"===Object.prototype.toString.call(e)}deepMergeConfig(e,t){if(!this.isPlainObject(t)&&!Array.isArray(t))return t;if(Array.isArray(t))return t.slice();const n=this.isPlainObject(e)?Object.assign({},e):{};return Object.keys(t||{}).forEach(e=>{const o=n[e],i=t[e];e.indexOf(["favoriteMode"])>=0||(this.isPlainObject(o)&&this.isPlainObject(i)?n[e]=this.deepMergeConfig(o,i):this.isPlainObject(i)?n[e]=this.deepMergeConfig({},i):Array.isArray(i)?n[e]=i.slice():n[e]=i)}),n}applyLocaleOverrides(e){const t=e.locales,n=Object.assign({},e),o=this.findLocaleFromConfig(t);if(!o)return n;const i=this.deepMergeConfig(n,o);return t&&(i.locales=t),i}getSchemaDefault(e){const t=(this.currentLocale||"en").toLowerCase();if(null==e)return;const n=e=>null!=e;return void 0!==e.default&&null!==e.default&&"text"!==e.type?e.default:t.startsWith("ja")&&n(e.defaultJa)?e.defaultJa:t.startsWith("en")&&n(e.defaultEn)?e.defaultEn:n(e.default)?e.default:n(e.defaultEn)?e.defaultEn:n(e.defaultJa)?e.defaultJa:""}mergeWidgetConfig(e,t,n){const o=Object.assign({},t||{});return(e&&e.rows||[]).forEach(e=>{const t=e.slug;if(t){if(n&&Object.prototype.hasOwnProperty.call(n,t)){const i=n[t];if(!Object.prototype.hasOwnProperty.call(o,t))return void(o[t]=i);const r=o[t],s=this.getSchemaDefault(e);return void(null!=r&&""!==r&&r!==s||(o[t]=i))}Object.prototype.hasOwnProperty.call(o,t)||(o[t]=this.getSchemaDefault(e))}}),o}applyDefaults(e){const t=e||this.widgetTemplates||{};this.config.favorite=this.mergeWidgetConfig(r.schema,this.config.favorite,t.favorite),this.config.favoriteList=this.mergeWidgetConfig(s.schema,this.config.favoriteList,t["favorite-list"]),this.config.restock=this.mergeWidgetConfig(a.schema,this.config.restock,t.restock),this.config.lineRestock=this.mergeWidgetConfig((()=>{try{return n(669).schema||{rows:[]}}catch(e){return{rows:[]}}})(),this.config.lineRestock,t["line-restock"]),this.config.restockPopup=this.mergeWidgetConfig(l.schema,this.config.restockPopup,t["restock-popup"]),this.config.restockOption=this.mergeWidgetConfig(d.schema,this.config.restockOption,void 0),this.config.lineRestockPopup=this.mergeWidgetConfig(u.schema,this.config.lineRestockPopup,t["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 e=encodeURIComponent(this.currentLocale||"en"),t=Object.entries({favorite:"favorite",restock:"restock","restock-popup":"restock-popup","line-restock":"line-restock","line-restock-popup":"line-restock-popup"}),n=yield Promise.all(t.map(t=>o(this,[t],void 0,function*([t,n]){try{const o=yield fetch(`${this.config.backendUrl}/widget/templates/${n}?locale=${e}`,{credentials:"same-origin"});if(!o.ok)return[t,void 0];return[t,(yield o.json()).template||{}]}catch(e){return console.warn("StoreCRM: Failed to load widget template",n,e),[t,void 0]}}))),i={};n.forEach(([e,t])=>{t&&(i[e]=t)}),this.widgetTemplates=i,this.applyDefaults(i),this.popupManager.config=this.config.restockPopup,this.lineRestockPopupManager.config=this.config.lineRestockPopup,this.widgetTemplateLoaded=!0})}render(e=!1){this.doRender(e),e||(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 e=document.body||document.documentElement;e?(this.dynamicRenderObserver=new MutationObserver(e=>{e.some(e=>Array.from(e.addedNodes).some(e=>this.isStorecrmRenderableNode(e)))&&this.scheduleDynamicRender()}),this.dynamicRenderObserver.observe(e,{childList:!0,subtree:!0})):document.addEventListener("DOMContentLoaded",()=>this.initDynamicRenderObserver(),{once:!0})}isStorecrmRenderableNode(e){if(!(e instanceof Element))return!1;const t=".storecrm-button[data-type], .storecrm-favorite, .storecrm_favoritelist";return e.matches(t)||Boolean(e.querySelector(t))}scheduleDynamicRender(e=50){void 0===this.dynamicRenderTimer&&(this.dynamicRenderTimer=window.setTimeout(()=>{this.dynamicRenderTimer=void 0,this.render(!0),this.handlePendingRestockIntent().catch(e=>{console.warn("StoreCRM: pending restock check after dynamic render failed",e)})},e))}doRender(e=!1){window.location.pathname.includes("/apps")&&window.location.pathname.endsWith("/connect")&&this.checkConnect();const t=JSON.parse(window.localStorage.getItem("storecrm_wishlist")||"{}");t.products||(t.products=[]),t.variants||(t.variants=[]),document.querySelectorAll(".storecrm-button").forEach(e=>{if(e instanceof HTMLElement==!1)return;const n=e.id||"storecrm-button-"+Math.random().toString(36).slice(-8);e.id||(e.id=n);const o=new URL(location.href),i=o.searchParams.get("variant")&&o.searchParams.get("variant"),s=e.dataset.productId,l=i||e.dataset.variantId,d=void 0!==e.dataset.variantSelector,u=JSON.parse(e.dataset.variants||"[]"),h={tags:JSON.parse(e.dataset.productTags||"[]"),id:e.dataset.productId};if(!h||!s||!l)return;const m=t&&("product"===this.favoriteMode?t.products&&t.products.includes(s):t.variants&&t.variants.includes(l)),g=!!e.dataset.currentVariantAvailable,p="wishlist-button"===e.dataset.type?(0,r.render)({productId:s,variantId:l,id:n,button:e,variants:u,product:h,buttonSettings:this.config.favorite,isFavorited:m,hasVariantSelector:d}):"line-restock-button"===e.dataset.type?(0,c.render)({productId:s,variantId:l,id:n,buttonSettings:this.config.lineRestock||(0,c.generateDefaultSettings)(),isOutOfStock:g,product:h,variants:u}):(0,a.render)({productId:s,variantId:l,id:n,buttonSettings:this.config.restock,isOutOfStock:g,product:h,variants:u});p&&(e.innerHTML=p)}),this.refreshAllRestockButtonStates(),document.querySelectorAll(".storecrm-favorite").forEach(n=>{if(n instanceof HTMLElement==!1)return;if(!e&&"true"===n.dataset.isRendered)return;n.dataset.isRendered="true";const o=n.dataset.productId||"",i=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=t&&t.products&&t.products.includes(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.checkToken()}checkToken(){this.isTokenRefreshed||this.isTokenRefreshNeeded()&&this.fetchToken()}isTokenRefreshNeeded(){const e=window.localStorage.getItem("storecrm_customer_id"),t=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(e){}return this.isTokenRefreshed?(console.log("StoreCRM: Token refresh needed: false (already refreshed)"),!1):e&&n&&o?window.ShopifyAnalytics&&window.ShopifyAnalytics.meta&&window.ShopifyAnalytics.meta.page&&window.ShopifyAnalytics.meta.page.customerId&&window.ShopifyAnalytics.meta.page.customerId!==t?(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(e){try{const t=this.normalizePathname(e);if(!t)return!1;const n=this.getAccountPathIndex(t);if(-1===n)return!1;const o=(t.split("/")[n+1]||"").toLowerCase();return!this.getExcludedAccountPages().has(o)}catch(t){return console.warn("StoreCRM: Invalid pathname for widget rendering:",e,t),!1}}getExcludedAccountPages(){return new Set(this.config.excludedAccountPages||f.DEFAULT_EXCLUDED_ACCOUNT_PAGES)}getAccountPathIndex(e){const t=this.normalizePathname(e);if(!t)return-1;const n=t.split("/"),o=(n[0]||"").toLowerCase();if("account"===o)return 0;const i=(n[1]||"").toLowerCase();return n.length>=2&&f.LOCALE_PATTERN.test(o)&&"account"===i?1:-1}normalizePathname(e){if("string"!=typeof e)throw new TypeError("Expected pathname to be a string, but received "+typeof e);return e.replace(/\/{2,}/g,"/").replace(/^\/|\/$/g,"")||null}fetchToken(){return o(this,void 0,void 0,function*(){if(this.isTokenFetching)return yield new Promise(e=>{const t=setInterval(()=>{this.isTokenFetching||(clearInterval(t),e(null))},100)}),window.localStorage.getItem("storecrm_token");this.isTokenFetching=!0;const e=window.localStorage.getItem("storecrm_customer_id"),t=yield fetch(`/apps/${this.config.appProxyName}/token?current_customer_id=${e}`),n=(yield t.text()).match(/\[data\]([\s\S]*?)\[\/data\]/);if(!n)throw this.isTokenRefreshed=!0,new Error("No data from API");const o=JSON.parse(n[1]);if(!o||!o.customer)throw this.isTokenRefreshed=!0,new Error("No data from API2");return window.localStorage.setItem("storecrm_token",o.customer.token),window.localStorage.setItem("storecrm_customer_id",o.customer.id),this.isTokenRefreshed=!0,(null==e?void 0:e.startsWith("TEMP_"))&&o.customer.id!==e&&(yield this.syncWishlist(null,e)),this.isTokenFetching=!1,o.customer.token})}getToken(){return o(this,void 0,void 0,function*(){return this.isTokenFetching&&(yield this.fetchToken()),window.localStorage.getItem("storecrm_token")})}getCustomerId(){return o(this,void 0,void 0,function*(){return this.isTokenFetching&&(yield this.fetchToken()),window.localStorage.getItem("storecrm_customer_id")})}request(){return o(this,arguments,void 0,function*(e="GET",t,n=null,o=!1){const i=yield this.getCustomerId(),r=yield this.getToken(),s=window.location.href;t.includes("?")?t+=`&customer_id=${i}&host=${window.location.host}&referrer=${encodeURIComponent(s)}`:t+=`?customer_id=${i}&host=${window.location.host}&referrer=${encodeURIComponent(s)}`;const a=yield fetch(t,{method:e,headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`},body:n?JSON.stringify(n):null,credentials:o?"include":"same-origin"});if(!a.ok)throw new Error("API request failed");return a.json()})}toggleWishlist(e,t=!1,n=!1,o=""){n?this.fetchToken().then(()=>{var n=window.localStorage.getItem("storecrm_customer_id");n&&!/^TEMP_/.test(n)?this.doToggleWishlist(e,!t).then(()=>{}).catch(e=>{console.error(e),alert("\u30b5\u30fc\u30d0\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f\uff01 error: "+e.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(e,!t).then(()=>{}).catch(e=>{console.error(e),alert("\u30b5\u30fc\u30d0\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f\uff01 error: "+e.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*(e=null,t=void 0,n=!1){if(!n){const e=JSON.parse(window.localStorage.getItem("storecrm_wishlist")||"{}"),t=6e4;if(e.lastUpdated&&Date.now()-e.lastUpdated{console.error("StoreCRM Restock: click flow failed",e),this.popupManager.show(this.config.restockPopup,n.variants,n.productId)}):console.error("StoreCRM Restock: restockButton not found")}isRestockLoginRequired(){var e;return this.toBoolean(null===(e=this.config.restockOption)||void 0===e?void 0:e.require_login_for_restock)}shouldAutoRegisterRestockAfterLogin(){var e;return this.toBoolean(null===(e=this.config.restockOption)||void 0===e?void 0:e.auto_register_after_login)}shouldOneClickRestockWhenLoggedIn(){var e;return this.toBoolean(null===(e=this.config.restockOption)||void 0===e?void 0:e.one_click_when_logged_in)}shouldShowRestockRegisteredState(){var e;return this.toBoolean(null===(e=this.config.restockOption)||void 0===e?void 0:e.show_registered_status_when_logged_in)}getRestockRegistrationMode(e=[],t=""){return t||Array.isArray(e)&&e.length>1?"variant":this.favoriteMode}toBoolean(e){return!0===e||"true"===e||1===e||"1"===e}handleRestockButtonClick(e,t){return o(this,void 0,void 0,function*(){var n;const o=yield this.isLoggedInCustomer(),i=this.getCurrentRestockVariantId(t.variants),r=this.getRestockRegistrationMode(t.variants,i);if(o){if(this.shouldShowRestockRegisteredState()){const o=yield this.getRestockStatus(t.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",e,!0)}if(this.shouldOneClickRestockWhenLoggedIn())return void(yield this.registerEmailRestockOneClick(e,t,i))}if(this.isRestockLoginRequired()&&!o){const n=this.buildPendingRestockIntent(e,t);return void this.showRestockLoginRequiredModal(n)}this.popupManager.show(this.config.restockPopup,t.variants,t.productId)})}registerEmailRestockOneClick(e,t,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,t.variants,t.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(t.variants,n);yield this.doStoreRestock(n,t.productId,i,!1,!1,!1,o),this.shouldShowRestockRegisteredState()?(this.markRestockStatusCacheRegistered("email",t.productId,n,o),this.applyRestockButtonRegisteredState("email",e,!0),this.refreshAllRestockButtonStates(!1)):this.invalidateRestockStatusCache(t.productId,n,o),this.popupManager.show(this.config.restockPopup,t.variants,t.productId,{readOnly:!0,hideSubmitButton:!0,variantId:n,email:i}),this.popupManager.success(this.config.restockPopup.success_text)}catch(e){console.error("StoreCRM Restock: one-click registration failed",e),this.popupManager.show(this.config.restockPopup,t.variants,t.productId),this.popupManager.failure(this.config.restockPopup.error_text)}})}handleLoginRequiredRestockClick(e,t){return o(this,void 0,void 0,function*(){if(yield this.isLoggedInCustomer())return void this.popupManager.show(this.config.restockPopup,t.variants,t.productId);const n=this.buildPendingRestockIntent(e,t);this.showRestockLoginRequiredModal(n)})}buildPendingRestockIntent(e,t){return{version:1,product_id:String(t.productId),variant_id:this.getCurrentRestockVariantId(t.variants),pdp_url:window.location.href,button_id:e,clicked_at:(new Date).toISOString(),created_at:Date.now(),auto_register_after_login:this.shouldAutoRegisterRestockAfterLogin(),mode:this.getRestockRegistrationMode(t.variants,this.getCurrentRestockVariantId(t.variants))}}getCurrentRestockVariantId(e){const t=new URL(window.location.href).searchParams.get("variant");if(t)return String(t);const n=this.getSelectedProductFormVariantId(e);if(n)return n;const o=(e||[]).find(e=>!e.available)||(e||[])[0];return o&&o.id?String(o.id):""}getSelectedProductFormVariantId(e){if(!document||!Array.isArray(e)||0===e.length)return"";const t=new Set(e.map(e=>String(e.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 e of n){const n=Array.from(document.querySelectorAll(e)).find(e=>{const n=String(e.value||"");return n&&t.has(n)});if(n)return String(n.value)}return""}initRestockStateWatcher(){if(this.restockStateWatcherStarted)return;this.restockStateWatcherStarted=!0,this.lastRestockStateHref=window.location.href;const e=()=>{this.refreshAllRestockButtonStates(!1)},t=()=>{this.refreshAllRestockButtonStates(!0)},n=()=>{e(),window.setTimeout(e,60),window.setTimeout(t,250)};window.navigation&&window.navigation.addEventListener("navigate",()=>{n()}),this.patchHistoryForRestockStateWatcher(),window.addEventListener("storecrm:locationchange",n),window.addEventListener("popstate",n),document.addEventListener("change",e=>{this.isVariantChangeTarget(e.target)&&n()},!0),["variant:change","variant:changed","product:variant-change","shopify:section:load"].forEach(e=>{document.addEventListener(e,n)}),window.setInterval(()=>{this.lastRestockStateHref!==window.location.href&&(this.lastRestockStateHref=window.location.href,n())},1e3)}patchHistoryForRestockStateWatcher(){const e="__storecrmRestockHistoryPatched";window[e]||(window[e]=!0,["pushState","replaceState"].forEach(e=>{const t=window.history[e];window.history[e]=(...e)=>{const n=t.apply(window.history,e);return window.dispatchEvent(new Event("storecrm:locationchange")),n}}))}isVariantChangeTarget(e){if(!(e instanceof HTMLElement))return!1;if(e.matches('input[name="id"], select[name="id"]'))return!0;const t=e.name||e.getAttribute("name")||"";return!!/options?\[|option-|variant/i.test(t)||Boolean(e.closest('variant-selects, variant-radios, product-form, .product-form, [data-product-form], [data-section*="product"]')&&e.matches("input, select"))}refreshAllRestockButtonStates(e=!1){document.querySelectorAll(".storecrm-button").forEach(t=>{if(!(t instanceof HTMLElement))return;const n=t.id;if(n)try{if("restock-button"===t.dataset.type){const t=a.RestockButton.getInstance(n);this.refreshRestockButtonState("email",n,t.productId,t.variants,this.getRestockRegistrationMode(t.variants,this.getCurrentRestockVariantId(t.variants)),e)}else if("line-restock-button"===t.dataset.type){const t=c.LineRestockButton.getInstance(n);this.refreshRestockButtonState("line",n,t.productId,t.variants,this.getRestockRegistrationMode(t.variants,this.getCurrentRestockVariantId(t.variants)),e)}}catch(e){}})}refreshRestockButtonState(e,t,n,i,r){return o(this,arguments,void 0,function*(e,t,n,o,i,r=!1){let s="";try{if(s=this.prepareRestockButtonStateRefresh(e,t,n,o,i),!this.shouldApplyRestockRegisteredState())return this.applyRestockButtonLoadingState(e,t,!1),void this.applyRestockButtonRegisteredState(e,t,!1);const a=this.getFreshCachedRestockStatus(n,s,i);if(a&&(this.applyRestockButtonLoadingState(e,t,!1),this.applyRestockButtonRegisteredState(e,t,this.isRestockStatusRegistered(e,n,s,i,a)),!r))return;const c=yield this.isLoggedInCustomer(),l=this.getCurrentRestockVariantId(o);if(l!==s)return void this.refreshRestockButtonState(e,t,n,o,this.getRestockRegistrationMode(o,l),!0);if(!c)return this.applyRestockButtonLoadingState(e,t,!1),void this.applyRestockButtonRegisteredState(e,t,!1);const d=yield this.getRestockStatus(n,s,i,r),u=this.getCurrentRestockVariantId(o);if(u!==s)return void this.refreshRestockButtonState(e,t,n,o,this.getRestockRegistrationMode(o,u),!0);this.applyRestockButtonLoadingState(e,t,!1),this.applyRestockButtonRegisteredState(e,t,this.isRestockStatusRegistered(e,n,s,i,d))}catch(n){s&&this.getCurrentRestockVariantId(o)===s&&this.applyRestockButtonLoadingState(e,t,!1),console.warn("StoreCRM Restock: failed to refresh registration status",n)}})}prepareRestockButtonStateRefresh(e,t,n,o,i){const r=this.getCurrentRestockVariantId(o),s=`${e}:${t}`,a=this.restockButtonVariantByKey.get(s),c=Boolean(a&&a!==r);c&&this.applyRestockButtonRegisteredState(e,t,!1),this.restockButtonVariantByKey.set(s,r);return this.getFreshCachedRestockStatus(n,r,i)?this.applyRestockButtonLoadingState(e,t,!1):c&&(this.applyRestockButtonRegisteredState(e,t,!1),this.applyRestockButtonLoadingState(e,t,!0)),r}getRestockStatusCacheKey(e,t,n){return`${n}:${e}:${t||""}`}getOptimisticRestockRegisteredKey(e,t,n,o){return`${e}:${this.getRestockStatusCacheKey(t,n,o)}`}isOptimisticRestockRegistered(e,t,n,o){const i=this.getOptimisticRestockRegisteredKey(e,t,n,o),r=this.optimisticRestockRegistered.get(i);return!!r&&(!(Date.now()-r>=3e4)||(this.optimisticRestockRegistered.delete(i),!1))}isRestockStatusRegistered(e,t,n,o,i){var r;return Boolean(null===(r=null==i?void 0:i[e])||void 0===r?void 0:r.registered)||this.isOptimisticRestockRegistered(e,t,n,o)}shouldApplyRestockRegisteredState(){return this.shouldShowRestockRegisteredState()}getFreshCachedRestockStatus(e,t,n){const o=this.restockStatusCache.get(this.getRestockStatusCacheKey(e,t,n));return!o||Date.now()-o.fetchedAt>=3e4?null:o.value}invalidateRestockStatusCache(e,t,n){this.restockStatusCache.delete(this.getRestockStatusCacheKey(e,t,n))}markRestockStatusCacheRegistered(e,t,n,o){this.optimisticRestockRegistered.set(this.getOptimisticRestockRegisteredKey(e,t,n,o),Date.now());const i=this.getFreshCachedRestockStatus(t,n,o)||{mode:o,product_id:t,variant_id:n||null,email:{registered:!1,customer_restock_id:null},line:{registered:!1,customer_restock_id:null,line_connected:!1}};i[e]=Object.assign(Object.assign({},i[e]),{registered:!0}),this.restockStatusCache.set(this.getRestockStatusCacheKey(t,n,o),{value:i,fetchedAt:Date.now()})}getRestockStatus(e,t,n){return o(this,arguments,void 0,function*(e,t,n,o=!1){var i;if(!e||"variant"===n&&!t)return null;const r=this.getRestockStatusCacheKey(e,t,n),s=this.getFreshCachedRestockStatus(e,t,n);if(!o&&s)return s;const a=this.restockStatusRequests.get(r);if(a)return a;const c=new URLSearchParams({product_id:e,mode:n});t&&c.set("variant_id",t);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(e=>(this.restockStatusCache.set(r,{value:e,fetchedAt:Date.now()}),e)).catch(e=>(console.warn("StoreCRM Restock: status request failed",e),null)).finally(()=>{this.restockStatusRequests.delete(r)});return this.restockStatusRequests.set(r,d),d})}getRestockButtonSettings(e){return"line"===e?this.config.lineRestock||{}:this.config.restock||{}}getNonEmptyRestockButtonSetting(e,t){var n;const o=null===(n=this.getRestockButtonSettings(e))||void 0===n?void 0:n[t];return"string"==typeof o&&""!==o.trim()?o:void 0}getRegisteredRestockButtonText(e){const t=this.getNonEmptyRestockButtonSetting(e,"registered_button_text");return t||(/^ja\b/i.test(this.currentLocale||"")?"\u767b\u9332\u6e08\u307f":"Registered")}getRegisteredRestockButtonOpacity(e){var t;const n=null===(t=this.getRestockButtonSettings(e))||void 0===t?void 0:t.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(f.RESTOCK_LOADING_STYLE_ID))return;const e=document.createElement("style");e.id=f.RESTOCK_LOADING_STYLE_ID,e.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(e)}getRestockButtonLoadingHtml(){return`${this.getRestockButtonLoadingLabel()}`}rememberRestockButtonInlineStyles(e){"true"!==e.dataset.storecrmOriginalStyleSaved&&(e.dataset.storecrmOriginalStyleSaved="true",e.dataset.storecrmOriginalColor=e.style.color||"",e.dataset.storecrmOriginalBackgroundColor=e.style.backgroundColor||"",e.dataset.storecrmOriginalBorderColor=e.style.borderColor||"",e.dataset.storecrmOriginalOpacity=e.style.opacity||"",e.dataset.storecrmOriginalCursor=e.style.cursor||"",e.dataset.storecrmOriginalMinWidth=e.style.minWidth||"")}restoreRestockButtonInlineStyles(e){e.style.color=e.dataset.storecrmOriginalColor||"",e.style.backgroundColor=e.dataset.storecrmOriginalBackgroundColor||"",e.style.borderColor=e.dataset.storecrmOriginalBorderColor||"",e.style.opacity=e.dataset.storecrmOriginalOpacity||"",e.style.cursor=e.dataset.storecrmOriginalCursor||"",e.style.minWidth=e.dataset.storecrmOriginalMinWidth||"",delete e.dataset.storecrmOriginalStyleSaved,delete e.dataset.storecrmOriginalColor,delete e.dataset.storecrmOriginalBackgroundColor,delete e.dataset.storecrmOriginalBorderColor,delete e.dataset.storecrmOriginalOpacity,delete e.dataset.storecrmOriginalCursor,delete e.dataset.storecrmOriginalMinWidth}escapeCssIdentifier(e){return String(e).replace(/([^\w-])/g,"\\$1")}getRestockButtonSelector(e,t){return`.${"line"===e?"storecrm-line-restock":"storecrm-restock"}-${this.escapeCssIdentifier(t)}`}applyRestockButtonLoadingState(e,t,n){const o=this.getRestockButtonSelector(e,t);document.querySelectorAll(o).forEach(e=>{if(e instanceof HTMLButtonElement){if(e.dataset.storecrmOriginalText||(e.dataset.storecrmOriginalText=e.textContent||""),n)return this.ensureRestockLoadingStyle(),this.rememberRestockButtonInlineStyles(e),e.dataset.storecrmRestockLoading="true",e.dataset.storecrmRestockOriginalHtml||(e.dataset.storecrmRestockOriginalHtml=e.innerHTML),e.offsetWidth>0&&(e.style.minWidth=`${e.offsetWidth}px`),e.innerHTML=this.getRestockButtonLoadingHtml(),e.setAttribute("disabled","disabled"),e.setAttribute("aria-disabled","true"),e.setAttribute("aria-busy","true"),e.classList.add("storecrm-restock-loading"),void(e.style.cursor="progress");"true"===e.dataset.storecrmRestockLoading&&(e.removeAttribute("aria-busy"),e.classList.remove("storecrm-restock-loading"),delete e.dataset.storecrmRestockLoading,"true"!==e.dataset.storecrmRegistered&&(e.removeAttribute("disabled"),e.removeAttribute("aria-disabled"),e.innerHTML=e.dataset.storecrmRestockOriginalHtml||e.dataset.storecrmOriginalText||e.innerHTML||"",this.restoreRestockButtonInlineStyles(e)),delete e.dataset.storecrmRestockOriginalHtml)}})}applyRestockButtonRegisteredState(e,t,n){const o=this.getRestockButtonSelector(e,t);document.querySelectorAll(o).forEach(t=>{if(t instanceof HTMLButtonElement){if(t.dataset.storecrmOriginalText||(t.dataset.storecrmOriginalText=t.textContent||""),n)return this.rememberRestockButtonInlineStyles(t),t.dataset.storecrmStateDisabled="true",t.dataset.storecrmRegistered="true",t.textContent=this.getRegisteredRestockButtonText(e),t.setAttribute("disabled","disabled"),t.setAttribute("aria-disabled","true"),t.classList.add("storecrm-restock-registered"),t.style.color=this.getNonEmptyRestockButtonSetting(e,"registered_button_color")||t.style.color,t.style.backgroundColor=this.getNonEmptyRestockButtonSetting(e,"registered_button_background_color")||t.style.backgroundColor,t.style.borderColor=this.getNonEmptyRestockButtonSetting(e,"registered_button_border_color")||t.style.borderColor,t.style.opacity=this.getRegisteredRestockButtonOpacity(e),void(t.style.cursor="not-allowed");"true"===t.dataset.storecrmStateDisabled&&(t.removeAttribute("disabled"),t.removeAttribute("aria-disabled"),t.classList.remove("storecrm-restock-registered"),t.textContent=t.dataset.storecrmOriginalText||t.textContent||"",delete t.dataset.storecrmStateDisabled,delete t.dataset.storecrmRegistered,this.restoreRestockButtonInlineStyles(t))}})}buildGuestRestockRedirectUrl(e){var t;const n=null===(t=this.config.restockOption)||void 0===t?void 0:t.guest_redirect_url;if(this.isNonEmptyOption(n))return this.buildConfiguredGuestRestockRedirectUrl(n,e);const o=this.toGuestRestockReturnPath(e);try{const e=new URL(this.getStoreAccountLoginUrl(),window.location.origin);return e.searchParams.set(this.getGuestRestockReturnParamName(e),o),e.origin===window.location.origin?`${e.pathname}${e.search}${e.hash}`:e.toString()}catch(e){return`/account/login?return_url=${encodeURIComponent(o)}`}}buildConfiguredGuestRestockRedirectUrl(e,t){const n=this.toGuestRestockReturnPath(t);try{const t=new URL(e,window.location.origin);return t.searchParams.set(this.getConfiguredGuestRestockReturnParamName(t),n),t.origin===window.location.origin?`${t.pathname}${t.search}${t.hash}`:t.toString()}catch(t){return e.trim()}}getConfiguredGuestRestockReturnParamName(e){return e.searchParams.has("return_to")||e.pathname.includes("/customer_authentication/login")?"return_to":"return_url"}getStoreAccountLoginUrl(){var e,t;const n=null===(e=window.storecrm_data)||void 0===e?void 0:e.account_login_url,o=null===(t=window.storecrm_data)||void 0===t?void 0:t.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 e=this.config.shopifyCustomerAccountsIsClassic;if(!1===e||"false"===e||"0"===e)return!0;const t=String(this.config.shopifyCustomerAccountsVersion||"").toUpperCase();return"NEW"===t||"NEW_CUSTOMER_ACCOUNTS"===t}getGuestRestockReturnParamName(e){return e.searchParams.has("return_to")||e.pathname.includes("/customer_authentication/login")?"return_to":"return_url"}isNonEmptyOption(e){return"string"==typeof e&&""!==e.trim()&&"undefined"!==e}toGuestRestockReturnPath(e){try{const t=new URL(e,window.location.origin);return t.origin===window.location.origin||/(^|\/)products\//.test(t.pathname)?`${t.pathname}${t.search}${t.hash}`:t.toString()}catch(e){return window.location.pathname+window.location.search+window.location.hash}}setPendingRestockIntent(e){window.localStorage.setItem(f.PENDING_RESTOCK_INTENT_KEY,JSON.stringify(e))}getPendingRestockIntent(){const e=window.localStorage.getItem(f.PENDING_RESTOCK_INTENT_KEY);if(!e)return null;try{const t=JSON.parse(e);return t&&t.product_id&&t.pdp_url&&t.created_at?t:(this.clearPendingRestockIntent(),null)}catch(e){return this.clearPendingRestockIntent(),null}}clearPendingRestockIntent(){this.clearPendingRestockRetryTimer(),window.localStorage.removeItem(f.PENDING_RESTOCK_INTENT_KEY)}clearPendingRestockRetryTimer(){void 0!==this.pendingRestockRetryTimer&&(window.clearTimeout(this.pendingRestockRetryTimer),this.pendingRestockRetryTimer=void 0),this.pendingRestockRetryAttempts=0}schedulePendingRestockIntentRetry(e=600){void 0===this.pendingRestockRetryTimer&&(this.pendingRestockRetryAttempts>=10||(this.pendingRestockRetryAttempts+=1,this.pendingRestockRetryTimer=window.setTimeout(()=>{this.pendingRestockRetryTimer=void 0,this.handlePendingRestockIntent().catch(e=>{console.warn("StoreCRM: pending restock retry failed",e)})},e)))}showRestockLoginRequiredModal(e){this.pendingRestockLoginIntent=e,this.clearPendingRestockIntent();const t=this.ensureRestockLoginRequiredModal();if(!t)return this.setPendingRestockIntent(e),void(window.location.href=this.buildGuestRestockRedirectUrl(e.pdp_url));t.classList.add("is-open"),t.setAttribute("aria-hidden","false"),void 0===this.restockLoginRequiredPreviousOverflow&&(this.restockLoginRequiredPreviousOverflow=document.documentElement.style.overflow),document.documentElement.style.overflow="hidden";const n=t.querySelector('[data-storecrm-restock-login-action="login"]');null==n||n.focus()}hideRestockLoginRequiredModal(){const e=document.getElementById(f.RESTOCK_LOGIN_REQUIRED_MODAL_ID);e&&(e.classList.remove("is-open"),e.setAttribute("aria-hidden","true"),document.documentElement.style.overflow=this.restockLoginRequiredPreviousOverflow||"",this.restockLoginRequiredPreviousOverflow=void 0)}ensureRestockLoginRequiredModal(){if(!document||!document.body)return null;let e=document.getElementById(f.RESTOCK_LOGIN_REQUIRED_MODAL_ID);return e||(document.body.insertAdjacentHTML("beforeend",`
`),l+='',this.content.innerHTML=l,this.content.style.color=e.text_color||"#000000",this.container){const t=this.container.querySelector(".storecrm_modal__container");t&&(t.style.backgroundColor=e.background_color||"#ffffff",t.style.borderRadius=`${e.popup_radius||10}px`)}this.button&&(this.button.style.backgroundColor=e.button_background_color||"#222222",this.button.style.color=e.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=e.close_text_color||"#000000"),this.resetMessage(),this.preview&&(this.success(e.success_text||"\u518d\u5165\u8377\u901a\u77e5\u304c\u767b\u9332\u3055\u308c\u307e\u3057\u305f\uff01"),this.failure(e.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(e=>{e.addEventListener("click",e=>{e.preventDefault(),e.stopPropagation()})}))}handleEnableClick(){return o(this,void 0,void 0,function*(){var e,t,n;if(this.preview)return;this.resetMessage(),this.disableButton();const o=null===(e=this.content)||void 0===e?void 0:e.querySelector("#storecrm_restock_variant"),i=o?o.value:"";this.parent&&this.parent.storeLineRestock(this.product_id,i,null===(t=this.line_profile)||void 0===t?void 0:t.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*(){this.preview||(this.resetMessage(),this.disableButton(),console.log("StoreCRM: LINE\u8cfc\u8aad\u51e6\u7406\u3092\u3057\u307e\u3059"),this.parent&&this.parent.lineSubscribe(function(e){alert(e)}))})}resetMessage(){this.footer&&this.footer.querySelectorAll(".storecrm_modal_message").forEach(e=>e.remove())}disableButton(){this.button&&(this.button.setAttribute("disabled","disabled"),this.button.innerText="\u9001\u4fe1\u4e2d...")}enableButton(){this.button&&(this.button.removeAttribute("disabled"),this.button.innerText=this.config.button_text||"\u518d\u5165\u8377\u901a\u77e5\u3092\u6709\u52b9\u306b\u3059\u308b")}success(e){this.enableButton();const t=document.createElement("div");t.classList.add("storecrm_modal_success","storecrm_modal_message"),t.style.color=this.config.success_text_color||"#166534",t.style.backgroundColor=this.config.success_background_color||"#F0FDF4",t.style.padding="1rem",t.style.marginTop="1rem",t.style.borderRadius="4px",t.innerText=e,this.footer&&this.footer.appendChild(t)}failure(e){this.enableButton();const t=document.createElement("div");t.classList.add("storecrm_modal_error","storecrm_modal_message"),t.style.color=this.config.error_text_color||"#991B1B",t.style.backgroundColor=this.config.error_background_color||"#FEF2F2",t.style.padding="1rem",t.style.marginTop="1rem",t.style.borderRadius="4px",t.innerText=e,this.footer&&this.footer.appendChild(t)}show(e,t,n,o,i={}){this.product_id=n,this.inited?this.runShow(e,t,o,i):window.setTimeout(()=>this.show(e,t,n,o,i),100)}runShow(e,t,n,o={}){this.render(e,t,n,o);if(document.getElementById("storecrm-line-restock-modal"))try{r.default.show("storecrm-line-restock-modal",{disableFocus:!0})}catch(e){console.warn("StoreCRM: line restock popup show failed",e)}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(e){console.warn("StoreCRM: line restock popup close failed",e)}}}t.LineRestockPopupManager=s,s.template='
';let a=null;t.schema={preview:(e,t)=>{var n,o;return n=()=>{s.getInstance(e,!0).show(e,[],"1234567890",void 0)},o=300,clearTimeout(a),a=setTimeout(n,o),s.template},rows:[{type:"text",slug:"title",nameJa:"\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u306e\u30bf\u30a4\u30c8\u30eb",nameEn:"Popup title",defaultJa:"LINE\u518d\u5165\u8377\u901a\u77e5",defaultEn:"LINE Restock Notification"},{type:"text",slug:"description_text",nameJa:"\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u306e\u672c\u6587",nameEn:"Popup description",defaultJa:"\u3053\u306e\u5546\u54c1\u306e\u518d\u5165\u8377\u3092LINE\u3067\u304a\u77e5\u3089\u305b\u3057\u307e\u3059",defaultEn:"We will notify you via LINE when this product is restocked."},{type:"colorpicker",slug:"background_color",nameJa:"\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u306e\u80cc\u666f\u8272",nameEn:"Popup background color",default:"#ffffff"},{type:"colorpicker",slug:"text_color",nameJa:"\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u306e\u30c6\u30ad\u30b9\u30c8\u8272",nameEn:"Text color",default:"#000000"},{type:"colorpicker",slug:"close_text_color",nameJa:"\u9589\u3058\u308b\u30dc\u30bf\u30f3\u306e\u8272",nameEn:"Popup close button text color",default:"#000000"},{type:"colorpicker",slug:"button_background_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u80cc\u666f\u8272",nameEn:"Button background color",default:"#222222"},{type:"colorpicker",slug:"button_text_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u30c6\u30ad\u30b9\u30c8\u30ab\u30e9\u30fc",nameEn:"Button text color",default:"#dddddd"},{type:"text",slug:"button_text",nameJa:"\u30dc\u30bf\u30f3\u306e\u30c6\u30ad\u30b9\u30c8",nameEn:"Button text",defaultJa:"\u518d\u5165\u8377\u901a\u77e5\u3092\u6709\u52b9\u306b\u3059\u308b",defaultEn:"Enable restock notification"},{type:"text",slug:"success_text",nameJa:"\u6210\u529f\u6642\u306e\u30c6\u30ad\u30b9\u30c8",nameEn:"Success text",defaultJa:"\u518d\u5165\u8377\u901a\u77e5\u304c\u767b\u9332\u3055\u308c\u307e\u3057\u305f\uff01",defaultEn:"Restock notification registered!"},{type:"colorpicker",slug:"success_background_color",nameJa:"\u6210\u529f\u6642\u306e\u80cc\u666f\u8272",nameEn:"Success background color",default:"#F0FDF4"},{type:"colorpicker",slug:"success_text_color",nameJa:"\u6210\u529f\u6642\u306e\u6587\u5b57\u8272",nameEn:"Success text color",default:"#166534"},{type:"text",slug:"error_text",nameJa:"\u5931\u6557\u6642\u306e\u30c6\u30ad\u30b9\u30c8",nameEn:"Error text",defaultJa:"\u518d\u5165\u8377\u901a\u77e5\u306e\u767b\u9332\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002\u3057\u3070\u3089\u304f\u305f\u3063\u3066\u304b\u3089\u518d\u5ea6\u304a\u8a66\u3057\u304f\u3060\u3055\u3044\u3002",defaultEn:"Failed to register restock notification. Please try again later."},{type:"colorpicker",slug:"error_background_color",nameJa:"\u30a8\u30e9\u30fc\u6642\u306e\u80cc\u666f\u8272",nameEn:"Error background color",default:"#FEF2F2"},{type:"colorpicker",slug:"error_text_color",nameJa:"\u30a8\u30e9\u30fc\u6642\u306e\u6587\u5b57\u8272",nameEn:"Error text color",default:"#991B1B"},{type:"range",slug:"popup_radius",nameJa:"\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u306e\u4e38\u307f",nameEn:"Popup border radius",default:10,min:0,max:20,step:1}]}},932(e,t,n){e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}}},t={};function n(o){var i=t[o];if(void 0!==i)return i.exports;var r=t[o]={id:o,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0;n(600)})();