
    (function (value, widgetUrl) {
        const commChatElement = document.getElementById("comm-chat");
        if (commChatElement)
            return;
        const convertedValue = JSON.parse(value);
        const url = location.href;
        const targets = convertedValue.chatbots.filter((chatbot) => {
            return chatbot.ChatbotTagCondition.some((condition) => {
                if (condition.type === "equal") {
                    return url === condition.value;
                }
                else if (condition.type === "include") {
                    return url.includes(condition.value);
                }
                else if (condition.type === "startWith") {
                    return url.startsWith(condition.value);
                }
                else {
                    return false;
                }
            });
        });
        if (targets.length === 0)
            return;
        // ABテスト実施中、かつオリジナル設定ではない、かつオリジナル設定のチャットボットがある場合を除外
        const targetsExcludingTest = targets.filter((target) => {
            var _a, _b, _c;
            const abTestId = (_b = (_a = target.AbTestItem[0]) === null || _a === void 0 ? void 0 : _a.abTest) === null || _b === void 0 ? void 0 : _b.id;
            const isOriginal = (_c = target.AbTestItem[0]) === null || _c === void 0 ? void 0 : _c.original;
            const hasOriginal = targets.some(({ AbTestItem }) => { var _a, _b, _c; return ((_a = AbTestItem[0]) === null || _a === void 0 ? void 0 : _a.original) && ((_c = (_b = AbTestItem[0]) === null || _b === void 0 ? void 0 : _b.abTest) === null || _c === void 0 ? void 0 : _c.id) === abTestId; });
            return !(abTestId && !isOriginal && hasOriginal);
        });
        const chatbotTag = document.createElement("script");
        chatbotTag.id = "comm-chat";
        chatbotTag.setAttribute("src", widgetUrl);
        chatbotTag.setAttribute("data-chatbot", targetsExcludingTest.map((target) => target.id).join(","));
        document.body.appendChild(chatbotTag);
    })
    (`{"chatbots":[{"id":"57937128-7aad-4598-9787-df7a19b746e7","ChatbotTagCondition":[{"type":"startWith","value":"https://eb-online.jp/products/liftone?"}],"AbTestItem":[]},{"id":"449e6667-db4a-4b19-b101-849ca3fa9184","ChatbotTagCondition":[{"type":"startWith","value":"https://eb-online.jp/products/nowmi_lab_spiralcare"}],"AbTestItem":[]},{"id":"0bad55a3-2da9-41bb-a3b0-98e6794c5483","ChatbotTagCondition":[{"type":"include","value":"https://eb-online.jp/products/heatphotocare_nowmi_switch"}],"AbTestItem":[]},{"id":"d3ebc8c8-cc03-4d60-ad30-35809ed8b7b6","ChatbotTagCondition":[{"type":"startWith","value":"https://eb-online.jp/products/hogunoa"}],"AbTestItem":[]},{"id":"c6857b42-a8ac-403a-a566-27a63321effc","ChatbotTagCondition":[{"type":"startWith","value":"https://eb-online.jp/products/rocklean"}],"AbTestItem":[]},{"id":"a07b4096-a2e2-4a04-baf7-f114c074cdb2","ChatbotTagCondition":[{"type":"startWith","value":"https://eb-online.jp/products/facepump"}],"AbTestItem":[]}]}`, "https://widget.comm-chat.com")