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BACAC,2BACAC,aACAG,YACAE,eACAC,SACAE,WACAN,OACAyB,UAAWzB,O","sources":["webpack://teddy/webpack/universalModuleDefinition","webpack://teddy/./cheerioPolyfill.js","webpack://teddy/webpack/bootstrap","webpack://teddy/webpack/runtime/define property getters","webpack://teddy/webpack/runtime/hasOwnProperty shorthand","webpack://teddy/webpack/runtime/make namespace object","webpack://teddy/./teddy.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"teddy\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"teddy\"] = factory();\n\telse\n\t\troot[\"teddy\"] = factory();\n})(this, () => {\nreturn ","// stub out cheerio using native dom methods for frontend so we don't have to bundle cheerio on the frontend\nexport function load (html) {\n  const doc = parseTeddyDOMFromString(html) // create a DOM\n\n  // return a querySelector function with function chains\n  // e.g. dom('include') or dom(el) from teddy\n  const $ = function (query) { // query can be a string, or a dom object\n    // if query is a string, we need to create a dom object from the string: an object with elements in it, e.g. a list of include tag objects\n    if (typeof query === 'string') {\n      const els = doc.querySelectorAll(query)\n      return els // return the object collection\n    }\n\n    // if query is an object, it's assumed we're trying to perform operations on a single dom node\n    const el = query\n    return {\n\n      // e.g. dom(el).children() from teddy\n      children: function () {\n        return el.childNodes\n      },\n\n      // e.g. dom(el).find() from teddy\n      find: function (selector) {\n        return el.querySelectorAll(selector)\n      },\n\n      // e.g. dom(arg).html() from teddy\n      html: function () {\n        return getTeddyDOMInnerHTML(el)\n      },\n\n      // e.g. dom(arg).toString() from teddy\n      toString: function () {\n        return getTeddyDOMOuterHTML(el)\n      },\n\n      // e.g. dom(el).attr('teddydeferreddynamicinclude', 'true') from teddy\n      attr: function (attr, val) {\n        return el.setAttribute(attr, val)\n      },\n\n      // dom(el).removeAttr(attr) from teddy\n      removeAttr: function (attr) {\n        return el.removeAttribute(attr)\n      },\n\n      // e.g. dom(el).replaceWith(localDom.html()) from teddy\n      replaceWith: function (html) {\n        // can either be a string or an array of elements\n        if (typeof html === 'object') {\n          let newHtml = ''\n          for (const el of html) {\n            if (el.nodeType === window.Node.COMMENT_NODE) newHtml += '<!--' + el.textContent + '-->'\n            else newHtml += el.outerHTML || el.textContent\n          }\n          html = newHtml\n        }\n        const temp = document.createElement('div')\n        temp.innerHTML = html\n        el.replaceWith(...temp.childNodes)\n      },\n\n      // e.g. dom(el).remove() from teddy\n      remove: function () {\n        return el.remove()\n      }\n    }\n  }\n\n  // e.g. dom.html() from teddy\n  $.html = function () {\n    return getTeddyDOMInnerHTML(doc)\n  }\n\n  // e.g. dom.toString() from teddy\n  $.toString = function () {\n    return getTeddyDOMOuterHTML(doc)\n  }\n\n  return $\n}\n\nload.isCheerioPolyfill = true\n\n// DOM parser function like DOMParser's parseFromString but allows Teddy elements to exist in places where they otherwise wouldn't be allowed, like inside of <select> elements\nfunction parseTeddyDOMFromString (html) {\n  const selfClosingTags = new Set(['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'param', 'source', 'track', 'wbr'])\n  const root = document.createElement('body')\n  const dom = [root]\n  const openTags = [] // stack to track open tags\n  const tagAndCommentRegex = /<\\/?([a-zA-Z0-9]+)([^>]*)>|<!--([\\s\\S]*?)-->/g\n  const attrRegex = /([a-zA-Z0-9-:._]+)(?:=([\"'])(.*?)\\2|([^>\\s]+))?/g\n  let lastIndex = 0\n  let match\n\n  // loop through each match and build a DOM\n  while ((match = tagAndCommentRegex.exec(html)) !== null) {\n    if (!dom[dom.length - 1]) throw new Error('Error parsing your template. There may be a coding mistake in your HTML. Look for extra closing </tags> and other common mistakes.')\n    const textBeforeMatch = html.slice(lastIndex, match.index)\n\n    // append text nodes\n    if (textBeforeMatch.trim()) {\n      const textNode = document.createTextNode(textBeforeMatch)\n      dom[dom.length - 1].appendChild(textNode)\n    }\n\n    if (match[0].startsWith('<!--')) {\n      // handle comments\n      const commentNode = document.createComment(match[3])\n      dom[dom.length - 1].appendChild(commentNode)\n    } else {\n      // handle tags\n      const [fullMatch, tagName, attrString] = match\n      const lowerCaseTagName = tagName.toLowerCase()\n      const isClosingTag = fullMatch.startsWith('</')\n      if (isClosingTag) {\n        if (selfClosingTags.has(lowerCaseTagName)) {\n          // convert incorrect closing tag for self-closing tag to self-closing tag\n          const element = document.createElement(tagName)\n          dom[dom.length - 1].appendChild(element)\n        } else {\n          // check if the closing tag matches the most recent open tag\n          if (openTags.length > 0 && openTags[openTags.length - 1] === lowerCaseTagName) {\n            openTags.pop()\n            dom.pop()\n          }\n        }\n      } else {\n        // create a new element\n        const element = document.createElement(tagName)\n\n        // set attributes\n        let attrMatch\n        const attrMap = new Map()\n        while ((attrMatch = attrRegex.exec(attrString)) !== null) {\n          const attrName = attrMatch[1]\n          const attrValue = attrMatch[3] || attrMatch[4] || ''\n\n          // handle duplicate attributes for special tags\n          if (attrMap.has(attrName)) {\n            let count = 1\n            let newAttrName\n            do {\n              newAttrName = `${attrName}-teddyduplicate${count}`\n              count++\n            } while (attrMap.has(newAttrName))\n            attrMap.set(newAttrName, attrValue)\n          } else attrMap.set(attrName, attrValue)\n        }\n\n        // apply attributes to the element\n        for (const [name, value] of attrMap) {\n          try {\n            // replace elements with `src` attributes with `data-teddy-defer-attr-src` so the browser doesn't try to prefetch the asset\n            // this is needed because the value of the `src` attribute could be a {teddyVariable} and that fetch won't resolve\n            switch (lowerCaseTagName) {\n              case 'img':\n              case 'video':\n              case 'audio':\n              case 'iframe':\n              case 'script':\n                if (name === 'src') element.setAttribute('data-teddy-defer-attr-src', value) // replace src with data-teddy-defer-attr-src\n                else element.setAttribute(name, value || '')\n                break\n              case 'link':\n                if (name === 'href') element.setAttribute('data-teddy-defer-attr-href', value) // replace src with data-teddy-defer-attr-href\n                else element.setAttribute(name, value || '')\n                break\n              default:\n                element.setAttribute(name, value || '')\n            }\n          } catch (e) {\n            console.warn('Error parsing an element attribute. You might have a typo in your HTML. A common cause is two spaces between element attributes.')\n          }\n        }\n\n        // append the new element to the current parent\n        dom[dom.length - 1].appendChild(element)\n\n        // push the new element to the dom if it's not self-closing\n        if (!selfClosingTags.has(lowerCaseTagName) && !fullMatch.endsWith('/>')) {\n          dom.push(element)\n          openTags.push(lowerCaseTagName)\n        }\n      }\n    }\n\n    lastIndex = tagAndCommentRegex.lastIndex\n  }\n\n  // append any remaining text after the last match\n  if (lastIndex < html.length) {\n    const remainingText = html.slice(lastIndex)\n    if (remainingText.trim()) {\n      const textNode = document.createTextNode(remainingText)\n      dom[dom.length - 1].appendChild(textNode)\n    }\n  }\n\n  return root\n}\n\n// custom functions to get inner/outer HTML without escaping various things to prevent teddy from infinitely escaping them\nconst doublyEncodedEntities = {\n  '&amp;amp;': '&amp;',\n  '&amp;lt;': '&lt;',\n  '&amp;gt;': '&gt;',\n  '&amp;quot;': '&quot;',\n  '&amp;#39;': '&#39;',\n  '&amp;#x2F;': '&#x2F;'\n}\nconst entityEntries = Object.entries(doublyEncodedEntities)\nfunction getTeddyDOMInnerHTML (node) {\n  // build html string\n  let html = ''\n  for (const child of node.childNodes) {\n    if (child.nodeType === window.Node.ELEMENT_NODE) {\n      let outerHTML = child.outerHTML\n      for (const [doublyEncoded, singleEncoded] of entityEntries) outerHTML = outerHTML.replace(new RegExp(doublyEncoded, 'g'), singleEncoded)\n      html += outerHTML\n    } else if (child.nodeType === window.Node.TEXT_NODE) {\n      let textContent = child.textContent\n      for (const [doublyEncoded, singleEncoded] of entityEntries) textContent = textContent.replace(new RegExp(doublyEncoded, 'g'), singleEncoded)\n      html += textContent\n    } else if (child.nodeType === window.Node.COMMENT_NODE) {\n      let commentContent = child.textContent\n      for (const [doublyEncoded, singleEncoded] of entityEntries) commentContent = commentContent.replace(new RegExp(doublyEncoded, 'g'), singleEncoded)\n      html += `<!--${commentContent}-->`\n    }\n  }\n\n  return html\n}\nfunction getTeddyDOMOuterHTML (node) {\n  // start with the outerHTML of the node\n  let outerHTML = ''\n\n  if (node.nodeType === window.Node.ELEMENT_NODE) {\n    outerHTML = node.outerHTML\n  } else if (node.nodeType === window.Node.TEXT_NODE) {\n    outerHTML = node.textContent\n  } else if (node.nodeType === window.Node.COMMENT_NODE) {\n    outerHTML = `<!--${node.textContent}-->`\n  }\n\n  // replace doubly encoded entities\n  for (const [doublyEncoded, singleEncoded] of entityEntries) outerHTML = outerHTML.replace(new RegExp(doublyEncoded, 'g'), singleEncoded)\n\n  return outerHTML\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// #region globals\n\nimport fs from 'fs' // node filesystem module\nimport path from 'path' // node path module\nimport { load as cheerioLoad } from 'cheerio/slim' // dom parser\n\nconst cheerioOptions = { xml: { xmlMode: false, lowerCaseAttributeNames: false, decodeEntities: false } }\nconst browser = cheerioLoad.isCheerioPolyfill // true if we are executing in the browser context\nconst params = {} // teddy parameters\nsetDefaultParams() // set params to the defaults\nlet templates = {} // loaded templates are stored as object collections, e.g. { \"myTemplate.html\": \"<p>some markup</p>\"}\nconst caches = {} // a place to store cached portions of templates\nconst templateCaches = {} // a place to store cached full templates\n\n// #endregion\n\n// #region private methods\n\n// loads the template from the filesystem\nfunction loadTemplate (template) {\n  // ensure template is a string\n  if (typeof template !== 'string') {\n    if (params.verbosity > 1) console.warn('teddy.loadTemplate attempted to load a template which is not a string.')\n    return ''\n  }\n  const name = template\n  let register = false\n  if (!templates[template] && template.indexOf('<') === -1 && fs && fs.readFileSync) {\n    // template is not found, it is not code, and we're in the node.js context\n    register = true\n    // append extension if not present\n    if (template.slice(-5) !== '.html') template += '.html'\n    try {\n      template = fs.readFileSync(template, 'utf8')\n    } catch (e) {\n      try {\n        template = fs.readFileSync(params.templateRoot + template, 'utf8')\n      } catch (e) {\n        try {\n          template = fs.readFileSync(params.templateRoot + '/' + template, 'utf8')\n        } catch (e) {\n          // do nothing, attempt to render it as code\n          register = false\n        }\n      }\n    }\n  } else {\n    if (templates[template]) {\n      template = templates[template]\n      register = true\n    } else {\n      // didn't find it; append extension if not present and check it again\n      if (template.slice(-5) !== '.html') {\n        template += '.html'\n      }\n      if (templates[template]) {\n        template = templates[template]\n        register = true\n      }\n      template = removeTeddyComments(template)\n    }\n  }\n  if (register) {\n    // register the new template and return the code\n    template = removeTeddyComments(template)\n    templates[name] = template\n    return template\n  } else {\n    // return the template name which is presumed to be code\n    return template.slice(-5) === '.html' ? template.substring(0, template.length - 5) : template\n  }\n}\n\n// remove teddy {! comments !} and <!--! comments -->; also replace <!--# content --> with <escape>content</escape>\nfunction removeTeddyComments (renderedTemplate) {\n  let oldTemplate\n  do {\n    oldTemplate = renderedTemplate\n    let vars\n\n    try {\n      vars = matchByDelimiter(renderedTemplate, '{!', '!}')\n    } catch (e) {\n      return renderedTemplate // it will match {! comments {! with comments in them !} !} but if there are unbalanced brackets, just return the original text\n    }\n    for (let i = 0; i < vars.length; i++) renderedTemplate = renderedTemplate.replace(`{!${vars[i]}!}`, '')\n\n    try {\n      vars = matchByDelimiter(renderedTemplate, '<!--!', '-->')\n    } catch (e) {\n      return renderedTemplate\n    }\n    for (let i = 0; i < vars.length; i++) renderedTemplate = renderedTemplate.replace(`<!--!${vars[i]}-->`, '')\n\n    try {\n      vars = matchByDelimiter(renderedTemplate, '<!--#', '-->')\n    } catch (e) {\n      return renderedTemplate\n    }\n    for (let i = 0; i < vars.length; i++) renderedTemplate = renderedTemplate.replace(`<!--#${vars[i]}-->`, `<escape>${vars[i]}</escape>`)\n  } while (oldTemplate !== renderedTemplate)\n  return renderedTemplate\n}\n\n// find all cache elements and replace them with the rendered contents of their cache, then remove the cache element\nfunction replaceCacheElements (dom, model) {\n  let parsedTags\n  do {\n    parsedTags = 0\n    const tags = dom('cache:not([defer])')\n    if (tags.length > 0) {\n      for (const el of tags) {\n        if (browser) el.attribs = getAttribs(el)\n        const name = el.attribs.name\n        if (name.includes('{')) continue\n        const key = el.attribs.key || 'none'\n        if (key.includes('{')) continue\n        const cache = caches[name]\n        if (cache && cache.entries) {\n          const keyVal = el.attribs.key ? getOrSetObjectByDotNotation(model, key) : 'none'\n          if (cache.entries[keyVal]) {\n            const now = Date.now()\n            // if max age is not set, then there is no max age and the cache content is still valid\n            // or if last accessed + max age > now then the cache is not stale and the cache is still valid\n            if (!(cache.maxAge && !cache.maxage) || cache.entries[keyVal].lastAccessed + (cache.maxAge || cache.maxage) > now) {\n              const cacheContent = cache.entries[keyVal].markup\n              cache.entries[keyVal].lastAccessed = now\n              dom(el).replaceWith(cacheContent)\n            } else {\n              // if last accessed + max age <= now then the cache is stale and the cache is no longer valid\n              delete caches[name].entries[keyVal]\n              dom(el).attr('defer', 'true') // create a new cache\n            }\n          } else dom(el).attr('defer', 'true') // no cache exists for this yet; create after the template renders\n        } else dom(el).attr('defer', 'true') // no cache exists for this yet; create after the template renders\n        parsedTags++\n      }\n    }\n  } while (parsedTags)\n  return dom\n}\n\n// add an id to all <noteddy> or <noparse> tags, then remove their content temporarily until the template is fully parsed\nfunction tagNoParseBlocks (dom, model) {\n  let parsedTags\n  do {\n    parsedTags = 0\n    let tags = dom('noteddy:not([id]), noparse:not([id])')\n    if (tags.length > 0) {\n      for (const el of tags) {\n        const id = model._noTeddyBlocks.push(dom(el).html()) - 1\n        dom(el).replaceWith(`<noteddy id=\"${id}\"></noteddy>`)\n        parsedTags++\n      }\n    }\n    tags = dom('pre:not([id]):not([parse])')\n    if (tags.length > 0) {\n      for (const el of tags) {\n        const id = model._noTeddyBlocks.push(dom(el).toString()) - 1\n        dom(el).replaceWith(`<noteddy id=\"${id}\" pre=\"true\"></noteddy>`)\n        parsedTags++\n      }\n    }\n  } while (parsedTags)\n  return dom\n}\n\n// parse <include> tags\nfunction parseIncludes (dom, model, dynamic) {\n  let parsedTags\n  let passes = 0\n  do {\n    passes++\n    if (passes > params.maxPasses) throw new Error(`teddy could not finish rendering the template because the max number of passes over the template (${params.maxPasses}) was exceeded; there may be an infinite loop in your template logic.`)\n    parsedTags = 0\n    let tags\n    // dynamic includes are includes like <include src=\"{sourcedFromVariable}\"></include>\n    if (dynamic) tags = dom('include') // parse all includes\n    else tags = dom('include:not([teddydeferreddynamicinclude])') // parse only includes that aren't dynamic\n    if (tags.length > 0) {\n      for (const el of tags) {\n        // ensure this isn't the child of a no parse block\n        let foundBody = false\n        let next = false\n        let parent = el.parent || el.parentNode\n        while (!foundBody) {\n          let parentName\n          if (!parent) parentName = 'body'\n          else parentName = parent.nodeName?.toLowerCase() || parent.name\n          if (parentName === 'noparse' || parentName === 'noteddy') {\n            next = true\n            break\n          } else if (parentName === 'body') foundBody = true\n          else parent = parent.parent || parent.parentNode\n        }\n        if (next) continue\n        // get attributes\n        if (browser) el.attribs = getAttribs(el)\n        const src = el.attribs.src\n        if (!src) {\n          if (params.verbosity > 1) console.warn('teddy encountered an include tag with no src attribute.')\n          continue\n        }\n        if (src.startsWith('{')) {\n          dom(el).attr('teddydeferreddynamicinclude', 'true') // mark it dynamic and then skip it\n          continue\n        }\n        loadTemplate(src) // load the partial into the template list\n        let contents = templates[src] || ''\n        if (typeof templates[src] !== 'string' && params.includeNotFoundBehavior === 'display') {\n          contents = `Template \"${src}\" not found!`\n          if (params.verbosity > 1) console.warn(`teddy encountered an include tag with a src set to a template that could not be found: ${src}`)\n        }\n        const localModel = Object.assign({}, model)\n        for (const arg of dom(el).children()) {\n          const argName = browser ? arg.nodeName?.toLowerCase() : arg.name\n          if (argName === 'arg') {\n            if (browser) arg.attribs = getAttribs(arg)\n            const argval = Object.keys(arg.attribs)[0]\n            getOrSetObjectByDotNotation(localModel, argval, dom(arg).html())\n          }\n        }\n        const hasNoteddy = contents.includes('</noteddy>')\n        const hasNoparse = contents.includes('</noparse>')\n        const hasPre = contents.includes('</pre>')\n        const hasIf = contents.includes('</if>')\n        const hasUnless = contents.includes('</unless>')\n        const hasTrue = contents.includes(' true=')\n        const hasFalse = contents.includes(' false=')\n        const hasLoop = contents.includes('</loop>')\n        const hasInline = contents.includes('</inline>')\n        const hasEscape = contents.includes('</escape>') || contents.includes('<!--#')\n        const hasSelected = contents.includes(' selected-value=') || contents.includes(' checked-value=')\n        if (hasEscape) contents = parseEscapes(contents)\n        let localDom\n        if (hasNoteddy || hasNoparse || hasPre) {\n          localDom = cheerioLoad(contents, cheerioOptions)\n          localDom = tagNoParseBlocks(localDom, localModel)\n          contents = localDom.html()\n        }\n        localDom = cheerioLoad(parseVars(contents, localModel), cheerioOptions)\n        if (hasIf || hasUnless) localDom = parseConditionals(localDom, localModel)\n        if (hasTrue || hasFalse) localDom = parseOneLineConditionals(localDom, localModel)\n        if (hasLoop) localDom = parseLoops(localDom, localModel)\n        if (hasInline) localDom = parseInlines(localDom, localModel)\n        if (hasSelected) localDom = parseSelectedAttributeValues(localDom, localModel)\n        dom(el).replaceWith(localDom.html())\n        parsedTags++\n      }\n    }\n  } while (parsedTags)\n  return dom\n}\n\n// parse <if>, <elseif>, <unless>, <elseunless>, and <else> tags\nfunction parseConditionals (dom, model) {\n  let parsedTags\n  do {\n    parsedTags = 0\n    const tags = dom('if, unless')\n    if (tags.length > 0) {\n      for (const el of tags) {\n        // ensure this isn't the child of a loop or a no parse block\n        let foundBody = false\n        let next = false\n        let parent = el.parent || el.parentNode\n        while (!foundBody) {\n          let parentName\n          if (!parent) parentName = 'body'\n          else parentName = parent.nodeName?.toLowerCase() || parent.name\n          if (parentName === 'loop' || parentName === 'noparse' || parentName === 'noteddy') {\n            next = true\n            break\n          } else if (parentName === 'body') foundBody = true\n          else parent = parent.parent || parent.parentNode\n        }\n        if (next) continue\n        // get conditions\n        let args = []\n        if (browser) el.attribs = getAttribs(el)\n        for (let attr in el.attribs) {\n          if (attr.includes('-teddyduplicate')) attr = attr.split('-teddyduplicate')[0] // the condition is a duplicate, so remove the `-teddyduplicate1` from `conditionName-teddyduplicate1`, `conditionName-teddyduplicate2`, etc\n          let val = el.attribs[attr]\n          if (val) {\n            if (val.startsWith('{')) val = parseVars(val, model)\n            args.push(`${attr}=${val}`)\n          } else args.push(attr)\n        }\n        // check if it's an if tag and not an unless tag\n        let isIf = true\n        const elName = browser ? el.nodeName?.toLowerCase() : el.name\n        if (elName === 'unless') isIf = false\n        // evaluate conditional\n        const condResult = evaluateConditional(args, model)\n        if ((isIf && condResult) || ((!isIf && !condResult))) {\n          // render the true block and discard the elseif, elseunless, and else blocks\n          let nextSibling = el.nextSibling\n          const removeStack = []\n          while (nextSibling) {\n            const nextSiblingName = browser ? nextSibling.nodeName?.toLowerCase() : nextSibling.name\n            switch (nextSiblingName) {\n              case 'elseif':\n              case 'elseunless':\n              case 'else':\n                removeStack.push(nextSibling)\n                nextSibling = nextSibling.nextSibling\n                break\n              case 'if':\n              case 'unless':\n                nextSibling = false\n                break\n              default:\n                nextSibling = nextSibling.nextSibling\n            }\n          }\n          for (const element of removeStack) dom(element).replaceWith('')\n          dom(el).replaceWith(el.childNodes || el.children)\n          parsedTags++\n        } else {\n          // true block is false; find the next elseif, elseunless, or else tag to evaluate\n          let nextSibling = el.nextSibling\n          while (nextSibling) {\n            const nextSiblingName = browser ? nextSibling.nodeName?.toLowerCase() : nextSibling.name\n            switch (nextSiblingName) {\n              case 'elseif':\n                // get conditions\n                args = []\n                if (browser) nextSibling.attribs = getAttribs(nextSibling)\n                for (const attr in nextSibling.attribs) {\n                  const val = nextSibling.attribs[attr]\n                  if (val) args.push(`${attr}=${val}`)\n                  else args.push(attr)\n                }\n                if (evaluateConditional(args, model)) {\n                  // render the true block and discard the elseif, elseunless, and else blocks\n                  const replaceSibling = nextSibling\n                  dom(replaceSibling).replaceWith(replaceSibling.childNodes || replaceSibling.children)\n                  nextSibling = el.nextSibling\n                  const removeStack = []\n                  while (nextSibling) {\n                    const nextSiblingName = browser ? nextSibling.nodeName?.toLowerCase() : nextSibling.name\n                    switch (nextSiblingName) {\n                      case 'elseif':\n                      case 'elseunless':\n                      case 'else':\n                        removeStack.push(nextSibling)\n                        nextSibling = nextSibling.nextSibling\n                        break\n                      case 'if':\n                      case 'unless':\n                        nextSibling = false\n                        break\n                      default:\n                        nextSibling = nextSibling.nextSibling\n                    }\n                  }\n                  for (const element of removeStack) dom(element).replaceWith('')\n                  nextSibling = false\n                  parsedTags++\n                } else {\n                  // true block is false; find the next elseif, elseunless, or else tag to evaluate\n                  const siblingToWipe = nextSibling\n                  nextSibling = nextSibling.nextSibling\n                  dom(siblingToWipe).replaceWith('')\n                }\n                break\n              case 'elseunless':\n                // get conditions\n                args = []\n                if (browser) nextSibling.attribs = getAttribs(nextSibling)\n                for (const attr in nextSibling.attribs) {\n                  const val = nextSibling.attribs[attr]\n                  if (val) args.push(`${attr}=${val}`)\n                  else args.push(attr)\n                }\n                if (!evaluateConditional(args, model)) {\n                  // render the true block and discard the elseif, elseunless, and else blocks\n                  const replaceSibling = nextSibling\n                  dom(replaceSibling).replaceWith(replaceSibling.childNodes || replaceSibling.children)\n                  nextSibling = el.nextSibling\n                  const removeStack = []\n                  while (nextSibling) {\n                    const nextSiblingName = browser ? nextSibling.nodeName?.toLowerCase() : nextSibling.name\n                    switch (nextSiblingName) {\n                      case 'elseif':\n                      case 'elseunless':\n                      case 'else':\n                        removeStack.push(nextSibling)\n                        nextSibling = nextSibling.nextSibling\n                        break\n                      case 'if':\n                      case 'unless':\n                        nextSibling = false\n                        break\n                      default:\n                        nextSibling = nextSibling.nextSibling\n                    }\n                  }\n                  for (const element of removeStack) dom(element).replaceWith('')\n                  nextSibling = false\n                  parsedTags++\n                } else {\n                  // true block is false; find the next elseif, elseunless, or else tag to evaluate\n                  const siblingToWipe = nextSibling\n                  nextSibling = nextSibling.nextSibling\n                  dom(siblingToWipe).replaceWith('')\n                }\n                break\n              case 'else':\n                // else is always true, so if we've gotten here, then there's nothing to evaluate and we've reached the end of the conditional blocks\n                dom(nextSibling).replaceWith(nextSibling.childNodes || nextSibling.children)\n                nextSibling = false\n                parsedTags++\n                break\n              case 'if':\n              case 'unless':\n                // if we encounter another fresh if statement or unless statement, then there's nothing left to evaluate and we've reached the end of this conditional's blocks\n                nextSibling = false\n                break\n              default:\n                // if we encounter any other element or a text node we assume there could still be more elseif, elseunless, or else tags ahead so we keep going\n                nextSibling = nextSibling.nextSibling\n            }\n          }\n          dom(el).replaceWith('') // remove the original if statement once done with finding its siblings\n        }\n      }\n    }\n  } while (parsedTags)\n  return dom\n}\n\n// evaluates a single <if> or <unless> tag\nfunction evaluateConditional (conditions, model) {\n  const conditionsLength = conditions.length\n  // loop through conditions and reduce them to booleans\n  for (let i = 0; i < conditionsLength; i++) {\n    const condition = conditions[i]\n    if (typeof condition === 'boolean') continue // if the condition is already a boolean then we don't need to reduce it to a boolean to evaluate it\n    // reject conditions with invalid formatting\n    if (condition.startsWith('=') || condition.endsWith('=')) {\n      if (params.verbosity > 1) console.warn('teddy encountered a conditional statement with \"=\" at the beginning or end of a condition.')\n      return false\n    }\n    if (condition.includes(':') && !condition.startsWith('not:')) {\n      if (params.verbosity > 1) console.warn('teddy encountered a conditional statement with a \"not:\" that isn\\'t at the beginning of a condition.')\n      return false\n    }\n    // deal with boolean logic\n    if (condition === 'and') {\n      if (conditions[i - 1] && evaluateCondition(conditions[i + 1], model)) {\n        // if both sides of an and are true, then reduce all 3 condition blocks to true\n        conditions[i - 1] = true\n        conditions[i] = true\n        conditions[i + 1] = true\n      } else {\n        // if either side of an and is false, then reduce all 3 condition blocks to false\n        conditions[i - 1] = false\n        conditions[i] = false\n        conditions[i + 1] = false\n      }\n    } else if (condition === 'or') {\n      if (conditions[i - 1] || evaluateCondition(conditions[i + 1], model)) {\n        // if either side of an or is true, then reduce all 3 condition blocks to true, as well as all condition blocks that precded this or\n        conditions.fill(true, 0, i + 2)\n      } else {\n        // if both sides of an or are false, then reduce all 3 condition blocks to false\n        conditions[i - 1] = false\n        conditions[i] = false\n        conditions[i + 1] = false\n      }\n    } else if (condition === 'xor') {\n      if (!!conditions[i - 1] === !!evaluateCondition(conditions[i + 1], model)) {\n        // if both sides of an xor are equal to each other, then reduce all 3 condition blocks to false\n        conditions[i - 1] = false\n        conditions[i] = false\n        conditions[i + 1] = false\n      } else {\n        // if the two sides of an xor are not equal to each other, then reduce all 3 condition blocks to true\n        conditions[i - 1] = true\n        conditions[i] = true\n        conditions[i + 1] = true\n      }\n    } else conditions[i] = evaluateCondition(condition, model)\n  }\n  return conditions.every(item => item === true) || false // if any of the booleans are false, then return false. otherwise return true\n}\n\n// determines whether a single condition in a teddy conditional is true or false\nfunction evaluateCondition (condition, model) {\n  let not // stores whether the :not modifier is present\n  if (typeof condition === 'string' && condition.includes('=')) { // it's an equality check condition\n    not = !!condition.startsWith('not:') // true if \"not:\" is present\n    if (not) condition = condition.slice(4) // remove the :not prefix\n    const parts = condition.split('=') // something=\"Some content\"\n    const cond = parts[0] // something\n    delete parts[0] // remove the something=\n    const val = parts.join('') // \"Some content\" — the path.join method ensures the string gets rebuilt even if it contains another = character\n    const lookup = getOrSetObjectByDotNotation(model, cond)\n    // the == is necessary because teddy does type-insensitive equality checks\n    if (lookup == val) return !not // eslint-disable-line\n    else return not // false\n  } else { // it's a presence check\n    not = typeof condition === 'string' ? !!condition.startsWith('not:') : false // true if \"not:\" is present\n    if (not) condition = condition.slice(4) // remove the :not prefix\n    const lookup = getOrSetObjectByDotNotation(model, condition)\n    if (lookup) {\n      if (typeof lookup === 'object' && Object.keys(lookup).length === 0) return not // false; empty object or array\n      return !not // true; var is present\n    } else return not // false; var is not present\n  }\n}\n\n// render one-line if attributes, e.g. <p if-something=\"value\" true=\"class='class-applied-if-true'\" false=\"class='class-applied-if-false'\">hello</p>\nfunction parseOneLineConditionals (dom, model) {\n  let parsedTags\n  do {\n    parsedTags = 0\n    const tags = dom('[true], [false]')\n    if (tags.length > 0) {\n      for (const el of tags) {\n        // skip parsing this if it uses variables as part of its conditions; it will get caught in the next pass after parseVars runs\n        let defer = false\n        if (browser) el.attribs = getAttribs(el)\n        for (const attr in el.attribs) {\n          const val = el.attribs[attr]\n          if (val.startsWith('{')) {\n            defer = true\n            break\n          }\n        }\n        if (defer) {\n          dom(el).attr('teddydeferredonelineconditional', 'true')\n          continue\n        }\n        // ensure this isn't the child of a loop or a no parse block\n        let foundBody = false\n        let next = false\n        let parent = el.parent || el.parentNode\n        while (!foundBody) {\n          let parentName\n          if (!parent) parentName = 'body'\n          else parentName = parent.nodeName?.toLowerCase() || parent.name\n          if (parentName === 'loop' || parentName === 'noparse' || parentName === 'noteddy') {\n            next = true\n            break\n          } else if (parentName === 'body') foundBody = true\n          else parent = parent.parent || parent.parentNode\n        }\n        if (next) continue\n        // get conditions\n        let ifTrue\n        let ifFalse\n        if (browser) el.attribs = getAttribs(el)\n        const args = []\n        for (const origAttr in el.attribs) {\n          let attr = origAttr\n          let val = el.attribs[attr]\n          if (attr.includes('-teddyduplicate')) attr = attr.split('-teddyduplicate')[0] // the condition is a duplicate, so remove the `-teddyduplicate1` from `conditionName-teddyduplicate1`, `conditionName-teddyduplicate2`, etc\n          if (val?.startsWith('{')) val = parseVars(val, model)\n          if (attr.startsWith('if-')) {\n            const parts = attr.split('if-')\n            if (val) args.push(`${parts[1]}=${val}`)\n            else args.push(parts[1])\n            dom(el).removeAttr(origAttr)\n          } else if (attr === 'true') {\n            ifTrue = val.replaceAll('&quot;', '\"') // true=\"class='blah'\"\n            dom(el).removeAttr(origAttr)\n          } else if (attr === 'false') {\n            ifFalse = val.replaceAll('&quot;', '\"') // false=\"class='blah'\"\n            dom(el).removeAttr(origAttr)\n          } else if (attr === 'and' || attr === 'or' || attr === 'xor') {\n            args.push(attr)\n            dom(el).removeAttr(origAttr)\n          }\n        }\n        // evaluate conditional\n        if (evaluateConditional(args, model)) {\n          if (ifTrue) {\n            const parts = ifTrue.split('=')\n            dom(el).attr(parts[0], parts[1] ? parts[1].replace(/[\"']/g, '') : '')\n          }\n          parsedTags++\n        } else if (ifFalse) {\n          if (ifFalse) {\n            const parts = ifFalse.split('=')\n            dom(el).attr(parts[0], parts[1] ? parts[1].replace(/[\"']/g, '') : '')\n          }\n          parsedTags++\n        }\n      }\n    }\n  } while (parsedTags)\n  return dom\n}\n\n// render <loop> tags\nfunction parseLoops (dom, model) {\n  let parsedTags\n  do {\n    parsedTags = 0\n    const tags = dom('loop')\n    if (tags.length > 0) {\n      for (const el of tags) {\n        // get attributes\n        let loopThrough\n        let keyName\n        let valName\n        if (browser) el.attribs = getAttribs(el)\n        for (const attr in el.attribs) {\n          if (attr === 'through') {\n            let attrVal = el.attribs[attr]\n            if (attrVal.startsWith('{')) attrVal = parseVars(attrVal, model)\n            loopThrough = getOrSetObjectByDotNotation(model, attrVal)\n          } else if (attr === 'key') keyName = el.attribs[attr]\n          else if (attr === 'val') valName = el.attribs[attr]\n        }\n        // reject the loop if it has invalid attributes\n        if (!loopThrough) {\n          if (params.verbosity > 1) console.warn('teddy encountered a loop without a through attribute.')\n          dom(el).replaceWith('')\n          continue\n        }\n        if (!keyName && !valName) {\n          if (params.verbosity > 1) console.warn('teddy encountered a loop without a key or a val attribute.')\n          dom(el).replaceWith('')\n          continue\n        }\n        // loop through model[loopThrough] and parse teddy tags within the loop's iteration against the local model\n        let newMarkup = ''\n        let loopContents = dom(el).html()\n        if (loopThrough instanceof Set) loopThrough = [...loopThrough] // convert Sets to arrays\n        for (const key in loopThrough) {\n          const val = loopThrough[key]\n          const localModel = Object.assign({}, model)\n          getOrSetObjectByDotNotation(localModel, keyName, key)\n          getOrSetObjectByDotNotation(localModel, valName, val)\n          const hasNoteddyLoopContents = loopContents.includes('</noteddy>')\n          const hasNoparseLoopContents = loopContents.includes('</noparse>')\n          const hasPreLoopContents = loopContents.includes('</pre>')\n          const hasEscape = loopContents.includes('</escape>') || loopContents.includes('<!--#')\n          if (hasEscape) loopContents = parseEscapes(loopContents)\n          if (hasNoteddyLoopContents || hasNoparseLoopContents || hasPreLoopContents) {\n            let localDom = cheerioLoad(loopContents, cheerioOptions)\n            localDom = tagNoParseBlocks(localDom, localModel)\n            loopContents = localDom.html()\n          }\n          const localMarkup = parseVars(loopContents, localModel) || ''\n          const hasNoteddy = localMarkup.includes('</noteddy>')\n          const hasNoparse = localMarkup.includes('</noparse>')\n          const hasIf = localMarkup.includes('</if>')\n          const hasUnless = localMarkup.includes('</unless>')\n          const hasTrue = localMarkup.includes(' true=')\n          const hasFalse = localMarkup.includes(' false=')\n          const hasLoop = localMarkup.includes('</loop>')\n          const hasInline = localMarkup.includes('</inline>')\n          const hasSelected = localMarkup.includes(' selected-value=') || localMarkup.includes(' checked-value=')\n          let localDom = cheerioLoad(localMarkup || '', cheerioOptions)\n          if (hasNoteddy || hasNoparse) localDom = tagNoParseBlocks(localDom, localModel)\n          if (hasIf || hasUnless) localDom = parseConditionals(localDom, localModel)\n          if (hasTrue || hasFalse) localDom = parseOneLineConditionals(localDom, localModel)\n          if (hasLoop) localDom = parseLoops(localDom, localModel)\n          if (hasInline) localDom = parseInlines(localDom, localModel)\n          if (hasSelected) localDom = parseSelectedAttributeValues(localDom, localModel)\n          newMarkup += localDom.html()\n        }\n        const newDom = cheerioLoad(newMarkup || '', cheerioOptions)\n        dom(el).replaceWith(newDom.html())\n        parsedTags++\n      }\n    }\n  } while (parsedTags)\n  return dom\n}\n\n// render <inline> tags\nfunction parseInlines (dom, model) {\n  let parsedTags\n  do {\n    parsedTags = 0\n    const tags = dom('inline')\n    if (tags.length > 0) {\n      for (const el of tags) {\n        // get attributes\n        let css\n        let js\n        if (browser) el.attribs = getAttribs(el)\n        for (const attr in el.attribs) {\n          if (attr === 'css') css = getOrSetObjectByDotNotation(model, el.attribs[attr])\n          else if (attr === 'js') js = getOrSetObjectByDotNotation(model, el.attribs[attr])\n        }\n        // reject if it has invalid attributes\n        if (!css && !js) {\n          if (params.verbosity > 1) console.warn('teddy encountered an <inline> element without a css or js attribute.')\n          dom(el).replaceWith('')\n          continue\n        }\n        let replaceWith = ''\n        if (css) replaceWith = `<style>${css}</style>`\n        else replaceWith = `<script>${js}</script>`\n        dom(el).replaceWith(replaceWith)\n        parsedTags++\n      }\n    }\n  } while (parsedTags)\n  return dom\n}\n\n// render <escape> tags\nfunction parseEscapes (templateString) {\n  return templateString.replace(/<escape>(.*?)<\\/escape>/gs, (_, content) => escapeEntities(content.trim()))\n}\n\n// render `selected-value` and `checked-value` attributes\nfunction parseSelectedAttributeValues (dom, model) {\n  let parsedTags\n  do {\n    parsedTags = 0\n    const tags = dom('select[selected-value], [checked-value]')\n    if (tags.length > 0) {\n      for (const el of tags) {\n        // get attributes\n        if (browser) el.attribs = getAttribs(el)\n        for (let attr in el.attribs) {\n          const origAttr = attr\n          if (attr.includes('-teddyduplicate')) attr = attr.split('-teddyduplicate')[0]\n          if (attr === 'selected-value') {\n            const val = parseVars(el.attribs[origAttr], model) || el.attribs[origAttr]\n            const children = dom(el).find('option[value]')\n            for (const opt of children) {\n              if (browser) opt.attribs = getAttribs(opt)\n              if (opt.attribs.value === val) dom(opt).attr('selected', 'selected')\n            }\n            dom(el).removeAttr(origAttr)\n          } else if (attr === 'checked-value') {\n            const val = parseVars(el.attribs[origAttr], model) || el.attribs[origAttr]\n            const children = dom(el).find('input[type=\"checkbox\"][value], input[type=\"radio\"][value]')\n            for (const opt of children) {\n              if (browser) opt.attribs = getAttribs(opt)\n              if (opt.attribs.value === val) dom(opt).attr('checked', 'checked')\n            }\n            dom(el).removeAttr(origAttr)\n          }\n        }\n        parsedTags++\n      }\n    }\n  } while (parsedTags)\n  return dom\n}\n\n// render {variables}\nfunction parseVars (templateString, model) {\n  let vars\n  try {\n    vars = matchByDelimiter(templateString, '{', '}')\n  } catch (e) {\n    return templateString // it will match {vars{withVarsInThem}} but if there are unbalanced brackets, just return the original text\n  }\n  const varsLength = vars.length\n  for (let i = 0; i < varsLength; i++) {\n    let match = vars[i]\n    if (match === '') continue // empty {}\n    if (!/^(\\d+|[a-zA-Z_$][a-zA-Z0-9_$|{}.-]*(\\.[a-zA-Z_$][a-zA-Z0-9_$|{}.-]*)*)$/.test(match)) {\n      if (params.verbosity > 2) console.warn(`teddy.parseVars encountered a {variable} that could not be parsed: {${match}}`)\n      continue // skip invalid variables\n    }\n    if (match.includes('{')) {\n      // there's a variable inside the variable name\n      const originalMatch = match\n      match = parseVars(match, model)\n      try {\n        templateString = templateString.replace(new RegExp(`\\${${originalMatch}}`, 'i'), () => `\\${${match}}`)\n        templateString = templateString.replace(new RegExp(`{${originalMatch}}`, 'i'), () => `{${match}}`)\n      } catch (e) {\n        if (params.verbosity > 2) console.warn(`teddy.parseVars encountered a {variable} that could not be parsed: {${originalMatch}}`)\n      }\n    }\n    const lastSixChars = match.slice(-6)\n    if (lastSixChars.includes('|p')) { // no parse flag is set\n      const originalMatch = match\n      match = match.substring(0, match.length - (lastSixChars.split('|').length - 1) * 2) // remove last 2-n chars\n      let parsed = getOrSetObjectByDotNotation(model, match)\n      if (!parsed && !lastSixChars.includes('|d') && (params.emptyVarBehavior === 'hide' || lastSixChars.includes('|h'))) parsed = '' // display empty string instead of the variable text verbatim if this setting is set\n      if (typeof parsed === 'string' && parsed.startsWith('{') && parsed.includes('|d')) parsed = parsed.replace('|d', '')\n      if (parsed || parsed === '') {\n        const id = model._noTeddyBlocks.push(parsed) - 1\n        try {\n          try {\n            templateString = templateString.replace(new RegExp(`\\${${originalMatch}}`.replace(/[|\\\\{}()[\\]^$+*?.]/g, '\\\\$&').replace(/-/g, '\\\\x2d'), 'i'), `<noteddy id=\"${id}\"></noteddy>`)\n            templateString = templateString.replace(new RegExp(`{${originalMatch}}`.replace(/[|\\\\{}()[\\]^$+*?.]/g, '\\\\$&').replace(/-/g, '\\\\x2d'), 'i'), `<noteddy id=\"${id}\"></noteddy>`)\n          } catch (e) {\n            if (params.verbosity > 2) console.warn(`teddy.parseVars encountered a {variable} that could not be parsed: {${originalMatch}}`)\n          }\n        } catch (e) {\n          return templateString\n        }\n      }\n    } else if (lastSixChars.includes('|s')) { // no escape flag is set\n      const originalMatch = match\n      match = match.substring(0, match.length - (lastSixChars.split('|').length - 1) * 2) // remove last 2-n chars\n      let parsed = getOrSetObjectByDotNotation(model, match)\n      let skipTemplateLiteralReplacement = false\n      if (!parsed && !lastSixChars.includes('|d') && (params.emptyVarBehavior === 'hide' || lastSixChars.includes('|h'))) parsed = '' // display empty string instead of the variable text verbatim if this setting is set\n      else if (!parsed && parsed !== '') {\n        skipTemplateLiteralReplacement = true\n        parsed = `{${originalMatch}}`\n      }\n      if (typeof parsed === 'string' && parsed.startsWith('{') && parsed.includes('|d')) parsed = parsed.replace('|d', '')\n      try {\n        if (!skipTemplateLiteralReplacement) templateString = templateString.replace(new RegExp(`\\${${originalMatch}}`.replace(/[|\\\\{}()[\\]^$+*?.]/g, '\\\\$&').replace(/-/g, '\\\\x2d'), 'i'), () => parsed)\n        templateString = templateString.replace(new RegExp(`{${originalMatch}}`.replace(/[|\\\\{}()[\\]^$+*?.]/g, '\\\\$&').replace(/-/g, '\\\\x2d'), 'i'), () => parsed)\n      } catch (e) {\n        return templateString\n      }\n    } else { // no flags are set\n      let parsed = getOrSetObjectByDotNotation(model, match)\n      let skipTemplateLiteralReplacement = false\n      if (!parsed && !lastSixChars.includes('|d') && (params.emptyVarBehavior === 'hide' || lastSixChars.includes('|h'))) parsed = '' // display empty string instead of the variable text verbatim if this setting is set\n      else if (parsed || parsed === '') parsed = escapeEntities(parsed)\n      else if (parsed === 0) parsed = '0'\n      else {\n        skipTemplateLiteralReplacement = true\n        parsed = `{${match}}`\n      }\n      if (typeof parsed === 'string' && parsed.startsWith('{') && parsed.includes('|d')) parsed = parsed.replace('|d', '')\n      try {\n        if (!skipTemplateLiteralReplacement) templateString = templateString.replace(new RegExp(`\\${${match}}`.replace(/[|\\\\{}()[\\]^$+*?.]/g, '\\\\$&').replace(/-/g, '\\\\x2d'), 'i'), () => parsed)\n        templateString = templateString.replace(new RegExp(`{${match}}`.replace(/[|\\\\{}()[\\]^$+*?.]/g, '\\\\$&').replace(/-/g, '\\\\x2d'), 'i'), () => parsed)\n      } catch (e) {\n        return templateString\n      }\n    }\n  }\n  return templateString\n}\n\n// once the template is fully rendered, find all cache elements that still exist and cache their contents\nfunction defineNewCaches (dom, model) {\n  let parsedTags\n  do {\n    parsedTags = 0\n    const tags = dom('cache[defer]')\n    if (tags.length > 0) {\n      for (const el of tags) {\n        if (browser) el.attribs = getAttribs(el)\n        const name = el.attribs.name\n        const key = el.attribs.key || 'none'\n        const maxAge = parseInt(el.attribs.maxAge || el.attribs.maxage) || 0\n        const maxCaches = parseInt(el.attribs.maxCaches || el.attribs.maxcaches) || 1000\n        const timestamp = Date.now()\n        const markup = dom(el).html()\n        if (!caches[name]) {\n          caches[name] = {\n            key,\n            maxAge,\n            maxCaches,\n            entries: {}\n          }\n        }\n        caches[name].entries[el.attribs.key ? getOrSetObjectByDotNotation(model, key) : 'none'] = {\n          lastAccessed: timestamp,\n          created: timestamp,\n          markup\n        }\n        // invalidate oldest cache if we've reached max caches limit\n        if (Object.keys(caches[name].entries).length > maxCaches) {\n          const lowestKeyVal = Object.keys(caches[name].entries).reduce((a, b) => caches[name].entries[a].lastAccessed < caches[name].entries[b].lastAccessed ? a : b)\n          delete caches[name].entries[lowestKeyVal]\n        }\n        dom(el).replaceWith(markup)\n        parsedTags++\n      }\n    }\n  } while (parsedTags)\n  return dom\n}\n\n// removes any remaining teddy tags from the dom before returning the parsed html to the user\nfunction cleanupStrayTeddyTags (dom) {\n  let parsedTags\n  do {\n    parsedTags = 0\n    const tags = dom('[teddydeferredonelineconditional], pre[parse], include, arg, if, unless, elseif, elseunless, else, loop, cache')\n    if (tags.length > 0) {\n      for (const el of tags) {\n        const tagName = browser ? el.nodeName?.toLowerCase() : el.name\n        if (tagName === 'include' || tagName === 'arg' || tagName === 'if' || tagName === 'unless' || tagName === 'elseif' || tagName === 'elseunless' || tagName === 'else' || tagName === 'loop' || tagName === 'cache') {\n          dom(el).remove()\n        }\n        if (browser) el.attribs = getAttribs(el)\n        for (const attr in el.attribs) {\n          if (attr === 'true' || attr === 'false' || attr === 'parse' || attr === 'teddydeferredonelineconditional' || attr.startsWith('if-')) {\n            dom(el).removeAttr(attr)\n          }\n        }\n      }\n    }\n  } while (parsedTags)\n  return dom\n}\n\n// escapes sensitive characters to prevent xss\nconst escapeHtmlEntities = {\n  '&': '&amp;',\n  '<': '&lt;',\n  '>': '&gt;',\n  '\"': '&#34;',\n  \"'\": '&#39;'\n}\nconst entityKeys = Object.keys(escapeHtmlEntities)\nconst ekl = entityKeys.length\nfunction escapeEntities (value) {\n  let escapedEntity = false\n  let newValue = ''\n  let i\n  let j\n\n  if (typeof value === 'object') { // cannot escape on this value\n    if (!value) return false // it is falsey to return false\n    else if (Array.isArray(value)) {\n      if (value.length === 0) return false // empty arrays are falsey\n      else return '[Array]' // print that it is an array with content in it, but do not print the contents\n    }\n    return '[Object]' // just print that it is an object, do not print the contents\n  } else if (value === undefined) return false // cannot escape on this value; undefined is falsey\n  else if (typeof value === 'boolean' || typeof value === 'number') return value // cannot escape on these values; if it's already a boolean or a number just return it\n  else {\n    // loop through value to find html entities\n    for (i = 0; i < value.length; i++) {\n      escapedEntity = false\n\n      // loop through list of html entities to escape\n      for (j = 0; j < ekl; j++) {\n        if (value[i] === entityKeys[j]) { // alter value to show escaped html entities\n          newValue += escapeHtmlEntities[entityKeys[j]]\n          escapedEntity = true\n          break\n        }\n      }\n\n      if (!escapedEntity) newValue += value[i]\n    }\n  }\n\n  return newValue\n}\n\n// if an entity is double-encoded, this will fix that\nfunction reverseDoubleEncodedEntities (str) {\n  return str.replace(/&amp;(#\\d+;|#x[0-9A-Fa-f]+;|[A-Za-z]+;)/g, '&$1')\n}\n\n// match strings by a custom delimiter\nfunction matchByDelimiter (input, openDelimiter, closeDelimiter) {\n  const stack = []\n  const result = []\n  const openLength = openDelimiter.length\n  const closeLength = closeDelimiter.length\n\n  for (let i = 0; i < input.length; i++) {\n    if (input.substring(i, i + openLength) === openDelimiter) {\n      stack.push(i + openLength)\n      i += openLength - 1\n    } else if (input.substring(i, i + closeLength) === closeDelimiter) {\n      const start = stack.pop()\n      if (stack.length === 0) {\n        result.push(input.substring(start, i))\n      }\n      i += closeLength - 1\n    }\n  }\n\n  const individualSegments = []\n  const regex = /{!([^{}]*)!}/g\n  let match\n\n  for (const segment of result) {\n    while ((match = regex.exec(segment)) !== null) {\n      individualSegments.push(match[1])\n    }\n    individualSegments.push(segment)\n  }\n\n  return individualSegments\n}\n\n// gets or sets an object by dot notation, e.g. thing.nestedThing.furtherNestedThing: two arguments gets, three arguments sets\nfunction getOrSetObjectByDotNotation (obj, dotNotation, value) {\n  if (!obj) return false\n  if (!dotNotation || typeof dotNotation === 'boolean' || typeof dotNotation === 'number') return dotNotation\n  if (typeof dotNotation === 'string') return getOrSetObjectByDotNotation(obj, dotNotation.split('.'), value)\n  else if (dotNotation.length === 1 && value !== undefined) {\n    obj[dotNotation[0]] = value\n    return obj[dotNotation[0]]\n  } else if (dotNotation.length === 0) return obj\n  else if (dotNotation.length === 1) {\n    if (obj) return caseInsensitiveLookup(obj, dotNotation[0])\n    return false\n  } else return getOrSetObjectByDotNotation(caseInsensitiveLookup(obj, dotNotation[0]), dotNotation.slice(1), value)\n  function caseInsensitiveLookup (obj, key) {\n    if (key === 'length') return obj.length\n    const lowerCaseKey = key.toLowerCase()\n    const normalizedObj = Object.keys(obj).reduce((acc, k) => {\n      acc[k.toLowerCase()] = obj[k]\n      return acc\n    }, {})\n    return normalizedObj[lowerCaseKey]\n  }\n}\n\n// cheerio polyfill\nfunction getAttribs (element) {\n  const attributes = element.attributes\n  const attributesObject = {}\n\n  for (let i = 0; i < attributes.length; i++) {\n    const attr = attributes[i]\n    attributesObject[attr.name] = attr.value\n  }\n\n  return attributesObject\n}\n\n// #endregion\n\n// #region public methods\n\n// set params to the defaults\nfunction setDefaultParams () {\n  params.verbosity = 1\n  params.templateRoot = './'\n  params.maxPasses = 1000\n  params.emptyVarBehavior = 'display' // or 'hide'\n  params.includeNotFoundBehavior = 'display' // or 'hide'\n}\n\n// mutator method to set verbosity param. takes human-readable string argument and converts it to an integer for more efficient checks against the setting\nfunction setVerbosity (v) {\n  switch (v) {\n    case 'none':\n    case 0:\n      v = 0\n      break\n    case 'verbose':\n    case 2:\n      v = 2\n      break\n    case 'debug':\n    case 'DEBUG':\n    case 3:\n      v = 3\n      break\n    default: // concise\n      v = 1\n  }\n  params.verbosity = v\n}\n\n// mutator method to set template root param; must be a string\nfunction setTemplateRoot (v) {\n  params.templateRoot = String(v)\n}\n\n// mutator method to set max passes param: the number of times the parser can iterate over the template\nfunction setMaxPasses (v) {\n  params.maxPasses = Number(v)\n}\n\n// mutator method to set empty var behavior param: whether to display {variables} that don't resolve as text ('display') or as an empty string ('hide')\nfunction setEmptyVarBehavior (v) {\n  if (v === 'hide') params.emptyVarBehavior = 'hide'\n  else params.emptyVarBehavior = 'display'\n}\n\n// mutator method to set include tag not found param: whether to display an error when an <include> tag src can't be found\nfunction setIncludeNotFoundBehavior (v) {\n  if (v === 'hide') params.includeNotFoundBehavior = 'hide'\n  else params.includeNotFoundBehavior = 'display'\n}\n\n// access templates\nfunction getTemplates () {\n  return templates\n}\n\n// takes in a template string and outputs a function which when given data will render out html\nfunction compile (templateString) {\n  return function (model) {\n    return render(templateString, model)\n  }\n}\n\n// mutator method to cache template\nfunction setTemplate (file, template) {\n  templates[file] = template\n}\n\n// mutator method to clear template cache entirely\nfunction clearTemplates () {\n  templates = {}\n}\n\nfunction setCache (params) {\n  if (!templateCaches[params.template]) templateCaches[params.template] = {}\n  if (params.key) {\n    templateCaches[params.template][params.key] = {\n      maxAge: params.maxAge || params.maxage,\n      maxCaches: (params.maxCaches || params.maxcaches) || 1000,\n      entries: {}\n    }\n  } else {\n    templateCaches[params.template].none = {\n      maxAge: params.maxAge || params.maxage,\n      markup: null,\n      created: null\n    }\n  }\n}\n\n// delete one or more cached templates\n// 1 string argument deletes the whole cache at that name for template partial caches\n// 2 arguments deletes just the value at that keyVal for template partial caches\n// 1 object argument assumes we're clearing whole template level cache\nfunction clearCache (name, keyVal) {\n  if (typeof name === 'string') {\n    if (keyVal) delete caches[name].entries[keyVal]\n    else delete caches[name]\n  } else if (typeof name === 'object') {\n    const params = name\n    if (params.key) delete templateCaches[params.template][params.key]\n    else delete templateCaches[params.template]\n  } else if (params.verbosity > 0) console.error('teddy: invalid params passed to clearCache.')\n}\n\n// parses a template\nfunction render (template, model, callback) {\n  // ensure template is a string\n  if (typeof template !== 'string') {\n    if (params.verbosity > 1) console.warn('teddy.render attempted to render a template which is not a string.')\n    if (typeof callback === 'function') return callback(null, '')\n    else return ''\n  }\n\n  // ensure model is an object\n  if (typeof model !== 'object') {\n    if (params.verbosity > 1) console.warn('teddy.render was passed an invalid model.')\n    model = {} // allow the template to render if an invalid model is supplied, but it will have an empty model\n  }\n\n  // declare vars\n  let dom\n  let renderedTemplate\n  model._noTeddyBlocks = [] // will store code blocks exempt from teddy parsing\n\n  // express.js support\n  if (model.settings && model.settings.views && path) params.templateRoot = path.resolve(model.settings.views)\n\n  // remove templateRoot from template name if necessary\n  if (template.slice(params.templateRoot.length) === params.templateRoot) template = template.replace(params.templateRoot, '')\n\n  // whole template caching\n  const templateCache = templateCaches[template]\n  let cacheKey = null\n  let cacheKeyModelVal = null\n  if (templateCache) {\n    const singletonCache = templateCache.none\n    if (singletonCache) {\n      // check if the timestamp exceeds max age\n      if (!singletonCache.created) cacheKey = 'none'\n      else if (!singletonCache.maxAge && singletonCache.maxage) {\n        // if no max age is set, then this cache doesn't expire\n        if (typeof callback === 'function') return callback(null, singletonCache.markup)\n        else return singletonCache.markup\n      } else if (singletonCache.created + (singletonCache.maxAge || singletonCache.maxage) < Date.now()) cacheKey = 'none' // if yes re-render the template and cache it again\n      else {\n        // if no return the cached markup and skip the template render\n        if (typeof callback === 'function') return callback(null, singletonCache.markup)\n        else return singletonCache.markup\n      }\n    } else {\n      // loop through its keys\n      for (const key in templateCache) {\n        // if there's a model value for that key name\n        cacheKeyModelVal = getOrSetObjectByDotNotation(model, key)\n        if (cacheKeyModelVal) {\n          // loop through its entries\n          const templateCacheAtThisKey = templateCache[key]\n          for (const entryKey in templateCacheAtThisKey.entries) {\n            // if any entry keys match the model value for that key name\n            if (entryKey === cacheKeyModelVal) {\n              // check if the timestamp exceeds max age\n              const entry = templateCacheAtThisKey.entries[entryKey]\n              if (!templateCacheAtThisKey.maxAge && !templateCacheAtThisKey.maxage) {\n                // if no max age is set, then this cache doesn't expire\n                if (typeof callback === 'function') return callback(null, entry.markup)\n                else return entry.markup\n              } else if (entry.created + (templateCacheAtThisKey.maxAge || templateCacheAtThisKey.maxage) < Date.now()) {\n                // if yes re-render the template and cache it again\n                cacheKey = key\n                break\n              } else {\n                // if no return the cached markup and skip the template render\n                if (typeof callback === 'function') return callback(null, entry.markup)\n                else return entry.markup\n              }\n            }\n          }\n          // this is a new model value so it needs a new entry\n          cacheKey = key\n          break\n        }\n      }\n    }\n  }\n\n  // start the render\n  renderedTemplate = loadTemplate(template)\n\n  // replace duplicate attributes with temporary unique names before loading into cheerio\n  if (!browser) {\n    renderedTemplate = renderedTemplate.replace(/<([a-zA-Z][a-zA-Z0-9-]*)([^>]*)>/g, (match, tagName, attributes) => {\n      const attrRegex = /([a-zA-Z0-9-:._]+)(?:=([\"'])(.*?)\\2|([^>\\s]+))?/g\n      const attrMap = new Map()\n      let count = 1\n      const processedAttributes = attributes.replace(attrRegex, (attrMatch, attrName, quote, attrValue) => {\n        if (attrMap.has(attrName)) {\n          const newAttrName = `${attrName}-teddyduplicate${count++}`\n          return attrMatch.replace(attrName, newAttrName)\n        } else {\n          attrMap.set(attrName, true)\n          return attrMatch\n        }\n      })\n      return `<${tagName}${processedAttributes}>`\n    })\n  }\n\n  const hasEscape = renderedTemplate.includes('</escape>') || renderedTemplate.includes('<!--#')\n  if (hasEscape) renderedTemplate = parseEscapes(renderedTemplate)\n\n  dom = cheerioLoad(renderedTemplate || '', cheerioOptions)\n  let oldTemplate\n  let passes = 0\n  let parseDynamicIncludes = false\n  do {\n    passes++\n    if (passes > params.maxPasses) {\n      if (params.verbosity > 0) console.error(`teddy could not finish rendering the template because the max number of passes over the template (${params.maxPasses}) was exceeded; there may be an infinite loop in your template logic.`)\n      break\n    }\n    const hasCache = renderedTemplate.includes('</cache>')\n    const hasNoteddy = renderedTemplate.includes('</noteddy>')\n    const hasNoparse = renderedTemplate.includes('</noparse>')\n    const hasPre = renderedTemplate.includes('</pre>')\n    const hasIf = renderedTemplate.includes('</if>')\n    const hasUnless = renderedTemplate.includes('</unless>')\n    const hasTrue = renderedTemplate.includes(' true=')\n    const hasFalse = renderedTemplate.includes(' false=')\n    const hasInclude = renderedTemplate.includes('</include>')\n    const hasLoop = renderedTemplate.includes('</loop>')\n    const hasInline = renderedTemplate.includes('</inline>')\n    const hasSelected = renderedTemplate.includes(' selected-value=') || renderedTemplate.includes(' checked-value=')\n    oldTemplate = renderedTemplate || ''\n    if (passes > 1) {\n      dom = cheerioLoad(renderedTemplate || '', cheerioOptions)\n      if (parseDynamicIncludes) dom = parseIncludes(dom, model, true)\n    }\n    if (hasCache) dom = replaceCacheElements(dom, model)\n    if (hasNoteddy || hasNoparse || hasPre) dom = tagNoParseBlocks(dom, model)\n    if (hasIf || hasUnless) dom = parseConditionals(dom, model)\n    if (hasTrue || hasFalse) dom = parseOneLineConditionals(dom, model)\n    if (hasInclude) dom = parseIncludes(dom, model)\n    if (hasLoop) dom = parseLoops(dom, model)\n    if (hasInline) dom = parseInlines(dom, model)\n    if (hasSelected) dom = parseSelectedAttributeValues(dom, model)\n    const cachesStillPresent = renderedTemplate.includes('</cache>')\n    renderedTemplate = dom.html()\n    renderedTemplate = parseVars(renderedTemplate, model)\n    if (parseDynamicIncludes) {\n      renderedTemplate = removeTeddyComments(renderedTemplate)\n      parseDynamicIncludes = false\n    }\n    if (renderedTemplate.includes('teddydeferreddynamicinclude=\"true\"')) {\n      oldTemplate = '' // reset old template to force another pass\n      parseDynamicIncludes = true\n    }\n    if (oldTemplate === renderedTemplate && cachesStillPresent) {\n      dom = cheerioLoad(renderedTemplate || '', cheerioOptions)\n      dom = defineNewCaches(dom, model)\n      renderedTemplate = dom.html()\n    }\n  } while (oldTemplate !== renderedTemplate)\n\n  // remove stray teddy tags if any exist\n  if (renderedTemplate.includes('teddydeferredonelineconditional=\"true\"') || renderedTemplate.includes('</include>') || renderedTemplate.includes('</arg>') || renderedTemplate.includes('</if>') || renderedTemplate.includes('</unless>') || renderedTemplate.includes('</elseif>') || renderedTemplate.includes('</elseunless>') || renderedTemplate.includes('</else>') || renderedTemplate.includes('</loop>') || renderedTemplate.includes('</cache>') || renderedTemplate.includes('</pre>')) {\n    dom = cheerioLoad(renderedTemplate || '', cheerioOptions)\n    dom = cleanupStrayTeddyTags(dom)\n    renderedTemplate = dom.html()\n  }\n\n  // replace <noteddy> blocks with the hidden code\n  for (const blockId in model._noTeddyBlocks) {\n    renderedTemplate = renderedTemplate.replace(`<noteddy id=\"${blockId}\"></noteddy>`, () => model._noTeddyBlocks[blockId])\n    renderedTemplate = renderedTemplate.replace(`<noteddy id=\"${blockId}\" pre=\"true\"></noteddy>`, () => model._noTeddyBlocks[blockId])\n  }\n\n  if (browser) {\n    // fix double-encoding html entity bug in client-side mode\n    renderedTemplate = reverseDoubleEncodedEntities(renderedTemplate)\n\n    // now that we're done with the render, reset data-teddy-defer-attr-src and data-teddy-defer-attr-href to native attributes\n    renderedTemplate = renderedTemplate.replaceAll('data-teddy-defer-attr-src', 'src').replaceAll('data-teddy-defer-attr-href', 'href')\n  }\n\n  // cache the template\n  if (cacheKey === 'none') {\n    templateCaches[template].none.markup = renderedTemplate\n    templateCaches[template].none.created = Date.now()\n  } else if (cacheKey) {\n    if (!templateCaches[template][cacheKey].entries[cacheKeyModelVal]) templateCaches[template][cacheKey].entries[cacheKeyModelVal] = {}\n    templateCaches[template][cacheKey].entries[cacheKeyModelVal].markup = renderedTemplate\n    templateCaches[template][cacheKey].entries[cacheKeyModelVal].created = Date.now()\n    // invalidate oldest cache if we've reached max caches limit\n    if (Object.keys(templateCaches[template][cacheKey].entries).length > templateCaches[template][cacheKey].maxCaches) {\n      const lowestKeyVal = Object.keys(templateCaches[template][cacheKey].entries).reduce((a, b) => templateCaches[template][cacheKey].entries[a].created < templateCaches[template][cacheKey].entries[b].created ? a : b)\n      delete templateCaches[template][cacheKey].entries[lowestKeyVal]\n    }\n  }\n\n  if (typeof callback === 'function') return callback(null, renderedTemplate)\n  else return renderedTemplate\n}\n\n// #endregion\n\nexport default {\n  params,\n  caches,\n  templateCaches,\n\n  // functions\n  compile,\n  setDefaultParams,\n  setVerbosity,\n  setTemplateRoot,\n  setMaxPasses,\n  setEmptyVarBehavior,\n  setIncludeNotFoundBehavior,\n  getTemplates,\n  setTemplate,\n  clearTemplates,\n  setCache,\n  clearCache,\n  render,\n  __express: render\n}\n"],"names":["root","factory","exports","module","define","amd","this","load","html","doc","parseTeddyDOMFromString","$","query","els","querySelectorAll","el","children","childNodes","find","selector","getTeddyDOMInnerHTML","toString","getTeddyDOMOuterHTML","attr","val","setAttribute","removeAttr","removeAttribute","replaceWith","newHtml","nodeType","window","Node","COMMENT_NODE","textContent","outerHTML","temp","document","createElement","innerHTML","remove","isCheerioPolyfill","selfClosingTags","Set","dom","openTags","tagAndCommentRegex","attrRegex","lastIndex","match","exec","length","Error","textBeforeMatch","slice","index","trim","textNode","createTextNode","appendChild","startsWith","commentNode","createComment","fullMatch","tagName","attrString","lowerCaseTagName","toLowerCase","isClosingTag","has","element","pop","attrMatch","attrMap","Map","attrName","attrValue","count","newAttrName","set","name","value","e","console","warn","endsWith","push","remainingText","doublyEncodedEntities","entityEntries","Object","entries","node","child","ELEMENT_NODE","doublyEncoded","singleEncoded","replace","RegExp","TEXT_NODE","commentContent","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","d","definition","key","o","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","cheerioOptions","xml","xmlMode","lowerCaseAttributeNames","decodeEntities","browser","params","setDefaultParams","templates","caches","templateCaches","loadTemplate","template","verbosity","register","indexOf","templateRoot","removeTeddyComments","substring","renderedTemplate","oldTemplate","vars","matchByDelimiter","i","replaceCacheElements","model","parsedTags","tags","attribs","getAttribs","includes","cache","keyVal","getOrSetObjectByDotNotation","now","Date","maxAge","maxage","lastAccessed","cacheContent","markup","tagNoParseBlocks","id","_noTeddyBlocks","parseIncludes","dynamic","passes","maxPasses","foundBody","next","parent","parentNode","parentName","nodeName","src","contents","includeNotFoundBehavior","localModel","assign","arg","argName","argval","keys","hasNoteddy","hasNoparse","hasPre","hasIf","hasUnless","hasTrue","hasFalse","hasLoop","hasInline","hasEscape","hasSelected","parseEscapes","localDom","parseVars","parseConditionals","parseOneLineConditionals","parseLoops","parseInlines","parseSelectedAttributeValues","args","split","isIf","elName","condResult","evaluateConditional","nextSibling","removeStack","nextSiblingName","replaceSibling","siblingToWipe","conditions","conditionsLength","condition","evaluateCondition","fill","every","item","not","parts","cond","join","lookup","defer","ifTrue","ifFalse","origAttr","replaceAll","loopThrough","keyName","valName","attrVal","newMarkup","loopContents","hasNoteddyLoopContents","hasNoparseLoopContents","hasPreLoopContents","localMarkup","newDom","css","js","templateString","_","content","escapeEntities","opt","varsLength","test","originalMatch","lastSixChars","parsed","emptyVarBehavior","skipTemplateLiteralReplacement","defineNewCaches","parseInt","maxCaches","maxcaches","timestamp","created","lowestKeyVal","reduce","a","b","cleanupStrayTeddyTags","escapeHtmlEntities","entityKeys","ekl","escapedEntity","newValue","j","Array","isArray","reverseDoubleEncodedEntities","str","input","openDelimiter","closeDelimiter","stack","result","openLength","closeLength","start","individualSegments","regex","segment","dotNotation","caseInsensitiveLookup","lowerCaseKey","normalizedObj","acc","k","attributes","attributesObject","setVerbosity","v","setTemplateRoot","String","setMaxPasses","Number","setEmptyVarBehavior","setIncludeNotFoundBehavior","getTemplates","compile","render","setTemplate","file","clearTemplates","setCache","none","clearCache","error","callback","settings","views","templateCache","cacheKey","cacheKeyModelVal","singletonCache","templateCacheAtThisKey","entryKey","entry","processedAttributes","quote","parseDynamicIncludes","hasCache","hasInclude","cachesStillPresent","blockId","__express"],"sourceRoot":""}