{"version":3,"file":"cdk-internals-scheduler.mjs","sources":["../../../../libs/cdk/internals/scheduler/src/lib/schedulerMinHeap.ts","../../../../libs/cdk/internals/scheduler/src/lib/scheduler.ts","../../../../libs/cdk/internals/scheduler/src/cdk-internals-scheduler.ts"],"sourcesContent":["import { PriorityLevel } from './schedulerPriorities';\n\ntype Heap = Array<ReactSchedulerTask>;\n\nexport interface SchedulerTaskZone {\n  run<T>(fn: (...args: any[]) => T): T;\n}\n\nexport interface ReactSchedulerTask {\n  id: number;\n  sortIndex: number;\n  callback: Function;\n  priorityLevel: PriorityLevel;\n  startTime: number;\n  expirationTime: number;\n  isQueued?: boolean;\n  ngZone?: SchedulerTaskZone;\n}\n\nexport function push(heap: Heap, node: ReactSchedulerTask): void {\n  const index = heap.length;\n  heap.push(node);\n  siftUp(heap, node, index);\n}\n\nexport function peek(heap: Heap): ReactSchedulerTask | null {\n  const first = heap[0];\n  return first === undefined ? null : first;\n}\n\nexport function pop(heap: Heap): ReactSchedulerTask | null {\n  const first = heap[0];\n  if (first !== undefined) {\n    const last = heap.pop();\n    if (last !== first) {\n      heap[0] = last;\n      siftDown(heap, last, 0);\n    }\n    return first;\n  } else {\n    return null;\n  }\n}\n\nfunction siftUp(heap, node, i) {\n  let index = i;\n  // eslint-disable-next-line no-constant-condition\n  while (true) {\n    const parentIndex = (index - 1) >>> 1;\n    const parent = heap[parentIndex];\n    if (parent !== undefined && compare(parent, node) > 0) {\n      // The parent is larger. Swap positions.\n      heap[parentIndex] = node;\n      heap[index] = parent;\n      index = parentIndex;\n    } else {\n      // The parent is smaller. Exit.\n      return;\n    }\n  }\n}\n\nfunction siftDown(heap, node, i) {\n  let index = i;\n  const length = heap.length;\n  while (index < length) {\n    const leftIndex = (index + 1) * 2 - 1;\n    const left = heap[leftIndex];\n    const rightIndex = leftIndex + 1;\n    const right = heap[rightIndex];\n\n    // If the left or right node is smaller, swap with the smaller of those.\n    if (left !== undefined && compare(left, node) < 0) {\n      if (right !== undefined && compare(right, left) < 0) {\n        heap[index] = right;\n        heap[rightIndex] = node;\n        index = rightIndex;\n      } else {\n        heap[index] = left;\n        heap[leftIndex] = node;\n        index = leftIndex;\n      }\n    } else if (right !== undefined && compare(right, node) < 0) {\n      heap[index] = right;\n      heap[rightIndex] = node;\n      index = rightIndex;\n    } else {\n      // Neither child is smaller. Exit.\n      return;\n    }\n  }\n}\n\nfunction compare(a, b) {\n  // Compare sort index first, then task id.\n  const diff = a.sortIndex - b.sortIndex;\n  return diff !== 0 ? diff : a.id - b.id;\n}\n","// see https://github.com/facebook/react/blob/main/packages/scheduler/src/forks/Scheduler.js\n\nimport { ɵglobal } from '@angular/core';\nimport {\n  peek,\n  pop,\n  push,\n  ReactSchedulerTask,\n  SchedulerTaskZone,\n} from './schedulerMinHeap';\nimport { PriorityLevel } from './schedulerPriorities';\n\n/**\n * @description Will be provided through Terser global definitions by Angular CLI\n * during the production build.\n */\ndeclare const ngDevMode: boolean;\n\nlet getCurrentTime: () => number;\nconst hasPerformanceNow =\n  typeof ɵglobal.performance === 'object' &&\n  typeof ɵglobal.performance.now === 'function';\n\nif (hasPerformanceNow) {\n  const localPerformance = ɵglobal.performance;\n  getCurrentTime = () => localPerformance.now();\n} else {\n  const localDate = Date;\n  const initialTime = localDate.now();\n  getCurrentTime = () => localDate.now() - initialTime;\n}\n\n// Max 31 bit integer. The max integer size in V8 for 32-bit systems.\n// Math.pow(2, 30) - 1\n// 0b111111111111111111111111111111\nconst maxSigned31BitInt = 1073741823;\n\n// Times out immediately\nconst IMMEDIATE_PRIORITY_TIMEOUT = -1;\n// Eventually times out\nconst USER_BLOCKING_PRIORITY_TIMEOUT = 250;\nconst NORMAL_PRIORITY_TIMEOUT = 5000;\nconst LOW_PRIORITY_TIMEOUT = 10000;\n// Never times out\nconst IDLE_PRIORITY_TIMEOUT = maxSigned31BitInt;\n\n// Tasks are stored on a min heap\nconst taskQueue = [];\nconst timerQueue = [];\n\n// Incrementing id counter. Used to maintain insertion order.\nlet taskIdCounter = 1;\n\nlet currentTask: ReactSchedulerTask = null;\nlet currentPriorityLevel = PriorityLevel.NormalPriority;\n\n// This is set while performing work, to prevent re-entrancy.\nlet isPerformingWork = false;\n\nlet isHostCallbackScheduled = false;\nlet isHostTimeoutScheduled = false;\n\n// Capture local references to native APIs, in case a polyfill overrides them.\nconst setTimeout = ɵglobal.setTimeout;\nconst clearTimeout = ɵglobal.clearTimeout;\nconst setImmediate = ɵglobal.setImmediate; // IE and Node.js + jsdom\nconst messageChannel = ɵglobal.MessageChannel;\n\nconst defaultZone = {\n  run: (fn) => fn(),\n};\n\nfunction advanceTimers(currentTime) {\n  // Check for tasks that are no longer delayed and add them to the queue.\n  let timer = peek(timerQueue);\n  while (timer !== null) {\n    if (timer.callback === null) {\n      // Timer was cancelled.\n      pop(timerQueue);\n    } else if (timer.startTime <= currentTime) {\n      // Timer fired. Transfer to the task queue.\n      pop(timerQueue);\n      timer.sortIndex = timer.expirationTime;\n      push(taskQueue, timer);\n    } else {\n      // Remaining timers are pending.\n      return;\n    }\n    timer = peek(timerQueue);\n  }\n}\n\nfunction handleTimeout(currentTime) {\n  isHostTimeoutScheduled = false;\n  advanceTimers(currentTime);\n\n  if (!isHostCallbackScheduled) {\n    if (peek(taskQueue) !== null) {\n      isHostCallbackScheduled = true;\n      requestHostCallback(flushWork);\n    } else {\n      const firstTimer = peek(timerQueue);\n      if (firstTimer !== null) {\n        requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime);\n      }\n    }\n  }\n}\n\nfunction flushWork(hasTimeRemaining, initialTime) {\n  // We'll need a host callback the next time work is scheduled.\n  isHostCallbackScheduled = false;\n  if (isHostTimeoutScheduled) {\n    // We scheduled a timeout but it's no longer needed. Cancel it.\n    isHostTimeoutScheduled = false;\n    cancelHostTimeout();\n  }\n\n  isPerformingWork = true;\n  const previousPriorityLevel = currentPriorityLevel;\n  try {\n    return workLoop(hasTimeRemaining, initialTime);\n  } finally {\n    currentTask = null;\n    currentPriorityLevel = previousPriorityLevel;\n    isPerformingWork = false;\n  }\n}\n\nfunction workLoop(\n  hasTimeRemaining: boolean,\n  initialTime: number,\n  _currentTask?: ReactSchedulerTask,\n) {\n  let currentTime = initialTime;\n  if (_currentTask) {\n    currentTask = _currentTask;\n  } else {\n    advanceTimers(currentTime);\n    currentTask = peek(taskQueue);\n  }\n  let zoneChanged = false;\n  const hitDeadline = () =>\n    currentTask &&\n    currentTask.expirationTime > currentTime &&\n    (!hasTimeRemaining || shouldYieldToHost());\n\n  if (!hitDeadline()) {\n    const ngZone = currentTask.ngZone || defaultZone;\n    ngZone.run(() => {\n      while (currentTask !== null && !zoneChanged) {\n        if (hitDeadline()) {\n          break;\n        }\n        const callback = currentTask.callback;\n        if (typeof callback === 'function') {\n          currentTask.callback = null;\n          currentPriorityLevel = currentTask.priorityLevel;\n          const didUserCallbackTimeout =\n            currentTask.expirationTime <= currentTime;\n          const continuationCallback = callback(didUserCallbackTimeout);\n          currentTime = getCurrentTime();\n          if (typeof continuationCallback === 'function') {\n            currentTask.callback = continuationCallback;\n          } else {\n            if (currentTask === peek(taskQueue)) {\n              pop(taskQueue);\n            }\n          }\n          advanceTimers(currentTime);\n        } else {\n          pop(taskQueue);\n        }\n        currentTask = peek(taskQueue);\n        zoneChanged =\n          currentTask?.ngZone != null && currentTask.ngZone !== ngZone;\n      }\n    });\n  }\n  // we need to check if leaving `NgZone` (tick => detectChanges) caused other\n  // directives to add tasks to the queue. If there is one and we still didn't\n  // hit the deadline, run the workLoop again in order to flush everything thats\n  // left.\n  // Otherwise, newly added tasks won't run as `performingWork` is still `true`\n  currentTask = currentTask ?? peek(taskQueue);\n  // We should also re-calculate the currentTime, as we need to account for the execution\n  // time of the NgZone tasks as well.\n  // If there is still a task in the queue, but no time is left for executing it,\n  // the scheduler will re-schedule the next tick anyway\n  currentTime = getCurrentTime();\n  if (zoneChanged || (currentTask && !hitDeadline())) {\n    return workLoop(hasTimeRemaining, currentTime, currentTask);\n  }\n  // Return whether there's additional work\n  if (currentTask !== null) {\n    return true;\n  } else {\n    const firstTimer = peek(timerQueue);\n    if (firstTimer !== null) {\n      requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime);\n    }\n    return false;\n  }\n}\n\ninterface ScheduleCallbackOptions {\n  delay?: number;\n  ngZone?: SchedulerTaskZone;\n}\n\nexport function scheduleCallback(\n  priorityLevel: PriorityLevel,\n  callback: VoidFunction,\n  options?: ScheduleCallbackOptions,\n): ReactSchedulerTask {\n  const currentTime = getCurrentTime();\n\n  let startTime: number;\n  if (typeof options === 'object' && options !== null) {\n    const delay = options.delay;\n    if (typeof delay === 'number' && delay > 0) {\n      startTime = currentTime + delay;\n    } else {\n      startTime = currentTime;\n    }\n  } else {\n    startTime = currentTime;\n  }\n\n  let timeout: number;\n  switch (priorityLevel) {\n    case PriorityLevel.ImmediatePriority:\n      timeout = IMMEDIATE_PRIORITY_TIMEOUT;\n      break;\n    case PriorityLevel.UserBlockingPriority:\n      timeout = USER_BLOCKING_PRIORITY_TIMEOUT;\n      break;\n    case PriorityLevel.IdlePriority:\n      timeout = IDLE_PRIORITY_TIMEOUT;\n      break;\n    case PriorityLevel.LowPriority:\n      timeout = LOW_PRIORITY_TIMEOUT;\n      break;\n    case PriorityLevel.NormalPriority:\n    default:\n      timeout = NORMAL_PRIORITY_TIMEOUT;\n      break;\n  }\n\n  const expirationTime = startTime + timeout;\n\n  const newTask: ReactSchedulerTask = {\n    id: taskIdCounter++,\n    callback,\n    priorityLevel,\n    startTime,\n    expirationTime,\n    sortIndex: -1,\n    ngZone: options?.ngZone || null,\n  };\n\n  if (startTime > currentTime) {\n    // This is a delayed task.\n    newTask.sortIndex = startTime;\n    push(timerQueue, newTask);\n    if (peek(taskQueue) === null && newTask === peek(timerQueue)) {\n      // All tasks are delayed, and this is the task with the earliest delay.\n      if (isHostTimeoutScheduled) {\n        // Cancel an existing timeout.\n        cancelHostTimeout();\n      } else {\n        isHostTimeoutScheduled = true;\n      }\n      // Schedule a timeout.\n      requestHostTimeout(handleTimeout, startTime - currentTime);\n    }\n  } else {\n    newTask.sortIndex = expirationTime;\n    push(taskQueue, newTask);\n    // Schedule a host callback, if needed. If we're already performing work,\n    // wait until the next time we yield.\n    if (!isHostCallbackScheduled && !isPerformingWork) {\n      isHostCallbackScheduled = true;\n      requestHostCallback(flushWork);\n    }\n  }\n\n  return newTask;\n}\n\nexport function cancelCallback(task) {\n  // Null out the callback to indicate the task has been canceled. (Can't\n  // remove from the queue because you can't remove arbitrary nodes from an\n  // array based heap, only the first one.)\n  task.callback = null;\n}\n\nlet isMessageLoopRunning = false;\nlet scheduledHostCallback = null;\nlet taskTimeoutID = -1;\n\n// Scheduler periodically yields in case there is other work on the main\n// thread, like user events. By default, it yields multiple times per frame.\n// It does not attempt to align with frame boundaries, since most tasks don't\n// need to be frame aligned; for those that do, use requestAnimationFrame.\nlet yieldInterval = 16;\nlet needsPaint = false;\nlet queueStartTime = -1;\n\nfunction shouldYieldToHost() {\n  if (needsPaint) {\n    // There's a pending paint (signaled by `requestPaint`). Yield now.\n    return true;\n  }\n  const timeElapsed = getCurrentTime() - queueStartTime;\n  if (timeElapsed < yieldInterval) {\n    // The main thread has only been blocked for a really short amount of time;\n    // smaller than a single frame. Don't yield yet.\n    return false;\n  }\n\n  // `isInputPending` isn't available. Yield now.\n  return true;\n}\n\nfunction requestPaint() {\n  needsPaint = true;\n}\n\nexport function forceFrameRate(fps) {\n  if (fps < 0 || fps > 125) {\n    if (typeof ngDevMode === 'undefined' || ngDevMode) {\n      console.error(\n        'forceFrameRate takes a positive int between 0 and 125, ' +\n          'forcing frame rates higher than 125 fps is not supported',\n      );\n    }\n    return;\n  }\n  if (fps > 0) {\n    yieldInterval = Math.floor(1000 / fps);\n  } else {\n    // reset the framerate\n    yieldInterval = 5;\n  }\n  // be aware of browser housekeeping work (~6ms per frame)\n  // according to https://developers.google.com/web/fundamentals/performance/rendering\n  yieldInterval = Math.max(5, yieldInterval - 6);\n}\n\nconst performWorkUntilDeadline = () => {\n  if (scheduledHostCallback !== null) {\n    const currentTime = getCurrentTime();\n    // Yield after `yieldInterval` ms, regardless of where we are in the vsync\n    // cycle. This means there's always time remaining at the beginning of\n    // the message event.\n    queueStartTime = currentTime;\n    const hasTimeRemaining = true;\n\n    // If a scheduler task throws, exit the current browser task so the\n    // error can be observed.\n    //\n    // Intentionally not using a try-catch, since that makes some debugging\n    // techniques harder. Instead, if `scheduledHostCallback` errors, then\n    // `hasMoreWork` will remain true, and we'll continue the work loop.\n    let hasMoreWork = true;\n    try {\n      hasMoreWork = scheduledHostCallback(hasTimeRemaining, currentTime);\n    } finally {\n      if (hasMoreWork) {\n        // If there's more work, schedule the next message event at the end\n        // of the preceding one.\n        schedulePerformWorkUntilDeadline();\n      } else {\n        isMessageLoopRunning = false;\n        scheduledHostCallback = null;\n      }\n    }\n  } else {\n    isMessageLoopRunning = false;\n  }\n  // Yielding to the browser will give it a chance to paint, so we can\n  // reset this.\n  needsPaint = false;\n};\n\nlet schedulePerformWorkUntilDeadline;\nif (typeof setImmediate === 'function') {\n  // Node.js and old IE.\n  // There's a few reasons for why we prefer setImmediate.\n  //\n  // Unlike MessageChannel, it doesn't prevent a Node.js process from exiting.\n  // (Even though this is a DOM fork of the Scheduler, you could get here\n  // with a mix of Node.js 15+, which has a MessageChannel, and jsdom.)\n  // https://github.com/facebook/react/issues/20756\n  //\n  // But also, it runs earlier which is the semantic we want.\n  // If other browsers ever implement it, it's better to use it.\n  // Although both of these would be inferior to native scheduling.\n  schedulePerformWorkUntilDeadline = () => {\n    setImmediate(performWorkUntilDeadline);\n  };\n} else if (typeof messageChannel !== 'undefined') {\n  const channel: MessageChannel = new messageChannel();\n  const port = channel.port2;\n\n  channel.port1.onmessage = performWorkUntilDeadline;\n  schedulePerformWorkUntilDeadline = () => {\n    port.postMessage(null);\n  };\n} else {\n  // We should only fallback here in non-browser environments.\n  schedulePerformWorkUntilDeadline = () => {\n    setTimeout(performWorkUntilDeadline, 0);\n  };\n}\n\nfunction requestHostCallback(callback) {\n  scheduledHostCallback = callback;\n  if (!isMessageLoopRunning) {\n    isMessageLoopRunning = true;\n    schedulePerformWorkUntilDeadline();\n  }\n}\n\nfunction requestHostTimeout(callback, ms) {\n  taskTimeoutID = setTimeout(() => {\n    callback(getCurrentTime());\n  }, ms);\n}\n\nfunction cancelHostTimeout() {\n  clearTimeout(taskTimeoutID);\n  taskTimeoutID = -1;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["ɵglobal"],"mappings":";;AAmBgB,SAAA,IAAI,CAAC,IAAU,EAAE,IAAwB,EAAA;AACvD,IAAA,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM;AACzB,IAAA,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AACf,IAAA,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC;AAC3B;AAEM,SAAU,IAAI,CAAC,IAAU,EAAA;AAC7B,IAAA,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC;IACrB,OAAO,KAAK,KAAK,SAAS,GAAG,IAAI,GAAG,KAAK;AAC3C;AAEM,SAAU,GAAG,CAAC,IAAU,EAAA;AAC5B,IAAA,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC;AACrB,IAAA,IAAI,KAAK,KAAK,SAAS,EAAE;AACvB,QAAA,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE;AACvB,QAAA,IAAI,IAAI,KAAK,KAAK,EAAE;AAClB,YAAA,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI;AACd,YAAA,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;;AAEzB,QAAA,OAAO,KAAK;;SACP;AACL,QAAA,OAAO,IAAI;;AAEf;AAEA,SAAS,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,EAAA;IAC3B,IAAI,KAAK,GAAG,CAAC;;IAEb,OAAO,IAAI,EAAE;QACX,MAAM,WAAW,GAAG,CAAC,KAAK,GAA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