{
  "version": 3,
  "sources": ["../index.ts", "../src/foreach.ts", "../src/nativeTemplateEngine.ts", "../src/templateEngine.ts", "../src/templateSources.ts", "../src/templating.ts", "../src/index.ts"],
  "sourcesContent": ["export * from './src'\n", "import { unwrap, peek } from '@tko/observable'\n\nimport { nativeTemplateEngine } from './nativeTemplateEngine'\n\nimport { TemplateBindingHandler } from './templating'\n\n// \"foreach: someExpression\" is equivalent to \"template: { foreach: someExpression }\"\n// \"foreach: { data: someExpression, afterAdd: myfn }\" is equivalent to \"template: { foreach: someExpression, afterAdd: myfn }\"\nexport class TemplateForEachBindingHandler extends TemplateBindingHandler {\n  override get value() {\n    const modelValue = this.valueAccessor()\n    const unwrappedValue = peek(modelValue) // Unwrap without setting a dependency here\n\n    // If unwrappedValue is the array, pass in the wrapped value on its own\n    // The value will be unwrapped and tracked within the template binding\n    // (See https://github.com/SteveSanderson/knockout/issues/523)\n    if (!unwrappedValue || typeof unwrappedValue.length === 'number') {\n      return { foreach: modelValue, templateEngine: nativeTemplateEngine.instance }\n    }\n\n    // If unwrappedValue.data is the array, preserve all relevant options and unwrap again value so we get updates\n    unwrap(modelValue)\n    return {\n      foreach: unwrappedValue.data,\n      as: unwrappedValue.as,\n      includeDestroyed: unwrappedValue.includeDestroyed,\n      afterAdd: unwrappedValue.afterAdd,\n      beforeRemove: unwrappedValue.beforeRemove,\n      afterRender: unwrappedValue.afterRender,\n      beforeMove: unwrappedValue.beforeMove,\n      afterMove: unwrappedValue.afterMove,\n      templateEngine: nativeTemplateEngine.instance\n    }\n  }\n}\n", "import { makeArray, parseHtmlFragment } from '@tko/utils'\nimport { templateEngine, type TemplateOptions } from './templateEngine'\nimport { setTemplateEngine } from './templating'\nimport type { TemplateSource } from './templateSources'\nimport type { BindingContext } from '@tko/bind'\n\nexport function nativeTemplateEngine() {}\n\nnativeTemplateEngine.prototype = new templateEngine()\nnativeTemplateEngine.prototype.constructor = nativeTemplateEngine\nnativeTemplateEngine.prototype.renderTemplateSource = function (\n  templateSource: TemplateSource,\n  bindingContext: BindingContext<any>,\n  options: TemplateOptions<any>,\n  templateDocument?: Document\n): Node[] {\n  const templateNodes = templateSource.nodes ? templateSource.nodes() : null\n\n  if (templateNodes) {\n    return makeArray(templateNodes.cloneNode(true).childNodes)\n  } else {\n    const templateText = templateSource.text()\n    return parseHtmlFragment(templateText, templateDocument)\n  }\n}\n\nnativeTemplateEngine.instance = new nativeTemplateEngine()\nsetTemplateEngine(nativeTemplateEngine.instance)\n", "// If you want to make a custom template engine,\n//\n// [1] Inherit from this class (like ko.nativeTemplateEngine does)\n// [2] Override 'renderTemplateSource', supplying a function with this signature:\n//\n//        function (templateSource, bindingContext, options) {\n//            // - templateSource.text() is the text of the template you should render\n//            // - bindingContext.$data is the data you should pass into the template\n//            //   - you might also want to make bindingContext.$parent, bindingContext.$parents,\n//            //     and bindingContext.$root available in the template too\n//            // - options gives you access to any other properties set on \"data-bind: { template: options }\"\n//            // - templateDocument is the document object of the template\n//            //\n//            // Return value: an array of DOM nodes\n//        }\n//\n// [3] Override 'createJavaScriptEvaluatorBlock', supplying a function with this signature:\n//\n//        function (script) {\n//            // Return value: Whatever syntax means \"Evaluate the JavaScript statement 'script' and output the result\"\n//            //               For example, the jquery.tmpl template engine converts 'someScript' to '${ someScript }'\n//        }\n//\n//     This is only necessary if you want to allow data-bind attributes to reference arbitrary template variables.\n//     If you don't want to allow that, you can set the property 'allowTemplateRewriting' to false (like ko.nativeTemplateEngine does)\n//     and then you don't need to override 'createJavaScriptEvaluatorBlock'.\n\nimport { extend, options } from '@tko/utils'\nimport { domElement, anonymousTemplate } from './templateSources'\nimport type { TemplateSource } from './templateSources'\nimport type { BindingContext } from '@tko/bind'\n\nexport interface TemplateOptions<T = any> {\n  afterRender?: (elements: Node[], dataItem: T) => void\n  templateEngine?: TemplateEngine\n}\n\nexport interface TemplateEngine {\n  allowTemplateRewriting: boolean\n\n  renderTemplateSource(\n    templateSource: TemplateSource,\n    bindingContext: BindingContext<any>,\n    options: TemplateOptions<any>,\n    templateDocument?: Document\n  ): Node[]\n  createJavaScriptEvaluatorBlock(script: string): string\n\n  makeTemplateSource(template: string | Node, templateDocument?: Document): TemplateSource\n\n  renderTemplate(\n    template: string | Node,\n    bindingContext: BindingContext<any>,\n    options: TemplateOptions<any>,\n    templateDocument?: Document\n  ): Node[]\n\n  isTemplateRewritten(template: string | Node, templateDocument?: Document): boolean\n\n  rewriteTemplate(template: string | Node, rewriterCallback: (val: string) => string, templateDocument?: Document): void\n}\n\n//TODO Class-Migration implements TemplateEngine\nexport function templateEngine() {}\n\nextend(templateEngine.prototype, {\n  renderTemplateSource(\n    templateSource: TemplateSource,\n    bindingContext: BindingContext<any>,\n    options,\n    templateDocument?: Document\n  ) {\n    // templateSource, bindingContext, templateDocument not in use\n    options.onError('Override renderTemplateSource')\n  },\n\n  createJavaScriptEvaluatorBlock(script: string) {\n    options.onError(new Error('Override createJavaScriptEvaluatorBlock'))\n  },\n\n  makeTemplateSource(template: string | Node, templateDocument?: Document): TemplateSource {\n    // Named template\n    if (typeof template === 'string') {\n      templateDocument = templateDocument || document\n      const elem = templateDocument.getElementById(template)\n      if (!elem) {\n        throw options.onError(new Error('Cannot find template with ID ' + template), false)\n      }\n      return new domElement(elem)\n    } else if (template.nodeType === Node.ELEMENT_NODE) {\n      // Anonymous template\n      return new anonymousTemplate(template as Element)\n    } else if (template.nodeType === Node.COMMENT_NODE) {\n      // Anonymous template stored in a comment node\n      return new anonymousTemplate(template as Comment)\n    } else {\n      throw options.onError(new Error('Unknown template type: ' + template), false)\n    }\n  },\n\n  renderTemplate(\n    template: string | Node,\n    bindingContext: BindingContext<any>,\n    options: TemplateOptions<any>,\n    templateDocument?: Document\n  ): Node[] {\n    const templateSource = this.makeTemplateSource(template, templateDocument)\n    return this.renderTemplateSource(templateSource, bindingContext, options, templateDocument)\n  }\n})\n", "// A template source represents a read/write way of accessing a template. This is to eliminate the need for template loading/saving\n// logic to be duplicated in every template engine (and means they can all work with anonymous templates, etc.)\n//\n// Two are provided by default:\n//  1. ko.templateSources.domElement       - reads/writes the text content of an arbitrary DOM element\n//  2. ko.templateSources.anonymousElement - uses ko.utils.domData to read/write text *associated* with the DOM element, but\n//                                           without reading/writing the actual element text content, since it will be overwritten\n//                                           with the rendered template output.\n// You can implement your own template source if you want to fetch/store templates somewhere other than in DOM elements.\n// Template sources need to have the following functions:\n//   text() \t\t\t- returns the template text from your storage location\n//   text(value)\t\t- writes the supplied template text to your storage location\n//   data(key)\t\t\t- reads values stored using data(key, value) - see below\n//   data(key, value)\t- associates \"value\" with this template and the key \"key\". Is used to store information like \"isRewritten\".\n//\n// Optionally, template sources can also have the following functions:\n//   nodes()            - returns a DOM element containing the nodes of this template, where available\n//   nodes(value)       - writes the given DOM element to your storage location\n// If a DOM element is available for a given template source, template engines are encouraged to use it in preference over text()\n// for improved speed. However, all templateSources must supply text() even if they don't supply nodes().\n//\n// Once you've implemented a templateSource, make your template engine use it by subclassing whatever template engine you were\n// using and overriding \"makeTemplateSource\" to return an instance of your custom template source.\n\nimport { tagNameLower as tagNameLowerFn, setHtml, domData, parseHtmlForTemplateNodes } from '@tko/utils'\n\n// ---- ko.templateSources.domElement -----\n\n// template types\nconst templateScript = 1,\n  templateTextArea = 2,\n  templateTemplate = 3,\n  templateElement = 4,\n  templateAnonymous = 5\n\nexport interface TemplateSource {\n  text(): string\n  text(valueToWrite: string): void\n  text(valueToWrite?: string): string | void\n\n  data(key: string): any\n  data<T>(key: string): T\n  data<T>(key: string, valueToWrite: T): void\n\n  nodes(): Node\n  nodes(valueToWrite: Node): undefined\n  nodes(valueToWrite?: any): Node | undefined\n}\n\nconst dataDomDataPrefix = domData.nextKey() + '_'\nconst templatesDomDataKey = domData.nextKey()\nfunction getTemplateDomData(element) {\n  return domData.get(element, templatesDomDataKey) || {}\n}\nfunction setTemplateDomData(element, data) {\n  domData.set(element, templatesDomDataKey, data)\n}\n\nexport class domElement implements TemplateSource {\n  protected domElement: Element | Comment\n  protected templateType: number\n\n  constructor(element: Element | Comment) {\n    this.domElement = element\n\n    if (element.nodeType === Node.COMMENT_NODE) {\n      this.templateType = templateElement\n    } else {\n      const tagNameLower = tagNameLowerFn(this.domElement as Element)\n      this.templateType =\n        tagNameLower === 'script'\n          ? templateScript\n          : tagNameLower === 'textarea'\n            ? templateTextArea\n            : // For browsers with proper <template> element support, where the .content property gives a document fragment\n              tagNameLower == 'template' &&\n                (element as HTMLTemplateElement).content &&\n                (element as HTMLTemplateElement).content.nodeType === Node.DOCUMENT_FRAGMENT_NODE\n              ? templateTemplate\n              : templateElement\n    }\n  }\n\n  text(): string\n  text(valueToWrite: string): void\n  text(valueToWrite?: string): string | void {\n    const elemContentsProperty =\n      this.templateType === templateScript ? 'text' : this.templateType === templateTextArea ? 'value' : 'innerHTML'\n\n    if (arguments.length == 0) {\n      return this.domElement[elemContentsProperty]\n    } else {\n      if (elemContentsProperty === 'innerHTML') {\n        setHtml(this.domElement, valueToWrite!)\n      } else {\n        this.domElement[elemContentsProperty] = valueToWrite\n      }\n    }\n  }\n\n  data<T = any>(key: string, valueToWrite?: T): T | void {\n    if (arguments.length === 1) {\n      return domData.get(this.domElement, dataDomDataPrefix + key)\n    } else {\n      domData.set(this.domElement, dataDomDataPrefix + key, valueToWrite)\n    }\n  }\n\n  nodes(): Node\n  nodes(valueToWrite: Node): undefined\n  nodes(valueToWrite?: any): Node | undefined {\n    const element = this.domElement\n    if (arguments.length == 0) {\n      const templateData = getTemplateDomData(element)\n      let nodes =\n        templateData.containerData ||\n        (this.templateType === templateTemplate\n          ? (element as HTMLTemplateElement).content\n          : this.templateType === templateElement\n            ? element\n            : undefined)\n      if (!nodes || templateData.alwaysCheckText) {\n        // If the template is associated with an element that stores the template as text,\n        // parse and cache the nodes whenever there's new text content available. This allows\n        // the user to update the template content by updating the text of template node.\n        const text = this.text()\n        if (text) {\n          nodes = parseHtmlForTemplateNodes(text, element.ownerDocument)\n          this.text('') // clear the text from the node\n          setTemplateDomData(element, { containerData: nodes, alwaysCheckText: true })\n        }\n      }\n      return nodes\n    } else {\n      setTemplateDomData(element, { containerData: valueToWrite })\n    }\n    return undefined\n  }\n}\n\n// ---- ko.templateSources.anonymousTemplate -----\n// Anonymous templates are normally saved/retrieved as DOM nodes through \"nodes\".\n// For compatibility, you can also read \"text\"; it will be serialized from the nodes on demand.\n// Writing to \"text\" is still supported, but then the template data will not be available as DOM nodes.\nexport class anonymousTemplate extends domElement {\n  constructor(element: Element | Comment) {\n    super(element)\n    //The old prototype construct uses an empty-constructor from domElement, so templateType and element was 'undefined'.\n    //With the new templateType = templateAnonymous (5) we achieve the same behavior in the \"nodes\" Method\n    this.templateType = templateAnonymous\n  }\n\n  override text(): string\n  override text(valueToWrite: string): void\n  override text(valueToWrite?: string): string | void {\n    if (arguments.length == 0) {\n      const templateData = getTemplateDomData(this.domElement)\n      if (templateData.textData === undefined && templateData.containerData) {\n        templateData.textData = templateData.containerData.innerHTML\n      }\n      return templateData.textData\n    } else {\n      setTemplateDomData(this.domElement, { textData: valueToWrite })\n    }\n  }\n}\n", "import {\n  virtualElements,\n  fixUpContinuousNodeArray,\n  replaceDomNodes,\n  memoization,\n  domNodeIsAttachedToDocument,\n  moveCleanedNodesToContainerElement,\n  arrayFilter,\n  domData,\n  options as koOptions\n} from '@tko/utils'\n\nimport {\n  applyBindings,\n  setDomNodeChildrenFromArrayMapping,\n  AsyncBindingHandler,\n  bindingEvent,\n  bindingContext as BindingContextConstructor\n} from '@tko/bind'\n\nimport { computed } from '@tko/computed'\n\nimport type { Computed } from '@tko/computed'\n\nimport type { BindingContext } from '@tko/bind'\n\nimport { isObservable, dependencyDetection, unwrap, observable, isObservableArray } from '@tko/observable'\n\nimport { templateEngine } from './templateEngine'\n\nimport type { TemplateEngine, TemplateOptions } from './templateEngine'\n\nimport { anonymousTemplate as AnonymousTemplate } from './templateSources'\n\nlet _templateEngine: TemplateEngine\nconst cleanContainerDomDataKey = domData.nextKey()\n\nexport function setTemplateEngine(tEngine: TemplateEngine | undefined): void {\n  if (tEngine !== undefined && !(tEngine instanceof templateEngine)) {\n    // TODO: ko.templateEngine to appropriate name\n    throw new Error('templateEngine must inherit from ko.templateEngine')\n  }\n  _templateEngine = tEngine!\n}\n\nfunction invokeForEachNodeInContinuousRange(firstNode, lastNode, action) {\n  let node\n  let nextInQueue = firstNode\n  const firstOutOfRangeNode = virtualElements.nextSibling(lastNode)\n  while (nextInQueue && (node = nextInQueue) !== firstOutOfRangeNode) {\n    nextInQueue = virtualElements.nextSibling(node)\n    action(node, nextInQueue)\n  }\n}\n\nfunction activateBindingsOnContinuousNodeArray(\n  continuousNodeArray,\n  bindingContext: BindingContext,\n  afterBindingCallback\n) {\n  // To be used on any nodes that have been rendered by a template and have been inserted into some parent element\n  // Walks through continuousNodeArray (which *must* be continuous, i.e., an uninterrupted sequence of sibling nodes, because\n  // the algorithm for walking them relies on this), and for each top-level item in the virtual-element sense,\n  // (1) Does a regular \"applyBindings\" to associate bindingContext with this node and to activate any non-memoized bindings\n  // (2) Unmemoizes any memos in the DOM subtree (e.g., to activate bindings that had been memoized during template rewriting)\n\n  if (continuousNodeArray.length) {\n    let firstNode = continuousNodeArray[0]\n    let lastNode = continuousNodeArray[continuousNodeArray.length - 1]\n    const parentNode = firstNode.parentNode\n    const provider = koOptions.bindingProviderInstance\n    const preprocessNode = provider.preprocessNode\n\n    if (preprocessNode) {\n      invokeForEachNodeInContinuousRange(firstNode, lastNode, function (node, nextNodeInRange) {\n        const nodePreviousSibling = node.previousSibling\n        const newNodes = preprocessNode.call(provider, node)\n        if (newNodes) {\n          if (node === firstNode) {\n            firstNode = newNodes[0] || nextNodeInRange\n          }\n          if (node === lastNode) {\n            lastNode = newNodes[newNodes.length - 1] || nodePreviousSibling\n          }\n        }\n      })\n\n      // Because preprocessNode can change the nodes, including the first and last nodes, update continuousNodeArray to match.\n      // We need the full set, including inner nodes, because the unmemoize step might remove the first node (and so the real\n      // first node needs to be in the array).\n      continuousNodeArray.length = 0\n      if (!firstNode) {\n        // preprocessNode might have removed all the nodes, in which case there's nothing left to do\n        return\n      }\n      if (firstNode === lastNode) {\n        continuousNodeArray.push(firstNode)\n      } else {\n        continuousNodeArray.push(firstNode, lastNode)\n        fixUpContinuousNodeArray(continuousNodeArray, parentNode)\n      }\n    }\n\n    // Need to applyBindings *before* unmemoziation, because unmemoization might introduce extra nodes (that we don't want to re-bind)\n    // whereas a regular applyBindings won't introduce new memoized nodes\n    invokeForEachNodeInContinuousRange(firstNode, lastNode, function (node) {\n      if (node.nodeType === Node.ELEMENT_NODE || node.nodeType === Node.COMMENT_NODE) {\n        applyBindings(bindingContext, node).then(afterBindingCallback)\n      }\n    })\n    invokeForEachNodeInContinuousRange(firstNode, lastNode, function (node) {\n      if (node.nodeType === Node.ELEMENT_NODE || node.nodeType === Node.COMMENT_NODE) {\n        memoization.unmemoizeDomNodeAndDescendants(node, [bindingContext])\n      }\n    })\n\n    // Make sure any changes done by applyBindings or unmemoize are reflected in the array\n    fixUpContinuousNodeArray(continuousNodeArray, parentNode)\n  }\n}\n\nfunction getFirstNodeFromPossibleArray(nodeOrNodeArray) {\n  return nodeOrNodeArray.nodeType ? nodeOrNodeArray : nodeOrNodeArray.length > 0 ? nodeOrNodeArray[0] : null\n}\n\nfunction executeTemplate(targetNodeOrNodeArray, renderMode, template, bindingContext, options, afterBindingCallback) {\n  options = options || {}\n  const firstTargetNode = targetNodeOrNodeArray && getFirstNodeFromPossibleArray(targetNodeOrNodeArray)\n  const templateDocument = (firstTargetNode || template || {}).ownerDocument\n  const templateEngineToUse = options.templateEngine || _templateEngine\n  const renderedNodesArray = templateEngineToUse.renderTemplate(template, bindingContext, options, templateDocument)\n\n  // Loosely check result is an array of DOM nodes\n  if (\n    typeof renderedNodesArray.length !== 'number' ||\n    (renderedNodesArray.length > 0 && typeof renderedNodesArray[0].nodeType !== 'number')\n  ) {\n    throw new Error('Template engine must return an array of DOM nodes')\n  }\n\n  let haveAddedNodesToParent = false\n  switch (renderMode) {\n    case 'replaceChildren':\n      virtualElements.setDomNodeChildren(targetNodeOrNodeArray, renderedNodesArray)\n      haveAddedNodesToParent = true\n      break\n    case 'replaceNode':\n      replaceDomNodes(targetNodeOrNodeArray, renderedNodesArray)\n      haveAddedNodesToParent = true\n      break\n    case 'ignoreTargetNode':\n      break\n    default:\n      throw new Error('Unknown renderMode: ' + renderMode)\n  }\n\n  if (haveAddedNodesToParent) {\n    activateBindingsOnContinuousNodeArray(renderedNodesArray, bindingContext, afterBindingCallback)\n    if (options.afterRender) {\n      dependencyDetection.ignore(options.afterRender, null, [renderedNodesArray, bindingContext['$data']])\n    }\n    if (renderMode === 'replaceChildren') {\n      bindingEvent.notify(targetNodeOrNodeArray, bindingEvent.childrenComplete)\n    }\n  }\n\n  return renderedNodesArray\n}\n\nfunction resolveTemplateName(template, data, context) {\n  // The template can be specified as:\n  if (isObservable(template)) {\n    // 1. An observable, with string value\n    return template()\n  } else if (typeof template === 'function') {\n    // 2. A function of (data, context) returning a string\n    return template(data, context)\n  } else {\n    // 3. A string\n    return template\n  }\n}\n\nexport type RenderModeEnum = 'replaceChildren' | 'replaceNode' | 'ignoreTargetNode'\n\nexport function renderTemplate<T = any>(\n  template: string | Node | (() => string | Node),\n  dataOrBindingContext: T | BindingContext<T> | null | undefined,\n  options: TemplateOptions<T> | null | undefined,\n  targetNodeOrNodeArray: Node | Node[],\n  renderMode?: RenderModeEnum,\n  afterBindingCallback?\n): Computed<void> | string {\n  options = options || {}\n  if ((options.templateEngine || _templateEngine) === undefined) {\n    throw new Error('Set a template engine before calling renderTemplate')\n  }\n  renderMode = renderMode || 'replaceChildren'\n\n  if (targetNodeOrNodeArray) {\n    let firstTargetNode = getFirstNodeFromPossibleArray(targetNodeOrNodeArray)\n\n    const whenToDispose = function () {\n      return !firstTargetNode || !domNodeIsAttachedToDocument(firstTargetNode)\n    } // Passive disposal (on next evaluation)\n    const activelyDisposeWhenNodeIsRemoved =\n      firstTargetNode && renderMode === 'replaceNode' ? firstTargetNode.parentNode : firstTargetNode\n\n    return computed(\n      // So the DOM is automatically updated when any dependency changes\n      function () {\n        // Ensure we've got a proper binding context to work with\n        const bindingContext =\n          dataOrBindingContext && dataOrBindingContext instanceof BindingContextConstructor\n            ? dataOrBindingContext\n            : new BindingContextConstructor(dataOrBindingContext, undefined, undefined, undefined, {\n                exportDependencies: true\n              })\n\n        const templateName = resolveTemplateName(template, bindingContext.$data, bindingContext)\n        const renderedNodesArray = executeTemplate(\n          targetNodeOrNodeArray,\n          renderMode,\n          templateName,\n          bindingContext,\n          options,\n          afterBindingCallback\n        )\n\n        if (renderMode === 'replaceNode') {\n          targetNodeOrNodeArray = renderedNodesArray\n          firstTargetNode = getFirstNodeFromPossibleArray(targetNodeOrNodeArray)\n        }\n      },\n      null,\n      { disposeWhen: whenToDispose, disposeWhenNodeIsRemoved: activelyDisposeWhenNodeIsRemoved }\n    )\n  } else {\n    // We don't yet have a DOM node to evaluate, so use a memo and render the template later when there is a DOM node\n    return memoization.memoize(function (domNode) {\n      renderTemplate(template, dataOrBindingContext, options, domNode, 'replaceNode')\n    })\n  }\n}\n\nexport default function renderTemplateForEach(\n  template,\n  arrayOrObservableArray,\n  options,\n  targetNode,\n  parentBindingContext,\n  afterBindingCallback\n) {\n  // Since setDomNodeChildrenFromArrayMapping always calls executeTemplateForArrayItem and then\n  // activateBindingsCallback for added items, we can store the binding context in the former to use in the latter.\n  let arrayItemContext\n\n  // This will be called by setDomNodeChildrenFromArrayMapping to get the nodes to add to targetNode\n  function executeTemplateForArrayItem(arrayValue, index) {\n    // Support selecting template as a function of the data being rendered\n    if (options.as) {\n      if (koOptions.createChildContextWithAs) {\n        arrayItemContext = parentBindingContext.createChildContext(arrayValue, options.as, context => {\n          context.$index = index\n        })\n      } else {\n        arrayItemContext = parentBindingContext.extend({ [options.as]: arrayValue, $index: index })\n      }\n    } else {\n      arrayItemContext = parentBindingContext.createChildContext(arrayValue, options.as, context => {\n        context.$index = index\n      })\n    }\n\n    const templateName = resolveTemplateName(template, arrayValue, arrayItemContext)\n    return executeTemplate(\n      targetNode,\n      'ignoreTargetNode',\n      templateName,\n      arrayItemContext,\n      options,\n      afterBindingCallback\n    )\n  }\n\n  // This will be called whenever setDomNodeChildrenFromArrayMapping has added nodes to targetNode\n  const activateBindingsCallback = function (arrayValue, addedNodesArray /*, index */) {\n    activateBindingsOnContinuousNodeArray(addedNodesArray, arrayItemContext, afterBindingCallback)\n    if (options.afterRender) {\n      options.afterRender(addedNodesArray, arrayValue)\n    }\n\n    // release the \"cache\" variable, so that it can be collected by\n    // the GC when its value isn't used from within the bindings anymore.\n    arrayItemContext = null\n  }\n\n  // Call setDomNodeChildrenFromArrayMapping, ignoring any observables unwrapped within (most likely from a callback function).\n  // If the array items are observables, though, they will be unwrapped in executeTemplateForArrayItem and managed within setDomNodeChildrenFromArrayMapping.\n  function localSetDomNodeChildrenFromArrayMapping(newArray, changeList?) {\n    dependencyDetection.ignore(setDomNodeChildrenFromArrayMapping, null, [\n      targetNode,\n      newArray,\n      executeTemplateForArrayItem,\n      options,\n      activateBindingsCallback,\n      changeList\n    ])\n    bindingEvent.notify(targetNode, bindingEvent.childrenComplete)\n  }\n\n  const shouldHideDestroyed =\n    options.includeDestroyed === false || (koOptions.foreachHidesDestroyed && !options.includeDestroyed)\n  if (!shouldHideDestroyed && !options.beforeRemove && isObservableArray(arrayOrObservableArray)) {\n    localSetDomNodeChildrenFromArrayMapping(arrayOrObservableArray.peek())\n    const subscription = arrayOrObservableArray.subscribe(\n      function (changeList) {\n        localSetDomNodeChildrenFromArrayMapping(arrayOrObservableArray(), changeList)\n      },\n      null,\n      'arrayChange'\n    )\n    subscription.disposeWhenNodeIsRemoved(targetNode)\n    return subscription\n  } else {\n    return computed(\n      function () {\n        let unwrappedArray = unwrap(arrayOrObservableArray) || []\n        const unwrappedIsIterable = Symbol.iterator in unwrappedArray\n        if (!unwrappedIsIterable) {\n          unwrappedArray = [unwrappedArray]\n        }\n        if (shouldHideDestroyed) {\n          // Filter out any entries marked as destroyed\n          unwrappedArray = arrayFilter(unwrappedArray, function (item) {\n            return item === undefined || item === null || !unwrap(item._destroy)\n          })\n        }\n        localSetDomNodeChildrenFromArrayMapping(unwrappedArray)\n      },\n      null,\n      { disposeWhenNodeIsRemoved: targetNode }\n    )\n  }\n}\n\nconst templateComputedDomDataKey = domData.nextKey()\n\nexport class TemplateBindingHandler extends AsyncBindingHandler {\n  constructor(params) {\n    super(params)\n    const element = this.$element\n    const bindingValue = unwrap(this.value)\n\n    // Expose 'conditional' for `else` chaining.\n    domData.set(element, 'conditional', { elseChainSatisfied: observable(true) })\n\n    // Support anonymous templates\n    if (typeof bindingValue === 'string' || bindingValue.name) {\n      this.bindNamedTemplate()\n    } else if ('nodes' in bindingValue) {\n      this.bindNodeTemplate(bindingValue.nodes || [])\n    } else {\n      this.bindAnonymousTemplate()\n    }\n  }\n\n  bindNamedTemplate() {\n    // It's a named template - clear the element\n    virtualElements.emptyNode(this.$element)\n  }\n\n  // We've been given an array of DOM nodes. Save them as the template source.\n  // There is no known use case for the node array being an observable array (if the output\n  // varies, put that behavior *into* your template - that's what templates are for), and\n  // the implementation would be a mess, so assert that it's not observable.\n  bindNodeTemplate(nodes) {\n    if (isObservable(nodes)) {\n      throw new Error('The \"nodes\" option must be a plain, non-observable array.')\n    }\n\n    // If the nodes are already attached to a KO-generated container, we reuse that container without moving the\n    // elements to a new one (we check only the first node, as the nodes are always moved together)\n    let container = nodes[0] && nodes[0].parentNode\n    if (!container || !domData.get(container, cleanContainerDomDataKey)) {\n      container = moveCleanedNodesToContainerElement(nodes)\n      domData.set(container, cleanContainerDomDataKey, true)\n    }\n\n    new AnonymousTemplate(this.$element).nodes(container)\n  }\n\n  bindAnonymousTemplate() {\n    // It's an anonymous template - store the element contents, then clear the element\n    const templateNodes = virtualElements.childNodes(this.$element)\n    if (templateNodes.length === 0) {\n      throw new Error('Anonymous template defined, but no template content was provided.')\n    }\n    const container = moveCleanedNodesToContainerElement(templateNodes) // This also removes the nodes from their current parent\n    new AnonymousTemplate(this.$element).nodes(container)\n  }\n\n  onValueChange() {\n    const element = this.$element\n    const bindingContext = this.$context\n    const value = this.value\n    let options = unwrap(value)\n    let shouldDisplay = true\n    let templateComputed: string | Computed<any> | null = null\n    const elseChainSatisfied = domData.get(element, 'conditional').elseChainSatisfied\n    let templateName\n\n    if (typeof options === 'string') {\n      templateName = value\n      options = {}\n    } else {\n      templateName = options.name\n\n      // Support \"if\"/\"ifnot\" conditions\n      if ('if' in options) {\n        shouldDisplay = unwrap(options.if)\n      }\n\n      if (shouldDisplay && 'ifnot' in options) {\n        shouldDisplay = !unwrap(options.ifnot)\n      }\n    }\n\n    if ('foreach' in options) {\n      // Render once for each data point (treating data set as empty if shouldDisplay==false)\n      const dataArray = (shouldDisplay && options.foreach) || []\n      templateComputed = renderTemplateForEach(\n        templateName || element,\n        dataArray,\n        options,\n        element,\n        bindingContext,\n        this.completeBinding\n      )\n\n      elseChainSatisfied((unwrap(dataArray) || []).length !== 0)\n    } else if (shouldDisplay) {\n      // Render once for this single data point (or use the viewModel if no data was provided)\n      const innerBindingContext =\n        'data' in options\n          ? bindingContext.createStaticChildContext(options.data, options.as) // Given an explicit 'data' value, we create a child binding context for it\n          : bindingContext // Given no explicit 'data' value, we retain the same binding context\n      templateComputed = renderTemplate(\n        templateName || element,\n        innerBindingContext,\n        options,\n        element,\n        undefined,\n        this.completeBinding\n      )\n      elseChainSatisfied(true)\n    } else {\n      virtualElements.emptyNode(element)\n      elseChainSatisfied(false)\n    }\n\n    // It only makes sense to have a single template computed per element (otherwise which one should have its output displayed?)\n    this.disposeOldComputedAndStoreNewOne(element, templateComputed)\n  }\n\n  disposeOldComputedAndStoreNewOne(element, newComputed) {\n    const oldComputed = domData.get(element, templateComputedDomDataKey)\n    if (oldComputed && typeof oldComputed.dispose === 'function') {\n      oldComputed.dispose()\n    }\n    domData.set(\n      element,\n      templateComputedDomDataKey,\n      newComputed && (!newComputed.isActive || newComputed.isActive()) ? newComputed : undefined\n    )\n  }\n\n  override get controlsDescendants() {\n    return true\n  }\n  static override get allowVirtualElements() {\n    return true\n  }\n}\n", "import { TemplateForEachBindingHandler } from './foreach'\n\nimport { TemplateBindingHandler } from './templating'\n//    'let': letBinding,\n//    template: template,\n\nexport const bindings = { foreach: TemplateForEachBindingHandler, template: TemplateBindingHandler }\n\nexport * from './nativeTemplateEngine'\nexport * from './templateEngine'\nexport * from './templating'\nexport * from './templateSources'\n"],
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,qBAA6B;;;ACA7B,IAAAC,gBAA6C;;;AC2B7C,IAAAC,gBAAgC;;;ACHhC,mBAA4F;AAK5F,IAAM,iBAAiB;AAAvB,IACE,mBAAmB;AADrB,IAEE,mBAAmB;AAFrB,IAGE,kBAAkB;AAHpB,IAIE,oBAAoB;AAgBtB,IAAM,oBAAoB,qBAAQ,QAAQ,IAAI;AAC9C,IAAM,sBAAsB,qBAAQ,QAAQ;AAC5C,SAAS,mBAAmB,SAAS;AACnC,SAAO,qBAAQ,IAAI,SAAS,mBAAmB,KAAK,CAAC;AACvD;AACA,SAAS,mBAAmB,SAAS,MAAM;AACzC,uBAAQ,IAAI,SAAS,qBAAqB,IAAI;AAChD;AAEO,IAAM,aAAN,MAA2C;AAAA,EAIhD,YAAY,SAA4B;AAHxC,wBAAU;AACV,wBAAU;AAGR,SAAK,aAAa;AAElB,QAAI,QAAQ,aAAa,KAAK,cAAc;AAC1C,WAAK,eAAe;AAAA,IACtB,OAAO;AACL,YAAM,mBAAe,aAAAC,cAAe,KAAK,UAAqB;AAC9D,WAAK,eACH,iBAAiB,WACb,iBACA,iBAAiB,aACf;AAAA;AAAA,QAEA,gBAAgB,cACb,QAAgC,WAChC,QAAgC,QAAQ,aAAa,KAAK,yBAC3D,mBACA;AAAA;AAAA,IACZ;AAAA,EACF;AAAA,EAIA,KAAK,cAAsC;AACzC,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Ae;AACjB,eAAO,yBAAU,cAAc,UAAU,IAAI,EAAE,UAAU;AAAA,EAC3D,OAAO;AACL,UAAM,eAAe,eAAe,KAAK;AACzC,eAAO,iCAAkB,cAAc,gBAAgB;AAAA,EACzD;AACF;AAEA,qBAAqB,WAAW,IAAI,qBAAqB;AACzD,kBAAkB,qBAAqB,QAAQ;;;ADnBxC,IAAM,gCAAN,cAA4C,uBAAuB;AAAA,EACxE,IAAa,QAAQ;AACnB,UAAM,aAAa,KAAK,cAAc;AACtC,UAAM,qBAAiB,yBAAK,UAAU;AAKtC,QAAI,CAAC,kBAAkB,OAAO,eAAe,WAAW,UAAU;AAChE,aAAO,EAAE,SAAS,YAAY,gBAAgB,qBAAqB,SAAS;AAAA,IAC9E;AAGA,mCAAO,UAAU;AACjB,WAAO;AAAA,MACL,SAAS,eAAe;AAAA,MACxB,IAAI,eAAe;AAAA,MACnB,kBAAkB,eAAe;AAAA,MACjC,UAAU,eAAe;AAAA,MACzB,cAAc,eAAe;AAAA,MAC7B,aAAa,eAAe;AAAA,MAC5B,YAAY,eAAe;AAAA,MAC3B,WAAW,eAAe;AAAA,MAC1B,gBAAgB,qBAAqB;AAAA,IACvC;AAAA,EACF;AACF;;;AK5BO,IAAM,WAAW,EAAE,SAAS,+BAA+B,UAAU,uBAAuB;",
  "names": ["import_observable", "import_utils", "import_utils", "tagNameLowerFn", "options", "import_utils", "koOptions", "options", "BindingContextConstructor", "options"]
}
