{"version":3,"sources":["webpack:///./src/js/components/breadcrumbs.js"],"names":["Module","Component","_a","_b","_c","_d","_e","_f","this","dom","$container","document","_$","$breadcrumbs","el","currentPage","$contenttype","head","querySelector","content","$title","$url","location","href","$referrer","referrer","systemPage","solutionPage","handleHistory","landing","listing","window","localStorage","setItem","JSON","stringify","removeItem","getItem","parse","breadcrumbs","push","protocol","host","split","length","populateList","last","forEach","breadcrumb","index","innerHTML"],"mappings":"2FAAA,mBAEA,MAAMA,UAAeC,YACnB,gBAHF,IAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAIIC,KAAKC,IAAM,CACTC,WAAYC,SAASC,GAAG,yBACxBC,aAAcL,KAAKM,GAAGF,GAAG,sBAG3BJ,KAAKO,YAAc,CACjBC,aAAc,OAAAd,EAAAS,SAASM,KAAKC,cAAc,8BAA5B,EAAAhB,EAAqDiB,QACnEC,OAAQ,OAAAjB,EAAAQ,SAASM,KAAKC,cAAc,kCAA5B,EAAAf,EAAyDgB,QACjEE,KAAMV,SAASW,SAASC,KACxBC,UAAWb,SAASc,UAGtBjB,KAAKkB,WAAa,CAChBN,OAAQ,OAAAhB,EAAAO,SAASM,KAAKC,cAAc,mCAA5B,EAAAd,EAA0De,QAClEE,KAAM,OAAAhB,EAAAM,SAASM,KAAKC,cAAc,iCAA5B,EAAAb,EAAwDc,SAGhEX,KAAKmB,aAAe,CAClBP,OAAQ,OAAAd,EAAAK,SAASM,KAAKC,cAAc,qCAA5B,EAAAZ,EAA4Da,QACpEE,KAAM,OAAAd,EAAAI,SAASM,KAAKC,cAAc,mCAA5B,EAAAX,EAA0DY,SAGlEX,KAAKoB,gBAGP,gBACE,IAAIC,EACFC,EAEF,OAAQtB,KAAKO,YAAYC,cAAA,IACpB,sBACHe,OAAOC,aAAaC,QAAQ,0BAA2BC,KAAKC,UAAU3B,KAAKO,cAC3EgB,OAAOC,aAAaI,WAAW,2BAC/B,MAAM,IACH,sBACHP,EAAUE,OAAOC,aAAaK,QAAQ,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qBAAqB2B,EAAW5B,WAAW4B,EAAW5B,aACzHN,GAAM,mNAIVN,KAAKC,IAAII,aAAaqC,UAAYpC,IAKzBd","file":"57.64b1fe3f05ca234e4686.js?v=559da8aae5e74938da8c","sourcesContent":["import { Component } from '@verndale/core';\n\nclass Module extends Component {\n setupDefaults() {\n this.dom = {\n $container: document._$('.breadcrumbs--siplast'),\n $breadcrumbs: this.el._$('.breadcrumb__list')\n };\n\n this.currentPage = {\n $contenttype: document.head.querySelector('[name=\"contenttype\"]')?.content,\n $title: document.head.querySelector('[name=\"navigationtitle\"]')?.content,\n $url: document.location.href,\n $referrer: document.referrer\n }\n\n this.systemPage = {\n $title: document.head.querySelector('[name=\"systemspagetitle\"]')?.content,\n $url: document.head.querySelector('[name=\"systemspageurl\"]')?.content\n }\n\n this.solutionPage = {\n $title: document.head.querySelector('[name=\"solutionspagetitle\"]')?.content,\n $url: document.head.querySelector('[name=\"solutionspageurl\"]')?.content\n }\n\n this.handleHistory();\n }\n\n handleHistory() {\n let landing,\n listing;\n\n switch (this.currentPage.$contenttype) {\n case 'system-landing-page':\n window.localStorage.setItem('siplast_history_landing', JSON.stringify(this.currentPage));\n window.localStorage.removeItem('siplast_history_listing');\n break;\n case 'system-listing-page':\n landing = window.localStorage.getItem('siplast_history_landing');\n\n if (landing) {\n landing = JSON.parse(landing);\n }\n\n if (landing?.$url !== this.currentPage.$referrer) {\n window.localStorage.removeItem('siplast_history_landing');\n }\n\n window.localStorage.setItem('siplast_history_listing', JSON.stringify(this.currentPage));\n\n break;\n case 'system-detail-page':\n const breadcrumbs = [];\n landing = window.localStorage.getItem('siplast_history_landing');\n listing = window.localStorage.getItem('siplast_history_listing');\n\n breadcrumbs.push(\n {\n $url: `${window.location.protocol}//${window.location.host}`,\n $title: 'Home'\n }\n );\n\n if (listing) {\n listing = JSON.parse(listing);\n if (listing.$url.split('?')[0] === this.currentPage.$referrer.split('?')[0]) {\n listing.$url = this.currentPage.$referrer;\n if (landing) {\n landing = JSON.parse(landing);\n breadcrumbs.push(this.solutionPage);\n breadcrumbs.push(landing);\n } else {\n breadcrumbs.push(this.systemPage);\n }\n breadcrumbs.push(listing);\n } else {\n window.localStorage.removeItem('siplast_history_listing');\n }\n } else {\n window.localStorage.removeItem('siplast_history_landing');\n }\n\n if (breadcrumbs.length === 1) {\n breadcrumbs.push(this.systemPage);\n }\n\n breadcrumbs.push(\n {\n $title: this.currentPage.$title\n }\n );\n\n this.populateList(breadcrumbs);\n window.localStorage.removeItem('siplast_history_listing');\n window.localStorage.removeItem('siplast_history_landing');\n break;\n default:\n window.localStorage.removeItem('siplast_history_listing');\n window.localStorage.removeItem('siplast_history_landing');\n break;\n }\n }\n\n populateList(breadcrumbs) {\n const last = breadcrumbs.length - 1;\n if (breadcrumbs.length > 1) {\n let el = '';\n breadcrumbs.forEach((breadcrumb, index) => {\n el += '
  • ';\n if (index === last) {\n el += `${breadcrumb.$title}
  • `;\n } else {\n el += `${breadcrumb.$title}`;\n el += ' ';\n }\n });\n\n this.dom.$breadcrumbs.innerHTML = el;\n }\n }\n}\n\nexport default Module;\n"],"sourceRoot":""}