@plasmicapp/loader-react 1.0.236 → 1.0.237
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -2
- package/dist/loader-react.cjs.development.js.map +1 -1
- package/dist/loader-react.cjs.production.min.js.map +1 -1
- package/dist/loader-react.esm.js.map +1 -1
- package/dist/loader.d.ts +1 -1
- package/dist-react-server/index.d.ts +2 -2
- package/dist-react-server/loader.d.ts +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader-react.cjs.production.min.js","sources":["../../../node_modules/regenerator-runtime/runtime.js","../src/utils.tsx","../src/component-lookup.ts","../src/variation.ts","../src/PlasmicRootProvider.tsx","../src/global-variants.ts","../src/bundles.ts","../src/loader-react-server.ts","../src/loader.ts","../src/usePlasmicComponent.tsx","../src/PlasmicComponent.tsx","../src/prepass.tsx","../src/render.tsx","../src/index.ts"],"sourcesContent":["/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar runtime = (function (exports) {\n \"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var undefined; // More compressible than void 0.\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n function define(obj, key, value) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n return obj[key];\n }\n try {\n // IE 8 has a broken Object.defineProperty that only works on DOM objects.\n define({}, \"\");\n } catch (err) {\n define = function(obj, key, value) {\n return obj[key] = value;\n };\n }\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n }\n exports.wrap = wrap;\n\n // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\";\n\n // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n var ContinueSentinel = {};\n\n // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n\n // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n var IteratorPrototype = {};\n define(IteratorPrototype, iteratorSymbol, function () {\n return this;\n });\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n if (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = GeneratorFunctionPrototype;\n define(Gp, \"constructor\", GeneratorFunctionPrototype);\n define(GeneratorFunctionPrototype, \"constructor\", GeneratorFunction);\n GeneratorFunction.displayName = define(\n GeneratorFunctionPrototype,\n toStringTagSymbol,\n \"GeneratorFunction\"\n );\n\n // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n define(prototype, method, function(arg) {\n return this._invoke(method, arg);\n });\n });\n }\n\n exports.isGeneratorFunction = function(genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n };\n\n exports.mark = function(genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n define(genFun, toStringTagSymbol, \"GeneratorFunction\");\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n };\n\n // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n exports.awrap = function(arg) {\n return { __await: arg };\n };\n\n function AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return PromiseImpl.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return PromiseImpl.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n define(AsyncIterator.prototype, asyncIteratorSymbol, function () {\n return this;\n });\n exports.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n if (PromiseImpl === void 0) PromiseImpl = Promise;\n\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList),\n PromiseImpl\n );\n\n return exports.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n define(Gp, toStringTagSymbol, \"Generator\");\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n define(Gp, iteratorSymbol, function() {\n return this;\n });\n\n define(Gp, \"toString\", function() {\n return \"[object Generator]\";\n });\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n exports.keys = function(object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n }\n exports.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n\n // Regardless of whether this script is executing as a CommonJS module\n // or not, return the runtime object so that we can declare the variable\n // regeneratorRuntime in the outer scope, which allows this module to be\n // injected easily by `bin/regenerator --include-runtime script.js`.\n return exports;\n\n}(\n // If this script is executing as a CommonJS module, use module.exports\n // as the regeneratorRuntime namespace. Otherwise create a new empty\n // object. Either way, the resulting object will be used to initialize\n // the regeneratorRuntime variable at the top of this file.\n typeof module === \"object\" ? module.exports : {}\n));\n\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n // This module should not be running in strict mode, so the above\n // assignment should always work unless something is misconfigured. Just\n // in case runtime.js accidentally runs in strict mode, in modern engines\n // we can explicitly access globalThis. In older engines we can escape\n // strict mode using a global Function call. This could conceivably fail\n // if a Content Security Policy forbids using Function, but in that case\n // the proper solution is to fix the accidental strict mode problem. If\n // you've misconfigured your bundler to force strict mode and applied a\n // CSP to forbid Function, and you're not willing to fix either of those\n // problems, please detail your unique predicament in a GitHub issue.\n if (typeof globalThis === \"object\") {\n globalThis.regeneratorRuntime = runtime;\n } else {\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n }\n}\n","import { ComponentMeta } from '@plasmicapp/loader-core';\nimport pascalcase from 'pascalcase';\nimport * as React from 'react';\n\nexport const isBrowser = typeof window !== 'undefined';\n\nexport type ComponentLookupSpec =\n | string\n | { name: string; projectId?: string; isCode?: boolean };\n\ninterface FullNameLookupSpec {\n name: string;\n rawName?: string;\n projectId?: string;\n isCode?: boolean;\n}\n\ninterface FullPathLookupSpec {\n path: string;\n projectId?: string;\n}\n\ntype FullLookupSpec = FullNameLookupSpec | FullPathLookupSpec;\n\nexport function useForceUpdate() {\n const [, setTick] = React.useState(0);\n const update = React.useCallback(() => {\n setTick((tick) => tick + 1);\n }, []);\n return update;\n}\n\nexport function useStableLookupSpec(spec: ComponentLookupSpec) {\n return useStableLookupSpecs(spec)[0];\n}\n\nexport function useStableLookupSpecs(...specs: ComponentLookupSpec[]) {\n const [stableSpecs, setStableSpecs] = React.useState(specs);\n\n React.useEffect(() => {\n if (\n specs.length !== stableSpecs.length ||\n specs.some((s, i) => !areLookupSpecsEqual(s, stableSpecs[i]))\n ) {\n setStableSpecs(specs);\n }\n }, [specs, stableSpecs]);\n return stableSpecs;\n}\n\nfunction areLookupSpecsEqual(\n spec1: ComponentLookupSpec,\n spec2: ComponentLookupSpec\n) {\n if (spec1 === spec2) {\n return true;\n }\n if (typeof spec1 !== typeof spec2) {\n return false;\n }\n\n const fullSpec1 = toFullLookup(spec1);\n const fullSpec2 = toFullLookup(spec2);\n return (\n ((isNameSpec(fullSpec1) &&\n isNameSpec(fullSpec2) &&\n fullSpec1.name === fullSpec2.name &&\n fullSpec1.isCode === fullSpec2.isCode) ||\n (isPathSpec(fullSpec1) &&\n isPathSpec(fullSpec2) &&\n fullSpec1.path === fullSpec2.path)) &&\n fullSpec1.projectId === fullSpec2.projectId\n );\n}\n\nfunction isNameSpec(lookup: FullLookupSpec): lookup is FullNameLookupSpec {\n return 'name' in lookup;\n}\n\nfunction isPathSpec(lookup: FullLookupSpec): lookup is FullPathLookupSpec {\n return 'path' in lookup;\n}\n\nfunction toFullLookup(lookup: ComponentLookupSpec): FullLookupSpec {\n const namePart = typeof lookup === 'string' ? lookup : lookup.name;\n const projectId = typeof lookup === 'string' ? undefined : lookup.projectId;\n const codeComponent = typeof lookup === 'string' ? undefined : lookup.isCode;\n\n if (codeComponent !== true && namePart.startsWith('/')) {\n return { path: normalizePath(namePart), projectId };\n } else {\n return {\n name: codeComponent ? namePart : normalizeName(namePart),\n rawName: namePart.trim(),\n projectId,\n isCode: codeComponent,\n };\n }\n}\n\nfunction normalizePath(path: string) {\n return path.trim();\n}\n\nfunction normalizeName(name: string) {\n // Not a full normalization, but should be good enough\n return pascalcase(name).trim();\n}\n\nexport function useIsMounted(): () => boolean {\n const ref = React.useRef<boolean>(false);\n const isMounted = React.useCallback(() => ref.current, []);\n\n React.useEffect(() => {\n ref.current = true;\n return () => {\n ref.current = false;\n };\n }, []);\n\n return isMounted;\n}\n\n/**\n * Check if `lookup` resolves to `pagePath`. If it's a match, return an object\n * containing path params; otherwise, returns false.\n *\n * For example,\n * - `matchesPagePath(\"/hello/[name]\", \"/hello/world\")` -> `{params: {name:\n * \"world\"}}`\n * - `matchesPagePath(\"/hello/[name]\", \"/\")` -> `false`\n * - `matchesPagePath(\"/\", \"\")` -> `{params: {}}`\n */\nexport function matchesPagePath(\n pagePath: string,\n lookup: string\n): { params: Record<string, string> } | false {\n // Remove trailing slashes from both `pagePath` and `lookup`.\n pagePath = pagePath.replace(/^\\/*/, '').replace(/\\/*$/, '');\n lookup = lookup.replace(/^\\/*/, '').replace(/\\/*$/, '');\n\n // paramNames will contain a list of parameter names; e.g. if pagePath\n // is \"/products/[slug]/[variant]\" it will contain [\"slug\", \"variant\"].\n const paramNames = (pagePath.match(/\\[([^\\]]*)\\]/g) || []).map((group) =>\n group.slice(1, -1)\n );\n\n const pagePathRegExp = new RegExp(\n '^' + pagePath.replace(/\\[[^\\]]*\\]/g, '([^/]+)') + '$'\n );\n const maybeVals = lookup.match(pagePathRegExp)?.slice(1);\n if (!maybeVals) {\n return false;\n }\n\n const params: Record<string, string> = {};\n for (let i = 0; i < paramNames.length; i++) {\n params[paramNames[i]] = maybeVals[i];\n }\n\n return { params };\n}\n\nexport function isDynamicPagePath(path: string): boolean {\n return !!path.match(/\\[[^/]*\\]/);\n}\n\nfunction matchesCompMeta(lookup: FullLookupSpec, meta: ComponentMeta) {\n if (lookup.projectId && meta.projectId !== lookup.projectId) {\n return false;\n }\n\n return isNameSpec(lookup)\n ? (lookup.name === meta.name ||\n lookup.rawName === meta.name ||\n lookup.rawName === meta.displayName) &&\n (lookup.isCode == null || lookup.isCode === meta.isCode)\n : !!(meta.path && matchesPagePath(meta.path, lookup.path));\n}\n\nexport function getCompMetas(\n metas: ComponentMeta[],\n lookup: ComponentLookupSpec\n) {\n const full = toFullLookup(lookup);\n return metas\n .filter((meta) => matchesCompMeta(full, meta))\n .map<ComponentMeta & { params?: Record<string, string> }>((meta) => {\n if (isNameSpec(full) || !meta.path) {\n return meta;\n }\n\n const match = matchesPagePath(meta.path, full.path);\n if (!match) {\n return meta;\n }\n\n return { ...meta, params: match.params };\n })\n .sort(\n (meta1, meta2) =>\n // We sort the matched component metas by the number of path params, so\n // if there are two pages `/products/foo` and `/products/[slug]`,\n // the first one will have higher precedence.\n Array.from(Object.keys(meta1.params || {})).length -\n Array.from(Object.keys(meta2.params || {})).length\n );\n}\n\nexport function getLookupSpecName(lookup: ComponentLookupSpec) {\n if (typeof lookup === 'string') {\n return lookup;\n } else if (lookup.projectId) {\n return `${lookup.name} (project ${lookup.projectId})`;\n } else {\n return lookup.name;\n }\n}\n\nexport function uniq<T>(elements: T[]): T[] {\n return Array.from(new Set(elements));\n}\n","import {\n AssetModule,\n ComponentMeta,\n FontMeta,\n GlobalGroupMeta,\n LoaderBundleOutput,\n Registry,\n} from '@plasmicapp/loader-core';\nimport * as React from 'react';\nimport { ComponentLookupSpec, getCompMetas } from './utils';\n\nfunction getFirstCompMeta(metas: ComponentMeta[], lookup: ComponentLookupSpec) {\n const filtered = getCompMetas(metas, lookup);\n return filtered.length === 0 ? undefined : filtered[0];\n}\n\nexport class ComponentLookup {\n constructor(private bundle: LoaderBundleOutput, private registry: Registry) {}\n\n getComponentMeta(spec: ComponentLookupSpec): ComponentMeta | undefined {\n const compMeta = getFirstCompMeta(this.bundle.components, spec);\n return compMeta;\n }\n\n getComponent<P extends React.ComponentType = any>(\n spec: ComponentLookupSpec,\n opts: { forceOriginal?: boolean } = {}\n ) {\n const compMeta = getFirstCompMeta(this.bundle.components, spec);\n if (!compMeta) {\n throw new Error(`Component not found: ${spec}`);\n }\n const moduleName = compMeta.entry;\n if (!this.registry.hasModule(moduleName, opts)) {\n throw new Error(`Component not yet fetched: ${compMeta.name}`);\n }\n const entry = this.registry.load(moduleName, {\n forceOriginal: opts.forceOriginal,\n });\n return !opts.forceOriginal &&\n typeof entry?.getPlasmicComponent === 'function'\n ? entry.getPlasmicComponent()\n : (entry.default as P);\n }\n\n hasComponent(spec: ComponentLookupSpec) {\n const compMeta = getFirstCompMeta(this.bundle.components, spec);\n if (compMeta) {\n return this.registry.hasModule(compMeta.entry);\n }\n return false;\n }\n\n getGlobalContexts(): { meta: GlobalGroupMeta; context: any }[] {\n const customGlobalMetas = this.bundle.globalGroups.filter(\n (m) => m.type === 'global-user-defined'\n );\n return customGlobalMetas.map((meta) => ({\n meta,\n context: this.registry.load(meta.contextFile).default,\n }));\n }\n\n getGlobalContextsProvider(spec: ComponentLookupSpec) {\n const compMeta = getFirstCompMeta(this.bundle.components, spec);\n const projectMeta = compMeta\n ? this.bundle.projects.find((x) => x.id === compMeta.projectId)\n : undefined;\n\n if (\n !projectMeta ||\n !projectMeta.globalContextsProviderFileName ||\n !this.registry.hasModule(projectMeta.globalContextsProviderFileName)\n ) {\n return undefined;\n }\n const entry = this.registry.load(\n projectMeta.globalContextsProviderFileName\n );\n\n return typeof entry?.getPlasmicComponent === 'function'\n ? entry.getPlasmicComponent()\n : entry.default;\n }\n\n getRootProvider() {\n const entry = this.registry.load('root-provider.js');\n return entry.default;\n }\n\n getCss(): AssetModule[] {\n // We can probably always get the modules from the browser build\n return this.bundle.modules.browser.filter(\n (mod) => mod.type === 'asset' && mod.fileName.endsWith('css')\n ) as AssetModule[];\n }\n\n getRemoteFonts(): FontMeta[] {\n return this.bundle.projects.flatMap((p) => p.remoteFonts);\n }\n}\n","import { ExperimentSlice, SegmentSlice, Split } from '@plasmicapp/loader-core';\nimport type { GlobalVariantSpec } from './PlasmicRootProvider';\n\nexport function getPlasmicCookieValues() {\n return Object.fromEntries(\n document.cookie\n .split('; ')\n .filter((cookie) => cookie.includes('plasmic:'))\n .map((cookie) => cookie.split('='))\n .map(([key, value]) => [key.split(':')[1], value])\n );\n}\n\nexport function updatePlasmicCookieValue(key: string, value: string) {\n document.cookie = `plasmic:${key}=${value}`;\n}\n\nexport function ensureVariationCookies(variation: Record<string, string> = {}) {\n Object.keys(variation).map((variationKey) => {\n const sliceId = variation[variationKey];\n updatePlasmicCookieValue(variationKey, sliceId);\n });\n}\n\nexport const getGlobalVariantsFromSplits = (\n splits: Split[],\n variation: Record<string, string>\n) => {\n const globalVariants: GlobalVariantSpec[] = [];\n\n Object.keys(variation).map((variationKey: string) => {\n const [type, splitId] = variationKey.split('.');\n const sliceId = variation[variationKey];\n const split = splits.find(\n (s) => s.id === splitId || s.externalId === splitId\n );\n if (split) {\n const slice:\n | ExperimentSlice\n | SegmentSlice\n | undefined = (split.slices as Array<\n ExperimentSlice | SegmentSlice\n >).find((s: any) => s.id === sliceId || s.externalId === sliceId);\n if (slice) {\n slice.contents.map((x) => {\n globalVariants.push({\n name: x.group,\n value: x.variant,\n projectId: x.projectId,\n });\n });\n }\n }\n });\n\n return globalVariants;\n};\n\nexport const mergeGlobalVariantsSpec = (\n target: GlobalVariantSpec[],\n from: GlobalVariantSpec[]\n) => {\n let result = [...target];\n const existingGlobalVariants = new Set(\n target.map((t) => `${t.name}-${t.projectId ?? ''}`)\n );\n const newGlobals = from.filter(\n (t) => !existingGlobalVariants.has(`${t.name}-${t.projectId ?? ''}`)\n );\n\n if (newGlobals.length > 0) {\n result = [...result, ...newGlobals];\n }\n\n return result;\n};\n","import { PlasmicDataSourceContextValue } from '@plasmicapp/data-sources-context';\nimport { PageParamsProvider } from '@plasmicapp/host';\nimport { AssetModule, ComponentMeta, Split } from '@plasmicapp/loader-core';\nimport { PlasmicQueryDataProvider } from '@plasmicapp/query';\nimport * as React from 'react';\nimport {\n ComponentRenderData,\n InternalPlasmicComponentLoader,\n PlasmicComponentLoader,\n} from './loader';\nimport { useForceUpdate } from './utils';\nimport {\n ensureVariationCookies,\n getGlobalVariantsFromSplits,\n mergeGlobalVariantsSpec,\n} from './variation';\n\ninterface PlasmicRootContextValue extends PlasmicDataSourceContextValue {\n globalVariants?: GlobalVariantSpec[];\n globalContextsProps?: Record<string, any>;\n loader: InternalPlasmicComponentLoader;\n variation?: Record<string, string>;\n translator?: PlasmicTranslator;\n Head?: React.ComponentType<any>;\n}\n\nconst PlasmicRootContext = React.createContext<\n PlasmicRootContextValue | undefined\n>(undefined);\n\nexport interface GlobalVariantSpec {\n name: string;\n projectId?: string;\n value: any;\n}\n\nexport type PlasmicTranslator = (\n str: string,\n opts?: {\n components?: {\n [key: string]: React.ReactElement | React.ReactFragment;\n };\n }\n) => React.ReactNode;\n\n/**\n * PlasmicRootProvider should be used at the root of your page\n * or application.\n */\nexport function PlasmicRootProvider(props: {\n /**\n * The global PlasmicComponentLoader instance you created via\n * initPlasmicLoader().\n */\n loader: PlasmicComponentLoader;\n\n /**\n * Global variants to activate for Plasmic components\n */\n globalVariants?: GlobalVariantSpec[];\n\n children?: React.ReactNode;\n\n /**\n * If true, will skip rendering css\n */\n skipCss?: boolean;\n\n /**\n * If true, will skip installing fonts\n */\n skipFonts?: boolean;\n\n /**\n * If you have pre-fetched component data via PlasmicComponentLoader,\n * you can pass them in here; PlasmicComponent will avoid fetching\n * component data that have already been pre-fetched.\n */\n prefetchedData?: ComponentRenderData;\n\n /**\n * If you have pre-fetched data that are needed by usePlasmicQueryData(),\n * then pass in the pre-fetched cache here, mapping query key to fetched data.\n */\n prefetchedQueryData?: Record<string, any>;\n\n /**\n * Specifies whether usePlasmicQueryData() should be operating in suspense mode\n * (throwing promises).\n */\n suspenseForQueryData?: boolean;\n\n /**\n * Override your Global Contexts Provider props. This is a map from\n * globalContextComponentNameProps to object of props to use for that\n * component.\n */\n globalContextsProps?: Record<string, any>;\n\n /**\n * Specifies a mapping of split id to slice id that should be activated\n */\n variation?: Record<string, string>;\n\n /**\n * Translator function to be used for text blocks\n */\n translator?: PlasmicTranslator;\n\n /**\n * Head component to use in PlasmicHead component (e.g. Head from next/head\n * or Helmet from react-helmet).\n */\n Head?: React.ComponentType<any>;\n\n /**\n * Page path parameters (e.g. {slug: \"foo\"} if page path is\n * /products/[slug] and URI is /products/foo).\n */\n pageParams?: Record<string, string | string[] | undefined>;\n\n /**\n * Page query parameters (e.g. {q: \"foo\"} if page path is\n * /some/path?q=foo).\n */\n pageQuery?: Record<string, string | string[] | undefined>;\n}) {\n const {\n globalVariants,\n prefetchedData,\n children,\n skipCss,\n skipFonts,\n prefetchedQueryData,\n suspenseForQueryData,\n globalContextsProps,\n variation,\n translator,\n Head,\n pageParams,\n pageQuery,\n } = props;\n const loader = (props.loader as any)\n .__internal as InternalPlasmicComponentLoader;\n\n if (prefetchedData) {\n loader.registerPrefetchedBundle(prefetchedData?.bundle);\n }\n\n const [splits, setSplits] = React.useState<Split[]>(loader.getActiveSplits());\n const forceUpdate = useForceUpdate();\n const watcher = React.useMemo(\n () => ({\n onDataFetched: () => {\n setSplits(loader.getActiveSplits());\n forceUpdate();\n },\n }),\n [loader, forceUpdate]\n );\n\n React.useEffect(() => {\n loader.subscribePlasmicRoot(watcher);\n return () => loader.unsubscribePlasmicRoot(watcher);\n }, [watcher, loader]);\n\n React.useEffect(() => {\n ensureVariationCookies(variation);\n loader.trackRender({\n renderCtx: {\n // We track the provider as a single entity\n rootComponentId: 'provider',\n teamIds: loader.getTeamIds(),\n projectIds: loader.getProjectIds(),\n },\n variation,\n });\n }, [loader, variation]);\n\n // @ts-ignore\n const { user, userAuthToken, isUserLoading, authRedirectUri } = props;\n\n const value = React.useMemo<PlasmicRootContextValue>(\n () => ({\n globalVariants: mergeGlobalVariantsSpec(\n globalVariants ?? [],\n getGlobalVariantsFromSplits(splits, variation ?? {})\n ),\n globalContextsProps,\n loader,\n variation,\n translator,\n Head,\n user,\n userAuthToken,\n isUserLoading,\n authRedirectUri,\n }),\n [\n globalVariants,\n variation,\n globalContextsProps,\n loader,\n splits,\n translator,\n Head,\n user,\n userAuthToken,\n isUserLoading,\n authRedirectUri,\n ]\n );\n\n return (\n <PlasmicQueryDataProvider\n prefetchedCache={prefetchedQueryData}\n suspense={suspenseForQueryData}\n >\n <PlasmicRootContext.Provider value={value}>\n {!skipCss && (\n <PlasmicCss\n loader={loader}\n prefetchedData={prefetchedData}\n skipFonts={skipFonts}\n />\n )}\n <PageParamsProvider params={pageParams} query={pageQuery}>\n {children}\n </PageParamsProvider>\n </PlasmicRootContext.Provider>\n </PlasmicQueryDataProvider>\n );\n}\n\n/**\n * Inject all css modules as <style/> tags. We can't use the usual styleInjector postcss\n * uses because that doesn't work on the server side for SSR.\n */\nconst PlasmicCss = React.memo(function PlasmicCss(props: {\n loader: InternalPlasmicComponentLoader;\n prefetchedData?: ComponentRenderData;\n skipFonts?: boolean;\n}) {\n const { loader, prefetchedData, skipFonts } = props;\n const [useScopedCss, setUseScopedCss] = React.useState(!!prefetchedData);\n const builtCss = buildCss(loader, {\n scopedCompMetas:\n useScopedCss && prefetchedData\n ? prefetchedData.bundle.components\n : undefined,\n skipFonts,\n });\n const forceUpdate = useForceUpdate();\n const watcher = React.useMemo(\n () => ({\n onDataFetched: () => {\n // If new data has been fetched, then use all the fetched css\n setUseScopedCss(false);\n forceUpdate();\n },\n }),\n [loader, forceUpdate]\n );\n\n React.useEffect(() => {\n loader.subscribePlasmicRoot(watcher);\n return () => loader.unsubscribePlasmicRoot(watcher);\n }, [watcher, loader]);\n\n return <style dangerouslySetInnerHTML={{ __html: builtCss }} />;\n});\n\nfunction buildCss(\n loader: InternalPlasmicComponentLoader,\n opts: {\n scopedCompMetas?: ComponentMeta[];\n skipFonts?: boolean;\n }\n) {\n const { scopedCompMetas, skipFonts } = opts;\n const cssFiles =\n scopedCompMetas &&\n new Set<string>([\n 'entrypoint.css',\n ...scopedCompMetas.map((c) => c.cssFile),\n ]);\n const cssModules = loader\n .getLookup()\n .getCss()\n .filter((f) => !cssFiles || cssFiles.has(f.fileName));\n\n const getPri = (fileName: string) => (fileName === 'entrypoint.css' ? 0 : 1);\n const compareModules = (a: AssetModule, b: AssetModule) =>\n getPri(a.fileName) !== getPri(b.fileName)\n ? getPri(a.fileName) - getPri(b.fileName)\n : a.fileName.localeCompare(b.fileName);\n cssModules.sort(compareModules);\n\n const remoteFonts = loader.getLookup().getRemoteFonts();\n\n // Make sure the @import statements come at the front of css\n return `\n ${\n skipFonts\n ? ''\n : remoteFonts.map((f) => `@import url('${f.url}');`).join('\\n')\n }\n ${cssModules.map((mod) => mod.source).join('\\n')}\n `;\n}\n\nexport function usePlasmicRootContext() {\n return React.useContext(PlasmicRootContext);\n}\n","/**\n * We don't actually make use of the global variant React contexts generated\n * in the bundle. That's because we would have to wait until the data is\n * loaded before we can set up the context providers, but setting up context\n * providers will mutate the React tree and invalidate all the children. That means\n * once data comes in, we'll re-render the React tree from the providers down\n * in a way that will lose all existing React state. Therefore, instead,\n * we always have a single context provided -- the PlasmicRootContext -- and we\n * create these fake useGlobalVariant() hooks that just read from that\n * PlasmicRootContext. This allows us to have a stable React tree before and\n * after the data load.\n */\n\nimport { InternalPlasmicComponentLoader } from './loader';\nimport { usePlasmicRootContext } from './PlasmicRootProvider';\n\nexport function createUseGlobalVariant(name: string, projectId: string) {\n return () => {\n const rootContext = usePlasmicRootContext();\n if (!rootContext) {\n return undefined;\n }\n\n const loader = rootContext.loader as InternalPlasmicComponentLoader;\n const spec = [\n ...loader.getGlobalVariants(),\n ...(rootContext.globalVariants ?? []),\n ].find(\n (spec) =>\n spec.name === name && (!spec.projectId || spec.projectId === projectId)\n );\n return spec ? spec.value : undefined;\n };\n}\n","import {\n ComponentMeta,\n getBundleSubset,\n LoaderBundleOutput,\n} from '@plasmicapp/loader-core';\nimport type { ComponentRenderData } from './loader';\n\nfunction getUsedComps(allComponents: ComponentMeta[], entryCompIds: string[]) {\n const q: string[] = [...entryCompIds];\n const seenIds = new Set<string>(entryCompIds);\n const componentMetaById = new Map<string, ComponentMeta>(\n allComponents.map((meta) => [meta.id, meta])\n );\n const usedComps: ComponentMeta[] = [];\n while (q.length > 0) {\n const [id] = q.splice(0, 1);\n const meta = componentMetaById.get(id);\n if (!meta) {\n continue;\n }\n usedComps.push(meta);\n meta.usedComponents.forEach((usedCompId) => {\n if (!seenIds.has(usedCompId)) {\n seenIds.add(usedCompId);\n q.push(usedCompId);\n }\n });\n }\n return usedComps;\n}\n\nexport function prepComponentData(\n bundle: LoaderBundleOutput,\n compMetas: ComponentMeta[],\n opts?: {\n target?: 'browser' | 'server';\n }\n): ComponentRenderData {\n if (compMetas.length === 0) {\n return {\n entryCompMetas: bundle.components,\n bundle: bundle,\n remoteFontUrls: [],\n };\n }\n\n const usedComps = getUsedComps(\n bundle.components,\n compMetas.map((compMeta) => compMeta.id)\n );\n const compPaths = usedComps.map((compMeta) => compMeta.entry);\n const subBundle = getBundleSubset(\n bundle,\n [\n 'entrypoint.css',\n ...compPaths,\n 'root-provider.js',\n ...bundle.projects\n .map((x) => x.globalContextsProviderFileName)\n .filter((x) => !!x),\n // We need to explicitly include global context provider components\n // to make sure they are kept in bundle.components. That's because\n // for esbuild, just the globalContextsProviderFileName is not enough,\n // because it will import a chunk that includes the global context\n // component, instead of importing that global context component's\n // entry file. And because nothing depends on the global context component's\n // entry file, we end up excluding the global context component from\n // bundle.components, which then makes its substitution not work.\n // Instead, we forcibly include it here (we'll definitely need it anyway!).\n ...bundle.components\n .filter((c) => c.isGlobalContextProvider)\n .map((c) => c.entry),\n ...bundle.globalGroups.map((g) => g.contextFile),\n ],\n opts\n );\n\n const remoteFontUrls: string[] = [];\n subBundle.projects.forEach((p) =>\n remoteFontUrls.push(...p.remoteFonts.map((f) => f.url))\n );\n\n return {\n entryCompMetas: compMetas,\n bundle: subBundle,\n remoteFontUrls,\n };\n}\n\nexport function mergeBundles(\n target: LoaderBundleOutput,\n from: LoaderBundleOutput\n) {\n const existingCompIds = new Set(target.components.map((c) => c.id));\n\n const newCompMetas = from.components.filter(\n (m) => !existingCompIds.has(m.id)\n );\n if (newCompMetas.length > 0) {\n target = { ...target, components: [...target.components, ...newCompMetas] };\n }\n\n const existingProjects = new Set(target.projects.map((p) => p.id));\n const newProjects = from.projects.filter((p) => !existingProjects.has(p.id));\n if (newProjects.length > 0) {\n target = {\n ...target,\n projects: [...target.projects, ...newProjects],\n };\n }\n\n const existingModules = {\n browser: new Set(target.modules.browser.map((m) => m.fileName)),\n server: new Set(target.modules.server.map((m) => m.fileName)),\n };\n const newModules = {\n browser: from.modules.browser.filter(\n (m) => !existingModules.browser.has(m.fileName)\n ),\n server: from.modules.server.filter(\n (m) => !existingModules.server.has(m.fileName)\n ),\n };\n if (newModules.browser.length > 0 || newModules.server.length > 0) {\n target = {\n ...target,\n modules: {\n browser: [...target.modules.browser, ...newModules.browser],\n server: [...target.modules.server, ...newModules.server],\n },\n };\n }\n\n const existingGlobalIds = new Set(target.globalGroups.map((g) => g.id));\n const newGlobals = from.globalGroups.filter(\n (g) => !existingGlobalIds.has(g.id)\n );\n if (newGlobals.length > 0) {\n target = {\n ...target,\n globalGroups: [...target.globalGroups, ...newGlobals],\n };\n }\n\n const existingExternals = new Set(target.external);\n const newExternals = target.external.filter((x) => !existingExternals.has(x));\n if (newExternals.length > 0) {\n target = { ...target, external: [...target.external, ...newExternals] };\n }\n\n const existingSplitIds = new Set(target.activeSplits.map((s) => s.id));\n const newSplits =\n from.activeSplits.filter((s) => !existingSplitIds.has(s.id)) ?? [];\n if (newSplits.length > 0) {\n target = {\n ...target,\n activeSplits: [...target.activeSplits, ...newSplits],\n };\n }\n\n return target;\n}\n\nexport const convertBundlesToComponentRenderData = (\n bundles: LoaderBundleOutput[],\n compMetas: ComponentMeta[]\n): ComponentRenderData | null => {\n if (bundles.length === 0) {\n return null;\n }\n\n const mergedBundles = bundles.reduce((prev, cur) => mergeBundles(prev, cur));\n return prepComponentData(mergedBundles, compMetas);\n};\n","import {\n LoaderBundleCache,\n PageMeta,\n PlasmicModulesFetcher,\n PlasmicTracker,\n} from '@plasmicapp/loader-core';\nimport { ComponentMeta, LoaderBundleOutput } from '@plasmicapp/loader-fetcher';\nimport { mergeBundles, prepComponentData } from './bundles';\nimport { ComponentRenderData, FetchPagesOpts } from './loader';\nimport {\n ComponentLookupSpec,\n getCompMetas,\n getLookupSpecName,\n isBrowser,\n isDynamicPagePath,\n} from './utils';\n\nexport interface InitOptions {\n projects: {\n id: string;\n token: string;\n version?: string;\n }[];\n cache?: LoaderBundleCache;\n platform?: 'react' | 'nextjs' | 'gatsby';\n preview?: boolean;\n host?: string;\n onClientSideFetch?: 'warn' | 'error';\n i18nKeyScheme?: 'content' | 'hash';\n\n /**\n * By default, fetchComponentData() and fetchPages() calls cached in memory\n * with the PlasmicComponentLoader instance. If alwaysFresh is true, then\n * data is always freshly fetched over the network.\n */\n alwaysFresh?: boolean;\n}\n\n/** Subset of loader functionality that works on React Server Components. */\nexport class ReactServerPlasmicComponentLoader {\n private readonly opts: InitOptions;\n private readonly fetcher: PlasmicModulesFetcher;\n private readonly tracker: PlasmicTracker;\n private readonly onBundleMerged?: () => void;\n private readonly onBundleFetched?: () => void;\n\n private bundle: LoaderBundleOutput = {\n modules: {\n browser: [],\n server: [],\n },\n components: [],\n globalGroups: [],\n external: [],\n projects: [],\n activeSplits: [],\n };\n\n constructor(args: {\n opts: InitOptions;\n fetcher: PlasmicModulesFetcher;\n tracker: PlasmicTracker;\n /** Called after `mergeBundle` (including `fetch` calls). */\n onBundleMerged?: () => void;\n /** Called after any `fetch` calls. */\n onBundleFetched?: () => void;\n }) {\n this.opts = args.opts;\n this.fetcher = args.fetcher;\n this.tracker = args.tracker;\n this.onBundleMerged = args.onBundleMerged;\n this.onBundleFetched = args.onBundleFetched;\n }\n\n private maybeGetCompMetas(...specs: ComponentLookupSpec[]) {\n const found = new Set<ComponentMeta>();\n const missing: ComponentLookupSpec[] = [];\n for (const spec of specs) {\n const filteredMetas = getCompMetas(this.bundle.components, spec);\n if (filteredMetas.length > 0) {\n filteredMetas.forEach((meta) => found.add(meta));\n } else {\n missing.push(spec);\n }\n }\n return { found: Array.from(found.keys()), missing };\n }\n\n async maybeFetchComponentData(\n specs: ComponentLookupSpec[],\n opts?: FetchComponentDataOpts\n ): Promise<ComponentRenderData | null>;\n async maybeFetchComponentData(\n ...specs: ComponentLookupSpec[]\n ): Promise<ComponentRenderData | null>;\n async maybeFetchComponentData(\n ...args: any[]\n ): Promise<ComponentRenderData | null> {\n const { specs, opts } = parseFetchComponentDataArgs(...args);\n const returnWithSpecsToFetch = async (\n specsToFetch: ComponentLookupSpec[]\n ) => {\n await this.fetchMissingData({ missingSpecs: specsToFetch });\n const {\n found: existingMetas2,\n missing: missingSpecs2,\n } = this.maybeGetCompMetas(...specs);\n if (missingSpecs2.length > 0) {\n return null;\n }\n\n return prepComponentData(this.bundle, existingMetas2, opts);\n };\n\n if (this.opts.alwaysFresh) {\n // If alwaysFresh, then we treat all specs as missing\n return await returnWithSpecsToFetch(specs);\n }\n\n // Else we only fetch actually missing specs\n const {\n found: existingMetas,\n missing: missingSpecs,\n } = this.maybeGetCompMetas(...specs);\n if (missingSpecs.length === 0) {\n return prepComponentData(this.bundle, existingMetas, opts);\n }\n\n return await returnWithSpecsToFetch(missingSpecs);\n }\n\n async fetchComponentData(\n specs: ComponentLookupSpec[],\n opts?: FetchComponentDataOpts\n ): Promise<ComponentRenderData>;\n async fetchComponentData(\n ...specs: ComponentLookupSpec[]\n ): Promise<ComponentRenderData>;\n async fetchComponentData(...args: any[]): Promise<ComponentRenderData> {\n const { specs, opts } = parseFetchComponentDataArgs(...args);\n const data = await this.maybeFetchComponentData(specs, opts);\n\n if (!data) {\n const { missing: missingSpecs } = this.maybeGetCompMetas(...specs);\n throw new Error(\n `Unable to find components ${missingSpecs\n .map(getLookupSpecName)\n .join(', ')}`\n );\n }\n\n return data;\n }\n\n async fetchPages(opts?: FetchPagesOpts) {\n this.maybeReportClientSideFetch(\n () => `Plasmic: fetching all page metadata in the browser`\n );\n const data = await this.fetchAllData();\n return data.components.filter(\n (comp) =>\n comp.isPage &&\n comp.path &&\n (opts?.includeDynamicPages || !isDynamicPagePath(comp.path))\n ) as PageMeta[];\n }\n\n async fetchComponents() {\n this.maybeReportClientSideFetch(\n () => `Plasmic: fetching all component metadata in the browser`\n );\n const data = await this.fetchAllData();\n return data.components;\n }\n\n getActiveSplits() {\n return this.bundle.activeSplits;\n }\n\n private async fetchMissingData(opts: {\n missingSpecs: ComponentLookupSpec[];\n }) {\n // TODO: do better than just fetching everything\n this.maybeReportClientSideFetch(\n () =>\n `Plasmic: fetching missing components in the browser: ${opts.missingSpecs\n .map((spec) => getLookupSpecName(spec))\n .join(', ')}`\n );\n return this.fetchAllData();\n }\n\n private maybeReportClientSideFetch(mkMsg: () => string) {\n if (isBrowser && this.opts.onClientSideFetch) {\n const msg = mkMsg();\n if (this.opts.onClientSideFetch === 'warn') {\n console.warn(msg);\n } else {\n throw new Error(msg);\n }\n }\n }\n\n private async fetchAllData() {\n const bundle = await this.fetcher.fetchAllData();\n this.tracker.trackFetch();\n this.mergeBundle(bundle);\n this.onBundleFetched?.();\n return bundle;\n }\n\n mergeBundle(bundle: LoaderBundleOutput) {\n this.bundle = mergeBundles(bundle, this.bundle);\n this.onBundleMerged?.();\n }\n\n getBundle(): LoaderBundleOutput {\n return this.bundle;\n }\n\n clearCache() {\n this.bundle = {\n modules: {\n browser: [],\n server: [],\n },\n components: [],\n globalGroups: [],\n external: [],\n projects: [],\n activeSplits: [],\n };\n }\n}\n\nexport interface FetchComponentDataOpts {\n /**\n * Will fetch either code targeting SSR or browser hydration in the\n * returned bundle.\n *\n * By default, the target is browser. That's okay, because even when\n * doing SSR, as long as you are using the same instance of PlasmicLoader\n * that was used to fetch component data, it will still know how to get at\n * the server code.\n *\n * But, if you are building your own SSR solution, where fetching and rendering\n * are using different instances of PlasmicLoader, then you'll want to make\n * sure that when you fetch, you are fetching the right one to be used in the\n * right environment for either SSR or browser hydration.\n */\n target?: 'server' | 'browser';\n}\n\nfunction parseFetchComponentDataArgs(\n specs: ComponentLookupSpec[],\n opts?: FetchComponentDataOpts\n): { specs: ComponentLookupSpec[]; opts?: FetchComponentDataOpts };\nfunction parseFetchComponentDataArgs(\n ...specs: ComponentLookupSpec[]\n): { specs: ComponentLookupSpec[]; opts?: FetchComponentDataOpts };\nfunction parseFetchComponentDataArgs(...args: any[]) {\n let specs: ComponentLookupSpec[];\n let opts: FetchComponentDataOpts | undefined;\n if (Array.isArray(args[0])) {\n specs = args[0];\n opts = args[1];\n } else {\n specs = args;\n opts = undefined;\n }\n return { specs, opts };\n}\n","import * as PlasmicDataSourcesContext from '@plasmicapp/data-sources-context';\nimport * as PlasmicHost from '@plasmicapp/host';\nimport {\n ComponentHelpers as InternalCodeComponentHelpers,\n ComponentMeta as InternalCodeComponentMeta,\n GlobalContextMeta as InternalGlobalContextMeta,\n registerComponent,\n registerGlobalContext,\n registerToken,\n registerTrait,\n StateHelpers,\n StateSpec,\n TokenRegistration,\n TraitMeta,\n} from '@plasmicapp/host';\nimport {\n ComponentMeta,\n LoaderBundleOutput,\n PlasmicModulesFetcher,\n PlasmicTracker,\n Registry,\n TrackRenderOptions,\n} from '@plasmicapp/loader-core';\nimport { internal_getCachedBundleInNodeServer } from '@plasmicapp/loader-fetcher';\nimport { getActiveVariation, getExternalIds } from '@plasmicapp/loader-splits';\nimport * as PlasmicQuery from '@plasmicapp/query';\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport * as jsxDevRuntime from 'react/jsx-dev-runtime';\nimport * as jsxRuntime from 'react/jsx-runtime';\nimport { ComponentLookup } from './component-lookup';\nimport { createUseGlobalVariant } from './global-variants';\nimport {\n FetchComponentDataOpts,\n InitOptions,\n ReactServerPlasmicComponentLoader,\n} from './loader-react-server';\nimport type { GlobalVariantSpec } from './PlasmicRootProvider';\nimport { ComponentLookupSpec, getCompMetas, isBrowser, uniq } from './utils';\nimport { getPlasmicCookieValues, updatePlasmicCookieValue } from './variation';\n\nexport interface ComponentRenderData {\n entryCompMetas: (ComponentMeta & { params?: Record<string, string> })[];\n bundle: LoaderBundleOutput;\n remoteFontUrls: string[];\n}\n\ninterface ComponentSubstitutionSpec {\n lookup: ComponentLookupSpec;\n component: React.ComponentType<any>;\n codeComponentHelpers?: InternalCodeComponentHelpers<\n React.ComponentProps<any>\n >;\n}\n\ninterface PlasmicRootWatcher {\n onDataFetched?: () => void;\n}\n\nexport type CodeComponentMeta<P> = Omit<\n InternalCodeComponentMeta<P>,\n 'importPath' | 'componentHelpers' | 'states'\n> & {\n /**\n * The path to be used when importing the component in the generated code.\n * It can be the name of the package that contains the component, or the path\n * to the file in the project (relative to the root directory).\n * Optional: not used by Plasmic headless API, only by codegen.\n */\n importPath?: string;\n /**\n * The states helpers are registered together with the states for the Plasmic headless API\n */\n states?: Record<string, StateSpec & StateHelpers<P, any>>;\n};\n\nexport type GlobalContextMeta<P> = Omit<\n InternalGlobalContextMeta<P>,\n 'importPath'\n> & {\n /**\n * The path to be used when importing the component in the generated code.\n * It can be the name of the package that contains the component, or the path\n * to the file in the project (relative to the root directory).\n * Optional: not used by Plasmic headless API, only by codegen.\n */\n importPath?: string;\n};\n\nexport type FetchPagesOpts = {\n /**\n * Whether to include dynamic pages in fetchPages() output. A page is\n * considered dynamic if its path contains some param between brackets,\n * e.g. \"[slug]\".\n */\n includeDynamicPages?: boolean;\n};\n\nconst SUBSTITUTED_COMPONENTS: Record<string, React.ComponentType<any>> = {};\nconst REGISTERED_CODE_COMPONENT_HELPERS: Record<\n string,\n InternalCodeComponentHelpers<React.ComponentProps<any>>\n> = {};\nconst SUBSTITUTED_GLOBAL_VARIANT_HOOKS: Record<string, () => any> = {};\n\nexport class InternalPlasmicComponentLoader {\n private readonly reactServerLoader: ReactServerPlasmicComponentLoader;\n private readonly registry = new Registry();\n private subs: ComponentSubstitutionSpec[] = [];\n private roots: PlasmicRootWatcher[] = [];\n private globalVariants: GlobalVariantSpec[] = [];\n private tracker: PlasmicTracker;\n\n constructor(private opts: InitOptions) {\n this.tracker = new PlasmicTracker({\n projectIds: opts.projects.map((p) => p.id),\n platform: opts.platform,\n preview: opts.preview,\n });\n this.reactServerLoader = new ReactServerPlasmicComponentLoader({\n opts,\n fetcher: new PlasmicModulesFetcher(opts),\n tracker: this.tracker,\n onBundleMerged: () => {\n this.refreshRegistry();\n },\n onBundleFetched: () => {\n this.roots.forEach((watcher) => watcher.onDataFetched?.());\n },\n });\n\n this.registerModules({\n react: React,\n 'react-dom': ReactDOM,\n 'react/jsx-runtime': jsxRuntime,\n 'react/jsx-dev-runtime': jsxDevRuntime,\n\n // Also inject @plasmicapp/query and @plasmicapp/host to use the\n // same contexts here and in loader-downloaded code.\n '@plasmicapp/query': PlasmicQuery,\n '@plasmicapp/data-sources-context': PlasmicDataSourcesContext,\n '@plasmicapp/host': PlasmicHost,\n '@plasmicapp/loader-runtime-registry': {\n components: SUBSTITUTED_COMPONENTS,\n globalVariantHooks: SUBSTITUTED_GLOBAL_VARIANT_HOOKS,\n codeComponentHelpers: REGISTERED_CODE_COMPONENT_HELPERS,\n },\n });\n }\n\n getBundle() {\n return this.reactServerLoader.getBundle();\n }\n\n setGlobalVariants(globalVariants: GlobalVariantSpec[]) {\n this.globalVariants = globalVariants;\n }\n\n getGlobalVariants() {\n return this.globalVariants;\n }\n\n registerModules(modules: Record<string, any>) {\n if (\n Object.keys(modules).some(\n (name) => this.registry.getRegisteredModule(name) !== modules[name]\n )\n ) {\n if (!this.registry.isEmpty()) {\n console.warn(\n 'Calling PlasmicComponentLoader.registerModules() after Plasmic component has rendered; starting over.'\n );\n this.registry.clear();\n }\n for (const key of Object.keys(modules)) {\n this.registry.register(key, modules[key]);\n }\n }\n }\n\n substituteComponent<P>(\n component: React.ComponentType<P>,\n name: ComponentLookupSpec\n ) {\n this.internalSubstituteComponent(component, name, undefined);\n }\n\n private internalSubstituteComponent<P>(\n component: React.ComponentType<P>,\n name: ComponentLookupSpec,\n codeComponentHelpers:\n | InternalCodeComponentHelpers<\n React.ComponentProps<React.ComponentType<P>>\n >\n | undefined\n ) {\n if (!this.registry.isEmpty()) {\n console.warn(\n 'Calling PlasmicComponentLoader.registerSubstitution() after Plasmic component has rendered; starting over.'\n );\n this.registry.clear();\n }\n this.subs.push({ lookup: name, component, codeComponentHelpers });\n }\n\n registerComponent<T extends React.ComponentType<any>>(\n component: T,\n meta: CodeComponentMeta<React.ComponentProps<T>>\n ) {\n // making the component meta consistent between codegen and loader\n const stateHelpers = Object.fromEntries(\n Object.entries(meta.states ?? {})\n .filter(\n ([_, stateSpec]) =>\n 'initFunc' in stateSpec || 'onChangeArgsToValue' in stateSpec\n )\n .map(([stateName, stateSpec]) => [\n stateName,\n {\n ...('initFunc' in stateSpec\n ? { initFunc: stateSpec.initFunc }\n : {}),\n ...('onChangeArgsToValue' in stateSpec\n ? { onChangeArgsToValue: stateSpec.onChangeArgsToValue }\n : {}),\n },\n ])\n );\n const helpers = { states: stateHelpers };\n this.internalSubstituteComponent(\n component,\n { name: meta.name, isCode: true },\n Object.keys(stateHelpers).length > 0 ? helpers : undefined\n );\n registerComponent(component, {\n ...meta,\n // Import path is not used as we will use component substitution\n importPath: meta.importPath ?? '',\n ...(Object.keys(stateHelpers).length > 0\n ? {\n componentHelpers: {\n helpers,\n importPath: '',\n importName: '',\n },\n }\n : {}),\n });\n }\n\n registerGlobalContext<T extends React.ComponentType<any>>(\n context: T,\n meta: GlobalContextMeta<React.ComponentProps<T>>\n ) {\n this.substituteComponent(context, { name: meta.name, isCode: true });\n // Import path is not used as we will use component substitution\n registerGlobalContext(context, {\n ...meta,\n importPath: meta.importPath ?? '',\n });\n }\n\n registerTrait(trait: string, meta: TraitMeta) {\n registerTrait(trait, meta);\n }\n\n registerToken(token: TokenRegistration) {\n registerToken(token);\n }\n\n registerPrefetchedBundle(bundle: LoaderBundleOutput) {\n // For React Server Components (Next.js 13+),\n // we need to pass server modules in LoaderBundleOutput from Server Components to Client Components.\n // We don't want to pass them via normal page props because that will be serialized to the browser.\n // Instead, we pass the bundle (including the server modules) via the Node `global` variable.\n //\n // This is the code that reads the stored bundle and merges it back into the loader.\n if (!isBrowser) {\n // Check if we have a cached bundle on this Node server.\n const cachedBundle = internal_getCachedBundleInNodeServer(this.opts);\n if (cachedBundle) {\n // If it's there, merge the cached bundle first.\n this.reactServerLoader.mergeBundle(cachedBundle);\n }\n }\n this.reactServerLoader.mergeBundle(bundle);\n }\n\n subscribePlasmicRoot(watcher: PlasmicRootWatcher) {\n this.roots.push(watcher);\n }\n\n unsubscribePlasmicRoot(watcher: PlasmicRootWatcher) {\n const index = this.roots.indexOf(watcher);\n if (index >= 0) {\n this.roots.splice(index, 1);\n }\n }\n\n clearCache() {\n this.reactServerLoader.clearCache();\n this.registry.clear();\n }\n\n getLookup() {\n return new ComponentLookup(this.getBundle(), this.registry);\n }\n\n // ReactServerLoader methods\n\n maybeFetchComponentData(\n specs: ComponentLookupSpec[],\n opts?: FetchComponentDataOpts\n ): Promise<ComponentRenderData | null>;\n maybeFetchComponentData(\n ...specs: ComponentLookupSpec[]\n ): Promise<ComponentRenderData | null>;\n maybeFetchComponentData(...args: any[]): Promise<ComponentRenderData | null> {\n return this.reactServerLoader.maybeFetchComponentData(...args);\n }\n\n fetchComponentData(\n specs: ComponentLookupSpec[],\n opts?: FetchComponentDataOpts\n ): Promise<ComponentRenderData>;\n fetchComponentData(\n ...specs: ComponentLookupSpec[]\n ): Promise<ComponentRenderData>;\n fetchComponentData(...args: any[]): Promise<ComponentRenderData> {\n return this.reactServerLoader.fetchComponentData(...args);\n }\n\n fetchPages(opts?: FetchPagesOpts) {\n return this.reactServerLoader.fetchPages(opts);\n }\n\n fetchComponents() {\n return this.reactServerLoader.fetchComponents();\n }\n\n getActiveSplits() {\n return this.reactServerLoader.getActiveSplits();\n }\n\n trackConversion(value: number = 0) {\n this.tracker.trackConversion(value);\n }\n\n public async getActiveVariation(opts: {\n traits: Record<string, string | number | boolean>;\n getKnownValue: (key: string) => string | undefined;\n updateKnownValue: (key: string, value: string) => void;\n }) {\n await this.reactServerLoader.fetchComponents();\n return getActiveVariation({\n ...opts,\n splits: this.getBundle().activeSplits,\n });\n }\n\n public getTeamIds(): string[] {\n return uniq(\n this.getBundle()\n .projects.map((p) =>\n p.teamId ? `${p.teamId}${p.indirect ? '@indirect' : ''}` : null\n )\n .filter((x): x is string => !!x)\n );\n }\n\n public getProjectIds(): string[] {\n return uniq(\n this.getBundle().projects.map(\n (p) => `${p.id}${p.indirect ? '@indirect' : ''}`\n )\n );\n }\n\n public trackRender(opts?: TrackRenderOptions) {\n this.tracker.trackRender(opts);\n }\n\n private refreshRegistry() {\n // Once we have received data, we register components to\n // substitute. We had to wait for data to do this so\n // that we can look up the right module name to substitute\n // in component meta.\n for (const sub of this.subs) {\n const metas = getCompMetas(this.getBundle().components, sub.lookup);\n metas.forEach((meta) => {\n SUBSTITUTED_COMPONENTS[meta.id] = sub.component;\n if (sub.codeComponentHelpers) {\n REGISTERED_CODE_COMPONENT_HELPERS[meta.id] = sub.codeComponentHelpers;\n }\n });\n }\n\n // We also swap global variants' useXXXGlobalVariant() hook with\n // a fake one that just reads from the PlasmicRootContext. Because\n // global variant values are not supplied by the generated global variant\n // context providers, but instead by <PlasmicRootProvider/> and by\n // PlasmicComponentLoader.setGlobalVariants(), we redirect these\n // hooks to read from them instead.\n for (const globalGroup of this.getBundle().globalGroups) {\n if (globalGroup.type !== 'global-screen') {\n SUBSTITUTED_GLOBAL_VARIANT_HOOKS[\n globalGroup.id\n ] = createUseGlobalVariant(globalGroup.name, globalGroup.projectId);\n }\n }\n this.registry.updateModules(this.getBundle());\n }\n}\n\n/**\n * Library for fetching component data, and registering\n * custom components.\n */\nexport class PlasmicComponentLoader {\n private __internal: InternalPlasmicComponentLoader;\n constructor(internal: InternalPlasmicComponentLoader) {\n this.__internal = internal;\n }\n\n /**\n * Sets global variants to be used for all components. Note that\n * this is not reactive, and will not re-render all components\n * already mounted; instead, it should be used to activate global\n * variants that should always be activated for the lifetime of this\n * app. If you'd like to reactively change the global variants,\n * you should specify them via <PlasmicRootProvider />\n */\n setGlobalVariants(globalVariants: GlobalVariantSpec[]) {\n this.__internal.setGlobalVariants(globalVariants);\n }\n\n registerModules(modules: Record<string, any>) {\n this.__internal.registerModules(modules);\n }\n\n /**\n * Register custom components that should be swapped in for\n * components defined in your project. You can use this to\n * swap in / substitute a Plasmic component with a \"real\" component.\n */\n substituteComponent<P>(\n component: React.ComponentType<P>,\n name: ComponentLookupSpec\n ) {\n this.__internal.substituteComponent(component, name);\n }\n\n /**\n * Register code components to be used on Plasmic Editor.\n */\n registerComponent<T extends React.ComponentType<any>>(\n component: T,\n meta: CodeComponentMeta<React.ComponentProps<T>>\n ): void;\n\n /**\n * [[deprecated]] Please use `substituteComponent` instead for component\n * substitution, or the other `registerComponent` overload to register\n * code components to be used on Plasmic Editor.\n *\n * @see `substituteComponent`\n */\n registerComponent<T extends React.ComponentType<any>>(\n component: T,\n name: ComponentLookupSpec\n ): void;\n\n registerComponent<T extends React.ComponentType<any>>(\n component: T,\n metaOrName: ComponentLookupSpec | CodeComponentMeta<React.ComponentProps<T>>\n ) {\n // 'props' is a required field in CodeComponentMeta\n if (metaOrName && typeof metaOrName === 'object' && 'props' in metaOrName) {\n this.__internal.registerComponent(component, metaOrName);\n } else {\n // Deprecated call\n if (\n process.env.NODE_ENV === 'development' &&\n !this.warnedRegisterComponent\n ) {\n console.warn(\n `PlasmicLoader: Using deprecated method \\`registerComponent\\` for component substitution. ` +\n `Please consider using \\`substituteComponent\\` instead.`\n );\n this.warnedRegisterComponent = true;\n }\n this.substituteComponent(component, metaOrName);\n }\n }\n private warnedRegisterComponent = false;\n\n registerGlobalContext<T extends React.ComponentType<any>>(\n context: T,\n meta: GlobalContextMeta<React.ComponentProps<T>>\n ) {\n this.__internal.registerGlobalContext(context, meta);\n }\n\n registerTrait(trait: string, meta: TraitMeta) {\n this.__internal.registerTrait(trait, meta);\n }\n\n registerToken(token: TokenRegistration) {\n this.__internal.registerToken(token);\n }\n\n /**\n * Pre-fetches component data needed to for PlasmicLoader to render\n * these components. Should be passed into PlasmicRootProvider as\n * the prefetchedData prop.\n *\n * You can look up a component either by:\n * - the name of the component\n * - the path for a page component\n * - an array of strings that make up parts of the path\n * - object { name: \"name_or_path\", projectId: ...}, to specify which project\n * to use, if multiple projects have the same component name\n *\n * Throws an Error if a specified component to fetch does not exist in\n * the Plasmic project.\n */\n async fetchComponentData(\n ...specs: ComponentLookupSpec[]\n ): Promise<ComponentRenderData> {\n return this.__internal.fetchComponentData(...specs);\n }\n\n /**\n * Like fetchComponentData(), but returns null instead of throwing an Error\n * when a component is not found. Useful when you are implementing a catch-all\n * page and want to check if a specific path had been defined for Plasmic.\n */\n async maybeFetchComponentData(\n ...specs: ComponentLookupSpec[]\n ): Promise<ComponentRenderData | null> {\n return this.__internal.maybeFetchComponentData(...specs);\n }\n\n /**\n * Returns all the page component metadata for these projects.\n */\n async fetchPages(opts?: FetchPagesOpts) {\n return this.__internal.fetchPages(opts);\n }\n\n /**\n * Returns all components metadata for these projects.\n */\n async fetchComponents() {\n return this.__internal.fetchComponents();\n }\n\n protected async _getActiveVariation(opts: {\n traits: Record<string, string | number | boolean>;\n getKnownValue: (key: string) => string | undefined;\n updateKnownValue: (key: string, value: string) => void;\n }) {\n return this.__internal.getActiveVariation(opts);\n }\n\n async getActiveVariation(opts: {\n known?: Record<string, string>;\n traits: Record<string, string | number | boolean>;\n }) {\n return this._getActiveVariation({\n traits: opts.traits,\n getKnownValue: (key: string) => {\n if (opts.known) {\n return opts.known[key];\n } else {\n const cookies = getPlasmicCookieValues();\n return cookies[key];\n }\n },\n updateKnownValue: (key: string, value: string) => {\n if (!opts.known) {\n updatePlasmicCookieValue(key, value);\n }\n },\n });\n }\n\n getExternalVariation(variation: Record<string, string>) {\n return getExternalIds(this.getActiveSplits(), variation);\n }\n\n getActiveSplits() {\n return this.__internal.getActiveSplits();\n }\n\n trackConversion(value: number = 0) {\n this.__internal.trackConversion(value);\n }\n\n clearCache() {\n return this.__internal.clearCache();\n }\n}\n","import * as React from 'react';\nimport { usePlasmicRootContext } from './PlasmicRootProvider';\nimport {\n ComponentLookupSpec,\n useForceUpdate,\n useIsMounted,\n useStableLookupSpec,\n} from './utils';\n\n/**\n * Hook that fetches and returns a React component for rendering the argument\n * Plasmic component. Returns undefined if the component data is still\n * being fetched.\n *\n * @param opts.forceOriginal if you used PlasmicComponentLoader.registerComponent,\n * then normally usePlasmicComponent will return the registered component.\n * You can set forceOriginal to true if you want to return the Plasmic-generated\n * component instead.\n */\nexport function usePlasmicComponent<P extends React.ComponentType = any>(\n spec: ComponentLookupSpec,\n opts: { forceOriginal?: boolean } = {}\n) {\n const rootContext = usePlasmicRootContext();\n if (!rootContext) {\n throw new Error(\n `You can only use usePlasmicComponent if wrapped in <PlasmicRootProvider />`\n );\n }\n\n const loader = rootContext.loader;\n const lookup = loader.getLookup();\n\n const component = lookup.hasComponent(spec)\n ? lookup.getComponent(spec, opts)\n : undefined;\n\n const stableSpec = useStableLookupSpec(spec);\n const isMounted = useIsMounted();\n const forceUpdate = useForceUpdate();\n\n React.useEffect(() => {\n if (!component) {\n (async () => {\n await loader.fetchComponentData(stableSpec);\n if (isMounted()) {\n forceUpdate();\n }\n })();\n }\n }, [component, stableSpec]);\n\n return component as P;\n}\n","import * as React from 'react';\nimport { usePlasmicRootContext } from './PlasmicRootProvider';\nimport { usePlasmicComponent } from './usePlasmicComponent';\n\nconst PlasmicComponentContext = React.createContext(false);\n\nexport function PlasmicComponent(props: {\n /**\n * Name of the component to render, or the path of the page component\n */\n component: string;\n /**\n * Optionally specify a projectId if there are multiple components\n * of the same name from different projects\n */\n projectId?: string;\n /**\n * If you used registerComponent(), then if the name matches a registered\n * component, that component is used. If you want the Plasmic-generated\n * component instead, specify forceOriginal.\n */\n forceOriginal?: boolean;\n componentProps?: any;\n}): React.ReactElement | null {\n const { component, projectId, componentProps, forceOriginal } = props;\n\n const rootContext = usePlasmicRootContext();\n const isRootLoader = !React.useContext(PlasmicComponentContext);\n\n if (!rootContext) {\n // no existing PlasmicRootProvider\n throw new Error(\n `You must use <PlasmicRootProvider/> at the root of your app`\n );\n }\n\n const {\n loader,\n globalContextsProps,\n variation,\n userAuthToken,\n isUserLoading,\n authRedirectUri,\n ...rest\n } = rootContext;\n\n const Component = usePlasmicComponent(\n { name: component, projectId, isCode: false },\n { forceOriginal }\n );\n\n React.useEffect(() => {\n if (isRootLoader) {\n const meta = loader\n .getLookup()\n .getComponentMeta({ name: component, projectId });\n\n if (meta) {\n loader.trackRender({\n renderCtx: {\n rootProjectId: meta.projectId,\n rootComponentId: meta.id,\n rootComponentName: component,\n teamIds: loader.getTeamIds(),\n projectIds: loader.getProjectIds(),\n },\n variation,\n });\n }\n }\n }, [component, projectId, loader, variation]);\n\n const element = React.useMemo(() => {\n if (!Component) {\n return null;\n }\n\n let element = <Component {...componentProps} />;\n\n if (isRootLoader) {\n // If this is the root PlasmicComponent, then wrap the content with the\n // react-web's PlasmicRootProvider. We are doing this here, instead of\n // say PlasmicRootProvider, because we don't have access to this context\n // provider until data has been loaded. If we insert this provider into\n // the tree at the root after data is loaded, then we'll invalidate the\n // React tree and tree state, which is bad. Instead, we do it at the\n // \"root-most PlasmicComponent\"; we won't risk invalidating the sub-tree\n // here because there were no children before the data came in.\n const lookup = loader.getLookup();\n const ReactWebRootProvider = lookup.getRootProvider();\n const GlobalContextsProvider = lookup.getGlobalContextsProvider({\n name: component,\n projectId,\n });\n element = (\n <ReactWebRootProvider\n {...rest}\n userAuthToken={userAuthToken}\n isUserLoading={isUserLoading}\n authRedirectUri={authRedirectUri}\n >\n <MaybeWrap\n cond={!!GlobalContextsProvider}\n wrapper={(children) => (\n <GlobalContextsProvider {...globalContextsProps}>\n {children}\n </GlobalContextsProvider>\n )}\n >\n <PlasmicComponentContext.Provider value={true}>\n {element}\n </PlasmicComponentContext.Provider>\n </MaybeWrap>\n </ReactWebRootProvider>\n );\n }\n return element;\n }, [\n Component,\n componentProps,\n loader,\n isRootLoader,\n component,\n projectId,\n globalContextsProps,\n userAuthToken, // Just use the token to memo, `user` should be derived from it\n isUserLoading,\n authRedirectUri,\n ]);\n return element;\n}\n\nfunction MaybeWrap(props: {\n children: React.ReactNode;\n cond: boolean;\n wrapper: (children: React.ReactNode) => React.ReactElement;\n}) {\n return (props.cond\n ? props.wrapper(props.children)\n : props.children) as React.ReactElement;\n}\n","import { PlasmicPrepassContext } from '@plasmicapp/query';\nimport prepass from '@plasmicapp/react-ssr-prepass';\nimport React from 'react';\nimport { isFragment } from 'react-is';\nimport { PlasmicComponent } from './PlasmicComponent';\n\n/**\n * Performs a prepass over Plasmic content, kicking off the necessary\n * data fetches, and populating the fetched data into a cache. This\n * cache can be passed as prefetchedQueryData into PlasmicRootProvider.\n *\n * To limit rendering errors that can occur when you do this, we recommend\n * that you pass in _only_ the PlasmicComponents that you are planning to use\n * as the argument. For example:\n *\n * const cache = await extractPlasmicQueryData(\n * <PlasmicRootProvider loader={PLASMIC} prefetchedData={plasmicData}>\n * <PlasmicComponent component=\"Home\" componentProps={{\n * // Specify the component prop overrides you are planning to use\n * // to render the page, as they may change what data is fetched.\n * ...\n * }} />\n * <PlasmicComponent component=\"NavBar\" componentProps={{\n * ...\n * }} />\n * ...\n * </PlasmicRootProvider>\n * );\n *\n * If your PlasmicComponent will be wrapping components that require special\n * context set up, you should also wrap the element above with those context\n * providers.\n *\n * You should avoid passing in elements that are not related to Plasmic, as any\n * rendering errors from those elements during the prepass may result in data\n * not being populated in the cache.\n *\n * @param element a React element containing instances of PlasmicComponent.\n * Will attempt to satisfy all data needs from usePlasmicDataQuery()\n * in this element tree.\n * @returns an object mapping query key to fetched data\n */\nexport async function extractPlasmicQueryData(\n element: React.ReactElement\n): Promise<Record<string, any>> {\n const cache = new Map<string, any>();\n try {\n await plasmicPrepass(\n <PlasmicPrepassContext cache={cache}>{element}</PlasmicPrepassContext>\n );\n } catch (err) {\n console.warn(`PLASMIC: Error encountered while pre-rendering`, err);\n }\n\n const queryCache = Object.fromEntries(\n Array.from(cache.entries()).filter(\n ([key, val]) => !key.startsWith('$swr$') && val !== undefined\n )\n );\n\n try {\n return JSON.parse(\n JSON.stringify(queryCache, (key, value) =>\n value !== undefined ? value : null\n )\n );\n } catch {\n return queryCache;\n }\n}\n\n/**\n * Runs react-ssr-prepass on `element`, while isolating rendering errors\n * as much as possible for each PlasmicComponent instance.\n */\nexport async function plasmicPrepass(element: React.ReactElement) {\n await prepass(buildPlasmicPrepassElement(element));\n}\n\n/**\n * Returns a clone of the element tree, where componentProps of PlasmicComponent\n * has been processed such that any React elements found are wrapped in\n * an error boundary. Makes it possible to isolate rendering errors while still\n * finishing as much data fetched as possible.\n */\nfunction buildPlasmicPrepassElement(element: React.ReactElement) {\n return (\n <GenericErrorBoundary>{processReactElement(element)}</GenericErrorBoundary>\n );\n}\n\nfunction processReactElement(element: React.ReactElement) {\n if (element.type === PlasmicComponent) {\n return React.cloneElement(\n element,\n processPlasmicComponentProps(element.props)\n );\n } else {\n return React.cloneElement(element, processComponentProps(element.props));\n }\n}\n\nfunction processComponentProps(\n props: Record<string, any>\n): Record<string, any> {\n if (!props || typeof props !== 'object') {\n return props;\n }\n\n return Object.fromEntries(\n Object.entries(props).map(([k, v]) => {\n return [k, React.isValidElement(v) ? processReactElement(v) : v];\n })\n );\n}\n\nclass GenericErrorBoundary extends React.Component<{\n children: React.ReactNode;\n}> {\n constructor(props: { children: React.ReactNode }) {\n super(props);\n }\n\n componentDidCatch(error: any) {\n console.log(`Plasmic: Encountered error while prepass rendering:`, error);\n }\n\n render() {\n return <>{this.props.children}</>;\n }\n}\n\n/**\n * To process the componentProps passed to PlasmicComponent, wrap any\n * React element we find in <GenericErrorBoundary />.\n */\nfunction processPlasmicComponentProps(x: any): any {\n if (!x) {\n return x;\n } else if (isFragment(x)) {\n return (\n <React.Fragment>\n {React.Children.map(x.props.children, processPlasmicComponentProps)}\n </React.Fragment>\n );\n } else if (React.isValidElement(x)) {\n return <GenericErrorBoundary>{x}</GenericErrorBoundary>;\n } else if (Array.isArray(x)) {\n return x.map(processPlasmicComponentProps);\n } else if (isLiteralObject(x)) {\n return Object.fromEntries(\n Object.entries(x).map(([key, val]) => [\n key,\n processPlasmicComponentProps(val),\n ])\n );\n } else {\n return x;\n }\n}\n\nfunction isLiteralObject(obj: any): obj is Object {\n return !!obj && typeof obj === 'object' && obj.constructor === Object;\n}\n","import React from 'react';\nimport ReactDOM from 'react-dom';\nimport { renderToString as reactRenderToString } from 'react-dom/server';\nimport { ComponentRenderData, PlasmicComponentLoader } from './loader';\nimport { PlasmicComponent } from './PlasmicComponent';\nimport { GlobalVariantSpec, PlasmicRootProvider } from './PlasmicRootProvider';\nimport { extractPlasmicQueryData } from './prepass';\nimport { ComponentLookupSpec } from './utils';\n\nexport async function renderToElement(\n loader: PlasmicComponentLoader,\n target: HTMLElement,\n lookup: ComponentLookupSpec,\n opts: {\n prefetchedData?: ComponentRenderData;\n componentProps?: any;\n globalVariants?: GlobalVariantSpec[];\n prefetchedQueryData?: Record<string, any>;\n } = {}\n) {\n return new Promise<void>((resolve) => {\n const element = makeElement(loader, lookup, opts);\n ReactDOM.render(element, target, () => resolve());\n });\n}\n\nexport function renderToString(\n loader: PlasmicComponentLoader,\n lookup: ComponentLookupSpec,\n opts: {\n prefetchedData?: ComponentRenderData;\n componentProps?: any;\n globalVariants?: GlobalVariantSpec[];\n prefetchedQueryData?: Record<string, any>;\n } = {}\n) {\n const element = makeElement(loader, lookup, opts);\n return reactRenderToString(element);\n}\n\nexport async function extractPlasmicQueryDataFromElement(\n loader: PlasmicComponentLoader,\n lookup: ComponentLookupSpec,\n opts: {\n prefetchedData?: ComponentRenderData;\n componentProps?: any;\n globalVariants?: GlobalVariantSpec[];\n prefetchedQueryData?: Record<string, any>;\n } = {}\n) {\n const element = makeElement(loader, lookup, opts);\n return extractPlasmicQueryData(element);\n}\n\nexport async function hydrateFromElement(\n loader: PlasmicComponentLoader,\n target: HTMLElement,\n lookup: ComponentLookupSpec,\n opts: {\n prefetchedData?: ComponentRenderData;\n componentProps?: any;\n globalVariants?: GlobalVariantSpec[];\n prefetchedQueryData?: Record<string, any>;\n } = {}\n) {\n return new Promise<void>((resolve) => {\n const element = makeElement(loader, lookup, opts);\n ReactDOM.hydrate(element, target, () => resolve());\n });\n}\n\nfunction makeElement(\n loader: PlasmicComponentLoader,\n lookup: ComponentLookupSpec,\n opts: {\n prefetchedData?: ComponentRenderData;\n componentProps?: any;\n globalVariants?: GlobalVariantSpec[];\n prefetchedQueryData?: Record<string, any>;\n } = {}\n) {\n return (\n <PlasmicRootProvider\n loader={loader}\n prefetchedData={opts.prefetchedData}\n globalVariants={opts.globalVariants}\n prefetchedQueryData={opts.prefetchedQueryData}\n >\n <PlasmicComponent\n component={typeof lookup === 'string' ? lookup : lookup.name}\n projectId={typeof lookup === 'string' ? undefined : lookup.projectId}\n componentProps={opts.componentProps}\n />\n </PlasmicRootProvider>\n );\n}\n","import {\n InternalPlasmicComponentLoader,\n PlasmicComponentLoader,\n} from './loader';\nimport type { InitOptions } from './loader-react-server';\n\nexport {\n DataCtxReader,\n DataProvider,\n PageParamsProvider,\n PlasmicCanvasContext,\n PlasmicCanvasHost,\n PrimitiveType,\n PropType,\n repeatedElement,\n TokenRegistration,\n useDataEnv,\n usePlasmicCanvasContext,\n useSelector,\n useSelectors,\n} from '@plasmicapp/host';\nexport { usePlasmicQueryData } from '@plasmicapp/query';\nexport * from './index-shared';\nexport { PlasmicComponent } from './PlasmicComponent';\nexport {\n GlobalVariantSpec,\n PlasmicRootProvider,\n PlasmicTranslator,\n} from './PlasmicRootProvider';\nexport { extractPlasmicQueryData, plasmicPrepass } from './prepass';\nexport {\n extractPlasmicQueryDataFromElement,\n hydrateFromElement,\n renderToElement,\n renderToString,\n} from './render';\nexport { usePlasmicComponent } from './usePlasmicComponent';\nexport { InternalPlasmicComponentLoader, PlasmicComponentLoader };\n\nexport function initPlasmicLoader(opts: InitOptions): PlasmicComponentLoader {\n const internal = new InternalPlasmicComponentLoader(opts);\n return new PlasmicComponentLoader(internal);\n}\n"],"names":["runtime","exports","Op","Object","prototype","hasOwn","hasOwnProperty","$Symbol","Symbol","iteratorSymbol","iterator","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","toStringTag","define","obj","key","value","defineProperty","enumerable","configurable","writable","err","wrap","innerFn","outerFn","self","tryLocsList","generator","create","Generator","context","Context","_invoke","state","method","arg","Error","undefined","done","delegate","delegateResult","maybeInvokeDelegate","ContinueSentinel","sent","_sent","dispatchException","abrupt","record","tryCatch","type","makeInvokeMethod","fn","call","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","this","getProto","getPrototypeOf","NativeIteratorPrototype","values","Gp","defineIteratorMethods","forEach","AsyncIterator","PromiseImpl","previousPromise","callInvokeWithMethodAndArg","resolve","reject","invoke","result","__await","then","unwrapped","error","TypeError","info","resultName","next","nextLoc","pushTryEntry","locs","entry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","push","resetTryEntry","completion","reset","iterable","iteratorMethod","isNaN","length","i","doneResult","displayName","isGeneratorFunction","genFun","ctor","constructor","name","mark","setPrototypeOf","__proto__","awrap","async","Promise","iter","keys","object","reverse","pop","skipTempReset","prev","charAt","slice","stop","rootRecord","rval","exception","handle","loc","caught","hasCatch","hasFinally","finallyEntry","complete","finish","catch","thrown","delegateYield","module","regeneratorRuntime","accidentalStrictMode","globalThis","Function","isBrowser","window","useForceUpdate","setTick","React","tick","areLookupSpecsEqual","spec1","spec2","fullSpec1","toFullLookup","fullSpec2","isNameSpec","isCode","isPathSpec","path","projectId","lookup","namePart","codeComponent","startsWith","trim","pascalcase","rawName","matchesPagePath","pagePath","replace","paramNames","match","map","group","pagePathRegExp","RegExp","maybeVals","_lookup$match","params","getCompMetas","metas","full","filter","meta","matchesCompMeta","sort","meta1","meta2","Array","from","getLookupSpecName","uniq","elements","Set","getFirstCompMeta","filtered","ComponentLookup","bundle","registry","_proto","getComponentMeta","spec","components","getComponent","opts","compMeta","moduleName","hasModule","load","forceOriginal","getPlasmicComponent","hasComponent","getGlobalContexts","globalGroups","m","_this","contextFile","getGlobalContextsProvider","projectMeta","projects","find","x","id","globalContextsProviderFileName","getRootProvider","getCss","modules","browser","mod","fileName","endsWith","getRemoteFonts","flatMap","p","remoteFonts","updatePlasmicCookieValue","document","cookie","getGlobalVariantsFromSplits","splits","variation","globalVariants","variationKey","split","sliceId","s","splitId","externalId","slices","contents","variant","PlasmicRootContext","PlasmicRootProvider","props","prefetchedData","children","skipCss","skipFonts","prefetchedQueryData","suspenseForQueryData","globalContextsProps","translator","Head","pageParams","pageQuery","loader","__internal","registerPrefetchedBundle","getActiveSplits","setSplits","forceUpdate","watcher","onDataFetched","subscribePlasmicRoot","unsubscribePlasmicRoot","ensureVariationCookies","trackRender","renderCtx","rootComponentId","teamIds","getTeamIds","projectIds","getProjectIds","user","userAuthToken","isUserLoading","authRedirectUri","target","existingGlobalVariants","t","newGlobals","has","PlasmicQueryDataProvider","prefetchedCache","suspense","Provider","PlasmicCss","PageParamsProvider","query","setUseScopedCss","builtCss","scopedCompMetas","cssFiles","c","cssFile","cssModules","getLookup","f","getPri","a","b","localeCompare","url","join","source","buildCss","dangerouslySetInnerHTML","__html","usePlasmicRootContext","createUseGlobalVariant","rootContext","getGlobalVariants","prepComponentData","compMetas","entryCompMetas","remoteFontUrls","compPaths","allComponents","entryCompIds","q","seenIds","componentMetaById","Map","usedComps","splice","get","usedComponents","usedCompId","add","getUsedComps","subBundle","getBundleSubset","isGlobalContextProvider","g","mergeBundles","existingCompIds","newCompMetas","existingProjects","newProjects","existingModules","server","newModules","existingGlobalIds","existingExternals","external","newExternals","existingSplitIds","activeSplits","newSplits","ReactServerPlasmicComponentLoader","args","fetcher","tracker","onBundleMerged","onBundleFetched","maybeGetCompMetas","found","missing","specs","filteredMetas","maybeFetchComponentData","returnWithSpecsToFetch","_this$maybeGetCompMet2","existingMetas","missingSpecs","_args2","_parseFetchComponentD","parseFetchComponentDataArgs","specsToFetch","_context","fetchMissingData","_this$maybeGetCompMet","existingMetas2","alwaysFresh","_context2","fetchComponentData","data","_this$maybeGetCompMet3","_args3","_parseFetchComponentD2","_context3","fetchPages","maybeReportClientSideFetch","_context4","fetchAllData","comp","isPage","includeDynamicPages","fetchComponents","_context5","mkMsg","onClientSideFetch","msg","console","warn","_context7","trackFetch","mergeBundle","_this$onBundleFetched","_this$onBundleMerged","getBundle","clearCache","isArray","SUBSTITUTED_COMPONENTS","REGISTERED_CODE_COMPONENT_HELPERS","SUBSTITUTED_GLOBAL_VARIANT_HOOKS","InternalPlasmicComponentLoader","Registry","PlasmicTracker","platform","preview","reactServerLoader","PlasmicModulesFetcher","refreshRegistry","roots","registerModules","react","react-dom","ReactDOM","react/jsx-runtime","jsxRuntime","react/jsx-dev-runtime","jsxDevRuntime","@plasmicapp/query","PlasmicQuery","@plasmicapp/data-sources-context","PlasmicDataSourcesContext","@plasmicapp/host","PlasmicHost","@plasmicapp/loader-runtime-registry","globalVariantHooks","codeComponentHelpers","setGlobalVariants","some","_this2","getRegisteredModule","isEmpty","clear","register","substituteComponent","component","internalSubstituteComponent","subs","registerComponent","stateHelpers","fromEntries","entries","states","stateSpec","initFunc","onChangeArgsToValue","helpers","importPath","componentHelpers","importName","registerGlobalContext","registerTrait","trait","registerToken","token","cachedBundle","internal_getCachedBundleInNodeServer","index","indexOf","trackConversion","getActiveVariation","teamId","indirect","sub","_this3","_loop","globalGroup","updateModules","PlasmicComponentLoader","internal","_proto2","metaOrName","_getActiveVariation","traits","getKnownValue","known","includes","updateKnownValue","getExternalVariation","getExternalIds","usePlasmicComponent","stableSpec","stableSpecs","setStableSpecs","useStableLookupSpecs","useStableLookupSpec","isMounted","ref","current","useIsMounted","_asyncToGenerator","PlasmicComponentContext","PlasmicComponent","componentProps","isRootLoader","rest","Component","rootProjectId","rootComponentName","element","ReactWebRootProvider","GlobalContextsProvider","MaybeWrap","cond","wrapper","extractPlasmicQueryData","_extractPlasmicQueryData","cache","plasmicPrepass","PlasmicPrepassContext","queryCache","val","JSON","parse","stringify","_plasmicPrepass","prepass","buildPlasmicPrepassElement","GenericErrorBoundary","processReactElement","cloneElement","processPlasmicComponentProps","v","isValidElement","_React$Component","componentDidCatch","log","render","isFragment","Fragment","Children","_renderToElement","makeElement","_extractPlasmicQueryDataFromElement","_hydrateFromElement","hydrate","bundles","reduce","cur","reactRenderToString"],"m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H,cAAA,OAAA6d,aAZM,WACL3R,EACAzG,EACA4C,wEAOiD,gBAPjDA,IAAAA,EAKI,IAEEsT,EAAUiC,GAAY1R,EAAQzG,EAAQ4C,qBACrC4T,GAAwBN,IAAQ,OAAA,UAAA,iDAkBxC,cAAA,OAAAmC,aAfM,WACL5R,EACAsB,EACA/H,EACA4C,kEAKM,gBALNA,IAAAA,EAKI,sBAEG,IAAI3F,SAAc,SAAC1C,GACxB,IAAM2b,EAAUiC,GAAY1R,EAAQzG,EAAQ4C,GAC5CgO,EAAS0H,QAAQpC,EAASnO,GAAQ,WAAA,OAAMxN,WACxC,OAAA,UAAA,iDAGJ,SAAS4d,GACP1R,EACAzG,EACA4C,GAOA,gBAPAA,IAAAA,EAKI,IAGFzD,gBAACyG,GACCa,OAAQA,EACRX,eAAgBlD,EAAKkD,eACrBb,eAAgBrC,EAAKqC,eACrBiB,oBAAqBtD,EAAKsD,qBAE1B/G,gBAACwW,IACCzD,UAA6B,iBAAXlS,EAAsBA,EAASA,EAAOrD,KACxDoD,UAA6B,iBAAXC,OAAsBxH,EAAYwH,EAAOD,UAC3D6V,eAAgBhT,EAAKgT,01CNwEsB,SACjD2C,EACApO,GAEA,OAAuB,IAAnBoO,EAAQpc,OACH,KAIF+N,EADeqO,EAAQC,QAAO,SAAChb,EAAMib,GAAG,OAAKjN,EAAahO,EAAMib,MAC/BtO,kFMpI1C,gBAAwD,4DAcxD,kBAAwC,oECfNvH,GAChC,IAAMwR,EAAW,IAAIpE,EAA+BpN,GACpD,OAAO,IAAIuR,EAAuBC,kGDhCC,wDAiBrC,SACE3N,EACAzG,EACA4C,YAAAA,IAAAA,EAKI,IAEJ,IAAMsT,EAAUiC,GAAY1R,EAAQzG,EAAQ4C,GAC5C,OAAO8V,iBAAoBxC"}
|
|
1
|
+
{"version":3,"file":"loader-react.cjs.production.min.js","sources":["../../../node_modules/regenerator-runtime/runtime.js","../src/utils.tsx","../src/component-lookup.ts","../src/variation.ts","../src/PlasmicRootProvider.tsx","../src/global-variants.ts","../src/bundles.ts","../src/loader-react-server.ts","../src/loader.ts","../src/usePlasmicComponent.tsx","../src/PlasmicComponent.tsx","../src/prepass.tsx","../src/render.tsx","../src/index.ts"],"sourcesContent":["/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar runtime = (function (exports) {\n \"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var undefined; // More compressible than void 0.\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n function define(obj, key, value) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n return obj[key];\n }\n try {\n // IE 8 has a broken Object.defineProperty that only works on DOM objects.\n define({}, \"\");\n } catch (err) {\n define = function(obj, key, value) {\n return obj[key] = value;\n };\n }\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n }\n exports.wrap = wrap;\n\n // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\";\n\n // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n var ContinueSentinel = {};\n\n // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n\n // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n var IteratorPrototype = {};\n define(IteratorPrototype, iteratorSymbol, function () {\n return this;\n });\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n if (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = GeneratorFunctionPrototype;\n define(Gp, \"constructor\", GeneratorFunctionPrototype);\n define(GeneratorFunctionPrototype, \"constructor\", GeneratorFunction);\n GeneratorFunction.displayName = define(\n GeneratorFunctionPrototype,\n toStringTagSymbol,\n \"GeneratorFunction\"\n );\n\n // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n define(prototype, method, function(arg) {\n return this._invoke(method, arg);\n });\n });\n }\n\n exports.isGeneratorFunction = function(genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n };\n\n exports.mark = function(genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n define(genFun, toStringTagSymbol, \"GeneratorFunction\");\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n };\n\n // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n exports.awrap = function(arg) {\n return { __await: arg };\n };\n\n function AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return PromiseImpl.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return PromiseImpl.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n define(AsyncIterator.prototype, asyncIteratorSymbol, function () {\n return this;\n });\n exports.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n if (PromiseImpl === void 0) PromiseImpl = Promise;\n\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList),\n PromiseImpl\n );\n\n return exports.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n define(Gp, toStringTagSymbol, \"Generator\");\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n define(Gp, iteratorSymbol, function() {\n return this;\n });\n\n define(Gp, \"toString\", function() {\n return \"[object Generator]\";\n });\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n exports.keys = function(object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n }\n exports.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n\n // Regardless of whether this script is executing as a CommonJS module\n // or not, return the runtime object so that we can declare the variable\n // regeneratorRuntime in the outer scope, which allows this module to be\n // injected easily by `bin/regenerator --include-runtime script.js`.\n return exports;\n\n}(\n // If this script is executing as a CommonJS module, use module.exports\n // as the regeneratorRuntime namespace. Otherwise create a new empty\n // object. Either way, the resulting object will be used to initialize\n // the regeneratorRuntime variable at the top of this file.\n typeof module === \"object\" ? module.exports : {}\n));\n\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n // This module should not be running in strict mode, so the above\n // assignment should always work unless something is misconfigured. Just\n // in case runtime.js accidentally runs in strict mode, in modern engines\n // we can explicitly access globalThis. In older engines we can escape\n // strict mode using a global Function call. This could conceivably fail\n // if a Content Security Policy forbids using Function, but in that case\n // the proper solution is to fix the accidental strict mode problem. If\n // you've misconfigured your bundler to force strict mode and applied a\n // CSP to forbid Function, and you're not willing to fix either of those\n // problems, please detail your unique predicament in a GitHub issue.\n if (typeof globalThis === \"object\") {\n globalThis.regeneratorRuntime = runtime;\n } else {\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n }\n}\n","import { ComponentMeta } from '@plasmicapp/loader-core';\nimport pascalcase from 'pascalcase';\nimport * as React from 'react';\n\nexport const isBrowser = typeof window !== 'undefined';\n\nexport type ComponentLookupSpec =\n | string\n | { name: string; projectId?: string; isCode?: boolean };\n\ninterface FullNameLookupSpec {\n name: string;\n rawName?: string;\n projectId?: string;\n isCode?: boolean;\n}\n\ninterface FullPathLookupSpec {\n path: string;\n projectId?: string;\n}\n\ntype FullLookupSpec = FullNameLookupSpec | FullPathLookupSpec;\n\nexport function useForceUpdate() {\n const [, setTick] = React.useState(0);\n const update = React.useCallback(() => {\n setTick((tick) => tick + 1);\n }, []);\n return update;\n}\n\nexport function useStableLookupSpec(spec: ComponentLookupSpec) {\n return useStableLookupSpecs(spec)[0];\n}\n\nexport function useStableLookupSpecs(...specs: ComponentLookupSpec[]) {\n const [stableSpecs, setStableSpecs] = React.useState(specs);\n\n React.useEffect(() => {\n if (\n specs.length !== stableSpecs.length ||\n specs.some((s, i) => !areLookupSpecsEqual(s, stableSpecs[i]))\n ) {\n setStableSpecs(specs);\n }\n }, [specs, stableSpecs]);\n return stableSpecs;\n}\n\nfunction areLookupSpecsEqual(\n spec1: ComponentLookupSpec,\n spec2: ComponentLookupSpec\n) {\n if (spec1 === spec2) {\n return true;\n }\n if (typeof spec1 !== typeof spec2) {\n return false;\n }\n\n const fullSpec1 = toFullLookup(spec1);\n const fullSpec2 = toFullLookup(spec2);\n return (\n ((isNameSpec(fullSpec1) &&\n isNameSpec(fullSpec2) &&\n fullSpec1.name === fullSpec2.name &&\n fullSpec1.isCode === fullSpec2.isCode) ||\n (isPathSpec(fullSpec1) &&\n isPathSpec(fullSpec2) &&\n fullSpec1.path === fullSpec2.path)) &&\n fullSpec1.projectId === fullSpec2.projectId\n );\n}\n\nfunction isNameSpec(lookup: FullLookupSpec): lookup is FullNameLookupSpec {\n return 'name' in lookup;\n}\n\nfunction isPathSpec(lookup: FullLookupSpec): lookup is FullPathLookupSpec {\n return 'path' in lookup;\n}\n\nfunction toFullLookup(lookup: ComponentLookupSpec): FullLookupSpec {\n const namePart = typeof lookup === 'string' ? lookup : lookup.name;\n const projectId = typeof lookup === 'string' ? undefined : lookup.projectId;\n const codeComponent = typeof lookup === 'string' ? undefined : lookup.isCode;\n\n if (codeComponent !== true && namePart.startsWith('/')) {\n return { path: normalizePath(namePart), projectId };\n } else {\n return {\n name: codeComponent ? namePart : normalizeName(namePart),\n rawName: namePart.trim(),\n projectId,\n isCode: codeComponent,\n };\n }\n}\n\nfunction normalizePath(path: string) {\n return path.trim();\n}\n\nfunction normalizeName(name: string) {\n // Not a full normalization, but should be good enough\n return pascalcase(name).trim();\n}\n\nexport function useIsMounted(): () => boolean {\n const ref = React.useRef<boolean>(false);\n const isMounted = React.useCallback(() => ref.current, []);\n\n React.useEffect(() => {\n ref.current = true;\n return () => {\n ref.current = false;\n };\n }, []);\n\n return isMounted;\n}\n\n/**\n * Check if `lookup` resolves to `pagePath`. If it's a match, return an object\n * containing path params; otherwise, returns false.\n *\n * For example,\n * - `matchesPagePath(\"/hello/[name]\", \"/hello/world\")` -> `{params: {name:\n * \"world\"}}`\n * - `matchesPagePath(\"/hello/[name]\", \"/\")` -> `false`\n * - `matchesPagePath(\"/\", \"\")` -> `{params: {}}`\n */\nexport function matchesPagePath(\n pagePath: string,\n lookup: string\n): { params: Record<string, string> } | false {\n // Remove trailing slashes from both `pagePath` and `lookup`.\n pagePath = pagePath.replace(/^\\/*/, '').replace(/\\/*$/, '');\n lookup = lookup.replace(/^\\/*/, '').replace(/\\/*$/, '');\n\n // paramNames will contain a list of parameter names; e.g. if pagePath\n // is \"/products/[slug]/[variant]\" it will contain [\"slug\", \"variant\"].\n const paramNames = (pagePath.match(/\\[([^\\]]*)\\]/g) || []).map((group) =>\n group.slice(1, -1)\n );\n\n const pagePathRegExp = new RegExp(\n '^' + pagePath.replace(/\\[[^\\]]*\\]/g, '([^/]+)') + '$'\n );\n const maybeVals = lookup.match(pagePathRegExp)?.slice(1);\n if (!maybeVals) {\n return false;\n }\n\n const params: Record<string, string> = {};\n for (let i = 0; i < paramNames.length; i++) {\n params[paramNames[i]] = maybeVals[i];\n }\n\n return { params };\n}\n\nexport function isDynamicPagePath(path: string): boolean {\n return !!path.match(/\\[[^/]*\\]/);\n}\n\nfunction matchesCompMeta(lookup: FullLookupSpec, meta: ComponentMeta) {\n if (lookup.projectId && meta.projectId !== lookup.projectId) {\n return false;\n }\n\n return isNameSpec(lookup)\n ? (lookup.name === meta.name ||\n lookup.rawName === meta.name ||\n lookup.rawName === meta.displayName) &&\n (lookup.isCode == null || lookup.isCode === meta.isCode)\n : !!(meta.path && matchesPagePath(meta.path, lookup.path));\n}\n\nexport function getCompMetas(\n metas: ComponentMeta[],\n lookup: ComponentLookupSpec\n) {\n const full = toFullLookup(lookup);\n return metas\n .filter((meta) => matchesCompMeta(full, meta))\n .map<ComponentMeta & { params?: Record<string, string> }>((meta) => {\n if (isNameSpec(full) || !meta.path) {\n return meta;\n }\n\n const match = matchesPagePath(meta.path, full.path);\n if (!match) {\n return meta;\n }\n\n return { ...meta, params: match.params };\n })\n .sort(\n (meta1, meta2) =>\n // We sort the matched component metas by the number of path params, so\n // if there are two pages `/products/foo` and `/products/[slug]`,\n // the first one will have higher precedence.\n Array.from(Object.keys(meta1.params || {})).length -\n Array.from(Object.keys(meta2.params || {})).length\n );\n}\n\nexport function getLookupSpecName(lookup: ComponentLookupSpec) {\n if (typeof lookup === 'string') {\n return lookup;\n } else if (lookup.projectId) {\n return `${lookup.name} (project ${lookup.projectId})`;\n } else {\n return lookup.name;\n }\n}\n\nexport function uniq<T>(elements: T[]): T[] {\n return Array.from(new Set(elements));\n}\n","import {\n AssetModule,\n ComponentMeta,\n FontMeta,\n GlobalGroupMeta,\n LoaderBundleOutput,\n Registry,\n} from '@plasmicapp/loader-core';\nimport * as React from 'react';\nimport { ComponentLookupSpec, getCompMetas } from './utils';\n\nfunction getFirstCompMeta(metas: ComponentMeta[], lookup: ComponentLookupSpec) {\n const filtered = getCompMetas(metas, lookup);\n return filtered.length === 0 ? undefined : filtered[0];\n}\n\nexport class ComponentLookup {\n constructor(private bundle: LoaderBundleOutput, private registry: Registry) {}\n\n getComponentMeta(spec: ComponentLookupSpec): ComponentMeta | undefined {\n const compMeta = getFirstCompMeta(this.bundle.components, spec);\n return compMeta;\n }\n\n getComponent<P extends React.ComponentType = any>(\n spec: ComponentLookupSpec,\n opts: { forceOriginal?: boolean } = {}\n ) {\n const compMeta = getFirstCompMeta(this.bundle.components, spec);\n if (!compMeta) {\n throw new Error(`Component not found: ${spec}`);\n }\n const moduleName = compMeta.entry;\n if (!this.registry.hasModule(moduleName, opts)) {\n throw new Error(`Component not yet fetched: ${compMeta.name}`);\n }\n const entry = this.registry.load(moduleName, {\n forceOriginal: opts.forceOriginal,\n });\n return !opts.forceOriginal &&\n typeof entry?.getPlasmicComponent === 'function'\n ? entry.getPlasmicComponent()\n : (entry.default as P);\n }\n\n hasComponent(spec: ComponentLookupSpec) {\n const compMeta = getFirstCompMeta(this.bundle.components, spec);\n if (compMeta) {\n return this.registry.hasModule(compMeta.entry);\n }\n return false;\n }\n\n getGlobalContexts(): { meta: GlobalGroupMeta; context: any }[] {\n const customGlobalMetas = this.bundle.globalGroups.filter(\n (m) => m.type === 'global-user-defined'\n );\n return customGlobalMetas.map((meta) => ({\n meta,\n context: this.registry.load(meta.contextFile).default,\n }));\n }\n\n getGlobalContextsProvider(spec: ComponentLookupSpec) {\n const compMeta = getFirstCompMeta(this.bundle.components, spec);\n const projectMeta = compMeta\n ? this.bundle.projects.find((x) => x.id === compMeta.projectId)\n : undefined;\n\n if (\n !projectMeta ||\n !projectMeta.globalContextsProviderFileName ||\n !this.registry.hasModule(projectMeta.globalContextsProviderFileName)\n ) {\n return undefined;\n }\n const entry = this.registry.load(\n projectMeta.globalContextsProviderFileName\n );\n\n return typeof entry?.getPlasmicComponent === 'function'\n ? entry.getPlasmicComponent()\n : entry.default;\n }\n\n getRootProvider() {\n const entry = this.registry.load('root-provider.js');\n return entry.default;\n }\n\n getCss(): AssetModule[] {\n // We can probably always get the modules from the browser build\n return this.bundle.modules.browser.filter(\n (mod) => mod.type === 'asset' && mod.fileName.endsWith('css')\n ) as AssetModule[];\n }\n\n getRemoteFonts(): FontMeta[] {\n return this.bundle.projects.flatMap((p) => p.remoteFonts);\n }\n}\n","import { ExperimentSlice, SegmentSlice, Split } from '@plasmicapp/loader-core';\nimport type { GlobalVariantSpec } from './PlasmicRootProvider';\n\nexport function getPlasmicCookieValues() {\n return Object.fromEntries(\n document.cookie\n .split('; ')\n .filter((cookie) => cookie.includes('plasmic:'))\n .map((cookie) => cookie.split('='))\n .map(([key, value]) => [key.split(':')[1], value])\n );\n}\n\nexport function updatePlasmicCookieValue(key: string, value: string) {\n document.cookie = `plasmic:${key}=${value}`;\n}\n\nexport function ensureVariationCookies(variation: Record<string, string> = {}) {\n Object.keys(variation).map((variationKey) => {\n const sliceId = variation[variationKey];\n updatePlasmicCookieValue(variationKey, sliceId);\n });\n}\n\nexport const getGlobalVariantsFromSplits = (\n splits: Split[],\n variation: Record<string, string>\n) => {\n const globalVariants: GlobalVariantSpec[] = [];\n\n Object.keys(variation).map((variationKey: string) => {\n const [type, splitId] = variationKey.split('.');\n const sliceId = variation[variationKey];\n const split = splits.find(\n (s) => s.id === splitId || s.externalId === splitId\n );\n if (split) {\n const slice:\n | ExperimentSlice\n | SegmentSlice\n | undefined = (split.slices as Array<\n ExperimentSlice | SegmentSlice\n >).find((s: any) => s.id === sliceId || s.externalId === sliceId);\n if (slice) {\n slice.contents.map((x) => {\n globalVariants.push({\n name: x.group,\n value: x.variant,\n projectId: x.projectId,\n });\n });\n }\n }\n });\n\n return globalVariants;\n};\n\nexport const mergeGlobalVariantsSpec = (\n target: GlobalVariantSpec[],\n from: GlobalVariantSpec[]\n) => {\n let result = [...target];\n const existingGlobalVariants = new Set(\n target.map((t) => `${t.name}-${t.projectId ?? ''}`)\n );\n const newGlobals = from.filter(\n (t) => !existingGlobalVariants.has(`${t.name}-${t.projectId ?? ''}`)\n );\n\n if (newGlobals.length > 0) {\n result = [...result, ...newGlobals];\n }\n\n return result;\n};\n","import { PlasmicDataSourceContextValue } from '@plasmicapp/data-sources-context';\nimport { PageParamsProvider } from '@plasmicapp/host';\nimport { AssetModule, ComponentMeta, Split } from '@plasmicapp/loader-core';\nimport { PlasmicQueryDataProvider } from '@plasmicapp/query';\nimport * as React from 'react';\nimport {\n ComponentRenderData,\n InternalPlasmicComponentLoader,\n PlasmicComponentLoader,\n} from './loader';\nimport { useForceUpdate } from './utils';\nimport {\n ensureVariationCookies,\n getGlobalVariantsFromSplits,\n mergeGlobalVariantsSpec,\n} from './variation';\n\ninterface PlasmicRootContextValue extends PlasmicDataSourceContextValue {\n globalVariants?: GlobalVariantSpec[];\n globalContextsProps?: Record<string, any>;\n loader: InternalPlasmicComponentLoader;\n variation?: Record<string, string>;\n translator?: PlasmicTranslator;\n Head?: React.ComponentType<any>;\n}\n\nconst PlasmicRootContext = React.createContext<\n PlasmicRootContextValue | undefined\n>(undefined);\n\nexport interface GlobalVariantSpec {\n name: string;\n projectId?: string;\n value: any;\n}\n\nexport type PlasmicTranslator = (\n str: string,\n opts?: {\n components?: {\n [key: string]: React.ReactElement | React.ReactFragment;\n };\n }\n) => React.ReactNode;\n\n/**\n * PlasmicRootProvider should be used at the root of your page\n * or application.\n */\nexport function PlasmicRootProvider(props: {\n /**\n * The global PlasmicComponentLoader instance you created via\n * initPlasmicLoader().\n */\n loader: PlasmicComponentLoader;\n\n /**\n * Global variants to activate for Plasmic components\n */\n globalVariants?: GlobalVariantSpec[];\n\n children?: React.ReactNode;\n\n /**\n * If true, will skip rendering css\n */\n skipCss?: boolean;\n\n /**\n * If true, will skip installing fonts\n */\n skipFonts?: boolean;\n\n /**\n * If you have pre-fetched component data via PlasmicComponentLoader,\n * you can pass them in here; PlasmicComponent will avoid fetching\n * component data that have already been pre-fetched.\n */\n prefetchedData?: ComponentRenderData;\n\n /**\n * If you have pre-fetched data that are needed by usePlasmicQueryData(),\n * then pass in the pre-fetched cache here, mapping query key to fetched data.\n */\n prefetchedQueryData?: Record<string, any>;\n\n /**\n * Specifies whether usePlasmicQueryData() should be operating in suspense mode\n * (throwing promises).\n */\n suspenseForQueryData?: boolean;\n\n /**\n * Override your Global Contexts Provider props. This is a map from\n * globalContextComponentNameProps to object of props to use for that\n * component.\n */\n globalContextsProps?: Record<string, any>;\n\n /**\n * Specifies a mapping of split id to slice id that should be activated\n */\n variation?: Record<string, string>;\n\n /**\n * Translator function to be used for text blocks\n */\n translator?: PlasmicTranslator;\n\n /**\n * Head component to use in PlasmicHead component (e.g. Head from next/head\n * or Helmet from react-helmet).\n */\n Head?: React.ComponentType<any>;\n\n /**\n * Page path parameters (e.g. {slug: \"foo\"} if page path is\n * /products/[slug] and URI is /products/foo).\n */\n pageParams?: Record<string, string | string[] | undefined>;\n\n /**\n * Page query parameters (e.g. {q: \"foo\"} if page path is\n * /some/path?q=foo).\n */\n pageQuery?: Record<string, string | string[] | undefined>;\n}) {\n const {\n globalVariants,\n prefetchedData,\n children,\n skipCss,\n skipFonts,\n prefetchedQueryData,\n suspenseForQueryData,\n globalContextsProps,\n variation,\n translator,\n Head,\n pageParams,\n pageQuery,\n } = props;\n const loader = (props.loader as any)\n .__internal as InternalPlasmicComponentLoader;\n\n if (prefetchedData) {\n loader.registerPrefetchedBundle(prefetchedData?.bundle);\n }\n\n const [splits, setSplits] = React.useState<Split[]>(loader.getActiveSplits());\n const forceUpdate = useForceUpdate();\n const watcher = React.useMemo(\n () => ({\n onDataFetched: () => {\n setSplits(loader.getActiveSplits());\n forceUpdate();\n },\n }),\n [loader, forceUpdate]\n );\n\n React.useEffect(() => {\n loader.subscribePlasmicRoot(watcher);\n return () => loader.unsubscribePlasmicRoot(watcher);\n }, [watcher, loader]);\n\n React.useEffect(() => {\n ensureVariationCookies(variation);\n loader.trackRender({\n renderCtx: {\n // We track the provider as a single entity\n rootComponentId: 'provider',\n teamIds: loader.getTeamIds(),\n projectIds: loader.getProjectIds(),\n },\n variation,\n });\n }, [loader, variation]);\n\n // @ts-ignore\n const { user, userAuthToken, isUserLoading, authRedirectUri } = props;\n\n const value = React.useMemo<PlasmicRootContextValue>(\n () => ({\n globalVariants: mergeGlobalVariantsSpec(\n globalVariants ?? [],\n getGlobalVariantsFromSplits(splits, variation ?? {})\n ),\n globalContextsProps,\n loader,\n variation,\n translator,\n Head,\n user,\n userAuthToken,\n isUserLoading,\n authRedirectUri,\n }),\n [\n globalVariants,\n variation,\n globalContextsProps,\n loader,\n splits,\n translator,\n Head,\n user,\n userAuthToken,\n isUserLoading,\n authRedirectUri,\n ]\n );\n\n return (\n <PlasmicQueryDataProvider\n prefetchedCache={prefetchedQueryData}\n suspense={suspenseForQueryData}\n >\n <PlasmicRootContext.Provider value={value}>\n {!skipCss && (\n <PlasmicCss\n loader={loader}\n prefetchedData={prefetchedData}\n skipFonts={skipFonts}\n />\n )}\n <PageParamsProvider params={pageParams} query={pageQuery}>\n {children}\n </PageParamsProvider>\n </PlasmicRootContext.Provider>\n </PlasmicQueryDataProvider>\n );\n}\n\n/**\n * Inject all css modules as <style/> tags. We can't use the usual styleInjector postcss\n * uses because that doesn't work on the server side for SSR.\n */\nconst PlasmicCss = React.memo(function PlasmicCss(props: {\n loader: InternalPlasmicComponentLoader;\n prefetchedData?: ComponentRenderData;\n skipFonts?: boolean;\n}) {\n const { loader, prefetchedData, skipFonts } = props;\n const [useScopedCss, setUseScopedCss] = React.useState(!!prefetchedData);\n const builtCss = buildCss(loader, {\n scopedCompMetas:\n useScopedCss && prefetchedData\n ? prefetchedData.bundle.components\n : undefined,\n skipFonts,\n });\n const forceUpdate = useForceUpdate();\n const watcher = React.useMemo(\n () => ({\n onDataFetched: () => {\n // If new data has been fetched, then use all the fetched css\n setUseScopedCss(false);\n forceUpdate();\n },\n }),\n [loader, forceUpdate]\n );\n\n React.useEffect(() => {\n loader.subscribePlasmicRoot(watcher);\n return () => loader.unsubscribePlasmicRoot(watcher);\n }, [watcher, loader]);\n\n return <style dangerouslySetInnerHTML={{ __html: builtCss }} />;\n});\n\nfunction buildCss(\n loader: InternalPlasmicComponentLoader,\n opts: {\n scopedCompMetas?: ComponentMeta[];\n skipFonts?: boolean;\n }\n) {\n const { scopedCompMetas, skipFonts } = opts;\n const cssFiles =\n scopedCompMetas &&\n new Set<string>([\n 'entrypoint.css',\n ...scopedCompMetas.map((c) => c.cssFile),\n ]);\n const cssModules = loader\n .getLookup()\n .getCss()\n .filter((f) => !cssFiles || cssFiles.has(f.fileName));\n\n const getPri = (fileName: string) => (fileName === 'entrypoint.css' ? 0 : 1);\n const compareModules = (a: AssetModule, b: AssetModule) =>\n getPri(a.fileName) !== getPri(b.fileName)\n ? getPri(a.fileName) - getPri(b.fileName)\n : a.fileName.localeCompare(b.fileName);\n cssModules.sort(compareModules);\n\n const remoteFonts = loader.getLookup().getRemoteFonts();\n\n // Make sure the @import statements come at the front of css\n return `\n ${\n skipFonts\n ? ''\n : remoteFonts.map((f) => `@import url('${f.url}');`).join('\\n')\n }\n ${cssModules.map((mod) => mod.source).join('\\n')}\n `;\n}\n\nexport function usePlasmicRootContext() {\n return React.useContext(PlasmicRootContext);\n}\n","/**\n * We don't actually make use of the global variant React contexts generated\n * in the bundle. That's because we would have to wait until the data is\n * loaded before we can set up the context providers, but setting up context\n * providers will mutate the React tree and invalidate all the children. That means\n * once data comes in, we'll re-render the React tree from the providers down\n * in a way that will lose all existing React state. Therefore, instead,\n * we always have a single context provided -- the PlasmicRootContext -- and we\n * create these fake useGlobalVariant() hooks that just read from that\n * PlasmicRootContext. This allows us to have a stable React tree before and\n * after the data load.\n */\n\nimport { InternalPlasmicComponentLoader } from './loader';\nimport { usePlasmicRootContext } from './PlasmicRootProvider';\n\nexport function createUseGlobalVariant(name: string, projectId: string) {\n return () => {\n const rootContext = usePlasmicRootContext();\n if (!rootContext) {\n return undefined;\n }\n\n const loader = rootContext.loader as InternalPlasmicComponentLoader;\n const spec = [\n ...loader.getGlobalVariants(),\n ...(rootContext.globalVariants ?? []),\n ].find(\n (spec) =>\n spec.name === name && (!spec.projectId || spec.projectId === projectId)\n );\n return spec ? spec.value : undefined;\n };\n}\n","import {\n ComponentMeta,\n getBundleSubset,\n LoaderBundleOutput,\n} from '@plasmicapp/loader-core';\nimport type { ComponentRenderData } from './loader';\n\nfunction getUsedComps(allComponents: ComponentMeta[], entryCompIds: string[]) {\n const q: string[] = [...entryCompIds];\n const seenIds = new Set<string>(entryCompIds);\n const componentMetaById = new Map<string, ComponentMeta>(\n allComponents.map((meta) => [meta.id, meta])\n );\n const usedComps: ComponentMeta[] = [];\n while (q.length > 0) {\n const [id] = q.splice(0, 1);\n const meta = componentMetaById.get(id);\n if (!meta) {\n continue;\n }\n usedComps.push(meta);\n meta.usedComponents.forEach((usedCompId) => {\n if (!seenIds.has(usedCompId)) {\n seenIds.add(usedCompId);\n q.push(usedCompId);\n }\n });\n }\n return usedComps;\n}\n\nexport function prepComponentData(\n bundle: LoaderBundleOutput,\n compMetas: ComponentMeta[],\n opts?: {\n target?: 'browser' | 'server';\n }\n): ComponentRenderData {\n if (compMetas.length === 0) {\n return {\n entryCompMetas: bundle.components,\n bundle: bundle,\n remoteFontUrls: [],\n };\n }\n\n const usedComps = getUsedComps(\n bundle.components,\n compMetas.map((compMeta) => compMeta.id)\n );\n const compPaths = usedComps.map((compMeta) => compMeta.entry);\n const subBundle = getBundleSubset(\n bundle,\n [\n 'entrypoint.css',\n ...compPaths,\n 'root-provider.js',\n ...bundle.projects\n .map((x) => x.globalContextsProviderFileName)\n .filter((x) => !!x),\n // We need to explicitly include global context provider components\n // to make sure they are kept in bundle.components. That's because\n // for esbuild, just the globalContextsProviderFileName is not enough,\n // because it will import a chunk that includes the global context\n // component, instead of importing that global context component's\n // entry file. And because nothing depends on the global context component's\n // entry file, we end up excluding the global context component from\n // bundle.components, which then makes its substitution not work.\n // Instead, we forcibly include it here (we'll definitely need it anyway!).\n ...bundle.components\n .filter((c) => c.isGlobalContextProvider)\n .map((c) => c.entry),\n ...bundle.globalGroups.map((g) => g.contextFile),\n ],\n opts\n );\n\n const remoteFontUrls: string[] = [];\n subBundle.projects.forEach((p) =>\n remoteFontUrls.push(...p.remoteFonts.map((f) => f.url))\n );\n\n return {\n entryCompMetas: compMetas,\n bundle: subBundle,\n remoteFontUrls,\n };\n}\n\nexport function mergeBundles(\n target: LoaderBundleOutput,\n from: LoaderBundleOutput\n) {\n const existingCompIds = new Set(target.components.map((c) => c.id));\n\n const newCompMetas = from.components.filter(\n (m) => !existingCompIds.has(m.id)\n );\n if (newCompMetas.length > 0) {\n target = { ...target, components: [...target.components, ...newCompMetas] };\n }\n\n const existingProjects = new Set(target.projects.map((p) => p.id));\n const newProjects = from.projects.filter((p) => !existingProjects.has(p.id));\n if (newProjects.length > 0) {\n target = {\n ...target,\n projects: [...target.projects, ...newProjects],\n };\n }\n\n const existingModules = {\n browser: new Set(target.modules.browser.map((m) => m.fileName)),\n server: new Set(target.modules.server.map((m) => m.fileName)),\n };\n const newModules = {\n browser: from.modules.browser.filter(\n (m) => !existingModules.browser.has(m.fileName)\n ),\n server: from.modules.server.filter(\n (m) => !existingModules.server.has(m.fileName)\n ),\n };\n if (newModules.browser.length > 0 || newModules.server.length > 0) {\n target = {\n ...target,\n modules: {\n browser: [...target.modules.browser, ...newModules.browser],\n server: [...target.modules.server, ...newModules.server],\n },\n };\n }\n\n const existingGlobalIds = new Set(target.globalGroups.map((g) => g.id));\n const newGlobals = from.globalGroups.filter(\n (g) => !existingGlobalIds.has(g.id)\n );\n if (newGlobals.length > 0) {\n target = {\n ...target,\n globalGroups: [...target.globalGroups, ...newGlobals],\n };\n }\n\n const existingExternals = new Set(target.external);\n const newExternals = target.external.filter((x) => !existingExternals.has(x));\n if (newExternals.length > 0) {\n target = { ...target, external: [...target.external, ...newExternals] };\n }\n\n const existingSplitIds = new Set(target.activeSplits.map((s) => s.id));\n const newSplits =\n from.activeSplits.filter((s) => !existingSplitIds.has(s.id)) ?? [];\n if (newSplits.length > 0) {\n target = {\n ...target,\n activeSplits: [...target.activeSplits, ...newSplits],\n };\n }\n\n return target;\n}\n\nexport const convertBundlesToComponentRenderData = (\n bundles: LoaderBundleOutput[],\n compMetas: ComponentMeta[]\n): ComponentRenderData | null => {\n if (bundles.length === 0) {\n return null;\n }\n\n const mergedBundles = bundles.reduce((prev, cur) => mergeBundles(prev, cur));\n return prepComponentData(mergedBundles, compMetas);\n};\n","import {\n LoaderBundleCache,\n PageMeta,\n PlasmicModulesFetcher,\n PlasmicTracker,\n} from '@plasmicapp/loader-core';\nimport { ComponentMeta, LoaderBundleOutput } from '@plasmicapp/loader-fetcher';\nimport { mergeBundles, prepComponentData } from './bundles';\nimport { ComponentRenderData, FetchPagesOpts } from './loader';\nimport {\n ComponentLookupSpec,\n getCompMetas,\n getLookupSpecName,\n isBrowser,\n isDynamicPagePath,\n} from './utils';\n\nexport interface InitOptions {\n projects: {\n id: string;\n token: string;\n version?: string;\n }[];\n cache?: LoaderBundleCache;\n platform?: 'react' | 'nextjs' | 'gatsby';\n preview?: boolean;\n host?: string;\n onClientSideFetch?: 'warn' | 'error';\n i18nKeyScheme?: 'content' | 'hash';\n\n /**\n * By default, fetchComponentData() and fetchPages() calls cached in memory\n * with the PlasmicComponentLoader instance. If alwaysFresh is true, then\n * data is always freshly fetched over the network.\n */\n alwaysFresh?: boolean;\n}\n\n/** Subset of loader functionality that works on React Server Components. */\nexport class ReactServerPlasmicComponentLoader {\n private readonly opts: InitOptions;\n private readonly fetcher: PlasmicModulesFetcher;\n private readonly tracker: PlasmicTracker;\n private readonly onBundleMerged?: () => void;\n private readonly onBundleFetched?: () => void;\n\n private bundle: LoaderBundleOutput = {\n modules: {\n browser: [],\n server: [],\n },\n components: [],\n globalGroups: [],\n external: [],\n projects: [],\n activeSplits: [],\n };\n\n constructor(args: {\n opts: InitOptions;\n fetcher: PlasmicModulesFetcher;\n tracker: PlasmicTracker;\n /** Called after `mergeBundle` (including `fetch` calls). */\n onBundleMerged?: () => void;\n /** Called after any `fetch` calls. */\n onBundleFetched?: () => void;\n }) {\n this.opts = args.opts;\n this.fetcher = args.fetcher;\n this.tracker = args.tracker;\n this.onBundleMerged = args.onBundleMerged;\n this.onBundleFetched = args.onBundleFetched;\n }\n\n private maybeGetCompMetas(...specs: ComponentLookupSpec[]) {\n const found = new Set<ComponentMeta>();\n const missing: ComponentLookupSpec[] = [];\n for (const spec of specs) {\n const filteredMetas = getCompMetas(this.bundle.components, spec);\n if (filteredMetas.length > 0) {\n filteredMetas.forEach((meta) => found.add(meta));\n } else {\n missing.push(spec);\n }\n }\n return { found: Array.from(found.keys()), missing };\n }\n\n async maybeFetchComponentData(\n specs: ComponentLookupSpec[],\n opts?: FetchComponentDataOpts\n ): Promise<ComponentRenderData | null>;\n async maybeFetchComponentData(\n ...specs: ComponentLookupSpec[]\n ): Promise<ComponentRenderData | null>;\n async maybeFetchComponentData(\n ...args: any[]\n ): Promise<ComponentRenderData | null> {\n const { specs, opts } = parseFetchComponentDataArgs(...args);\n const returnWithSpecsToFetch = async (\n specsToFetch: ComponentLookupSpec[]\n ) => {\n await this.fetchMissingData({ missingSpecs: specsToFetch });\n const {\n found: existingMetas2,\n missing: missingSpecs2,\n } = this.maybeGetCompMetas(...specs);\n if (missingSpecs2.length > 0) {\n return null;\n }\n\n return prepComponentData(this.bundle, existingMetas2, opts);\n };\n\n if (this.opts.alwaysFresh) {\n // If alwaysFresh, then we treat all specs as missing\n return await returnWithSpecsToFetch(specs);\n }\n\n // Else we only fetch actually missing specs\n const {\n found: existingMetas,\n missing: missingSpecs,\n } = this.maybeGetCompMetas(...specs);\n if (missingSpecs.length === 0) {\n return prepComponentData(this.bundle, existingMetas, opts);\n }\n\n return await returnWithSpecsToFetch(missingSpecs);\n }\n\n async fetchComponentData(\n specs: ComponentLookupSpec[],\n opts?: FetchComponentDataOpts\n ): Promise<ComponentRenderData>;\n async fetchComponentData(\n ...specs: ComponentLookupSpec[]\n ): Promise<ComponentRenderData>;\n async fetchComponentData(...args: any[]): Promise<ComponentRenderData> {\n const { specs, opts } = parseFetchComponentDataArgs(...args);\n const data = await this.maybeFetchComponentData(specs, opts);\n\n if (!data) {\n const { missing: missingSpecs } = this.maybeGetCompMetas(...specs);\n throw new Error(\n `Unable to find components ${missingSpecs\n .map(getLookupSpecName)\n .join(', ')}`\n );\n }\n\n return data;\n }\n\n async fetchPages(opts?: FetchPagesOpts) {\n this.maybeReportClientSideFetch(\n () => `Plasmic: fetching all page metadata in the browser`\n );\n const data = await this.fetchAllData();\n return data.components.filter(\n (comp) =>\n comp.isPage &&\n comp.path &&\n (opts?.includeDynamicPages || !isDynamicPagePath(comp.path))\n ) as PageMeta[];\n }\n\n async fetchComponents() {\n this.maybeReportClientSideFetch(\n () => `Plasmic: fetching all component metadata in the browser`\n );\n const data = await this.fetchAllData();\n return data.components;\n }\n\n getActiveSplits() {\n return this.bundle.activeSplits;\n }\n\n private async fetchMissingData(opts: {\n missingSpecs: ComponentLookupSpec[];\n }) {\n // TODO: do better than just fetching everything\n this.maybeReportClientSideFetch(\n () =>\n `Plasmic: fetching missing components in the browser: ${opts.missingSpecs\n .map((spec) => getLookupSpecName(spec))\n .join(', ')}`\n );\n return this.fetchAllData();\n }\n\n private maybeReportClientSideFetch(mkMsg: () => string) {\n if (isBrowser && this.opts.onClientSideFetch) {\n const msg = mkMsg();\n if (this.opts.onClientSideFetch === 'warn') {\n console.warn(msg);\n } else {\n throw new Error(msg);\n }\n }\n }\n\n private async fetchAllData() {\n const bundle = await this.fetcher.fetchAllData();\n this.tracker.trackFetch();\n this.mergeBundle(bundle);\n this.onBundleFetched?.();\n return bundle;\n }\n\n mergeBundle(bundle: LoaderBundleOutput) {\n this.bundle = mergeBundles(bundle, this.bundle);\n this.onBundleMerged?.();\n }\n\n getBundle(): LoaderBundleOutput {\n return this.bundle;\n }\n\n clearCache() {\n this.bundle = {\n modules: {\n browser: [],\n server: [],\n },\n components: [],\n globalGroups: [],\n external: [],\n projects: [],\n activeSplits: [],\n };\n }\n}\n\nexport interface FetchComponentDataOpts {\n /**\n * Will fetch either code targeting SSR or browser hydration in the\n * returned bundle.\n *\n * By default, the target is browser. That's okay, because even when\n * doing SSR, as long as you are using the same instance of PlasmicLoader\n * that was used to fetch component data, it will still know how to get at\n * the server code.\n *\n * But, if you are building your own SSR solution, where fetching and rendering\n * are using different instances of PlasmicLoader, then you'll want to make\n * sure that when you fetch, you are fetching the right one to be used in the\n * right environment for either SSR or browser hydration.\n */\n target?: 'server' | 'browser';\n}\n\nfunction parseFetchComponentDataArgs(\n specs: ComponentLookupSpec[],\n opts?: FetchComponentDataOpts\n): { specs: ComponentLookupSpec[]; opts?: FetchComponentDataOpts };\nfunction parseFetchComponentDataArgs(\n ...specs: ComponentLookupSpec[]\n): { specs: ComponentLookupSpec[]; opts?: FetchComponentDataOpts };\nfunction parseFetchComponentDataArgs(...args: any[]) {\n let specs: ComponentLookupSpec[];\n let opts: FetchComponentDataOpts | undefined;\n if (Array.isArray(args[0])) {\n specs = args[0];\n opts = args[1];\n } else {\n specs = args;\n opts = undefined;\n }\n return { specs, opts };\n}\n","import * as PlasmicDataSourcesContext from '@plasmicapp/data-sources-context';\nimport * as PlasmicHost from '@plasmicapp/host';\nimport {\n CodeComponentMeta as InternalCodeComponentMeta,\n ComponentHelpers as InternalCodeComponentHelpers,\n GlobalContextMeta as InternalGlobalContextMeta,\n registerComponent,\n registerGlobalContext,\n registerToken,\n registerTrait,\n StateHelpers,\n StateSpec,\n TokenRegistration,\n TraitMeta,\n} from '@plasmicapp/host';\nimport {\n ComponentMeta,\n LoaderBundleOutput,\n PlasmicModulesFetcher,\n PlasmicTracker,\n Registry,\n TrackRenderOptions,\n} from '@plasmicapp/loader-core';\nimport { internal_getCachedBundleInNodeServer } from '@plasmicapp/loader-fetcher';\nimport { getActiveVariation, getExternalIds } from '@plasmicapp/loader-splits';\nimport * as PlasmicQuery from '@plasmicapp/query';\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport * as jsxDevRuntime from 'react/jsx-dev-runtime';\nimport * as jsxRuntime from 'react/jsx-runtime';\nimport { ComponentLookup } from './component-lookup';\nimport { createUseGlobalVariant } from './global-variants';\nimport {\n FetchComponentDataOpts,\n InitOptions,\n ReactServerPlasmicComponentLoader,\n} from './loader-react-server';\nimport type { GlobalVariantSpec } from './PlasmicRootProvider';\nimport { ComponentLookupSpec, getCompMetas, isBrowser, uniq } from './utils';\nimport { getPlasmicCookieValues, updatePlasmicCookieValue } from './variation';\n\nexport interface ComponentRenderData {\n entryCompMetas: (ComponentMeta & { params?: Record<string, string> })[];\n bundle: LoaderBundleOutput;\n remoteFontUrls: string[];\n}\n\ninterface ComponentSubstitutionSpec {\n lookup: ComponentLookupSpec;\n component: React.ComponentType<any>;\n codeComponentHelpers?: InternalCodeComponentHelpers<\n React.ComponentProps<any>\n >;\n}\n\ninterface PlasmicRootWatcher {\n onDataFetched?: () => void;\n}\n\nexport type CodeComponentMeta<P> = Omit<\n InternalCodeComponentMeta<P>,\n 'importPath' | 'componentHelpers' | 'states'\n> & {\n /**\n * The path to be used when importing the component in the generated code.\n * It can be the name of the package that contains the component, or the path\n * to the file in the project (relative to the root directory).\n * Optional: not used by Plasmic headless API, only by codegen.\n */\n importPath?: string;\n /**\n * The states helpers are registered together with the states for the Plasmic headless API\n */\n states?: Record<string, StateSpec & StateHelpers<P, any>>;\n};\n\nexport type GlobalContextMeta<P> = Omit<\n InternalGlobalContextMeta<P>,\n 'importPath'\n> & {\n /**\n * The path to be used when importing the component in the generated code.\n * It can be the name of the package that contains the component, or the path\n * to the file in the project (relative to the root directory).\n * Optional: not used by Plasmic headless API, only by codegen.\n */\n importPath?: string;\n};\n\nexport type FetchPagesOpts = {\n /**\n * Whether to include dynamic pages in fetchPages() output. A page is\n * considered dynamic if its path contains some param between brackets,\n * e.g. \"[slug]\".\n */\n includeDynamicPages?: boolean;\n};\n\nconst SUBSTITUTED_COMPONENTS: Record<string, React.ComponentType<any>> = {};\nconst REGISTERED_CODE_COMPONENT_HELPERS: Record<\n string,\n InternalCodeComponentHelpers<React.ComponentProps<any>>\n> = {};\nconst SUBSTITUTED_GLOBAL_VARIANT_HOOKS: Record<string, () => any> = {};\n\nexport class InternalPlasmicComponentLoader {\n private readonly reactServerLoader: ReactServerPlasmicComponentLoader;\n private readonly registry = new Registry();\n private subs: ComponentSubstitutionSpec[] = [];\n private roots: PlasmicRootWatcher[] = [];\n private globalVariants: GlobalVariantSpec[] = [];\n private tracker: PlasmicTracker;\n\n constructor(private opts: InitOptions) {\n this.tracker = new PlasmicTracker({\n projectIds: opts.projects.map((p) => p.id),\n platform: opts.platform,\n preview: opts.preview,\n });\n this.reactServerLoader = new ReactServerPlasmicComponentLoader({\n opts,\n fetcher: new PlasmicModulesFetcher(opts),\n tracker: this.tracker,\n onBundleMerged: () => {\n this.refreshRegistry();\n },\n onBundleFetched: () => {\n this.roots.forEach((watcher) => watcher.onDataFetched?.());\n },\n });\n\n this.registerModules({\n react: React,\n 'react-dom': ReactDOM,\n 'react/jsx-runtime': jsxRuntime,\n 'react/jsx-dev-runtime': jsxDevRuntime,\n\n // Also inject @plasmicapp/query and @plasmicapp/host to use the\n // same contexts here and in loader-downloaded code.\n '@plasmicapp/query': PlasmicQuery,\n '@plasmicapp/data-sources-context': PlasmicDataSourcesContext,\n '@plasmicapp/host': PlasmicHost,\n '@plasmicapp/loader-runtime-registry': {\n components: SUBSTITUTED_COMPONENTS,\n globalVariantHooks: SUBSTITUTED_GLOBAL_VARIANT_HOOKS,\n codeComponentHelpers: REGISTERED_CODE_COMPONENT_HELPERS,\n },\n });\n }\n\n getBundle() {\n return this.reactServerLoader.getBundle();\n }\n\n setGlobalVariants(globalVariants: GlobalVariantSpec[]) {\n this.globalVariants = globalVariants;\n }\n\n getGlobalVariants() {\n return this.globalVariants;\n }\n\n registerModules(modules: Record<string, any>) {\n if (\n Object.keys(modules).some(\n (name) => this.registry.getRegisteredModule(name) !== modules[name]\n )\n ) {\n if (!this.registry.isEmpty()) {\n console.warn(\n 'Calling PlasmicComponentLoader.registerModules() after Plasmic component has rendered; starting over.'\n );\n this.registry.clear();\n }\n for (const key of Object.keys(modules)) {\n this.registry.register(key, modules[key]);\n }\n }\n }\n\n substituteComponent<P>(\n component: React.ComponentType<P>,\n name: ComponentLookupSpec\n ) {\n this.internalSubstituteComponent(component, name, undefined);\n }\n\n private internalSubstituteComponent<P>(\n component: React.ComponentType<P>,\n name: ComponentLookupSpec,\n codeComponentHelpers:\n | InternalCodeComponentHelpers<\n React.ComponentProps<React.ComponentType<P>>\n >\n | undefined\n ) {\n if (!this.registry.isEmpty()) {\n console.warn(\n 'Calling PlasmicComponentLoader.registerSubstitution() after Plasmic component has rendered; starting over.'\n );\n this.registry.clear();\n }\n this.subs.push({ lookup: name, component, codeComponentHelpers });\n }\n\n registerComponent<T extends React.ComponentType<any>>(\n component: T,\n meta: CodeComponentMeta<React.ComponentProps<T>>\n ) {\n // making the component meta consistent between codegen and loader\n const stateHelpers = Object.fromEntries(\n Object.entries(meta.states ?? {})\n .filter(\n ([_, stateSpec]) =>\n 'initFunc' in stateSpec || 'onChangeArgsToValue' in stateSpec\n )\n .map(([stateName, stateSpec]) => [\n stateName,\n {\n ...('initFunc' in stateSpec\n ? { initFunc: stateSpec.initFunc }\n : {}),\n ...('onChangeArgsToValue' in stateSpec\n ? { onChangeArgsToValue: stateSpec.onChangeArgsToValue }\n : {}),\n },\n ])\n );\n const helpers = { states: stateHelpers };\n this.internalSubstituteComponent(\n component,\n { name: meta.name, isCode: true },\n Object.keys(stateHelpers).length > 0 ? helpers : undefined\n );\n registerComponent(component, {\n ...meta,\n // Import path is not used as we will use component substitution\n importPath: meta.importPath ?? '',\n ...(Object.keys(stateHelpers).length > 0\n ? {\n componentHelpers: {\n helpers,\n importPath: '',\n importName: '',\n },\n }\n : {}),\n });\n }\n\n registerGlobalContext<T extends React.ComponentType<any>>(\n context: T,\n meta: GlobalContextMeta<React.ComponentProps<T>>\n ) {\n this.substituteComponent(context, { name: meta.name, isCode: true });\n // Import path is not used as we will use component substitution\n registerGlobalContext(context, {\n ...meta,\n importPath: meta.importPath ?? '',\n });\n }\n\n registerTrait(trait: string, meta: TraitMeta) {\n registerTrait(trait, meta);\n }\n\n registerToken(token: TokenRegistration) {\n registerToken(token);\n }\n\n registerPrefetchedBundle(bundle: LoaderBundleOutput) {\n // For React Server Components (Next.js 13+),\n // we need to pass server modules in LoaderBundleOutput from Server Components to Client Components.\n // We don't want to pass them via normal page props because that will be serialized to the browser.\n // Instead, we pass the bundle (including the server modules) via the Node `global` variable.\n //\n // This is the code that reads the stored bundle and merges it back into the loader.\n if (!isBrowser) {\n // Check if we have a cached bundle on this Node server.\n const cachedBundle = internal_getCachedBundleInNodeServer(this.opts);\n if (cachedBundle) {\n // If it's there, merge the cached bundle first.\n this.reactServerLoader.mergeBundle(cachedBundle);\n }\n }\n this.reactServerLoader.mergeBundle(bundle);\n }\n\n subscribePlasmicRoot(watcher: PlasmicRootWatcher) {\n this.roots.push(watcher);\n }\n\n unsubscribePlasmicRoot(watcher: PlasmicRootWatcher) {\n const index = this.roots.indexOf(watcher);\n if (index >= 0) {\n this.roots.splice(index, 1);\n }\n }\n\n clearCache() {\n this.reactServerLoader.clearCache();\n this.registry.clear();\n }\n\n getLookup() {\n return new ComponentLookup(this.getBundle(), this.registry);\n }\n\n // ReactServerLoader methods\n\n maybeFetchComponentData(\n specs: ComponentLookupSpec[],\n opts?: FetchComponentDataOpts\n ): Promise<ComponentRenderData | null>;\n maybeFetchComponentData(\n ...specs: ComponentLookupSpec[]\n ): Promise<ComponentRenderData | null>;\n maybeFetchComponentData(...args: any[]): Promise<ComponentRenderData | null> {\n return this.reactServerLoader.maybeFetchComponentData(...args);\n }\n\n fetchComponentData(\n specs: ComponentLookupSpec[],\n opts?: FetchComponentDataOpts\n ): Promise<ComponentRenderData>;\n fetchComponentData(\n ...specs: ComponentLookupSpec[]\n ): Promise<ComponentRenderData>;\n fetchComponentData(...args: any[]): Promise<ComponentRenderData> {\n return this.reactServerLoader.fetchComponentData(...args);\n }\n\n fetchPages(opts?: FetchPagesOpts) {\n return this.reactServerLoader.fetchPages(opts);\n }\n\n fetchComponents() {\n return this.reactServerLoader.fetchComponents();\n }\n\n getActiveSplits() {\n return this.reactServerLoader.getActiveSplits();\n }\n\n trackConversion(value: number = 0) {\n this.tracker.trackConversion(value);\n }\n\n public async getActiveVariation(opts: {\n traits: Record<string, string | number | boolean>;\n getKnownValue: (key: string) => string | undefined;\n updateKnownValue: (key: string, value: string) => void;\n }) {\n await this.reactServerLoader.fetchComponents();\n return getActiveVariation({\n ...opts,\n splits: this.getBundle().activeSplits,\n });\n }\n\n public getTeamIds(): string[] {\n return uniq(\n this.getBundle()\n .projects.map((p) =>\n p.teamId ? `${p.teamId}${p.indirect ? '@indirect' : ''}` : null\n )\n .filter((x): x is string => !!x)\n );\n }\n\n public getProjectIds(): string[] {\n return uniq(\n this.getBundle().projects.map(\n (p) => `${p.id}${p.indirect ? '@indirect' : ''}`\n )\n );\n }\n\n public trackRender(opts?: TrackRenderOptions) {\n this.tracker.trackRender(opts);\n }\n\n private refreshRegistry() {\n // Once we have received data, we register components to\n // substitute. We had to wait for data to do this so\n // that we can look up the right module name to substitute\n // in component meta.\n for (const sub of this.subs) {\n const metas = getCompMetas(this.getBundle().components, sub.lookup);\n metas.forEach((meta) => {\n SUBSTITUTED_COMPONENTS[meta.id] = sub.component;\n if (sub.codeComponentHelpers) {\n REGISTERED_CODE_COMPONENT_HELPERS[meta.id] = sub.codeComponentHelpers;\n }\n });\n }\n\n // We also swap global variants' useXXXGlobalVariant() hook with\n // a fake one that just reads from the PlasmicRootContext. Because\n // global variant values are not supplied by the generated global variant\n // context providers, but instead by <PlasmicRootProvider/> and by\n // PlasmicComponentLoader.setGlobalVariants(), we redirect these\n // hooks to read from them instead.\n for (const globalGroup of this.getBundle().globalGroups) {\n if (globalGroup.type !== 'global-screen') {\n SUBSTITUTED_GLOBAL_VARIANT_HOOKS[\n globalGroup.id\n ] = createUseGlobalVariant(globalGroup.name, globalGroup.projectId);\n }\n }\n this.registry.updateModules(this.getBundle());\n }\n}\n\n/**\n * Library for fetching component data, and registering\n * custom components.\n */\nexport class PlasmicComponentLoader {\n private __internal: InternalPlasmicComponentLoader;\n constructor(internal: InternalPlasmicComponentLoader) {\n this.__internal = internal;\n }\n\n /**\n * Sets global variants to be used for all components. Note that\n * this is not reactive, and will not re-render all components\n * already mounted; instead, it should be used to activate global\n * variants that should always be activated for the lifetime of this\n * app. If you'd like to reactively change the global variants,\n * you should specify them via <PlasmicRootProvider />\n */\n setGlobalVariants(globalVariants: GlobalVariantSpec[]) {\n this.__internal.setGlobalVariants(globalVariants);\n }\n\n registerModules(modules: Record<string, any>) {\n this.__internal.registerModules(modules);\n }\n\n /**\n * Register custom components that should be swapped in for\n * components defined in your project. You can use this to\n * swap in / substitute a Plasmic component with a \"real\" component.\n */\n substituteComponent<P>(\n component: React.ComponentType<P>,\n name: ComponentLookupSpec\n ) {\n this.__internal.substituteComponent(component, name);\n }\n\n /**\n * Register code components to be used on Plasmic Editor.\n */\n registerComponent<T extends React.ComponentType<any>>(\n component: T,\n meta: CodeComponentMeta<React.ComponentProps<T>>\n ): void;\n\n /**\n * [[deprecated]] Please use `substituteComponent` instead for component\n * substitution, or the other `registerComponent` overload to register\n * code components to be used on Plasmic Editor.\n *\n * @see `substituteComponent`\n */\n registerComponent<T extends React.ComponentType<any>>(\n component: T,\n name: ComponentLookupSpec\n ): void;\n\n registerComponent<T extends React.ComponentType<any>>(\n component: T,\n metaOrName: ComponentLookupSpec | CodeComponentMeta<React.ComponentProps<T>>\n ) {\n // 'props' is a required field in CodeComponentMeta\n if (metaOrName && typeof metaOrName === 'object' && 'props' in metaOrName) {\n this.__internal.registerComponent(component, metaOrName);\n } else {\n // Deprecated call\n if (\n process.env.NODE_ENV === 'development' &&\n !this.warnedRegisterComponent\n ) {\n console.warn(\n `PlasmicLoader: Using deprecated method \\`registerComponent\\` for component substitution. ` +\n `Please consider using \\`substituteComponent\\` instead.`\n );\n this.warnedRegisterComponent = true;\n }\n this.substituteComponent(component, metaOrName);\n }\n }\n private warnedRegisterComponent = false;\n\n registerGlobalContext<T extends React.ComponentType<any>>(\n context: T,\n meta: GlobalContextMeta<React.ComponentProps<T>>\n ) {\n this.__internal.registerGlobalContext(context, meta);\n }\n\n registerTrait(trait: string, meta: TraitMeta) {\n this.__internal.registerTrait(trait, meta);\n }\n\n registerToken(token: TokenRegistration) {\n this.__internal.registerToken(token);\n }\n\n /**\n * Pre-fetches component data needed to for PlasmicLoader to render\n * these components. Should be passed into PlasmicRootProvider as\n * the prefetchedData prop.\n *\n * You can look up a component either by:\n * - the name of the component\n * - the path for a page component\n * - an array of strings that make up parts of the path\n * - object { name: \"name_or_path\", projectId: ...}, to specify which project\n * to use, if multiple projects have the same component name\n *\n * Throws an Error if a specified component to fetch does not exist in\n * the Plasmic project.\n */\n async fetchComponentData(\n ...specs: ComponentLookupSpec[]\n ): Promise<ComponentRenderData> {\n return this.__internal.fetchComponentData(...specs);\n }\n\n /**\n * Like fetchComponentData(), but returns null instead of throwing an Error\n * when a component is not found. Useful when you are implementing a catch-all\n * page and want to check if a specific path had been defined for Plasmic.\n */\n async maybeFetchComponentData(\n ...specs: ComponentLookupSpec[]\n ): Promise<ComponentRenderData | null> {\n return this.__internal.maybeFetchComponentData(...specs);\n }\n\n /**\n * Returns all the page component metadata for these projects.\n */\n async fetchPages(opts?: FetchPagesOpts) {\n return this.__internal.fetchPages(opts);\n }\n\n /**\n * Returns all components metadata for these projects.\n */\n async fetchComponents() {\n return this.__internal.fetchComponents();\n }\n\n protected async _getActiveVariation(opts: {\n traits: Record<string, string | number | boolean>;\n getKnownValue: (key: string) => string | undefined;\n updateKnownValue: (key: string, value: string) => void;\n }) {\n return this.__internal.getActiveVariation(opts);\n }\n\n async getActiveVariation(opts: {\n known?: Record<string, string>;\n traits: Record<string, string | number | boolean>;\n }) {\n return this._getActiveVariation({\n traits: opts.traits,\n getKnownValue: (key: string) => {\n if (opts.known) {\n return opts.known[key];\n } else {\n const cookies = getPlasmicCookieValues();\n return cookies[key];\n }\n },\n updateKnownValue: (key: string, value: string) => {\n if (!opts.known) {\n updatePlasmicCookieValue(key, value);\n }\n },\n });\n }\n\n getExternalVariation(variation: Record<string, string>) {\n return getExternalIds(this.getActiveSplits(), variation);\n }\n\n getActiveSplits() {\n return this.__internal.getActiveSplits();\n }\n\n trackConversion(value: number = 0) {\n this.__internal.trackConversion(value);\n }\n\n clearCache() {\n return this.__internal.clearCache();\n }\n}\n","import * as React from 'react';\nimport { usePlasmicRootContext } from './PlasmicRootProvider';\nimport {\n ComponentLookupSpec,\n useForceUpdate,\n useIsMounted,\n useStableLookupSpec,\n} from './utils';\n\n/**\n * Hook that fetches and returns a React component for rendering the argument\n * Plasmic component. Returns undefined if the component data is still\n * being fetched.\n *\n * @param opts.forceOriginal if you used PlasmicComponentLoader.registerComponent,\n * then normally usePlasmicComponent will return the registered component.\n * You can set forceOriginal to true if you want to return the Plasmic-generated\n * component instead.\n */\nexport function usePlasmicComponent<P extends React.ComponentType = any>(\n spec: ComponentLookupSpec,\n opts: { forceOriginal?: boolean } = {}\n) {\n const rootContext = usePlasmicRootContext();\n if (!rootContext) {\n throw new Error(\n `You can only use usePlasmicComponent if wrapped in <PlasmicRootProvider />`\n );\n }\n\n const loader = rootContext.loader;\n const lookup = loader.getLookup();\n\n const component = lookup.hasComponent(spec)\n ? lookup.getComponent(spec, opts)\n : undefined;\n\n const stableSpec = useStableLookupSpec(spec);\n const isMounted = useIsMounted();\n const forceUpdate = useForceUpdate();\n\n React.useEffect(() => {\n if (!component) {\n (async () => {\n await loader.fetchComponentData(stableSpec);\n if (isMounted()) {\n forceUpdate();\n }\n })();\n }\n }, [component, stableSpec]);\n\n return component as P;\n}\n","import * as React from 'react';\nimport { usePlasmicRootContext } from './PlasmicRootProvider';\nimport { usePlasmicComponent } from './usePlasmicComponent';\n\nconst PlasmicComponentContext = React.createContext(false);\n\nexport function PlasmicComponent(props: {\n /**\n * Name of the component to render, or the path of the page component\n */\n component: string;\n /**\n * Optionally specify a projectId if there are multiple components\n * of the same name from different projects\n */\n projectId?: string;\n /**\n * If you used registerComponent(), then if the name matches a registered\n * component, that component is used. If you want the Plasmic-generated\n * component instead, specify forceOriginal.\n */\n forceOriginal?: boolean;\n componentProps?: any;\n}): React.ReactElement | null {\n const { component, projectId, componentProps, forceOriginal } = props;\n\n const rootContext = usePlasmicRootContext();\n const isRootLoader = !React.useContext(PlasmicComponentContext);\n\n if (!rootContext) {\n // no existing PlasmicRootProvider\n throw new Error(\n `You must use <PlasmicRootProvider/> at the root of your app`\n );\n }\n\n const {\n loader,\n globalContextsProps,\n variation,\n userAuthToken,\n isUserLoading,\n authRedirectUri,\n ...rest\n } = rootContext;\n\n const Component = usePlasmicComponent(\n { name: component, projectId, isCode: false },\n { forceOriginal }\n );\n\n React.useEffect(() => {\n if (isRootLoader) {\n const meta = loader\n .getLookup()\n .getComponentMeta({ name: component, projectId });\n\n if (meta) {\n loader.trackRender({\n renderCtx: {\n rootProjectId: meta.projectId,\n rootComponentId: meta.id,\n rootComponentName: component,\n teamIds: loader.getTeamIds(),\n projectIds: loader.getProjectIds(),\n },\n variation,\n });\n }\n }\n }, [component, projectId, loader, variation]);\n\n const element = React.useMemo(() => {\n if (!Component) {\n return null;\n }\n\n let element = <Component {...componentProps} />;\n\n if (isRootLoader) {\n // If this is the root PlasmicComponent, then wrap the content with the\n // react-web's PlasmicRootProvider. We are doing this here, instead of\n // say PlasmicRootProvider, because we don't have access to this context\n // provider until data has been loaded. If we insert this provider into\n // the tree at the root after data is loaded, then we'll invalidate the\n // React tree and tree state, which is bad. Instead, we do it at the\n // \"root-most PlasmicComponent\"; we won't risk invalidating the sub-tree\n // here because there were no children before the data came in.\n const lookup = loader.getLookup();\n const ReactWebRootProvider = lookup.getRootProvider();\n const GlobalContextsProvider = lookup.getGlobalContextsProvider({\n name: component,\n projectId,\n });\n element = (\n <ReactWebRootProvider\n {...rest}\n userAuthToken={userAuthToken}\n isUserLoading={isUserLoading}\n authRedirectUri={authRedirectUri}\n >\n <MaybeWrap\n cond={!!GlobalContextsProvider}\n wrapper={(children) => (\n <GlobalContextsProvider {...globalContextsProps}>\n {children}\n </GlobalContextsProvider>\n )}\n >\n <PlasmicComponentContext.Provider value={true}>\n {element}\n </PlasmicComponentContext.Provider>\n </MaybeWrap>\n </ReactWebRootProvider>\n );\n }\n return element;\n }, [\n Component,\n componentProps,\n loader,\n isRootLoader,\n component,\n projectId,\n globalContextsProps,\n userAuthToken, // Just use the token to memo, `user` should be derived from it\n isUserLoading,\n authRedirectUri,\n ]);\n return element;\n}\n\nfunction MaybeWrap(props: {\n children: React.ReactNode;\n cond: boolean;\n wrapper: (children: React.ReactNode) => React.ReactElement;\n}) {\n return (props.cond\n ? props.wrapper(props.children)\n : props.children) as React.ReactElement;\n}\n","import { PlasmicPrepassContext } from '@plasmicapp/query';\nimport prepass from '@plasmicapp/react-ssr-prepass';\nimport React from 'react';\nimport { isFragment } from 'react-is';\nimport { PlasmicComponent } from './PlasmicComponent';\n\n/**\n * Performs a prepass over Plasmic content, kicking off the necessary\n * data fetches, and populating the fetched data into a cache. This\n * cache can be passed as prefetchedQueryData into PlasmicRootProvider.\n *\n * To limit rendering errors that can occur when you do this, we recommend\n * that you pass in _only_ the PlasmicComponents that you are planning to use\n * as the argument. For example:\n *\n * const cache = await extractPlasmicQueryData(\n * <PlasmicRootProvider loader={PLASMIC} prefetchedData={plasmicData}>\n * <PlasmicComponent component=\"Home\" componentProps={{\n * // Specify the component prop overrides you are planning to use\n * // to render the page, as they may change what data is fetched.\n * ...\n * }} />\n * <PlasmicComponent component=\"NavBar\" componentProps={{\n * ...\n * }} />\n * ...\n * </PlasmicRootProvider>\n * );\n *\n * If your PlasmicComponent will be wrapping components that require special\n * context set up, you should also wrap the element above with those context\n * providers.\n *\n * You should avoid passing in elements that are not related to Plasmic, as any\n * rendering errors from those elements during the prepass may result in data\n * not being populated in the cache.\n *\n * @param element a React element containing instances of PlasmicComponent.\n * Will attempt to satisfy all data needs from usePlasmicDataQuery()\n * in this element tree.\n * @returns an object mapping query key to fetched data\n */\nexport async function extractPlasmicQueryData(\n element: React.ReactElement\n): Promise<Record<string, any>> {\n const cache = new Map<string, any>();\n try {\n await plasmicPrepass(\n <PlasmicPrepassContext cache={cache}>{element}</PlasmicPrepassContext>\n );\n } catch (err) {\n console.warn(`PLASMIC: Error encountered while pre-rendering`, err);\n }\n\n const queryCache = Object.fromEntries(\n Array.from(cache.entries()).filter(\n ([key, val]) => !key.startsWith('$swr$') && val !== undefined\n )\n );\n\n try {\n return JSON.parse(\n JSON.stringify(queryCache, (key, value) =>\n value !== undefined ? value : null\n )\n );\n } catch {\n return queryCache;\n }\n}\n\n/**\n * Runs react-ssr-prepass on `element`, while isolating rendering errors\n * as much as possible for each PlasmicComponent instance.\n */\nexport async function plasmicPrepass(element: React.ReactElement) {\n await prepass(buildPlasmicPrepassElement(element));\n}\n\n/**\n * Returns a clone of the element tree, where componentProps of PlasmicComponent\n * has been processed such that any React elements found are wrapped in\n * an error boundary. Makes it possible to isolate rendering errors while still\n * finishing as much data fetched as possible.\n */\nfunction buildPlasmicPrepassElement(element: React.ReactElement) {\n return (\n <GenericErrorBoundary>{processReactElement(element)}</GenericErrorBoundary>\n );\n}\n\nfunction processReactElement(element: React.ReactElement) {\n if (element.type === PlasmicComponent) {\n return React.cloneElement(\n element,\n processPlasmicComponentProps(element.props)\n );\n } else {\n return React.cloneElement(element, processComponentProps(element.props));\n }\n}\n\nfunction processComponentProps(\n props: Record<string, any>\n): Record<string, any> {\n if (!props || typeof props !== 'object') {\n return props;\n }\n\n return Object.fromEntries(\n Object.entries(props).map(([k, v]) => {\n return [k, React.isValidElement(v) ? processReactElement(v) : v];\n })\n );\n}\n\nclass GenericErrorBoundary extends React.Component<{\n children: React.ReactNode;\n}> {\n constructor(props: { children: React.ReactNode }) {\n super(props);\n }\n\n componentDidCatch(error: any) {\n console.log(`Plasmic: Encountered error while prepass rendering:`, error);\n }\n\n render() {\n return <>{this.props.children}</>;\n }\n}\n\n/**\n * To process the componentProps passed to PlasmicComponent, wrap any\n * React element we find in <GenericErrorBoundary />.\n */\nfunction processPlasmicComponentProps(x: any): any {\n if (!x) {\n return x;\n } else if (isFragment(x)) {\n return (\n <React.Fragment>\n {React.Children.map(x.props.children, processPlasmicComponentProps)}\n </React.Fragment>\n );\n } else if (React.isValidElement(x)) {\n return <GenericErrorBoundary>{x}</GenericErrorBoundary>;\n } else if (Array.isArray(x)) {\n return x.map(processPlasmicComponentProps);\n } else if (isLiteralObject(x)) {\n return Object.fromEntries(\n Object.entries(x).map(([key, val]) => [\n key,\n processPlasmicComponentProps(val),\n ])\n );\n } else {\n return x;\n }\n}\n\nfunction isLiteralObject(obj: any): obj is Object {\n return !!obj && typeof obj === 'object' && obj.constructor === Object;\n}\n","import React from 'react';\nimport ReactDOM from 'react-dom';\nimport { renderToString as reactRenderToString } from 'react-dom/server';\nimport { ComponentRenderData, PlasmicComponentLoader } from './loader';\nimport { PlasmicComponent } from './PlasmicComponent';\nimport { GlobalVariantSpec, PlasmicRootProvider } from './PlasmicRootProvider';\nimport { extractPlasmicQueryData } from './prepass';\nimport { ComponentLookupSpec } from './utils';\n\nexport async function renderToElement(\n loader: PlasmicComponentLoader,\n target: HTMLElement,\n lookup: ComponentLookupSpec,\n opts: {\n prefetchedData?: ComponentRenderData;\n componentProps?: any;\n globalVariants?: GlobalVariantSpec[];\n prefetchedQueryData?: Record<string, any>;\n } = {}\n) {\n return new Promise<void>((resolve) => {\n const element = makeElement(loader, lookup, opts);\n ReactDOM.render(element, target, () => resolve());\n });\n}\n\nexport function renderToString(\n loader: PlasmicComponentLoader,\n lookup: ComponentLookupSpec,\n opts: {\n prefetchedData?: ComponentRenderData;\n componentProps?: any;\n globalVariants?: GlobalVariantSpec[];\n prefetchedQueryData?: Record<string, any>;\n } = {}\n) {\n const element = makeElement(loader, lookup, opts);\n return reactRenderToString(element);\n}\n\nexport async function extractPlasmicQueryDataFromElement(\n loader: PlasmicComponentLoader,\n lookup: ComponentLookupSpec,\n opts: {\n prefetchedData?: ComponentRenderData;\n componentProps?: any;\n globalVariants?: GlobalVariantSpec[];\n prefetchedQueryData?: Record<string, any>;\n } = {}\n) {\n const element = makeElement(loader, lookup, opts);\n return extractPlasmicQueryData(element);\n}\n\nexport async function hydrateFromElement(\n loader: PlasmicComponentLoader,\n target: HTMLElement,\n lookup: ComponentLookupSpec,\n opts: {\n prefetchedData?: ComponentRenderData;\n componentProps?: any;\n globalVariants?: GlobalVariantSpec[];\n prefetchedQueryData?: Record<string, any>;\n } = {}\n) {\n return new Promise<void>((resolve) => {\n const element = makeElement(loader, lookup, opts);\n ReactDOM.hydrate(element, target, () => resolve());\n });\n}\n\nfunction makeElement(\n loader: PlasmicComponentLoader,\n lookup: ComponentLookupSpec,\n opts: {\n prefetchedData?: ComponentRenderData;\n componentProps?: any;\n globalVariants?: GlobalVariantSpec[];\n prefetchedQueryData?: Record<string, any>;\n } = {}\n) {\n return (\n <PlasmicRootProvider\n loader={loader}\n prefetchedData={opts.prefetchedData}\n globalVariants={opts.globalVariants}\n prefetchedQueryData={opts.prefetchedQueryData}\n >\n <PlasmicComponent\n component={typeof lookup === 'string' ? lookup : lookup.name}\n projectId={typeof lookup === 'string' ? undefined : lookup.projectId}\n componentProps={opts.componentProps}\n />\n </PlasmicRootProvider>\n );\n}\n","import {\n CodeComponentMeta,\n InternalPlasmicComponentLoader,\n PlasmicComponentLoader,\n} from './loader';\nimport type { InitOptions } from './loader-react-server';\n\nexport {\n DataCtxReader,\n DataProvider,\n PageParamsProvider,\n PlasmicCanvasContext,\n PlasmicCanvasHost,\n PrimitiveType,\n PropType,\n repeatedElement,\n TokenRegistration,\n useDataEnv,\n usePlasmicCanvasContext,\n useSelector,\n useSelectors,\n} from '@plasmicapp/host';\nexport { usePlasmicQueryData } from '@plasmicapp/query';\nexport * from './index-shared';\nexport { PlasmicComponent } from './PlasmicComponent';\nexport {\n GlobalVariantSpec,\n PlasmicRootProvider,\n PlasmicTranslator,\n} from './PlasmicRootProvider';\nexport { extractPlasmicQueryData, plasmicPrepass } from './prepass';\nexport {\n extractPlasmicQueryDataFromElement,\n hydrateFromElement,\n renderToElement,\n renderToString,\n} from './render';\nexport { usePlasmicComponent } from './usePlasmicComponent';\nexport {\n InternalPlasmicComponentLoader,\n PlasmicComponentLoader,\n CodeComponentMeta,\n};\n\nexport function initPlasmicLoader(opts: InitOptions): PlasmicComponentLoader {\n const internal = new InternalPlasmicComponentLoader(opts);\n return new PlasmicComponentLoader(internal);\n}\n"],"names":["runtime","exports","Op","Object","prototype","hasOwn","hasOwnProperty","$Symbol","Symbol","iteratorSymbol","iterator","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","toStringTag","define","obj","key","value","defineProperty","enumerable","configurable","writable","err","wrap","innerFn","outerFn","self","tryLocsList","generator","create","Generator","context","Context","_invoke","state","method","arg","Error","undefined","done","delegate","delegateResult","maybeInvokeDelegate","ContinueSentinel","sent","_sent","dispatchException","abrupt","record","tryCatch","type","makeInvokeMethod","fn","call","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","this","getProto","getPrototypeOf","NativeIteratorPrototype","values","Gp","defineIteratorMethods","forEach","AsyncIterator","PromiseImpl","previousPromise","callInvokeWithMethodAndArg","resolve","reject","invoke","result","__await","then","unwrapped","error","TypeError","info","resultName","next","nextLoc","pushTryEntry","locs","entry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","push","resetTryEntry","completion","reset","iterable","iteratorMethod","isNaN","length","i","doneResult","displayName","isGeneratorFunction","genFun","ctor","constructor","name","mark","setPrototypeOf","__proto__","awrap","async","Promise","iter","keys","object","reverse","pop","skipTempReset","prev","charAt","slice","stop","rootRecord","rval","exception","handle","loc","caught","hasCatch","hasFinally","finallyEntry","complete","finish","catch","thrown","delegateYield","module","regeneratorRuntime","accidentalStrictMode","globalThis","Function","isBrowser","window","useForceUpdate","setTick","React","tick","areLookupSpecsEqual","spec1","spec2","fullSpec1","toFullLookup","fullSpec2","isNameSpec","isCode","isPathSpec","path","projectId","lookup","namePart","codeComponent","startsWith","trim","pascalcase","rawName","matchesPagePath","pagePath","replace","paramNames","match","map","group","pagePathRegExp","RegExp","maybeVals","_lookup$match","params","getCompMetas","metas","full","filter","meta","matchesCompMeta","sort","meta1","meta2","Array","from","getLookupSpecName","uniq","elements","Set","getFirstCompMeta","filtered","ComponentLookup","bundle","registry","_proto","getComponentMeta","spec","components","getComponent","opts","compMeta","moduleName","hasModule","load","forceOriginal","getPlasmicComponent","hasComponent","getGlobalContexts","globalGroups","m","_this","contextFile","getGlobalContextsProvider","projectMeta","projects","find","x","id","globalContextsProviderFileName","getRootProvider","getCss","modules","browser","mod","fileName","endsWith","getRemoteFonts","flatMap","p","remoteFonts","updatePlasmicCookieValue","document","cookie","getGlobalVariantsFromSplits","splits","variation","globalVariants","variationKey","split","sliceId","s","splitId","externalId","slices","contents","variant","PlasmicRootContext","PlasmicRootProvider","props","prefetchedData","children","skipCss","skipFonts","prefetchedQueryData","suspenseForQueryData","globalContextsProps","translator","Head","pageParams","pageQuery","loader","__internal","registerPrefetchedBundle","getActiveSplits","setSplits","forceUpdate","watcher","onDataFetched","subscribePlasmicRoot","unsubscribePlasmicRoot","ensureVariationCookies","trackRender","renderCtx","rootComponentId","teamIds","getTeamIds","projectIds","getProjectIds","user","userAuthToken","isUserLoading","authRedirectUri","target","existingGlobalVariants","t","newGlobals","has","PlasmicQueryDataProvider","prefetchedCache","suspense","Provider","PlasmicCss","PageParamsProvider","query","setUseScopedCss","builtCss","scopedCompMetas","cssFiles","c","cssFile","cssModules","getLookup","f","getPri","a","b","localeCompare","url","join","source","buildCss","dangerouslySetInnerHTML","__html","usePlasmicRootContext","createUseGlobalVariant","rootContext","getGlobalVariants","prepComponentData","compMetas","entryCompMetas","remoteFontUrls","compPaths","allComponents","entryCompIds","q","seenIds","componentMetaById","Map","usedComps","splice","get","usedComponents","usedCompId","add","getUsedComps","subBundle","getBundleSubset","isGlobalContextProvider","g","mergeBundles","existingCompIds","newCompMetas","existingProjects","newProjects","existingModules","server","newModules","existingGlobalIds","existingExternals","external","newExternals","existingSplitIds","activeSplits","newSplits","ReactServerPlasmicComponentLoader","args","fetcher","tracker","onBundleMerged","onBundleFetched","maybeGetCompMetas","found","missing","specs","filteredMetas","maybeFetchComponentData","returnWithSpecsToFetch","_this$maybeGetCompMet2","existingMetas","missingSpecs","_args2","_parseFetchComponentD","parseFetchComponentDataArgs","specsToFetch","_context","fetchMissingData","_this$maybeGetCompMet","existingMetas2","alwaysFresh","_context2","fetchComponentData","data","_this$maybeGetCompMet3","_args3","_parseFetchComponentD2","_context3","fetchPages","maybeReportClientSideFetch","_context4","fetchAllData","comp","isPage","includeDynamicPages","fetchComponents","_context5","mkMsg","onClientSideFetch","msg","console","warn","_context7","trackFetch","mergeBundle","_this$onBundleFetched","_this$onBundleMerged","getBundle","clearCache","isArray","SUBSTITUTED_COMPONENTS","REGISTERED_CODE_COMPONENT_HELPERS","SUBSTITUTED_GLOBAL_VARIANT_HOOKS","InternalPlasmicComponentLoader","Registry","PlasmicTracker","platform","preview","reactServerLoader","PlasmicModulesFetcher","refreshRegistry","roots","registerModules","react","react-dom","ReactDOM","react/jsx-runtime","jsxRuntime","react/jsx-dev-runtime","jsxDevRuntime","@plasmicapp/query","PlasmicQuery","@plasmicapp/data-sources-context","PlasmicDataSourcesContext","@plasmicapp/host","PlasmicHost","@plasmicapp/loader-runtime-registry","globalVariantHooks","codeComponentHelpers","setGlobalVariants","some","_this2","getRegisteredModule","isEmpty","clear","register","substituteComponent","component","internalSubstituteComponent","subs","registerComponent","stateHelpers","fromEntries","entries","states","stateSpec","initFunc","onChangeArgsToValue","helpers","importPath","componentHelpers","importName","registerGlobalContext","registerTrait","trait","registerToken","token","cachedBundle","internal_getCachedBundleInNodeServer","index","indexOf","trackConversion","getActiveVariation","teamId","indirect","sub","_this3","_loop","globalGroup","updateModules","PlasmicComponentLoader","internal","_proto2","metaOrName","_getActiveVariation","traits","getKnownValue","known","includes","updateKnownValue","getExternalVariation","getExternalIds","usePlasmicComponent","stableSpec","stableSpecs","setStableSpecs","useStableLookupSpecs","useStableLookupSpec","isMounted","ref","current","useIsMounted","_asyncToGenerator","PlasmicComponentContext","PlasmicComponent","componentProps","isRootLoader","rest","Component","rootProjectId","rootComponentName","element","ReactWebRootProvider","GlobalContextsProvider","MaybeWrap","cond","wrapper","extractPlasmicQueryData","_extractPlasmicQueryData","cache","plasmicPrepass","PlasmicPrepassContext","queryCache","val","JSON","parse","stringify","_plasmicPrepass","prepass","buildPlasmicPrepassElement","GenericErrorBoundary","processReactElement","cloneElement","processPlasmicComponentProps","v","isValidElement","_React$Component","componentDidCatch","log","render","isFragment","Fragment","Children","_renderToElement","makeElement","_extractPlasmicQueryDataFromElement","_hydrateFromElement","hydrate","bundles","reduce","cur","reactRenderToString"],"mappings":"spEAOA,IAAIA,EAAW,SAAUC,GAGvB,IAAIC,EAAKC,OAAOC,UACZC,EAASH,EAAGI,eAEZC,EAA4B,mBAAXC,OAAwBA,OAAS,GAClDC,EAAiBF,EAAQG,UAAY,aACrCC,EAAsBJ,EAAQK,eAAiB,kBAC/CC,EAAoBN,EAAQO,aAAe,gBAE/C,SAASC,EAAOC,EAAKC,EAAKC,GAOxB,OANAf,OAAOgB,eAAeH,EAAKC,EAAK,CAC9BC,MAAOA,EACPE,YAAY,EACZC,cAAc,EACdC,UAAU,IAELN,EAAIC,GAEb,IAEEF,EAAO,GAAI,IACX,MAAOQ,GACPR,EAAS,SAASC,EAAKC,EAAKC,GAC1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