
    (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":"dd903246-4491-4af1-9409-de032151ae4f","ChatbotTagCondition":[{"type":"startWith","value":"https://zenb.jp/pages/zenbnoodle230"}],"AbTestItem":[{"original":true,"abTest":{"id":"9a5daf32-3064-45b0-aa4f-1829d2092c17"}}]},{"id":"3c913bd8-3aa5-4371-87c5-bc36a5deec2d","ChatbotTagCondition":[{"type":"startWith","value":"https://zenb.jp/pages/zenbbread100"}],"AbTestItem":[{"original":true,"abTest":{"id":"4e5a0077-a505-44af-ae59-fe5494d5852d"}}]},{"id":"cafc0dfd-7d7e-4637-b5ce-97d09788245d","ChatbotTagCondition":[{"type":"startWith","value":"https://zenb.jp/pages/zenbbread200"}],"AbTestItem":[{"original":true,"abTest":{"id":"0588da0f-d507-425a-9089-2ad1cadb0158"}}]},{"id":"8fdc8f96-340a-49c7-b9fd-e0b57bf15625","ChatbotTagCondition":[{"type":"startWith","value":"https://zenb.jp/pages/zenbbread001"}],"AbTestItem":[{"original":true,"abTest":{"id":"fa4f8fb5-d35b-411d-93ea-fcf4ce0860e3"}}]},{"id":"5606643f-24ae-4bf2-8a2d-629c18dea1dc","ChatbotTagCondition":[{"type":"equal","value":"https://zenb.jp/pages/zenbnoodle230?letrotab=6570&commchat="}],"AbTestItem":[]}]}`, "https://widget.comm-chat.com")