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ASF,KAAKtE,EAChB,GACF,GAAC,CAAA1E,IAAA,qBAAAC,MAED,SAAmBG,GACjBA,EAAMA,GAAOP,OAAOwD,SAASsB,KAC7B,IAAIyE,GAAS,EAGT3I,EAAWL,EAAIM,MAAM,KACzB,GAAID,EAASE,OAAS,EAAG,CACvB,IAAI0I,EAAS5I,EAAS,GAAGC,MAAM,KAAK,IACpCD,EAAW4I,EAAO3I,MAAM,MACfc,SAAQ,SAAC8H,GAChB,IAAIC,EAAKD,EAAM5I,MAAM,KACP,YAAV6I,EAAG,IAAoBA,EAAG5I,OAAS,IACrCyI,EAAS,IAAMG,EAAG,GAGtB,GACF,CAIA,OADA9I,EAAWL,EAAIM,MAAM,MACRC,OAAS,EACb,IAAMF,EAAS,GAGjB2I,CACT,GAAC,CAAApJ,IAAA,cAAAC,MAED,SAAY0E,EAAc6E,GACxB,IAAIJ,EAASzE,EAAK3C,QAAQ,QAAS,IAC/ByH,EAASL,EAAO1I,MAAM,SAE1B,OAAI+I,EAAO9I,QAAU,EAAYgE,GAEjCyE,EAASK,EAAOA,EAAO9I,OAAS,GAE5B6I,IACFJ,EAASA,EAAO1I,MAAM,KAAK,GAAGA,MAAM,KAAK,IAGpC0I,EACT,M,oEAACnG,CAAA,CA5a+B,GCC5BD,EAAc,GAEhB,oBAAuBnD,aACvB,IAAuBA,OAAO6J,cAE9B1G,EAAcnD,OAAO6J,aAId,IAAIzG,EAAcD,GACxB2G,WAAW3G,E,YCfhB4G,EAAOC,QAAUC,M","sources":["webpack:///./resources/js/gitguide/modules/history.ts","webpack:///./resources/js/gitguide/modules/search.ts","webpack:///./resources/js/gitguide/modules/content.ts","webpack:///./resources/js/gitguide/git-search.ts","webpack:///external var \"jQuery\""],"sourcesContent":["\nexport default class History {\n  supportsHistory: boolean;\n\n  constructor() {\n    this.supportsHistory = !!(window.history && window.history.pushState);\n  }\n\n  pushState(data: any, title: string, url: string, referrer: string) {\n    if (this.supportsHistory) {\n      document.title = title;\n      window.history.pushState(data, title, url);\n  \n      var getLastPathUrl = function (rawUrl: string) {\n        var urlParts = rawUrl.split(\"/\");\n        var lastPart = urlParts[urlParts.length - 1].split(\"?\")[0].split(\"#\")[0];\n        return lastPart;\n      };\n  \n      // Trigger Analytics\n      if (typeof analytics !== 'undefined' && getLastPathUrl(url) !== getLastPathUrl(referrer)) {\n        analytics.page(title, {\n          referrer: referrer\n        });\n      }\n    }\n  }\n\n  pushStateNoTracking(data: any, title: string, url: string) {\n    if (this.supportsHistory) {\n      window.history.pushState(data, title, url);\n    }\n  }\n}\n","import * as $ from \"jquery\";\nimport { template } from 'lodash';\n\ntype SearchResult = { pageKey: any; title: any; description: any; flag: string; };\ntype SearchPage = { dom: any; meta: { title: string; description: any; }; flags: { isTutorial: any; }; };\n\nexport default class Search {\n  searchData: any;\n\n  constructor(searchData: any) {\n    this.searchData = searchData || {};\n    this.bindEvents();\n  }\n\n  bindEvents() {\n    var self = this;\n\n    $(document).on(\"propertychange change click keyup input paste\", \".search-page #search-wrap input\", function () {\n      var term = $(this).val() as string;\n      if (term.length > 2) {\n        self.runSearch(term);\n      }\n    });\n  }\n\n  runSearch(term: string) {\n    var searchResults: SearchResult[] = [];\n\n    this.searchData.forEach(function (page: SearchPage, pageKey: any) {\n      var html = JSON.stringify(page.dom);\n      if (html.indexOf(term) > -1) {\n        var searchItem = {\n          \"pageKey\": pageKey,\n          \"title\": page.meta.title.replace(\"| Atlassian Git Tutorial\", \"\"),\n          \"description\": page.meta.description,\n          \"flag\": page.flags.isTutorial ? \"tutorial\" : \"articles\"\n        };\n\n        searchResults.push(searchItem);\n      }\n    });\n\n    searchResults.sort(this.sortByType);\n\n    this.renderSearchResults(searchResults);\n  }\n\n  sortByType(left: { flag: string; }) {\n    return left.flag === \"tutorial\" ? -1 : 1;\n  }\n\n  renderSearchResults(items: SearchResult[]) {\n    var itemTemplate = this.getItemTemplate();\n\n    var contentTemplate = template(itemTemplate);\n    $(\".search-results-col\").html(contentTemplate({ items: items }));\n  }\n\n  getItemTemplate() {\n    return '\\\n  <div class=\"search-result-list\">\\\n  <% items.forEach(function( item ){ %>\\\n    <div class=\"_item\" >\\\n      <a href=\"/<%= item.pageKey %>\">\\\n        <div>\\\n          <div class=\"_flag -<%= item.flag %>\">\\\n            <h4><%= item.flag %></h4>\\\n          </div>\\\n          <h3 class=\"_title\"><%= item.title %></h3>\\\n          <div class=\"_content\">\\\n            <%= item.description %>\\\n          </div>\\\n        </div>\\\n      </a>\\\n    </div>\\\n  <% }); %>\\\n  </div>';\n  }\n}\n","import History from './history';\nimport SearchLoader from './search';\nimport * as $ from \"jquery\";\n\nexport default class ContentLoader {\n  contextPath: any;\n  dataUrl: string;\n  history: any;\n  pages: any[];\n  pageHistory: string[];\n  isLocalizedContent: boolean;\n  pageRenderHookEventName: string;\n\n  constructor(contextPath) {\n    this.contextPath = contextPath;\n    this.dataUrl = \"/git/_content\";\n    this.history = new History();\n    this.pages = [];\n    this.pageHistory = [window.location.pathname];\n    this.isLocalizedContent = this.checkLocalizedDomain();\n\n    this.initialize();\n\n    /**\n     * Trigger event for optimizely, etc. to hook into page changes\n     * e.g.\n     *  $(document).on(\"GitPageRender\", function(e) { foo(); });\n     */\n    this.pageRenderHookEventName = \"GitPageRender\";\n  }\n\n  checkLocalizedDomain() {\n    var hostnameParts = window.location.hostname.split(\".\");\n    var i18nDomains = [\"es\", \"de\", \"fr\", \"ja\", \"br\", \"ru\", \"ko\"];\n\n    if (i18nDomains.indexOf(hostnameParts[0]) > -1) {\n      return true;\n    }\n    return false;\n  }\n\n  initialize() {\n    var self = this;\n    // Toggle main menu\n    $(\".hamburger\").on(\"click\", function () {\n      $(\".hamburger, .primary-nav\").toggleClass(\"is-active\");\n    });\n\n    // Check for fragment in url and scroll to before loading microsite\n    var deeplinkId = self.getSectionFragment();\n    if (deeplinkId) {\n      self.scrollTo($(deeplinkId));\n    }\n\n    // Set Active States on UX\n    self.setUXState();\n  }\n\n  getContent() {\n    var self = this;\n\n    $.ajax({\n      url: this.contextPath + this.dataUrl,\n      type: \"GET\",\n      dataType: \"json\"\n    })\n      .done(function (json) {\n        if (\"undefined\" !== typeof json[\"pages\"]) {\n          $(\"body\").addClass(\"content-loaded\");\n          self.pages = json.pages;\n          self.bindRoutes();\n\n          // Initialize Search\n          new SearchLoader(json.pages);\n        }\n      });\n  }\n\n  bindRoutes() {\n    var self = this;\n\n    // Intercept link clicks and route, or replace content if part of microsite\n    $(document).on(\"click\", \"a\", function (e) {\n\n      //Check for i18n domain\n      if (!self.isLocalizedContent) {\n        var $link = $(this);\n        var href = $link.attr(\"href\");\n        var externalPattern = /^https?:\\/\\//i;\n        var isFullUri = externalPattern.test(href);\n\n        if (isFullUri) {\n          return true;\n        }\n\n        // @todo: work-around can be removed here once wysiwyg fixed for internal links\n        href = href.replace(\".html\", \"\");\n\n        // Check for same page anchor link\n        if (href.charAt(0) !== \"#\") {\n          e.preventDefault();\n\n          // Check for search close state\n          if ($link.hasClass(\"search-close\")) {\n            var searchBackLink = self.pageHistory.length > 1 ? self.pageHistory[self.pageHistory.length - 2] : href;\n            return self.parseLink(searchBackLink);\n          }\n\n          return self.parseLink(href);\n        }\n      }\n    });\n\n    // Intercept pop state to check for app url and load content via js\n    window.addEventListener('popstate', function () {\n      self.parseLink(location.href, true);\n    });\n  }\n\n  parseLink(href, disablePushState) {\n    if (!href) {\n      return true;\n    }\n\n    // Check for an external link or a non-microsite link, proceed as normal link if found\n    var paths = href.split(\"/\");\n    if (paths.indexOf(\"git\") === -1 && href.indexOf(\"/git#\") === -1) {\n      window.location = href;\n      return true;\n    }\n\n    // Get page path by popping paths, key starts with /git/ path partial\n    while (paths.length) {\n      if (paths[0] === \"git\") {\n        break;\n      }\n      paths.shift();\n    }\n\n    var pageGrp = paths.join(\"/\").split(\"?\");\n    var pageKey = pageGrp[0].split(\"#\")[0];\n\n    this.dispatchPage(pageKey, href, disablePushState);\n\n    return false;\n  }\n\n  dispatchPage(pageKey, href, disablePushState) {\n    var pageContent = this.pages[pageKey];\n\n    // Default to homepage\n    if (typeof pageContent === \"undefined\") {\n      pageContent = this.pages[\"git\"];\n    }\n\n    if (typeof pageContent.dom === \"undefined\") {\n      // Error checking - load the page as normal if some reason js breaks down\n      window.location = href;\n      return true;\n    }\n\n    // Replace page content\n    $(\"#content\").empty();\n\n    $(\".topbar a\").text(pageContent.topbar.text).attr(\"href\", pageContent.topbar.href).parent().attr(\"class\", \"\").addClass(\"_header -\" + pageContent.topbar.cls);\n\n    this.renderContent(pageContent.dom, href);\n\n    // Update meta tags\n    $('meta[name=description]').attr('content', pageContent.meta.description);\n    $('link[rel=canonical]').attr('href', pageContent.meta.canonical);\n\n    if (!disablePushState) {\n      this.history.pushState({}, pageContent.meta.title, href, window.location.href);\n      this.pageHistory.push(href);\n    }\n\n    // Reset UI states\n    this.setUXState(pageContent.flags);\n\n    var deeplinkId = this.getSectionFragment(href);\n    if (deeplinkId) {\n      this.scrollTo($(deeplinkId));\n    } else {\n      $(\"html, body\").animate({ scrollTop: 0 }, 0);\n    }\n  }\n\n  renderContent(domList, href) {\n    var self = this;\n    var content = $(\"#content\");\n\n    if (!content.length) { return; }\n\n    domList.forEach(function (val) {\n      try {\n        var el = self.jsonToDom(val);\n        content.append(el);\n      } catch (ex) {\n        console.log(ex);\n      }\n    });\n\n    // Trigger hook event for external listeners\n    $.event.trigger({ type: this.pageRenderHookEventName, href: href });\n  }\n\n  /**\n   * Convert json structure to dom elements:\n   * https://github.com/mobz/joey/blob/master/src/joey.js\n   */\n  // TODO: Remove this old method/dependency\n  jsonToDom(elementDef, parentNode) {\n    return this.createNode(elementDef, parentNode, parentNode ? parentNode.ownerDocument : global.document);\n  }\n\n  createNode(obj, parent, context) {\n\n    var el, attr;\n    if (obj == null) {\n      return;\n    } else if (typeof obj === 'string') {\n      el = context.createTextNode(obj);\n    } else {\n      el = context.createElement(obj.tag || obj.tagName || 'DIV');\n      for (attr in obj) {\n        this.addAttr(el, attr, obj[attr], context);\n      }\n    }\n    if (parent) {\n      parent.appendChild(el);\n    }\n  \n    return el;\n  }\n\n  addAttr(el, attr, value, context) {\n    var shortcuts = {\n      \"text\": \"textContent\",\n      \"cls\": \"className\"\n    };\n    attr = shortcuts[attr] || attr;\n  \n    if (attr === 'children') {\n      for (var i = 0; i < value.length; i++) {\n        this.createNode(value[i], el, context);\n      }\n    } else if (attr === 'style' || attr === 'dataset') {\n      for (var prop in value) {\n        el[attr][prop] = value[prop];\n      }\n    } else if (attr.indexOf(\"on\") === 0) {\n      el.addEventListener(attr.substr(2), value, false);\n    } else if (attr === 'textContent') {\n      $(el).html(value);\n    } else if (attr === 'height' || attr === 'width') {\n      el[attr] = value.replace(\"px\", \"\");\n    } else if (attr === 'hashLink' && el[\"href\"] === \"\") {\n      el[\"href\"] = value;\n    } else {\n      el[attr] = value;\n    }\n  }\n\n  scrollTo($elem) {\n    if (!$elem.length) {\n      return false;\n    }\n  \n    // Set a timeout to let content builder\n    window.setTimeout(function () {\n      var offsetTop = $elem.offset().top - 90;\n      $(\"html, body\").animate({ scrollTop: offsetTop }, \"slow\");\n    }, 100);\n  }\n\n  setUXState(flags) {\n    if (typeof flags !== \"undefined\") {\n      // Toggle is-tutorial\n      if (flags.isTutorial) {\n        $(\".tutorial-sidebar\").addClass(\"is-active\");\n        $(\".topbar, #footer\").addClass(\"is-tutorial\");\n        $(\".topbar .header\").addClass(\"-is-tutorial\");\n        $(\".page-wrap\").addClass(\"is-active -gray-bg tutorial-detail\");\n      } else {\n        $(\".tutorial-sidebar\").removeClass(\"is-active\");\n        $(\".topbar, #footer\").removeClass(\"is-tutorial\");\n        $(\".topbar .header\").removeClass(\"-is-tutorial\");\n        $(\".page-wrap\").removeClass(\"is-active -gray-bg tutorial-detail\");\n      }\n  \n      // Toggle is-search\n      if (flags.isSearch) {\n        $(\".topbar, #footer, .hamburger\").addClass(\"is-search\");\n        $(\".search-open\").addClass(\"hidden\");\n        $(\".search-close\").removeClass(\"hidden\");\n      } else {\n        $(\".topbar, #footer, .hamburger\").removeClass(\"is-search\");\n        $(\".search-close\").addClass(\"hidden\");\n        $(\".search-open\").removeClass(\"hidden\");\n      }\n    }\n  \n    var $tutorialSidebar = $(\".tutorial-sidebar\");\n    if ($tutorialSidebar.length && $tutorialSidebar.hasClass(\"is-active\")) {\n      this.setUXStateTutorial($tutorialSidebar);\n    }\n  \n    var $articlesIndex = $(\".articles-index\");\n    if ($articlesIndex.length) {\n      this.setUXStateArticle();\n    }\n  \n    var $homeIndex = $(\".home-start\");\n    if ($homeIndex.length) {\n      this.setUXStateHome();\n    }\n  \n    $(\".hamburger, .primary-nav\").removeClass(\"is-active\");\n  }\n\n  setUXStateTutorial($sidebar) {\n    var self = this;\n    $sidebar.find(\"a.cms-link\").removeClass(\"active\");\n    $sidebar.find(\"._group-wrap, ._toc\").removeClass(\"is-active\");\n    var isFound = false;\n  \n    $sidebar.find(\"a.cms-link\").each(function () {\n      var $link = $(this);\n  \n      var currentUrl = self.sanitizeUrl(window.location.href);\n      var linkUrl = self.sanitizeUrl($link.attr(\"href\"));\n  \n      if (linkUrl === currentUrl) {\n        isFound = true;\n        $link.addClass(\"active\");\n        $link.closest(\"._group-wrap\").find(\".tutorial-link\").addClass(\"active\");\n        $link.next(\"._toc\").addClass(\"is-active\");\n        $link.closest(\"._toc\").addClass(\"is-active\");\n        $link.closest(\"._group\").find(\"._group-wrap\").addClass(\"is-active\");\n      }\n    });\n  \n    if (!isFound) {\n      $sidebar.find(\"a.cms-link\").each(function () {\n        var $link = $(this);\n        var stripUrlParams = true;\n  \n        var currentUrl = self.sanitizeUrl(window.location.href, stripUrlParams);\n        var linkUrl = self.sanitizeUrl($link.attr(\"href\"));\n  \n        if (linkUrl === currentUrl) {\n          isFound = true;\n          $link.addClass(\"active\");\n          $link.closest(\"._group-wrap\").find(\".tutorial-link\").addClass(\"active\");\n          $link.next(\"._toc\").addClass(\"is-active\");\n          $link.closest(\"._toc\").addClass(\"is-active\");\n          $link.closest(\"._group\").find(\"._group-wrap\").addClass(\"is-active\");\n          return;\n        }\n      });\n    }\n  \n    var $_footer = $(\"._footer\");\n    if ($_footer.length) {\n      var $link = $_footer.find(\"a\").clone().text(\"\");\n      var $column = $_footer.find(\".g-column\");\n  \n      $column.wrap($link);\n    }\n  }\n\n  setUXStateArticle() {\n    $(\".articles-item\").each(function () {\n      var $column = $(this);\n      var $heading = $column.find(\"h5\");\n      var $link = $column.find(\"a\").last().clone().text(\"\");\n  \n      $heading.wrap($link);\n    });\n  }\n\n  setUXStateHome() {\n    $(\".home-section.-posts ._item\").each(function () {\n      var $column = $(this);\n      var $heading = $column.find(\"h3\");\n      var $link = $column.find(\"a\").last().clone().text(\"\");\n  \n      $heading.wrap($link);\n    });\n  }\n\n  getSectionFragment(url: string) {\n    url = url || window.location.href;\n    var result = false;\n  \n    // Strip url down to query params and look for section param first\n    var urlParts = url.split(\"?\");\n    if (urlParts.length > 1) {\n      var search = urlParts[1].split(\"#\")[0];\n      urlParts = search.split(\"&\");\n      urlParts.forEach((param) => {\n        var kv = param.split(\"=\");\n        if (kv[0] === \"section\" && kv.length > 1) {\n          result = \"#\" + kv[1];\n          return;\n        }\n      });\n    }\n  \n    // Strip url down to fragment and return that if found\n    urlParts = url.split(\"#\");\n    if (urlParts.length > 1) {\n      return \"#\" + urlParts[1];\n    }\n  \n    return result;\n  }\n\n  sanitizeUrl(href: string, stripUrlParams?: boolean) {\n    var result = href.replace(\".html\", \"\");\n    var tmpUrl = result.split(\"/git/\");\n  \n    if (tmpUrl.length <= 1) { return href; }\n  \n    result = tmpUrl[tmpUrl.length - 1];\n  \n    if (stripUrlParams) {\n      result = result.split(\"?\")[0].split(\"#\")[0];\n    }\n  \n    return result;\n  }\n}\n","// App library\nimport ContentLoader from \"./modules/content\";\n\nvar Gitguide = function () {\n  // @todo: Remove contextPath code when context path is removed from CMS\n  var contextPath = \"\";\n  if (\n    \"undefined\" !== typeof window &&\n    \"undefined\" !== typeof window.HTTP_PREFIX\n  ) {\n    contextPath = window.HTTP_PREFIX;\n  }\n\n  // Initialize microsite content\n  var cl = new ContentLoader(contextPath);\n  cl.getContent(contextPath);\n};\n\n// Load edit mode\n\nGitguide();\n","module.exports = jQuery;"],"names":["History","_classCallCheck","this","supportsHistory","window","history","pushState","key","value","data","title","url","referrer","document","getLastPathUrl","rawUrl","urlParts","split","length","analytics","page","Search","searchData","bindEvents","self","$","on","term","val","runSearch","searchResults","forEach","pageKey","JSON","stringify","dom","indexOf","searchItem","meta","replace","description","flags","isTutorial","push","sort","sortByType","renderSearchResults","left","flag","items","itemTemplate","getItemTemplate","contentTemplate","template","html","contextPath","ContentLoader","dataUrl","pages","pageHistory","location","pathname","isLocalizedContent","checkLocalizedDomain","initialize","pageRenderHookEventName","hostnameParts","hostname","toggleClass","deeplinkId","getSectionFragment","scrollTo","setUXState","type","dataType","done","json","addClass","bindRoutes","SearchLoader","e","$link","href","attr","test","charAt","preventDefault","hasClass","searchBackLink","parseLink","addEventListener","disablePushState","paths","shift","join","dispatchPage","pageContent","empty","text","topbar","parent","cls","renderContent","canonical","animate","scrollTop","domList","content","el","jsonToDom","append","ex","console","log","elementDef","parentNode","createNode","ownerDocument","global","obj","context","createTextNode","createElement","tag","tagName","addAttr","appendChild","i","prop","substr","$elem","setTimeout","offsetTop","offset","top","removeClass","isSearch","$tutorialSidebar","setUXStateTutorial","setUXStateArticle","setUXStateHome","$sidebar","find","isFound","each","currentUrl","sanitizeUrl","closest","next","$_footer","clone","wrap","$column","$heading","last","result","search","param","kv","stripUrlParams","tmpUrl","HTTP_PREFIX","getContent","module","exports","jQuery"],"sourceRoot":""}