Best JavaScript code snippet using playwright-internal
browser.js
Source:browser.js  
...1577      }1578      return ret;1579  }1580  let shouldCacheAccess = true;1581  function resolveMergedOptions(instance) {1582      const raw = instance.type;1583      const { __merged, mixins, extends: extendsOptions } = raw;1584      if (__merged)1585          return __merged;1586      const globalMixins = instance.appContext.mixins;1587      if (!globalMixins.length && !mixins && !extendsOptions)1588          return raw;1589      const options = {};1590      globalMixins.forEach(m => mergeOptions(options, m, instance));1591      mergeOptions(options, raw, instance);1592      return (raw.__merged = options);1593  }1594  function mergeOptions(to, from, instance) {1595      const strats = instance.appContext.config.optionMergeStrategies;1596      const { mixins, extends: extendsOptions } = from;1597      extendsOptions && mergeOptions(to, extendsOptions, instance);1598      mixins &&1599          mixins.forEach((m) => mergeOptions(to, m, instance));1600      for (const key in from) {1601          if (strats && hasOwn(strats, key)) {1602              to[key] = strats[key](to[key], from[key], instance.proxy, key);1603          }1604          else {1605              to[key] = from[key];1606          }1607      }1608  }1609  /**1610   * #2437 In Vue 3, functional components do not have a public instance proxy but1611   * they exist in the internal parent chain. For code that relies on traversing1612   * public $parent chains, skip functional ones and go to the parent instead.1613   */1614  const getPublicInstance = (i) => {1615      if (!i)1616          return null;1617      if (isStatefulComponent(i))1618          return i.exposed ? i.exposed : i.proxy;1619      return getPublicInstance(i.parent);1620  };1621  const publicPropertiesMap = extend(Object.create(null), {1622      $: i => i,1623      $el: i => i.vnode.el,1624      $data: i => i.data,1625      $props: i => (i.props),1626      $attrs: i => (i.attrs),1627      $slots: i => (i.slots),1628      $refs: i => (i.refs),1629      $parent: i => getPublicInstance(i.parent),1630      $root: i => getPublicInstance(i.root),1631      $emit: i => i.emit,1632      $options: i => (__VUE_OPTIONS_API__ ? resolveMergedOptions(i) : i.type),1633      $forceUpdate: i => () => queueJob(i.update),1634      $nextTick: i => nextTick.bind(i.proxy),1635      $watch: i => (__VUE_OPTIONS_API__ ? instanceWatch.bind(i) : NOOP)1636  });1637  const PublicInstanceProxyHandlers = {1638      get({ _: instance }, key) {1639          const { ctx, setupState, data, props, accessCache, type, appContext } = instance;1640          // let @vue/reactivity know it should never observe Vue public instances.1641          if (key === "__v_skip" /* SKIP */) {1642              return true;1643          }1644          // data / props / ctx1645          // This getter gets called for every property access on the render context1646          // during render and is a major hotspot. The most expensive part of this
...Navigation.es.js
Source:Navigation.es.js  
...842  } else {843    queuePostFlushCb(fn);844  }845}846function resolveMergedOptions(instance) {847  const base = instance.type;848  const { mixins, extends: extendsOptions } = base;849  const { mixins: globalMixins, optionsCache: cache, config: { optionMergeStrategies } } = instance.appContext;850  const cached = cache.get(base);851  let resolved;852  if (cached) {853    resolved = cached;854  } else if (!globalMixins.length && !mixins && !extendsOptions) {855    {856      resolved = base;857    }858  } else {859    resolved = {};860    if (globalMixins.length) {861      globalMixins.forEach((m) => mergeOptions(resolved, m, optionMergeStrategies, true));862    }863    mergeOptions(resolved, base, optionMergeStrategies);864  }865  cache.set(base, resolved);866  return resolved;867}868function mergeOptions(to, from, strats, asMixin = false) {869  const { mixins, extends: extendsOptions } = from;870  if (extendsOptions) {871    mergeOptions(to, extendsOptions, strats, true);872  }873  if (mixins) {874    mixins.forEach((m) => mergeOptions(to, m, strats, true));875  }876  for (const key in from) {877    if (asMixin && key === "expose")878      ;879    else {880      const strat = internalOptionMergeStrats[key] || strats && strats[key];881      to[key] = strat ? strat(to[key], from[key]) : from[key];882    }883  }884  return to;885}886const internalOptionMergeStrats = {887  data: mergeDataFn,888  props: mergeObjectOptions,889  emits: mergeObjectOptions,890  methods: mergeObjectOptions,891  computed: mergeObjectOptions,892  beforeCreate: mergeAsArray,893  created: mergeAsArray,894  beforeMount: mergeAsArray,895  mounted: mergeAsArray,896  beforeUpdate: mergeAsArray,897  updated: mergeAsArray,898  beforeDestroy: mergeAsArray,899  beforeUnmount: mergeAsArray,900  destroyed: mergeAsArray,901  unmounted: mergeAsArray,902  activated: mergeAsArray,903  deactivated: mergeAsArray,904  errorCaptured: mergeAsArray,905  serverPrefetch: mergeAsArray,906  components: mergeObjectOptions,907  directives: mergeObjectOptions,908  watch: mergeWatchOptions,909  provide: mergeDataFn,910  inject: mergeInject911};912function mergeDataFn(to, from) {913  if (!from) {914    return to;915  }916  if (!to) {917    return from;918  }919  return function mergedDataFn() {920    return extend(isFunction(to) ? to.call(this, this) : to, isFunction(from) ? from.call(this, this) : from);921  };922}923function mergeInject(to, from) {924  return mergeObjectOptions(normalizeInject(to), normalizeInject(from));925}926function normalizeInject(raw) {927  if (isArray(raw)) {928    const res = {};929    for (let i = 0; i < raw.length; i++) {930      res[raw[i]] = raw[i];931    }932    return res;933  }934  return raw;935}936function mergeAsArray(to, from) {937  return to ? [...new Set([].concat(to, from))] : from;938}939function mergeObjectOptions(to, from) {940  return to ? extend(extend(Object.create(null), to), from) : from;941}942function mergeWatchOptions(to, from) {943  if (!to)944    return from;945  if (!from)946    return to;947  const merged = extend(Object.create(null), to);948  for (const key in from) {949    merged[key] = mergeAsArray(to[key], from[key]);950  }951  return merged;952}953const queuePostRenderEffect = queueEffectWithSuspense;954const isTeleport = (type) => type.__isTeleport;955const NULL_DYNAMIC_COMPONENT = Symbol();956const Fragment = Symbol(void 0);957const Text = Symbol(void 0);958const Comment = Symbol(void 0);959const blockStack = [];960let currentBlock = null;961function openBlock(disableTracking = false) {962  blockStack.push(currentBlock = disableTracking ? null : []);963}964function closeBlock() {965  blockStack.pop();966  currentBlock = blockStack[blockStack.length - 1] || null;967}968function setupBlock(vnode) {969  vnode.dynamicChildren = currentBlock || EMPTY_ARR;970  closeBlock();971  if (currentBlock) {972    currentBlock.push(vnode);973  }974  return vnode;975}976function createElementBlock(type, props, children, patchFlag, dynamicProps, shapeFlag) {977  return setupBlock(createBaseVNode(type, props, children, patchFlag, dynamicProps, shapeFlag, true));978}979function createBlock(type, props, children, patchFlag, dynamicProps) {980  return setupBlock(createVNode(type, props, children, patchFlag, dynamicProps, true));981}982function isVNode(value) {983  return value ? value.__v_isVNode === true : false;984}985const InternalObjectKey = `__vInternal`;986const normalizeKey = ({ key }) => key != null ? key : null;987const normalizeRef = ({ ref: ref2, ref_key, ref_for }) => {988  return ref2 != null ? isString(ref2) || isRef(ref2) || isFunction(ref2) ? { i: currentRenderingInstance, r: ref2, k: ref_key, f: !!ref_for } : ref2 : null;989};990function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {991  const vnode = {992    __v_isVNode: true,993    __v_skip: true,994    type,995    props,996    key: props && normalizeKey(props),997    ref: props && normalizeRef(props),998    scopeId: currentScopeId,999    slotScopeIds: null,1000    children,1001    component: null,1002    suspense: null,1003    ssContent: null,1004    ssFallback: null,1005    dirs: null,1006    transition: null,1007    el: null,1008    anchor: null,1009    target: null,1010    targetAnchor: null,1011    staticCount: 0,1012    shapeFlag,1013    patchFlag,1014    dynamicProps,1015    dynamicChildren: null,1016    appContext: null1017  };1018  if (needFullChildrenNormalization) {1019    normalizeChildren(vnode, children);1020    if (shapeFlag & 128) {1021      type.normalize(vnode);1022    }1023  } else if (children) {1024    vnode.shapeFlag |= isString(children) ? 8 : 16;1025  }1026  if (!isBlockNode && currentBlock && (vnode.patchFlag > 0 || shapeFlag & 6) && vnode.patchFlag !== 32) {1027    currentBlock.push(vnode);1028  }1029  return vnode;1030}1031const createVNode = _createVNode;1032function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {1033  if (!type || type === NULL_DYNAMIC_COMPONENT) {1034    type = Comment;1035  }1036  if (isVNode(type)) {1037    const cloned = cloneVNode(type, props, true);1038    if (children) {1039      normalizeChildren(cloned, children);1040    }1041    return cloned;1042  }1043  if (isClassComponent(type)) {1044    type = type.__vccOpts;1045  }1046  if (props) {1047    props = guardReactiveProps(props);1048    let { class: klass, style } = props;1049    if (klass && !isString(klass)) {1050      props.class = normalizeClass(klass);1051    }1052    if (isObject(style)) {1053      if (isProxy(style) && !isArray(style)) {1054        style = extend({}, style);1055      }1056      props.style = normalizeStyle(style);1057    }1058  }1059  const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0;1060  return createBaseVNode(type, props, children, patchFlag, dynamicProps, shapeFlag, isBlockNode, true);1061}1062function guardReactiveProps(props) {1063  if (!props)1064    return null;1065  return isProxy(props) || InternalObjectKey in props ? extend({}, props) : props;1066}1067function cloneVNode(vnode, extraProps, mergeRef = false) {1068  const { props, ref: ref2, patchFlag, children } = vnode;1069  const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;1070  const cloned = {1071    __v_isVNode: true,1072    __v_skip: true,1073    type: vnode.type,1074    props: mergedProps,1075    key: mergedProps && normalizeKey(mergedProps),1076    ref: extraProps && extraProps.ref ? mergeRef && ref2 ? isArray(ref2) ? ref2.concat(normalizeRef(extraProps)) : [ref2, normalizeRef(extraProps)] : normalizeRef(extraProps) : ref2,1077    scopeId: vnode.scopeId,1078    slotScopeIds: vnode.slotScopeIds,1079    children,1080    target: vnode.target,1081    targetAnchor: vnode.targetAnchor,1082    staticCount: vnode.staticCount,1083    shapeFlag: vnode.shapeFlag,1084    patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag,1085    dynamicProps: vnode.dynamicProps,1086    dynamicChildren: vnode.dynamicChildren,1087    appContext: vnode.appContext,1088    dirs: vnode.dirs,1089    transition: vnode.transition,1090    component: vnode.component,1091    suspense: vnode.suspense,1092    ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),1093    ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),1094    el: vnode.el,1095    anchor: vnode.anchor1096  };1097  return cloned;1098}1099function createTextVNode(text = " ", flag = 0) {1100  return createVNode(Text, null, text, flag);1101}1102function createCommentVNode(text = "", asBlock = false) {1103  return asBlock ? (openBlock(), createBlock(Comment, null, text)) : createVNode(Comment, null, text);1104}1105function normalizeChildren(vnode, children) {1106  let type = 0;1107  const { shapeFlag } = vnode;1108  if (children == null) {1109    children = null;1110  } else if (isArray(children)) {1111    type = 16;1112  } else if (typeof children === "object") {1113    if (shapeFlag & (1 | 64)) {1114      const slot = children.default;1115      if (slot) {1116        slot._c && (slot._d = false);1117        normalizeChildren(vnode, slot());1118        slot._c && (slot._d = true);1119      }1120      return;1121    } else {1122      type = 32;1123      const slotFlag = children._;1124      if (!slotFlag && !(InternalObjectKey in children)) {1125        children._ctx = currentRenderingInstance;1126      } else if (slotFlag === 3 && currentRenderingInstance) {1127        if (currentRenderingInstance.slots._ === 1) {1128          children._ = 1;1129        } else {1130          children._ = 2;1131          vnode.patchFlag |= 1024;1132        }1133      }1134    }1135  } else if (isFunction(children)) {1136    children = { default: children, _ctx: currentRenderingInstance };1137    type = 32;1138  } else {1139    children = String(children);1140    if (shapeFlag & 64) {1141      type = 16;1142      children = [createTextVNode(children)];1143    } else {1144      type = 8;1145    }1146  }1147  vnode.children = children;1148  vnode.shapeFlag |= type;1149}1150function mergeProps(...args) {1151  const ret = {};1152  for (let i = 0; i < args.length; i++) {1153    const toMerge = args[i];1154    for (const key in toMerge) {1155      if (key === "class") {1156        if (ret.class !== toMerge.class) {1157          ret.class = normalizeClass([ret.class, toMerge.class]);1158        }1159      } else if (key === "style") {1160        ret.style = normalizeStyle([ret.style, toMerge.style]);1161      } else if (isOn(key)) {1162        const existing = ret[key];1163        const incoming = toMerge[key];1164        if (existing !== incoming && !(isArray(existing) && existing.includes(incoming))) {1165          ret[key] = existing ? [].concat(existing, incoming) : incoming;1166        }1167      } else if (key !== "") {1168        ret[key] = toMerge[key];1169      }1170    }1171  }1172  return ret;1173}1174function renderList(source, renderItem, cache, index) {1175  let ret;1176  const cached = cache && cache[index];1177  if (isArray(source) || isString(source)) {1178    ret = new Array(source.length);1179    for (let i = 0, l = source.length; i < l; i++) {1180      ret[i] = renderItem(source[i], i, void 0, cached && cached[i]);1181    }1182  } else if (typeof source === "number") {1183    ret = new Array(source);1184    for (let i = 0; i < source; i++) {1185      ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);1186    }1187  } else if (isObject(source)) {1188    if (source[Symbol.iterator]) {1189      ret = Array.from(source, (item, i) => renderItem(item, i, void 0, cached && cached[i]));1190    } else {1191      const keys = Object.keys(source);1192      ret = new Array(keys.length);1193      for (let i = 0, l = keys.length; i < l; i++) {1194        const key = keys[i];1195        ret[i] = renderItem(source[key], key, i, cached && cached[i]);1196      }1197    }1198  } else {1199    ret = [];1200  }1201  if (cache) {1202    cache[index] = ret;1203  }1204  return ret;1205}1206const getPublicInstance = (i) => {1207  if (!i)1208    return null;1209  if (isStatefulComponent(i))1210    return getExposeProxy(i) || i.proxy;1211  return getPublicInstance(i.parent);1212};1213const publicPropertiesMap = extend(Object.create(null), {1214  $: (i) => i,1215  $el: (i) => i.vnode.el,1216  $data: (i) => i.data,1217  $props: (i) => i.props,1218  $attrs: (i) => i.attrs,1219  $slots: (i) => i.slots,1220  $refs: (i) => i.refs,1221  $parent: (i) => getPublicInstance(i.parent),1222  $root: (i) => getPublicInstance(i.root),1223  $emit: (i) => i.emit,1224  $options: (i) => resolveMergedOptions(i),1225  $forceUpdate: (i) => () => queueJob(i.update),1226  $nextTick: (i) => nextTick.bind(i.proxy),1227  $watch: (i) => instanceWatch.bind(i)1228});1229let currentInstance = null;1230const setCurrentInstance = (instance) => {1231  currentInstance = instance;1232  instance.scope.on();1233};1234const unsetCurrentInstance = () => {1235  currentInstance && currentInstance.scope.off();1236  currentInstance = null;1237};1238function isStatefulComponent(instance) {...Application2.es.js
Source:Application2.es.js  
...262  } else {263    queuePostFlushCb(fn);264  }265}266function resolveMergedOptions(instance) {267  const base = instance.type;268  const { mixins, extends: extendsOptions } = base;269  const { mixins: globalMixins, optionsCache: cache, config: { optionMergeStrategies } } = instance.appContext;270  const cached = cache.get(base);271  let resolved;272  if (cached) {273    resolved = cached;274  } else if (!globalMixins.length && !mixins && !extendsOptions) {275    {276      resolved = base;277    }278  } else {279    resolved = {};280    if (globalMixins.length) {281      globalMixins.forEach((m) => mergeOptions(resolved, m, optionMergeStrategies, true));282    }283    mergeOptions(resolved, base, optionMergeStrategies);284  }285  cache.set(base, resolved);286  return resolved;287}288function mergeOptions(to, from, strats, asMixin = false) {289  const { mixins, extends: extendsOptions } = from;290  if (extendsOptions) {291    mergeOptions(to, extendsOptions, strats, true);292  }293  if (mixins) {294    mixins.forEach((m) => mergeOptions(to, m, strats, true));295  }296  for (const key in from) {297    if (asMixin && key === "expose")298      ;299    else {300      const strat = internalOptionMergeStrats[key] || strats && strats[key];301      to[key] = strat ? strat(to[key], from[key]) : from[key];302    }303  }304  return to;305}306const internalOptionMergeStrats = {307  data: mergeDataFn,308  props: mergeObjectOptions,309  emits: mergeObjectOptions,310  methods: mergeObjectOptions,311  computed: mergeObjectOptions,312  beforeCreate: mergeAsArray,313  created: mergeAsArray,314  beforeMount: mergeAsArray,315  mounted: mergeAsArray,316  beforeUpdate: mergeAsArray,317  updated: mergeAsArray,318  beforeDestroy: mergeAsArray,319  beforeUnmount: mergeAsArray,320  destroyed: mergeAsArray,321  unmounted: mergeAsArray,322  activated: mergeAsArray,323  deactivated: mergeAsArray,324  errorCaptured: mergeAsArray,325  serverPrefetch: mergeAsArray,326  components: mergeObjectOptions,327  directives: mergeObjectOptions,328  watch: mergeWatchOptions,329  provide: mergeDataFn,330  inject: mergeInject331};332function mergeDataFn(to, from) {333  if (!from) {334    return to;335  }336  if (!to) {337    return from;338  }339  return function mergedDataFn() {340    return extend(isFunction(to) ? to.call(this, this) : to, isFunction(from) ? from.call(this, this) : from);341  };342}343function mergeInject(to, from) {344  return mergeObjectOptions(normalizeInject(to), normalizeInject(from));345}346function normalizeInject(raw) {347  if (isArray(raw)) {348    const res = {};349    for (let i = 0; i < raw.length; i++) {350      res[raw[i]] = raw[i];351    }352    return res;353  }354  return raw;355}356function mergeAsArray(to, from) {357  return to ? [...new Set([].concat(to, from))] : from;358}359function mergeObjectOptions(to, from) {360  return to ? extend(extend(Object.create(null), to), from) : from;361}362function mergeWatchOptions(to, from) {363  if (!to)364    return from;365  if (!from)366    return to;367  const merged = extend(Object.create(null), to);368  for (const key in from) {369    merged[key] = mergeAsArray(to[key], from[key]);370  }371  return merged;372}373const queuePostRenderEffect = queueEffectWithSuspense;374const isTeleport = (type) => type.__isTeleport;375const COMPONENTS = "components";376function resolveComponent(name, maybeSelfReference) {377  return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;378}379const NULL_DYNAMIC_COMPONENT = Symbol();380function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {381  const instance = currentRenderingInstance || currentInstance;382  if (instance) {383    const Component = instance.type;384    if (type === COMPONENTS) {385      const selfName = getComponentName(Component);386      if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {387        return Component;388      }389    }390    const res = resolve(instance[type] || Component[type], name) || resolve(instance.appContext[type], name);391    if (!res && maybeSelfReference) {392      return Component;393    }394    return res;395  }396}397function resolve(registry, name) {398  return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);399}400const Fragment = Symbol(void 0);401const Text = Symbol(void 0);402const Comment = Symbol(void 0);403const blockStack = [];404let currentBlock = null;405function openBlock(disableTracking = false) {406  blockStack.push(currentBlock = disableTracking ? null : []);407}408function closeBlock() {409  blockStack.pop();410  currentBlock = blockStack[blockStack.length - 1] || null;411}412function setupBlock(vnode) {413  vnode.dynamicChildren = currentBlock || EMPTY_ARR;414  closeBlock();415  if (currentBlock) {416    currentBlock.push(vnode);417  }418  return vnode;419}420function createElementBlock(type, props, children, patchFlag, dynamicProps, shapeFlag) {421  return setupBlock(createBaseVNode(type, props, children, patchFlag, dynamicProps, shapeFlag, true));422}423function isVNode(value) {424  return value ? value.__v_isVNode === true : false;425}426const InternalObjectKey = `__vInternal`;427const normalizeKey = ({ key }) => key != null ? key : null;428const normalizeRef = ({ ref }) => {429  return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i: currentRenderingInstance, r: ref } : ref : null;430};431function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {432  const vnode = {433    __v_isVNode: true,434    __v_skip: true,435    type,436    props,437    key: props && normalizeKey(props),438    ref: props && normalizeRef(props),439    scopeId: currentScopeId,440    slotScopeIds: null,441    children,442    component: null,443    suspense: null,444    ssContent: null,445    ssFallback: null,446    dirs: null,447    transition: null,448    el: null,449    anchor: null,450    target: null,451    targetAnchor: null,452    staticCount: 0,453    shapeFlag,454    patchFlag,455    dynamicProps,456    dynamicChildren: null,457    appContext: null458  };459  if (needFullChildrenNormalization) {460    normalizeChildren(vnode, children);461    if (shapeFlag & 128) {462      type.normalize(vnode);463    }464  } else if (children) {465    vnode.shapeFlag |= isString(children) ? 8 : 16;466  }467  if (!isBlockNode && currentBlock && (vnode.patchFlag > 0 || shapeFlag & 6) && vnode.patchFlag !== 32) {468    currentBlock.push(vnode);469  }470  return vnode;471}472const createVNode = _createVNode;473function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {474  if (!type || type === NULL_DYNAMIC_COMPONENT) {475    type = Comment;476  }477  if (isVNode(type)) {478    const cloned = cloneVNode(type, props, true);479    if (children) {480      normalizeChildren(cloned, children);481    }482    return cloned;483  }484  if (isClassComponent(type)) {485    type = type.__vccOpts;486  }487  if (props) {488    props = guardReactiveProps(props);489    let { class: klass, style } = props;490    if (klass && !isString(klass)) {491      props.class = normalizeClass(klass);492    }493    if (isObject(style)) {494      if (isProxy(style) && !isArray(style)) {495        style = extend({}, style);496      }497      props.style = normalizeStyle(style);498    }499  }500  const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0;501  return createBaseVNode(type, props, children, patchFlag, dynamicProps, shapeFlag, isBlockNode, true);502}503function guardReactiveProps(props) {504  if (!props)505    return null;506  return isProxy(props) || InternalObjectKey in props ? extend({}, props) : props;507}508function cloneVNode(vnode, extraProps, mergeRef = false) {509  const { props, ref, patchFlag, children } = vnode;510  const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;511  const cloned = {512    __v_isVNode: true,513    __v_skip: true,514    type: vnode.type,515    props: mergedProps,516    key: mergedProps && normalizeKey(mergedProps),517    ref: extraProps && extraProps.ref ? mergeRef && ref ? isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps) : ref,518    scopeId: vnode.scopeId,519    slotScopeIds: vnode.slotScopeIds,520    children,521    target: vnode.target,522    targetAnchor: vnode.targetAnchor,523    staticCount: vnode.staticCount,524    shapeFlag: vnode.shapeFlag,525    patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag,526    dynamicProps: vnode.dynamicProps,527    dynamicChildren: vnode.dynamicChildren,528    appContext: vnode.appContext,529    dirs: vnode.dirs,530    transition: vnode.transition,531    component: vnode.component,532    suspense: vnode.suspense,533    ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),534    ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),535    el: vnode.el,536    anchor: vnode.anchor537  };538  return cloned;539}540function createTextVNode(text = " ", flag = 0) {541  return createVNode(Text, null, text, flag);542}543function normalizeChildren(vnode, children) {544  let type = 0;545  const { shapeFlag } = vnode;546  if (children == null) {547    children = null;548  } else if (isArray(children)) {549    type = 16;550  } else if (typeof children === "object") {551    if (shapeFlag & (1 | 64)) {552      const slot = children.default;553      if (slot) {554        slot._c && (slot._d = false);555        normalizeChildren(vnode, slot());556        slot._c && (slot._d = true);557      }558      return;559    } else {560      type = 32;561      const slotFlag = children._;562      if (!slotFlag && !(InternalObjectKey in children)) {563        children._ctx = currentRenderingInstance;564      } else if (slotFlag === 3 && currentRenderingInstance) {565        if (currentRenderingInstance.slots._ === 1) {566          children._ = 1;567        } else {568          children._ = 2;569          vnode.patchFlag |= 1024;570        }571      }572    }573  } else if (isFunction(children)) {574    children = { default: children, _ctx: currentRenderingInstance };575    type = 32;576  } else {577    children = String(children);578    if (shapeFlag & 64) {579      type = 16;580      children = [createTextVNode(children)];581    } else {582      type = 8;583    }584  }585  vnode.children = children;586  vnode.shapeFlag |= type;587}588function mergeProps(...args) {589  const ret = {};590  for (let i = 0; i < args.length; i++) {591    const toMerge = args[i];592    for (const key in toMerge) {593      if (key === "class") {594        if (ret.class !== toMerge.class) {595          ret.class = normalizeClass([ret.class, toMerge.class]);596        }597      } else if (key === "style") {598        ret.style = normalizeStyle([ret.style, toMerge.style]);599      } else if (isOn(key)) {600        const existing = ret[key];601        const incoming = toMerge[key];602        if (existing !== incoming && !(isArray(existing) && existing.includes(incoming))) {603          ret[key] = existing ? [].concat(existing, incoming) : incoming;604        }605      } else if (key !== "") {606        ret[key] = toMerge[key];607      }608    }609  }610  return ret;611}612const getPublicInstance = (i) => {613  if (!i)614    return null;615  if (isStatefulComponent(i))616    return getExposeProxy(i) || i.proxy;617  return getPublicInstance(i.parent);618};619const publicPropertiesMap = extend(Object.create(null), {620  $: (i) => i,621  $el: (i) => i.vnode.el,622  $data: (i) => i.data,623  $props: (i) => i.props,624  $attrs: (i) => i.attrs,625  $slots: (i) => i.slots,626  $refs: (i) => i.refs,627  $parent: (i) => getPublicInstance(i.parent),628  $root: (i) => getPublicInstance(i.root),629  $emit: (i) => i.emit,630  $options: (i) => resolveMergedOptions(i),631  $forceUpdate: (i) => () => queueJob(i.update),632  $nextTick: (i) => nextTick.bind(i.proxy),633  $watch: (i) => instanceWatch.bind(i)634});635let currentInstance = null;636const setCurrentInstance = (instance) => {637  currentInstance = instance;638  instance.scope.on();639};640const unsetCurrentInstance = () => {641  currentInstance && currentInstance.scope.off();642  currentInstance = null;643};644function isStatefulComponent(instance) {...Menu.js.es.js
Source:Menu.js.es.js  
...237  } else {238    queuePostFlushCb(fn);239  }240}241function resolveMergedOptions(instance) {242  const base = instance.type;243  const { mixins, extends: extendsOptions } = base;244  const { mixins: globalMixins, optionsCache: cache, config: { optionMergeStrategies } } = instance.appContext;245  const cached = cache.get(base);246  let resolved;247  if (cached) {248    resolved = cached;249  } else if (!globalMixins.length && !mixins && !extendsOptions) {250    {251      resolved = base;252    }253  } else {254    resolved = {};255    if (globalMixins.length) {256      globalMixins.forEach((m) => mergeOptions(resolved, m, optionMergeStrategies, true));257    }258    mergeOptions(resolved, base, optionMergeStrategies);259  }260  cache.set(base, resolved);261  return resolved;262}263function mergeOptions(to, from, strats, asMixin = false) {264  const { mixins, extends: extendsOptions } = from;265  if (extendsOptions) {266    mergeOptions(to, extendsOptions, strats, true);267  }268  if (mixins) {269    mixins.forEach((m) => mergeOptions(to, m, strats, true));270  }271  for (const key in from) {272    if (asMixin && key === "expose")273      ;274    else {275      const strat = internalOptionMergeStrats[key] || strats && strats[key];276      to[key] = strat ? strat(to[key], from[key]) : from[key];277    }278  }279  return to;280}281const internalOptionMergeStrats = {282  data: mergeDataFn,283  props: mergeObjectOptions,284  emits: mergeObjectOptions,285  methods: mergeObjectOptions,286  computed: mergeObjectOptions,287  beforeCreate: mergeAsArray,288  created: mergeAsArray,289  beforeMount: mergeAsArray,290  mounted: mergeAsArray,291  beforeUpdate: mergeAsArray,292  updated: mergeAsArray,293  beforeDestroy: mergeAsArray,294  beforeUnmount: mergeAsArray,295  destroyed: mergeAsArray,296  unmounted: mergeAsArray,297  activated: mergeAsArray,298  deactivated: mergeAsArray,299  errorCaptured: mergeAsArray,300  serverPrefetch: mergeAsArray,301  components: mergeObjectOptions,302  directives: mergeObjectOptions,303  watch: mergeWatchOptions,304  provide: mergeDataFn,305  inject: mergeInject306};307function mergeDataFn(to, from) {308  if (!from) {309    return to;310  }311  if (!to) {312    return from;313  }314  return function mergedDataFn() {315    return extend(isFunction(to) ? to.call(this, this) : to, isFunction(from) ? from.call(this, this) : from);316  };317}318function mergeInject(to, from) {319  return mergeObjectOptions(normalizeInject(to), normalizeInject(from));320}321function normalizeInject(raw) {322  if (isArray(raw)) {323    const res = {};324    for (let i = 0; i < raw.length; i++) {325      res[raw[i]] = raw[i];326    }327    return res;328  }329  return raw;330}331function mergeAsArray(to, from) {332  return to ? [...new Set([].concat(to, from))] : from;333}334function mergeObjectOptions(to, from) {335  return to ? extend(extend(Object.create(null), to), from) : from;336}337function mergeWatchOptions(to, from) {338  if (!to)339    return from;340  if (!from)341    return to;342  const merged = extend(Object.create(null), to);343  for (const key in from) {344    merged[key] = mergeAsArray(to[key], from[key]);345  }346  return merged;347}348const queuePostRenderEffect = queueEffectWithSuspense;349const isTeleport = (type) => type.__isTeleport;350const NULL_DYNAMIC_COMPONENT = Symbol();351const Fragment = Symbol(void 0);352const Text = Symbol(void 0);353const Comment = Symbol(void 0);354const blockStack = [];355let currentBlock = null;356function openBlock(disableTracking = false) {357  blockStack.push(currentBlock = disableTracking ? null : []);358}359function closeBlock() {360  blockStack.pop();361  currentBlock = blockStack[blockStack.length - 1] || null;362}363function setupBlock(vnode) {364  vnode.dynamicChildren = currentBlock || EMPTY_ARR;365  closeBlock();366  if (currentBlock) {367    currentBlock.push(vnode);368  }369  return vnode;370}371function createElementBlock(type, props, children, patchFlag, dynamicProps, shapeFlag) {372  return setupBlock(createBaseVNode(type, props, children, patchFlag, dynamicProps, shapeFlag, true));373}374function isVNode(value) {375  return value ? value.__v_isVNode === true : false;376}377const InternalObjectKey = `__vInternal`;378const normalizeKey = ({ key }) => key != null ? key : null;379const normalizeRef = ({ ref, ref_key, ref_for }) => {380  return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;381};382function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {383  const vnode = {384    __v_isVNode: true,385    __v_skip: true,386    type,387    props,388    key: props && normalizeKey(props),389    ref: props && normalizeRef(props),390    scopeId: currentScopeId,391    slotScopeIds: null,392    children,393    component: null,394    suspense: null,395    ssContent: null,396    ssFallback: null,397    dirs: null,398    transition: null,399    el: null,400    anchor: null,401    target: null,402    targetAnchor: null,403    staticCount: 0,404    shapeFlag,405    patchFlag,406    dynamicProps,407    dynamicChildren: null,408    appContext: null409  };410  if (needFullChildrenNormalization) {411    normalizeChildren(vnode, children);412    if (shapeFlag & 128) {413      type.normalize(vnode);414    }415  } else if (children) {416    vnode.shapeFlag |= isString(children) ? 8 : 16;417  }418  if (!isBlockNode && currentBlock && (vnode.patchFlag > 0 || shapeFlag & 6) && vnode.patchFlag !== 32) {419    currentBlock.push(vnode);420  }421  return vnode;422}423const createVNode = _createVNode;424function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {425  if (!type || type === NULL_DYNAMIC_COMPONENT) {426    type = Comment;427  }428  if (isVNode(type)) {429    const cloned = cloneVNode(type, props, true);430    if (children) {431      normalizeChildren(cloned, children);432    }433    return cloned;434  }435  if (isClassComponent(type)) {436    type = type.__vccOpts;437  }438  if (props) {439    props = guardReactiveProps(props);440    let { class: klass, style } = props;441    if (klass && !isString(klass)) {442      props.class = normalizeClass(klass);443    }444    if (isObject(style)) {445      if (isProxy(style) && !isArray(style)) {446        style = extend({}, style);447      }448      props.style = normalizeStyle(style);449    }450  }451  const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0;452  return createBaseVNode(type, props, children, patchFlag, dynamicProps, shapeFlag, isBlockNode, true);453}454function guardReactiveProps(props) {455  if (!props)456    return null;457  return isProxy(props) || InternalObjectKey in props ? extend({}, props) : props;458}459function cloneVNode(vnode, extraProps, mergeRef = false) {460  const { props, ref, patchFlag, children } = vnode;461  const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;462  const cloned = {463    __v_isVNode: true,464    __v_skip: true,465    type: vnode.type,466    props: mergedProps,467    key: mergedProps && normalizeKey(mergedProps),468    ref: extraProps && extraProps.ref ? mergeRef && ref ? isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps) : ref,469    scopeId: vnode.scopeId,470    slotScopeIds: vnode.slotScopeIds,471    children,472    target: vnode.target,473    targetAnchor: vnode.targetAnchor,474    staticCount: vnode.staticCount,475    shapeFlag: vnode.shapeFlag,476    patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag,477    dynamicProps: vnode.dynamicProps,478    dynamicChildren: vnode.dynamicChildren,479    appContext: vnode.appContext,480    dirs: vnode.dirs,481    transition: vnode.transition,482    component: vnode.component,483    suspense: vnode.suspense,484    ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),485    ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),486    el: vnode.el,487    anchor: vnode.anchor488  };489  return cloned;490}491function createTextVNode(text = " ", flag = 0) {492  return createVNode(Text, null, text, flag);493}494function normalizeChildren(vnode, children) {495  let type = 0;496  const { shapeFlag } = vnode;497  if (children == null) {498    children = null;499  } else if (isArray(children)) {500    type = 16;501  } else if (typeof children === "object") {502    if (shapeFlag & (1 | 64)) {503      const slot = children.default;504      if (slot) {505        slot._c && (slot._d = false);506        normalizeChildren(vnode, slot());507        slot._c && (slot._d = true);508      }509      return;510    } else {511      type = 32;512      const slotFlag = children._;513      if (!slotFlag && !(InternalObjectKey in children)) {514        children._ctx = currentRenderingInstance;515      } else if (slotFlag === 3 && currentRenderingInstance) {516        if (currentRenderingInstance.slots._ === 1) {517          children._ = 1;518        } else {519          children._ = 2;520          vnode.patchFlag |= 1024;521        }522      }523    }524  } else if (isFunction(children)) {525    children = { default: children, _ctx: currentRenderingInstance };526    type = 32;527  } else {528    children = String(children);529    if (shapeFlag & 64) {530      type = 16;531      children = [createTextVNode(children)];532    } else {533      type = 8;534    }535  }536  vnode.children = children;537  vnode.shapeFlag |= type;538}539function mergeProps(...args) {540  const ret = {};541  for (let i = 0; i < args.length; i++) {542    const toMerge = args[i];543    for (const key in toMerge) {544      if (key === "class") {545        if (ret.class !== toMerge.class) {546          ret.class = normalizeClass([ret.class, toMerge.class]);547        }548      } else if (key === "style") {549        ret.style = normalizeStyle([ret.style, toMerge.style]);550      } else if (isOn(key)) {551        const existing = ret[key];552        const incoming = toMerge[key];553        if (existing !== incoming && !(isArray(existing) && existing.includes(incoming))) {554          ret[key] = existing ? [].concat(existing, incoming) : incoming;555        }556      } else if (key !== "") {557        ret[key] = toMerge[key];558      }559    }560  }561  return ret;562}563const getPublicInstance = (i) => {564  if (!i)565    return null;566  if (isStatefulComponent(i))567    return getExposeProxy(i) || i.proxy;568  return getPublicInstance(i.parent);569};570const publicPropertiesMap = extend(Object.create(null), {571  $: (i) => i,572  $el: (i) => i.vnode.el,573  $data: (i) => i.data,574  $props: (i) => i.props,575  $attrs: (i) => i.attrs,576  $slots: (i) => i.slots,577  $refs: (i) => i.refs,578  $parent: (i) => getPublicInstance(i.parent),579  $root: (i) => getPublicInstance(i.root),580  $emit: (i) => i.emit,581  $options: (i) => resolveMergedOptions(i),582  $forceUpdate: (i) => () => queueJob(i.update),583  $nextTick: (i) => nextTick.bind(i.proxy),584  $watch: (i) => instanceWatch.bind(i)585});586let currentInstance = null;587const setCurrentInstance = (instance) => {588  currentInstance = instance;589  instance.scope.on();590};591const unsetCurrentInstance = () => {592  currentInstance && currentInstance.scope.off();593  currentInstance = null;594};595function isStatefulComponent(instance) {...setup.js
Source:setup.js  
...84            $refs: i => ( shallowReadonly(i.refs) ),85            $parent: i => i.parent && i.parent.proxy,86            $root: i => i.root && i.root.proxy,87            $emit: i => i.emit,88            $options: i => ( resolveMergedOptions(i) ),89            $forceUpdate: i => () => queueJob(i.update),90            $nextTick: () => nextTick,91            $watch: i => ( instanceWatch.bind(i) )92        });93        // In dev mode, the proxy target exposes the same properties as seen on `this`94        // for easier console inspection. In prod mode it will be an empty object so95        // these properties definitions can be skipped.96        function createRenderContext(instance) {97            const target = {};98            // expose internal instance for proxy handlers99            Object.defineProperty(target, `_`, {100                configurable: true,101                enumerable: false,102                get: () => instance...componentOptions.js
Source:componentOptions.js  
...19  }20}21export let shouldCacheAccess = true22export function applyOptions (instance) {23  const options = resolveMergedOptions(instance)24  const publicThis = instance.proxy25  const ctx = instance.ctx26  shouldCacheAccess = false27  if (options.beforeCreate) {28    callHook(options.beforeCreate, instance, 'bc')29  }30  const {31    data: dataOptions,32    computed: computedOptions,33    methods,34    watch: watchOptions,35    provide: provideOptions,36    inject: injectOptions,37    created,...componentPublicInstance.js
Source:componentPublicInstance.js  
...157  $refs: i => shallowReadonly(i.refs),158  $parent: i => getPublicInstance(i.parent),159  $root: i => getPublicInstance(i.root),160  $emit: i => i.emit,161  $options: i => resolveMergedOptions(i),162  $forceUpdate: i => () => queueJob(i.update),163  $nextTick: i => nextTick.bind(i.proxy),164  $watch: i => instanceWatch.bind(i)...listed.js
Source:listed.js  
...41    $refs: i => (shallowReadonly(i.refs)),42    $parent: i => getPublicInstance(i.parent),43    $root: i => getPublicInstance(i.root),44    $emit: i => i.emit,45    $options: i => (resolveMergedOptions(i)),46    $forceUpdate: i => () => queueJob(i.update),47    $nextTick: i => nextTick.bind(i.proxy),48    $watch: i => (instanceWatch.bind(i))49});50function createComponentInstance(vnode, parent, suspense) {51    const type = vnode.type;52    // inherit parent app context - or - if root, adopt from root vnode53    const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;54    const instance = {55        uid: uid$1++,56        vnode,57        type,58        parent,59        appContext,...Using AI Code Generation
1const { resolveMergedOptions } = require('playwright/lib/utils/utils');2const { chromium } = require('playwright');3(async () => {4  const browser = await chromium.launch({ headless: false });5  const context = await browser.newContext();6  const page = await context.newPage();7  await page.screenshot({ path: `example.png` });8  await browser.close();9})();Using AI Code Generation
1const { Playwright } = require('playwright');2const { chromium } = require('playwright-chromium');3(async () => {4  const browser = await chromium.launch();5  const context = await browser.newContext();6  const page = await context.newPage();7  const options = await Playwright.resolveMergedOptions({ page });8  console.log(options);9  await browser.close();10})();Using AI Code Generation
1const { resolveMergedOptions } = require('playwright/lib/internal/api');2const { chromium } = require('playwright');3(async () => {4  const browser = await chromium.launch({ headless: false });5  const context = await browser.newContext();6  const page = await context.newPage();7  const options = await resolveMergedOptions(page);8  console.log(options);9  await browser.close();10})();11{ ignoreHTTPSErrors: false,12  viewport: { width: 1280, height: 720 },13   'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.0 Safari/537.36',14  extraHTTPHeaders: {},15  recordVideo: { dir: '/home/sumit/Downloads' },16  recordHar: { omitContent: false, path: '/home/sumit/Downloads' },17  recordTrace: { name: 'trace', screenshots: false, snapshots: false },18  acceptLanguage: 'en-US' }Using AI Code Generation
1const { resolveMergedOptions } = require('playwright-core/lib/utils/mergeOptions');2const { chromium } = require('playwright-core');3const { devices } = require('playwright-core/lib/server/deviceDescriptors');4(async () => {5  const options = {6  };7  const mergedOptions = await resolveMergedOptions(options);8  const browser = await chromium.launch();9  const context = await browser.newContext(mergedOptions);10  const page = await context.newPage();11  await browser.close();12})();Using AI Code Generation
1const { resolveMergedOptions } = require('playwright/lib/server/browserType');2const options = {headless: true, ...};3const resolvedOptions = resolveMergedOptions(options);4console.log(resolvedOptions);5const { resolveMergedOptions } = require('playwright/lib/server/browserType');6const options = {headless: true, ...};7const resolvedOptions = resolveMergedOptions(options);8console.log(resolvedOptions);9const { resolveMergedOptions } = require('playwright/lib/server/browserType');10const options = {headless: true, ...};11const resolvedOptions = resolveMergedOptions(options);12console.log(resolvedOptions);Using AI Code Generation
1const { resolveMergedOptions } = require('@playwright/test/lib/server/config');2const options = {3  ...require('@playwright/test').testOptions,4  use: {5    viewport: { width: 1280, height: 720 },6  },7};8const resolvedOptions = resolveMergedOptions(options);9console.log(resolvedOptions);10{11  use: {12    viewport: { width: 1280, height: 720 },13  }14}15import { test, expect } from '@playwright/test';16import { resolveMergedOptions } from '@playwright/test/lib/server/config';17const { use: { headless, viewport, ignoreHTTPSErrors } } = resolveMergedOptions(testOptions);18const config = {19  use: {20  },21};22export default config;23import { test, expect } from '@playwright/test';24import config from './test.config';25test.use(config);26test.describe('Test', () => {27  test('Test', async ({ page }) => {28    const title = page.locator('text=Playwright');29    await expect(title).toBeVisible();30  });31});32import { test, expect } from '@playwright/test';33import { resolveMergedOptions } from '@playwright/test/lib/server/config';34const options = {LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.
Get 100 minutes of automation test minutes FREE!!
