{"version":3,"sources":["discourse/initializers/theme-field-479-common-html-script-1.js","_html/common/body_tag_3.js"],"names":["window","define","_exports","_pluginApi","Object","defineProperty","value","default","require","getObjectForTheme","_default","name","after","initialize","withPluginApi","api","onPageChange","pageChange","hasAnalyticsConsent","otConsentCookie","decodeURIComponent","document","cookie","match","indexOf","pushEvent","eventData","adobeDataLayer","push","trackView","addEventListener","e","item","target","closest","event","eventInfo","action","label","detail","querySelector","textContent","trim","location","pathname"],"mappings":"AAAI,WAAYA,QAChBC,OAAO,uEAAwE,CAAC,UAAW,6BAA6B,SAAUC,EAAUC,GAC1I;AAEAC,OAAOC,eAAeH,EAAU,aAAc,CAC5CI,OAAO,IAETJ,EAASK,aAAU;AACFC,QAAQ,sCAAsCC,kBAAkB;AAEjF,IAAIC,EAAW,CACbC,KAAM,uCACNC,MAAO,iBACPC,cACE,EAAIV,EAAWW,eAAe,UAAUC,IAEtCA,EAAIC,cAAa,KACkB,mBAAtBhB,OAAOiB,YAChBjB,OAAOiB,YACT,GACA,GAEN;AAEFf,EAASK,QAAUG,CACrB,ICxBA,WAIE,SAASQ,IACP,MAAMC,EAHCC,oBAAoBC,SAASC,OAAOC,MAAM,qDAAuD,CAAC,CAAE,OAAO;AAIlH,OAA0B,MAAnBJ,GAA2BA,EAAgBK,QAAQ,YAAc,GAAKL,EAAgBK,QAAQ,aAAe,CACtH,CAIA,SAASC,EAAUC,GACZR,KACLlB,OAAO2B,eAAeC,KAAKF,EAC7B,CALA1B,OAAO2B,eAAiB3B,OAAO2B,gBAAkB,GAUjB,mBAArB3B,OAAO6B,WAChB7B,OAAO6B,YAITR,SAASS,iBAAiB,SAAS,SAASC,GAC1C,MAAMC,EAAOD,EAAEE,OAAOC,QAAQ;AAC9B,IAAKF,EAAM;AAEXP,EAAU,CACRU,MAAO,aACPC,UAAW,CACTC,OAAQ,QACRC,MAAO,aACPC,OANuBP,EAAKQ,cAAc,mBAXdC,aAAaC,QAAU,GAkBnDC,SAAU3C,OAAO2C,SAASC,WAGhC,IAGAvB,SAASS,iBAAiB,SAAS,SAASC,GAC1BA,EAAEE,OAAOC,QAAQ,iBAEjCT,EAAU,CACRU,MAAO,cACPC,UAAW,CACTC,OAAQ,QACRC,MAAO,OACPC,OAAQ,YACRI,SAAU3C,OAAO2C,SAASC,WAGhC,GACD,CArDD","sourceRoot":"theme-53/","sourcesContent":["if ('define' in window) {\ndefine(\"discourse/theme-53/initializers/theme-field-479-common-html-script-1\", [\"exports\", \"discourse/lib/plugin-api\"], function (_exports, _pluginApi) {\n  \"use strict\";\n\n  Object.defineProperty(_exports, \"__esModule\", {\n    value: true\n  });\n  _exports.default = void 0;\n  const settings = require(\"discourse/lib/theme-settings-store\").getObjectForTheme(53);\n  const themePrefix = key => \"theme_translations.53.\".concat(key);\n  var _default = {\n    name: \"theme-field-479-common-html-script-1\",\n    after: \"inject-objects\",\n    initialize() {\n      (0, _pluginApi.withPluginApi)(\"0.11.0\", api => {\n        // SPA page-change hook per implementation guide\n        api.onPageChange(() => {\n          if (typeof window.pageChange === 'function') {\n            window.pageChange();\n          }\n        });\n      });\n    }\n  };\n  _exports.default = _default;\n});\n}\n","\n(function() {\n  function getConsentCookie() {\n    return decodeURIComponent((document.cookie.match(/^(?:.*;)?\\s*OptanonConsent\\s*=\\s*([^;]+)(?:.*)?$/) || [, null])[1]);\n  }\n  function hasAnalyticsConsent() {\n    const otConsentCookie = getConsentCookie();\n    return otConsentCookie != null && otConsentCookie.indexOf(\"groups=\") > -1 && otConsentCookie.indexOf(\",C0002:1\") > -1;\n  }\n\n  window.adobeDataLayer = window.adobeDataLayer || [];\n\n  function pushEvent(eventData) {\n    if (!hasAnalyticsConsent()) return;\n    window.adobeDataLayer.push(eventData);\n  }\n\n  function getText(el) { return el?.textContent?.trim() || ''; }\n\n  // Track page view\n  if (typeof window.trackView === 'function') {\n    window.trackView();\n  }\n\n  // Track topic views\n  document.addEventListener('click', function(e) {\n    const item = e.target.closest('.topic-list-item');\n    if (!item) return;\n    const topicTitle = getText(item.querySelector('.link-top-line'));\n    pushEvent({\n      event: 'topicClick',\n      eventInfo: {\n        action: 'click',\n        label: 'Topic View',\n        detail: topicTitle,\n        location: window.location.pathname\n      }\n    });\n  });\n\n  // Track post likes\n  document.addEventListener('click', function(e) {\n    const likeBtn = e.target.closest('.toggle-like');\n    if (!likeBtn) return;\n    pushEvent({\n      event: 'interaction',\n      eventInfo: {\n        action: 'click',\n        label: 'Like',\n        detail: 'Post Like',\n        location: window.location.pathname\n      }\n    });\n  });\n})();\n\n"]}