@plasmicapp/loader-react 1.0.205 → 1.0.206

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.
Files changed (38) hide show
  1. package/dist/index-react-server.d.ts +5 -0
  2. package/dist/index-shared.d.ts +6 -0
  3. package/dist/index.d.ts +5 -4
  4. package/dist/loader-react-server.d.ts +72 -0
  5. package/dist/loader-react.cjs.development.js +484 -426
  6. package/dist/loader-react.cjs.development.js.map +1 -1
  7. package/dist/loader-react.cjs.production.min.js +1 -1
  8. package/dist/loader-react.cjs.production.min.js.map +1 -1
  9. package/dist/loader-react.esm.js +484 -426
  10. package/dist/loader-react.esm.js.map +1 -1
  11. package/dist/loader.d.ts +8 -51
  12. package/dist/utils.d.ts +1 -0
  13. package/dist-react-server/PlasmicComponent.d.ts +19 -0
  14. package/dist-react-server/PlasmicRootProvider.d.ts +92 -0
  15. package/dist-react-server/bundles.d.ts +7 -0
  16. package/dist-react-server/component-lookup.d.ts +21 -0
  17. package/dist-react-server/global-variants.d.ts +13 -0
  18. package/dist-react-server/index-react-server.d.ts +5 -0
  19. package/dist-react-server/index-shared.d.ts +6 -0
  20. package/dist-react-server/index.d.ts +12 -0
  21. package/dist-react-server/index.js +8 -0
  22. package/dist-react-server/loader-react-server.d.ts +72 -0
  23. package/dist-react-server/loader-react.cjs.development.js +1315 -0
  24. package/dist-react-server/loader-react.cjs.development.js.map +1 -0
  25. package/dist-react-server/loader-react.cjs.production.min.js +2 -0
  26. package/dist-react-server/loader-react.cjs.production.min.js.map +1 -0
  27. package/dist-react-server/loader-react.esm.js +1306 -0
  28. package/dist-react-server/loader-react.esm.js.map +1 -0
  29. package/dist-react-server/loader.d.ts +168 -0
  30. package/dist-react-server/prepass.d.ts +43 -0
  31. package/dist-react-server/render.d.ts +27 -0
  32. package/dist-react-server/usePlasmicComponent.d.ts +15 -0
  33. package/dist-react-server/utils.d.ts +30 -0
  34. package/dist-react-server/variation.d.ts +9 -0
  35. package/index.d.ts +1 -0
  36. package/package.json +46 -9
  37. package/react-server-conditional.d.ts +4 -0
  38. package/react-server.d.ts +1 -0
@@ -1,2 +1,2 @@
1
- "use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@plasmicapp/host"),r=require("@plasmicapp/query"),n=require("@plasmicapp/loader-core"),o=require("@plasmicapp/data-sources-context"),i=require("@plasmicapp/loader-splits"),a=require("react"),u=t(a),s=t(require("react-dom")),c=require("react/jsx-dev-runtime"),l=require("react/jsx-runtime"),p=t(require("pascalcase")),f=t(require("@plasmicapp/react-ssr-prepass")),h=require("react-is"),d=require("react-dom/server");function m(t,e,r,n,o,i,a){try{var u=t[i](a),s=u.value}catch(t){return void r(t)}u.done?e(s):Promise.resolve(s).then(n,o)}function v(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){m(i,n,o,a,u,"next",t)}function u(t){m(i,n,o,a,u,"throw",t)}a(void 0)}))}}function g(){return(g=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function y(t,e){return(y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function b(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function w(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return b(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?b(t,void 0):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function x(t,e,r){if(0===e.length)return{entryCompMetas:t.components,bundle:t,remoteFontUrls:[]};var o=function(t,e){for(var r=[].concat(e),n=new Set(e),o=new Map(t.map((function(t){return[t.id,t]}))),i=[];r.length>0;){var a=r.splice(0,1),u=o.get(a[0]);u&&(i.push(u),u.usedComponents.forEach((function(t){n.has(t)||(n.add(t),r.push(t))})))}return i}(t.components,e.map((function(t){return t.id}))).map((function(t){return t.entry})),i=n.getBundleSubset(t,["entrypoint.css"].concat(o,["root-provider.js"],t.projects.map((function(t){return t.globalContextsProviderFileName})).filter((function(t){return!!t})),t.components.filter((function(t){return t.isGlobalContextProvider})).map((function(t){return t.entry})),t.globalGroups.map((function(t){return t.contextFile}))),r),a=[];return i.projects.forEach((function(t){return a.push.apply(a,t.remoteFonts.map((function(t){return t.url})))})),{entryCompMetas:e,bundle:i,remoteFontUrls:a}}function C(t,e){var r,n=new Set(t.components.map((function(t){return t.id}))),o=e.components.filter((function(t){return!n.has(t.id)}));o.length>0&&(t=g({},t,{components:[].concat(t.components,o)}));var i=new Set(t.projects.map((function(t){return t.id}))),a=e.projects.filter((function(t){return!i.has(t.id)}));a.length>0&&(t=g({},t,{projects:[].concat(t.projects,a)}));var u={browser:new Set(t.modules.browser.map((function(t){return t.fileName}))),server:new Set(t.modules.server.map((function(t){return t.fileName})))},s={browser:e.modules.browser.filter((function(t){return!u.browser.has(t.fileName)})),server:e.modules.server.filter((function(t){return!u.server.has(t.fileName)}))};(s.browser.length>0||s.server.length>0)&&(t=g({},t,{modules:{browser:[].concat(t.modules.browser,s.browser),server:[].concat(t.modules.server,s.server)}}));var c=new Set(t.globalGroups.map((function(t){return t.id}))),l=e.globalGroups.filter((function(t){return!c.has(t.id)}));l.length>0&&(t=g({},t,{globalGroups:[].concat(t.globalGroups,l)}));var p=new Set(t.external),f=t.external.filter((function(t){return!p.has(t)}));f.length>0&&(t=g({},t,{external:[].concat(t.external,f)}));var h=new Set(t.activeSplits.map((function(t){return t.id}))),d=null!=(r=e.activeSplits.filter((function(t){return!h.has(t.id)})))?r:[];return d.length>0&&(t=g({},t,{activeSplits:[].concat(t.activeSplits,d)})),t}function P(t,e){return t(e={exports:{}},e.exports),e.exports}var j=P((function(t){var e=function(t){var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var o=Object.create((e&&e.prototype instanceof p?e:p).prototype),i=new P(n||[]);return o._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=w(a,r);if(u){if(u===l)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=c(t,e,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===l)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}(t,r,i),o}function c(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var l={};function p(){}function f(){}function h(){}var d={};u(d,o,(function(){return this}));var m=Object.getPrototypeOf,v=m&&m(m(j([])));v&&v!==e&&r.call(v,o)&&(d=v);var g=h.prototype=p.prototype=Object.create(d);function y(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){var n;this._invoke=function(o,i){function a(){return new e((function(n,a){!function n(o,i,a,u){var s=c(t[o],t,i);if("throw"!==s.type){var l=s.arg,p=l.value;return p&&"object"==typeof p&&r.call(p,"__await")?e.resolve(p.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):e.resolve(p).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,u)}))}u(s.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=c(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function j(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:k}}function k(){return{value:void 0,done:!0}}return f.prototype=h,u(g,"constructor",h),u(h,"constructor",f),f.displayName=u(h,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,u(t,a,"GeneratorFunction")),t.prototype=Object.create(g),t},t.awrap=function(t){return{__await:t}},y(b.prototype),u(b.prototype,i,(function(){return this})),t.AsyncIterator=b,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new b(s(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},y(g),u(g,a,"Generator"),u(g,o,(function(){return this})),u(g,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=j,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(C),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(u&&s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),C(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;C(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:j(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}(t.exports);try{regeneratorRuntime=e}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}}));function k(){var t=a.useState(0)[1];return a.useCallback((function(){t((function(t){return t+1}))}),[])}function E(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;var r=_(t),n=_(e);return(S(r)&&S(n)&&r.name===n.name&&r.isCode===n.isCode||O(r)&&O(n)&&r.path===n.path)&&r.projectId===n.projectId}function S(t){return"name"in t}function O(t){return"path"in t}function _(t){var e,r,n="string"==typeof t?t:t.name,o="string"==typeof t?void 0:t.projectId,i="string"==typeof t?void 0:t.isCode;return!0!==i&&n.startsWith("/")?{path:(r=n,r.trim()),projectId:o}:{name:i?n:(e=n,p(e).trim()),rawName:n.trim(),projectId:o,isCode:i}}function I(t,e){var r;t=t.replace(/^\/*/,"").replace(/\/*$/,""),e=e.replace(/^\/*/,"").replace(/\/*$/,"");var n=(t.match(/\[([^\]]*)\]/g)||[]).map((function(t){return t.slice(1,-1)})),o=new RegExp("^"+t.replace(/\[[^\]]*\]/g,"([^/]+)")+"$"),i=null==(r=e.match(o))?void 0:r.slice(1);if(!i)return!1;for(var a={},u=0;u<n.length;u++)a[n[u]]=i[u];return{params:a}}function F(t,e){var r=_(e);return t.filter((function(t){return function(t,e){return!(t.projectId&&e.projectId!==t.projectId||(S(t)?t.name!==e.name&&t.rawName!==e.name&&t.rawName!==e.displayName||null!=t.isCode&&t.isCode!==e.isCode:!e.path||!I(e.path,t.path)))}(r,t)})).map((function(t){if(S(r)||!t.path)return t;var e=I(t.path,r.path);return e?g({},t,{params:e.params}):t})).sort((function(t,e){return Array.from(Object.keys(t.params||{})).length-Array.from(Object.keys(e.params||{})).length}))}function L(t){return"string"==typeof t?t:t.projectId?t.name+" (project "+t.projectId+")":t.name}function A(t){return Array.from(new Set(t))}function D(t,e){var r=F(t,e);return 0===r.length?void 0:r[0]}var G=function(){function t(t,e){this.bundle=t,this.registry=e}var e=t.prototype;return e.getComponentMeta=function(t){return D(this.bundle.components,t)},e.getComponent=function(t,e){void 0===e&&(e={});var r=D(this.bundle.components,t);if(!r)throw new Error("Component not found: "+t);var n=r.entry;if(!this.registry.hasModule(n,e))throw new Error("Component not yet fetched: "+r.name);var o=this.registry.load(n,{forceOriginal:e.forceOriginal});return e.forceOriginal||"function"!=typeof(null==o?void 0:o.getPlasmicComponent)?o.default:o.getPlasmicComponent()},e.hasComponent=function(t){var e=D(this.bundle.components,t);return!!e&&this.registry.hasModule(e.entry)},e.getGlobalContexts=function(){var t=this;return this.bundle.globalGroups.filter((function(t){return"global-user-defined"===t.type})).map((function(e){return{meta:e,context:t.registry.load(e.contextFile).default}}))},e.getGlobalContextsProvider=function(t){var e=D(this.bundle.components,t),r=e?this.bundle.projects.find((function(t){return t.id===e.projectId})):void 0;if(r&&r.globalContextsProviderFileName&&this.registry.hasModule(r.globalContextsProviderFileName)){var n=this.registry.load(r.globalContextsProviderFileName);return"function"==typeof(null==n?void 0:n.getPlasmicComponent)?n.getPlasmicComponent():n.default}},e.getRootProvider=function(){return this.registry.load("root-provider.js").default},e.getCss=function(){return this.bundle.modules.browser.filter((function(t){return"asset"===t.type&&t.fileName.endsWith("css")}))},e.getRemoteFonts=function(){return this.bundle.projects.flatMap((function(t){return t.remoteFonts}))},t}();function M(t,e){document.cookie="plasmic:"+t+"="+e}var R=function(t,e){var r=[];return Object.keys(e).map((function(n){var o=n.split(".")[1],i=e[n],a=t.find((function(t){return t.id===o||t.externalId===o}));if(a){var u=a.slices.find((function(t){return t.id===i||t.externalId===i}));u&&u.contents.map((function(t){r.push({name:t.group,value:t.variant,projectId:t.projectId})}))}})),r},N=a.createContext(void 0);function V(t){var n=t.globalVariants,o=t.prefetchedData,i=t.children,u=t.skipCss,s=t.skipFonts,c=t.prefetchedQueryData,l=t.suspenseForQueryData,p=t.globalContextsProps,f=t.variation,h=t.translator,d=t.Head,m=t.pageParams,v=t.pageQuery,g=t.loader.__internal;o&&g.registerPrefetchedBundle(null==o?void 0:o.bundle);var y=a.useState(g.getActiveSplits()),b=y[0],w=y[1],x=k(),C=a.useMemo((function(){return{onDataFetched:function(){w(g.getActiveSplits()),x()}}}),[g,x]);a.useEffect((function(){return g.subscribePlasmicRoot(C),function(){return g.unsubscribePlasmicRoot(C)}}),[C,g]),a.useEffect((function(){!function(t){void 0===t&&(t={}),Object.keys(t).map((function(e){M(e,t[e])}))}(f),g.trackRender({renderCtx:{rootComponentId:"provider",teamIds:g.getTeamIds(),projectIds:g.getProjectIds()},variation:f})}),[g,f]);var P=t.user,j=t.userAuthToken,E=t.isUserLoading,S=a.useMemo((function(){return{globalVariants:(t=null!=n?n:[],e=R(b,null!=f?f:{}),r=[].concat(t),o=new Set(t.map((function(t){var e;return t.name+"-"+(null!=(e=t.projectId)?e:"")}))),i=e.filter((function(t){var e;return!o.has(t.name+"-"+(null!=(e=t.projectId)?e:""))})),i.length>0&&(r=[].concat(r,i)),r),globalContextsProps:p,loader:g,variation:f,translator:h,Head:d,user:P,userAuthToken:j,isUserLoading:E};var t,e,r,o,i}),[n,f,p,g,b,h,d,P,j,E]);return a.createElement(r.PlasmicQueryDataProvider,{prefetchedCache:c,suspense:l},a.createElement(N.Provider,{value:S},!u&&a.createElement(T,{loader:g,prefetchedData:o,skipFonts:s}),a.createElement(e.PageParamsProvider,{params:m,query:v},i)))}var T=a.memo((function(t){var e=t.loader,r=t.prefetchedData,n=t.skipFonts,o=a.useState(!!r),i=o[1],u=function(t,e){var r=e.scopedCompMetas,n=e.skipFonts,o=r&&new Set(["entrypoint.css"].concat(r.map((function(t){return t.cssFile})))),i=t.getLookup().getCss().filter((function(t){return!o||o.has(t.fileName)})),a=function(t){return"entrypoint.css"===t?0:1};i.sort((function(t,e){return a(t.fileName)!==a(e.fileName)?a(t.fileName)-a(e.fileName):t.fileName.localeCompare(e.fileName)}));var u=t.getLookup().getRemoteFonts();return"\n "+(n?"":u.map((function(t){return"@import url('"+t.url+"');"})).join("\n"))+"\n "+i.map((function(t){return t.source})).join("\n")+"\n "}(e,{scopedCompMetas:o[0]&&r?r.bundle.components:void 0,skipFonts:n}),s=k(),c=a.useMemo((function(){return{onDataFetched:function(){i(!1),s()}}}),[e,s]);return a.useEffect((function(){return e.subscribePlasmicRoot(c),function(){return e.unsubscribePlasmicRoot(c)}}),[c,e]),a.createElement("style",{dangerouslySetInnerHTML:{__html:u}})}));function q(){return a.useContext(N)}function Q(t,e){return function(){var r,n=q();if(n){var o=[].concat(n.loader.getGlobalVariants(),null!=(r=n.globalVariants)?r:[]).find((function(r){return r.name===t&&(!r.projectId||r.projectId===e)}));return o?o.value:void 0}}}var H="undefined"!=typeof window,U=function(){function t(t){this.opts=t,this.subs=[],this.roots=[],this.globalVariants=[],this.bundle={modules:{browser:[],server:[]},components:[],globalGroups:[],external:[],projects:[],activeSplits:[]},this.substitutedComponents={},this.substitutedGlobalVariantHooks={},this.registry=n.Registry.getInstance(),this.fetcher=new n.PlasmicModulesFetcher(t),this.tracker=new n.PlasmicTracker({projectIds:t.projects.map((function(t){return t.id})),platform:t.platform,preview:t.preview}),this.registerModules({react:u,"react-dom":s,"react/jsx-runtime":l,"react/jsx-dev-runtime":c,"@plasmicapp/query":r,"@plasmicapp/data-sources-context":o,"@plasmicapp/host":e,"@plasmicapp/loader-runtime-registry":{components:this.substitutedComponents,globalVariantHooks:this.substitutedGlobalVariantHooks}})}var a=t.prototype;return a.setGlobalVariants=function(t){this.globalVariants=t},a.getGlobalVariants=function(){return this.globalVariants},a.registerModules=function(t){var e=this;if(Object.keys(t).some((function(r){return e.registry.getRegisteredModule(r)!==t[r]}))){this.registry.isEmpty()||(console.warn("Calling PlasmicComponentLoader.registerModules() after Plasmic component has rendered; starting over."),this.registry.clear());for(var r=0,n=Object.keys(t);r<n.length;r++){var o=n[r];this.registry.register(o,t[o])}}},a.substituteComponent=function(t,e){this.registry.isEmpty()||(console.warn("Calling PlasmicComponentLoader.registerSubstitution() after Plasmic component has rendered; starting over."),this.registry.clear()),this.subs.push({lookup:e,component:t})},a.registerComponent=function(t,r){var n;this.substituteComponent(t,{name:r.name,isCode:!0}),e.registerComponent(t,g({},r,{importPath:null!=(n=r.importPath)?n:""}))},a.registerGlobalContext=function(t,r){var n;this.substituteComponent(t,{name:r.name,isCode:!0}),e.registerGlobalContext(t,g({},r,{importPath:null!=(n=r.importPath)?n:""}))},a.registerTrait=function(t,r){e.registerTrait(t,r)},a.registerPrefetchedBundle=function(t){this.mergeBundle(t)},a.subscribePlasmicRoot=function(t){this.roots.push(t)},a.unsubscribePlasmicRoot=function(t){var e=this.roots.indexOf(t);e>=0&&this.roots.splice(e,1)},a.clearCache=function(){this.bundle={modules:{browser:[],server:[]},components:[],globalGroups:[],external:[],projects:[],activeSplits:[]},this.registry.clear()},a.maybeGetCompMetas=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return B(this.bundle.components,e)},a.maybeFetchComponentData=function(){var t=v(j.mark((function t(){var e,r,n,o,i,a,u,s=this,c=arguments;return j.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=Y.apply(void 0,c),r=e.specs,n=e.opts,o=function(){var t=v(j.mark((function t(e){var o,i;return j.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,s.fetchMissingData({missingSpecs:e});case 2:if(o=s.maybeGetCompMetas.apply(s,r),i=o.found,!(o.missing.length>0)){t.next=5;break}return t.abrupt("return",null);case 5:return t.abrupt("return",x(s.bundle,i,n));case 6:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),!this.opts.alwaysFresh){t.next=6;break}return t.next=5,o(r);case 5:return t.abrupt("return",t.sent);case 6:if(i=this.maybeGetCompMetas.apply(this,r),a=i.found,0!==(u=i.missing).length){t.next=9;break}return t.abrupt("return",x(this.bundle,a,n));case 9:return t.next=11,o(u);case 11:return t.abrupt("return",t.sent);case 12:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),a.fetchComponentData=function(){var t=v(j.mark((function t(){var e,r,n,o,i,a,u=arguments;return j.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=Y.apply(void 0,u),r=e.specs,n=e.opts,t.next=3,this.maybeFetchComponentData(r,n);case 3:if(o=t.sent){t.next=7;break}throw i=this.maybeGetCompMetas.apply(this,r),a=i.missing,new Error("Unable to find components "+a.map(L).join(", "));case 7:return t.abrupt("return",o);case 8:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),a.fetchPages=function(){var t=v(j.mark((function t(e){return j.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.maybeReportClientSideFetch((function(){return"Plasmic: fetching all page metadata in the browser"})),t.next=3,this.fetchAllData();case 3:return t.abrupt("return",t.sent.components.filter((function(t){return t.isPage&&t.path&&((null==e?void 0:e.includeDynamicPages)||!t.path.match(/\[[^/]*\]/))})));case 5:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),a.fetchComponents=function(){var t=v(j.mark((function t(){return j.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.maybeReportClientSideFetch((function(){return"Plasmic: fetching all component metadata in the browser"})),t.next=3,this.fetchAllData();case 3:return t.abrupt("return",t.sent.components);case 5:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),a.getLookup=function(){return new G(this.bundle,this.registry)},a.getActiveSplits=function(){return this.bundle.activeSplits},a.trackConversion=function(t){void 0===t&&(t=0),this.tracker.trackConversion(t)},a.fetchMissingData=function(){var t=v(j.mark((function t(e){return j.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.maybeReportClientSideFetch((function(){return"Plasmic: fetching missing components in the browser: "+e.missingSpecs.map((function(t){return L(t)})).join(", ")})),t.abrupt("return",this.fetchAllData());case 2:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),a.maybeReportClientSideFetch=function(t){if(H&&this.opts.onClientSideFetch){var e=t();if("warn"!==this.opts.onClientSideFetch)throw new Error(e);console.warn(e)}},a.getActiveVariation=function(){var t=v(j.mark((function t(e){return j.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.fetchAllData();case 2:return t.abrupt("return",i.getActiveVariation(g({},e,{splits:this.bundle.activeSplits})));case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),a.getTeamIds=function(){return A(this.bundle.projects.map((function(t){return t.teamId?t.teamId+(t.indirect?"@indirect":""):null})).filter((function(t){return!!t})))},a.getProjectIds=function(){return A(this.bundle.projects.map((function(t){return t.id+(t.indirect?"@indirect":"")})))},a.trackRender=function(t){this.tracker.trackRender(t)},a.fetchAllData=function(){var t=v(j.mark((function t(){var e;return j.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.ensureFetcher().fetchAllData();case 2:return e=t.sent,this.tracker.trackFetch(),this.mergeBundle(e),this.roots.forEach((function(t){return null==t.onDataFetched?void 0:t.onDataFetched()})),t.abrupt("return",e);case 7:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),a.mergeBundle=function(t){this.bundle=C(t,this.bundle),this.refreshRegistry()},a.refreshRegistry=function(){for(var t,e=this,r=function(){var r=t.value;F(e.bundle.components,r.lookup).forEach((function(t){e.substitutedComponents[t.id]=r.component}))},n=w(this.subs);!(t=n()).done;)r();for(var o,i=w(this.bundle.globalGroups);!(o=i()).done;){var a=o.value;"global-screen"!==a.type&&(this.substitutedGlobalVariantHooks[a.id]=Q(a.name,a.projectId))}this.registry.updateModules(this.bundle)},a.ensureFetcher=function(){if(!this.fetcher)throw new Error("You must first call PlasmicComponentLoader.init()");return this.fetcher},t}();function B(t,e){for(var r,n=new Set,o=[],i=w(e);!(r=i()).done;){var a=r.value,u=F(t,a);u.length>0?u.forEach((function(t){return n.add(t)})):o.push(a)}return{found:Array.from(n.keys()),missing:o}}var $=function(){function t(t){this.warnedRegisterComponent=!1,this.__internal=t}var e=t.prototype;return e.setGlobalVariants=function(t){this.__internal.setGlobalVariants(t)},e.registerModules=function(t){this.__internal.registerModules(t)},e.substituteComponent=function(t,e){this.__internal.substituteComponent(t,e)},e.registerComponent=function(t,e){e&&"object"==typeof e&&"props"in e?this.__internal.registerComponent(t,e):this.substituteComponent(t,e)},e.registerGlobalContext=function(t,e){this.__internal.registerGlobalContext(t,e)},e.registerTrait=function(t,e){this.__internal.registerTrait(t,e)},e.fetchComponentData=function(){var t=v(j.mark((function t(){var e,r=arguments;return j.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",(e=this.__internal).fetchComponentData.apply(e,r));case 1:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),e.maybeFetchComponentData=function(){var t=v(j.mark((function t(){var e,r=arguments;return j.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",(e=this.__internal).maybeFetchComponentData.apply(e,r));case 1:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),e.fetchPages=function(){var t=v(j.mark((function t(e){return j.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.__internal.fetchPages(e));case 1:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.fetchComponents=function(){var t=v(j.mark((function t(){return j.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.__internal.fetchComponents());case 1:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),e._getActiveVariation=function(){var t=v(j.mark((function t(e){return j.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.__internal.getActiveVariation(e));case 1:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.getActiveVariation=function(){var t=v(j.mark((function t(e){return j.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this._getActiveVariation({traits:e.traits,getKnownValue:function(t){return e.known?e.known[t]:Object.fromEntries(document.cookie.split("; ").filter((function(t){return t.includes("plasmic:")})).map((function(t){return t.split("=")})).map((function(t){var e=t[1];return[t[0].split(":")[1],e]})))[t]},updateKnownValue:function(t,r){e.known||M(t,r)}}));case 1:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.getExternalVariation=function(t){return i.getExternalIds(this.getActiveSplits(),t)},e.getActiveSplits=function(){return this.__internal.getActiveSplits()},e.trackConversion=function(t){void 0===t&&(t=0),this.__internal.trackConversion(t)},e.clearCache=function(){return this.__internal.clearCache()},t}();function Y(){for(var t,e,r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return Array.isArray(n[0])?(t=n[0],e=n[1]):(t=n,e=void 0),{specs:t,opts:e}}function W(t,e){void 0===e&&(e={});var r=q();if(!r)throw new Error("You can only use usePlasmicComponent if wrapped in <PlasmicRootProvider />");var n=r.loader,o=n.getLookup(),i=o.hasComponent(t)?o.getComponent(t,e):void 0,u=function(t){return function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var n=a.useState(e),o=n[0],i=n[1];return a.useEffect((function(){(e.length!==o.length||e.some((function(t,e){return!E(t,o[e])})))&&i(e)}),[e,o]),o}(t)[0]}(t),s=function(){var t=a.useRef(!1),e=a.useCallback((function(){return t.current}),[]);return a.useEffect((function(){return t.current=!0,function(){t.current=!1}}),[]),e}(),c=k();return a.useEffect((function(){i||v(j.mark((function t(){return j.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.fetchComponentData(u);case 2:s()&&c();case 3:case"end":return t.stop()}}),t)})))()}),[i,u]),i}var J=["loader","globalContextsProps","variation","userAuthToken","isUserLoading"],K=a.createContext(!1);function z(t){var e=t.component,r=t.projectId,n=t.componentProps,o=t.forceOriginal,i=q(),u=!a.useContext(K);if(!i)throw new Error("You must use <PlasmicRootProvider/> at the root of your app");var s=i.loader,c=i.globalContextsProps,l=i.variation,p=i.userAuthToken,f=i.isUserLoading,h=function(t,e){if(null==t)return{};var r,n,o={},i=Object.keys(t);for(n=0;n<i.length;n++)e.indexOf(r=i[n])>=0||(o[r]=t[r]);return o}(i,J),d=W({name:e,projectId:r,isCode:!1},{forceOriginal:o});return a.useEffect((function(){if(u){var t=s.getLookup().getComponentMeta({name:e,projectId:r});t&&s.trackRender({renderCtx:{rootProjectId:t.projectId,rootComponentId:t.id,rootComponentName:e,teamIds:s.getTeamIds(),projectIds:s.getProjectIds()},variation:l})}}),[e,r,s,l]),a.useMemo((function(){if(!d)return null;var t=a.createElement(d,Object.assign({},n));if(u){var o=s.getLookup(),i=o.getRootProvider(),l=o.getGlobalContextsProvider({name:e,projectId:r});t=a.createElement(i,Object.assign({},h,{userAuthToken:p,isUserLoading:f}),a.createElement(X,{cond:!!l,wrapper:function(t){return a.createElement(l,Object.assign({},c),t)}},a.createElement(K.Provider,{value:!0},t)))}return t}),[d,n,s,u,e,r,c,p,f])}function X(t){return t.cond?t.wrapper(t.children):t.children}function Z(t){return tt.apply(this,arguments)}function tt(){return(tt=v(j.mark((function t(e){var n,o;return j.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=new Map,t.prev=1,t.next=4,et(u.createElement(r.PlasmicPrepassContext,{cache:n},e));case 4:t.next=9;break;case 6:t.prev=6,t.t0=t.catch(1),console.warn("PLASMIC: Error encountered while pre-rendering",t.t0);case 9:return o=Object.fromEntries(Array.from(n.entries()).filter((function(t){var e=t[1];return!t[0].startsWith("$swr$")&&void 0!==e}))),t.prev=10,t.abrupt("return",JSON.parse(JSON.stringify(o,(function(t,e){return void 0!==e?e:null}))));case 14:return t.prev=14,t.t1=t.catch(10),t.abrupt("return",o);case 17:case"end":return t.stop()}}),t,null,[[1,6],[10,14]])})))).apply(this,arguments)}function et(t){return rt.apply(this,arguments)}function rt(){return(rt=v(j.mark((function t(e){return j.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,f(nt(e));case 2:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function nt(t){return u.createElement(ot,null,function t(e){return u.cloneElement(e,e.type===z?it(e.props):(r=e.props)&&"object"==typeof r?Object.fromEntries(Object.entries(r).map((function(e){var r=e[1];return[e[0],u.isValidElement(r)?t(r):r]}))):r);var r}(t))}var ot=function(t){var e,r;function n(e){return t.call(this,e)||this}r=t,(e=n).prototype=Object.create(r.prototype),e.prototype.constructor=e,y(e,r);var o=n.prototype;return o.componentDidCatch=function(t){console.log("Plasmic: Encountered error while prepass rendering:",t)},o.render=function(){return u.createElement(u.Fragment,null,this.props.children)},n}(u.Component);function it(t){return t?h.isFragment(t)?u.createElement(u.Fragment,null,u.Children.map(t.props.children,it)):u.isValidElement(t)?u.createElement(ot,null,t):Array.isArray(t)?t.map(it):(e=t)&&"object"==typeof e&&e.constructor===Object?Object.fromEntries(Object.entries(t).map((function(t){return[t[0],it(t[1])]}))):t:t;var e}function at(){return(at=v(j.mark((function t(e,r,n,o){return j.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===o&&(o={}),t.abrupt("return",new Promise((function(t){var i=ct(e,n,o);s.render(i,r,(function(){return t()}))})));case 2:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function ut(){return(ut=v(j.mark((function t(e,r,n){var o;return j.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===n&&(n={}),o=ct(e,r,n),t.abrupt("return",Z(o));case 3:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function st(){return(st=v(j.mark((function t(e,r,n,o){return j.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===o&&(o={}),t.abrupt("return",new Promise((function(t){var i=ct(e,n,o);s.hydrate(i,r,(function(){return t()}))})));case 2:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function ct(t,e,r){return void 0===r&&(r={}),u.createElement(V,{loader:t,prefetchedData:r.prefetchedData,globalVariants:r.globalVariants,prefetchedQueryData:r.prefetchedQueryData},u.createElement(z,{component:"string"==typeof e?e:e.name,projectId:"string"==typeof e?void 0:e.projectId,componentProps:r.componentProps}))}Object.defineProperty(exports,"DataCtxReader",{enumerable:!0,get:function(){return e.DataCtxReader}}),Object.defineProperty(exports,"DataProvider",{enumerable:!0,get:function(){return e.DataProvider}}),Object.defineProperty(exports,"PageParamsProvider",{enumerable:!0,get:function(){return e.PageParamsProvider}}),Object.defineProperty(exports,"PlasmicCanvasContext",{enumerable:!0,get:function(){return e.PlasmicCanvasContext}}),Object.defineProperty(exports,"PlasmicCanvasHost",{enumerable:!0,get:function(){return e.PlasmicCanvasHost}}),Object.defineProperty(exports,"repeatedElement",{enumerable:!0,get:function(){return e.repeatedElement}}),Object.defineProperty(exports,"useDataEnv",{enumerable:!0,get:function(){return e.useDataEnv}}),Object.defineProperty(exports,"usePlasmicCanvasContext",{enumerable:!0,get:function(){return e.usePlasmicCanvasContext}}),Object.defineProperty(exports,"useSelector",{enumerable:!0,get:function(){return e.useSelector}}),Object.defineProperty(exports,"useSelectors",{enumerable:!0,get:function(){return e.useSelectors}}),Object.defineProperty(exports,"usePlasmicQueryData",{enumerable:!0,get:function(){return r.usePlasmicQueryData}}),exports.InternalPlasmicComponentLoader=U,exports.PlasmicComponent=z,exports.PlasmicComponentLoader=$,exports.PlasmicRootProvider=V,exports.convertBundlesToComponentRenderData=function(t,e){return 0===t.length?null:x(t.reduce((function(t,e){return C(t,e)})),e)},exports.extractPlasmicQueryData=Z,exports.extractPlasmicQueryDataFromElement=function(t,e,r){return ut.apply(this,arguments)},exports.hydrateFromElement=function(t,e,r,n){return st.apply(this,arguments)},exports.initPlasmicLoader=function(t){var e=new U(t);return new $(e)},exports.matchesPagePath=I,exports.plasmicPrepass=et,exports.renderToElement=function(t,e,r,n){return at.apply(this,arguments)},exports.renderToString=function(t,e,r){void 0===r&&(r={});var n=ct(t,e,r);return d.renderToString(n)},exports.usePlasmicComponent=W;
1
+ 'use client';"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@plasmicapp/data-sources-context"),r=require("@plasmicapp/host"),n=require("@plasmicapp/loader-core"),o=require("@plasmicapp/loader-splits"),i=require("@plasmicapp/query"),a=require("react"),u=t(a),s=t(require("react-dom")),c=require("react/jsx-dev-runtime"),l=require("react/jsx-runtime"),p=t(require("pascalcase")),f=t(require("@plasmicapp/react-ssr-prepass")),h=require("react-is"),d=require("react-dom/server");function m(t,e,r,n,o,i,a){try{var u=t[i](a),s=u.value}catch(t){return void r(t)}u.done?e(s):Promise.resolve(s).then(n,o)}function v(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){m(i,n,o,a,u,"next",t)}function u(t){m(i,n,o,a,u,"throw",t)}a(void 0)}))}}function g(){return(g=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function y(t,e){return(y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function b(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function w(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return b(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?b(t,void 0):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function x(t,e){return t(e={exports:{}},e.exports),e.exports}var C=x((function(t){var e=function(t){var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var o=Object.create((e&&e.prototype instanceof p?e:p).prototype),i=new P(n||[]);return o._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=w(a,r);if(u){if(u===l)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=c(t,e,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===l)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}(t,r,i),o}function c(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var l={};function p(){}function f(){}function h(){}var d={};u(d,o,(function(){return this}));var m=Object.getPrototypeOf,v=m&&m(m(j([])));v&&v!==e&&r.call(v,o)&&(d=v);var g=h.prototype=p.prototype=Object.create(d);function y(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){var n;this._invoke=function(o,i){function a(){return new e((function(n,a){!function n(o,i,a,u){var s=c(t[o],t,i);if("throw"!==s.type){var l=s.arg,p=l.value;return p&&"object"==typeof p&&r.call(p,"__await")?e.resolve(p.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):e.resolve(p).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,u)}))}u(s.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=c(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function j(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:k}}function k(){return{value:void 0,done:!0}}return f.prototype=h,u(g,"constructor",h),u(h,"constructor",f),f.displayName=u(h,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,u(t,a,"GeneratorFunction")),t.prototype=Object.create(g),t},t.awrap=function(t){return{__await:t}},y(b.prototype),u(b.prototype,i,(function(){return this})),t.AsyncIterator=b,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new b(s(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},y(g),u(g,a,"Generator"),u(g,o,(function(){return this})),u(g,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=j,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(C),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(u&&s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),C(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;C(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:j(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}(t.exports);try{regeneratorRuntime=e}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}})),P="undefined"!=typeof window;function j(){var t=a.useState(0)[1];return a.useCallback((function(){t((function(t){return t+1}))}),[])}function k(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;var r=O(t),n=O(e);return(E(r)&&E(n)&&r.name===n.name&&r.isCode===n.isCode||S(r)&&S(n)&&r.path===n.path)&&r.projectId===n.projectId}function E(t){return"name"in t}function S(t){return"path"in t}function O(t){var e,r,n="string"==typeof t?t:t.name,o="string"==typeof t?void 0:t.projectId,i="string"==typeof t?void 0:t.isCode;return!0!==i&&n.startsWith("/")?{path:(r=n,r.trim()),projectId:o}:{name:i?n:(e=n,p(e).trim()),rawName:n.trim(),projectId:o,isCode:i}}function _(t,e){var r;t=t.replace(/^\/*/,"").replace(/\/*$/,""),e=e.replace(/^\/*/,"").replace(/\/*$/,"");var n=(t.match(/\[([^\]]*)\]/g)||[]).map((function(t){return t.slice(1,-1)})),o=new RegExp("^"+t.replace(/\[[^\]]*\]/g,"([^/]+)")+"$"),i=null==(r=e.match(o))?void 0:r.slice(1);if(!i)return!1;for(var a={},u=0;u<n.length;u++)a[n[u]]=i[u];return{params:a}}function L(t,e){var r=O(e);return t.filter((function(t){return function(t,e){return!(t.projectId&&e.projectId!==t.projectId||(E(t)?t.name!==e.name&&t.rawName!==e.name&&t.rawName!==e.displayName||null!=t.isCode&&t.isCode!==e.isCode:!e.path||!_(e.path,t.path)))}(r,t)})).map((function(t){if(E(r)||!t.path)return t;var e=_(t.path,r.path);return e?g({},t,{params:e.params}):t})).sort((function(t,e){return Array.from(Object.keys(t.params||{})).length-Array.from(Object.keys(e.params||{})).length}))}function I(t){return"string"==typeof t?t:t.projectId?t.name+" (project "+t.projectId+")":t.name}function F(t){return Array.from(new Set(t))}function D(t,e){var r=L(t,e);return 0===r.length?void 0:r[0]}var A=function(){function t(t,e){this.bundle=t,this.registry=e}var e=t.prototype;return e.getComponentMeta=function(t){return D(this.bundle.components,t)},e.getComponent=function(t,e){void 0===e&&(e={});var r=D(this.bundle.components,t);if(!r)throw new Error("Component not found: "+t);var n=r.entry;if(!this.registry.hasModule(n,e))throw new Error("Component not yet fetched: "+r.name);var o=this.registry.load(n,{forceOriginal:e.forceOriginal});return e.forceOriginal||"function"!=typeof(null==o?void 0:o.getPlasmicComponent)?o.default:o.getPlasmicComponent()},e.hasComponent=function(t){var e=D(this.bundle.components,t);return!!e&&this.registry.hasModule(e.entry)},e.getGlobalContexts=function(){var t=this;return this.bundle.globalGroups.filter((function(t){return"global-user-defined"===t.type})).map((function(e){return{meta:e,context:t.registry.load(e.contextFile).default}}))},e.getGlobalContextsProvider=function(t){var e=D(this.bundle.components,t),r=e?this.bundle.projects.find((function(t){return t.id===e.projectId})):void 0;if(r&&r.globalContextsProviderFileName&&this.registry.hasModule(r.globalContextsProviderFileName)){var n=this.registry.load(r.globalContextsProviderFileName);return"function"==typeof(null==n?void 0:n.getPlasmicComponent)?n.getPlasmicComponent():n.default}},e.getRootProvider=function(){return this.registry.load("root-provider.js").default},e.getCss=function(){return this.bundle.modules.browser.filter((function(t){return"asset"===t.type&&t.fileName.endsWith("css")}))},e.getRemoteFonts=function(){return this.bundle.projects.flatMap((function(t){return t.remoteFonts}))},t}();function M(t,e){document.cookie="plasmic:"+t+"="+e}var G=function(t,e){var r=[];return Object.keys(e).map((function(n){var o=n.split(".")[1],i=e[n],a=t.find((function(t){return t.id===o||t.externalId===o}));if(a){var u=a.slices.find((function(t){return t.id===i||t.externalId===i}));u&&u.contents.map((function(t){r.push({name:t.group,value:t.variant,projectId:t.projectId})}))}})),r},R=a.createContext(void 0);function N(t){var e=t.globalVariants,n=t.prefetchedData,o=t.children,u=t.skipCss,s=t.skipFonts,c=t.prefetchedQueryData,l=t.suspenseForQueryData,p=t.globalContextsProps,f=t.variation,h=t.translator,d=t.Head,m=t.pageParams,v=t.pageQuery,g=t.loader.__internal;n&&g.registerPrefetchedBundle(null==n?void 0:n.bundle);var y=a.useState(g.getActiveSplits()),b=y[0],w=y[1],x=j(),C=a.useMemo((function(){return{onDataFetched:function(){w(g.getActiveSplits()),x()}}}),[g,x]);a.useEffect((function(){return g.subscribePlasmicRoot(C),function(){return g.unsubscribePlasmicRoot(C)}}),[C,g]),a.useEffect((function(){!function(t){void 0===t&&(t={}),Object.keys(t).map((function(e){M(e,t[e])}))}(f),g.trackRender({renderCtx:{rootComponentId:"provider",teamIds:g.getTeamIds(),projectIds:g.getProjectIds()},variation:f})}),[g,f]);var P=t.user,k=t.userAuthToken,E=t.isUserLoading,S=a.useMemo((function(){return{globalVariants:(t=null!=e?e:[],r=G(b,null!=f?f:{}),n=[].concat(t),o=new Set(t.map((function(t){var e;return t.name+"-"+(null!=(e=t.projectId)?e:"")}))),i=r.filter((function(t){var e;return!o.has(t.name+"-"+(null!=(e=t.projectId)?e:""))})),i.length>0&&(n=[].concat(n,i)),n),globalContextsProps:p,loader:g,variation:f,translator:h,Head:d,user:P,userAuthToken:k,isUserLoading:E};var t,r,n,o,i}),[e,f,p,g,b,h,d,P,k,E]);return a.createElement(i.PlasmicQueryDataProvider,{prefetchedCache:c,suspense:l},a.createElement(R.Provider,{value:S},!u&&a.createElement(V,{loader:g,prefetchedData:n,skipFonts:s}),a.createElement(r.PageParamsProvider,{params:m,query:v},o)))}var V=a.memo((function(t){var e=t.loader,r=t.prefetchedData,n=t.skipFonts,o=a.useState(!!r),i=o[1],u=function(t,e){var r=e.scopedCompMetas,n=e.skipFonts,o=r&&new Set(["entrypoint.css"].concat(r.map((function(t){return t.cssFile})))),i=t.getLookup().getCss().filter((function(t){return!o||o.has(t.fileName)})),a=function(t){return"entrypoint.css"===t?0:1};i.sort((function(t,e){return a(t.fileName)!==a(e.fileName)?a(t.fileName)-a(e.fileName):t.fileName.localeCompare(e.fileName)}));var u=t.getLookup().getRemoteFonts();return"\n "+(n?"":u.map((function(t){return"@import url('"+t.url+"');"})).join("\n"))+"\n "+i.map((function(t){return t.source})).join("\n")+"\n "}(e,{scopedCompMetas:o[0]&&r?r.bundle.components:void 0,skipFonts:n}),s=j(),c=a.useMemo((function(){return{onDataFetched:function(){i(!1),s()}}}),[e,s]);return a.useEffect((function(){return e.subscribePlasmicRoot(c),function(){return e.unsubscribePlasmicRoot(c)}}),[c,e]),a.createElement("style",{dangerouslySetInnerHTML:{__html:u}})}));function B(){return a.useContext(R)}function T(t,e){return function(){var r,n=B();if(n){var o=[].concat(n.loader.getGlobalVariants(),null!=(r=n.globalVariants)?r:[]).find((function(r){return r.name===t&&(!r.projectId||r.projectId===e)}));return o?o.value:void 0}}}function q(t,e,r){if(0===e.length)return{entryCompMetas:t.components,bundle:t,remoteFontUrls:[]};var o=function(t,e){for(var r=[].concat(e),n=new Set(e),o=new Map(t.map((function(t){return[t.id,t]}))),i=[];r.length>0;){var a=r.splice(0,1),u=o.get(a[0]);u&&(i.push(u),u.usedComponents.forEach((function(t){n.has(t)||(n.add(t),r.push(t))})))}return i}(t.components,e.map((function(t){return t.id}))).map((function(t){return t.entry})),i=n.getBundleSubset(t,["entrypoint.css"].concat(o,["root-provider.js"],t.projects.map((function(t){return t.globalContextsProviderFileName})).filter((function(t){return!!t})),t.components.filter((function(t){return t.isGlobalContextProvider})).map((function(t){return t.entry})),t.globalGroups.map((function(t){return t.contextFile}))),r),a=[];return i.projects.forEach((function(t){return a.push.apply(a,t.remoteFonts.map((function(t){return t.url})))})),{entryCompMetas:e,bundle:i,remoteFontUrls:a}}function Q(t,e){var r,n=new Set(t.components.map((function(t){return t.id}))),o=e.components.filter((function(t){return!n.has(t.id)}));o.length>0&&(t=g({},t,{components:[].concat(t.components,o)}));var i=new Set(t.projects.map((function(t){return t.id}))),a=e.projects.filter((function(t){return!i.has(t.id)}));a.length>0&&(t=g({},t,{projects:[].concat(t.projects,a)}));var u={browser:new Set(t.modules.browser.map((function(t){return t.fileName}))),server:new Set(t.modules.server.map((function(t){return t.fileName})))},s={browser:e.modules.browser.filter((function(t){return!u.browser.has(t.fileName)})),server:e.modules.server.filter((function(t){return!u.server.has(t.fileName)}))};(s.browser.length>0||s.server.length>0)&&(t=g({},t,{modules:{browser:[].concat(t.modules.browser,s.browser),server:[].concat(t.modules.server,s.server)}}));var c=new Set(t.globalGroups.map((function(t){return t.id}))),l=e.globalGroups.filter((function(t){return!c.has(t.id)}));l.length>0&&(t=g({},t,{globalGroups:[].concat(t.globalGroups,l)}));var p=new Set(t.external),f=t.external.filter((function(t){return!p.has(t)}));f.length>0&&(t=g({},t,{external:[].concat(t.external,f)}));var h=new Set(t.activeSplits.map((function(t){return t.id}))),d=null!=(r=e.activeSplits.filter((function(t){return!h.has(t.id)})))?r:[];return d.length>0&&(t=g({},t,{activeSplits:[].concat(t.activeSplits,d)})),t}var U=function(){function t(t){this.bundle={modules:{browser:[],server:[]},components:[],globalGroups:[],external:[],projects:[],activeSplits:[]},this.opts=t.opts,this.fetcher=t.fetcher,this.tracker=t.tracker,this.onBundleMerged=t.onBundleMerged,this.onBundleFetched=t.onBundleFetched}var e=t.prototype;return e.maybeGetCompMetas=function(){for(var t=new Set,e=[],r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];for(var i=0,a=n;i<a.length;i++){var u=a[i],s=L(this.bundle.components,u);s.length>0?s.forEach((function(e){return t.add(e)})):e.push(u)}return{found:Array.from(t.keys()),missing:e}},e.maybeFetchComponentData=function(){var t=v(C.mark((function t(){var e,r,n,o,i,a,u,s=this,c=arguments;return C.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=H.apply(void 0,c),r=e.specs,n=e.opts,o=function(){var t=v(C.mark((function t(e){var o,i;return C.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,s.fetchMissingData({missingSpecs:e});case 2:if(o=s.maybeGetCompMetas.apply(s,r),i=o.found,!(o.missing.length>0)){t.next=5;break}return t.abrupt("return",null);case 5:return t.abrupt("return",q(s.bundle,i,n));case 6:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),!this.opts.alwaysFresh){t.next=6;break}return t.next=5,o(r);case 5:return t.abrupt("return",t.sent);case 6:if(i=this.maybeGetCompMetas.apply(this,r),a=i.found,0!==(u=i.missing).length){t.next=9;break}return t.abrupt("return",q(this.bundle,a,n));case 9:return t.next=11,o(u);case 11:return t.abrupt("return",t.sent);case 12:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),e.fetchComponentData=function(){var t=v(C.mark((function t(){var e,r,n,o,i,a,u=arguments;return C.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=H.apply(void 0,u),r=e.specs,n=e.opts,t.next=3,this.maybeFetchComponentData(r,n);case 3:if(o=t.sent){t.next=7;break}throw i=this.maybeGetCompMetas.apply(this,r),a=i.missing,new Error("Unable to find components "+a.map(I).join(", "));case 7:return t.abrupt("return",o);case 8:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),e.fetchPages=function(){var t=v(C.mark((function t(e){return C.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.maybeReportClientSideFetch((function(){return"Plasmic: fetching all page metadata in the browser"})),t.next=3,this.fetchAllData();case 3:return t.abrupt("return",t.sent.components.filter((function(t){return t.isPage&&t.path&&((null==e?void 0:e.includeDynamicPages)||!t.path.match(/\[[^/]*\]/))})));case 5:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.fetchComponents=function(){var t=v(C.mark((function t(){return C.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.maybeReportClientSideFetch((function(){return"Plasmic: fetching all component metadata in the browser"})),t.next=3,this.fetchAllData();case 3:return t.abrupt("return",t.sent.components);case 5:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),e.getActiveSplits=function(){return this.bundle.activeSplits},e.fetchMissingData=function(){var t=v(C.mark((function t(e){return C.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.maybeReportClientSideFetch((function(){return"Plasmic: fetching missing components in the browser: "+e.missingSpecs.map((function(t){return I(t)})).join(", ")})),t.abrupt("return",this.fetchAllData());case 2:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.maybeReportClientSideFetch=function(t){if(P&&this.opts.onClientSideFetch){var e=t();if("warn"!==this.opts.onClientSideFetch)throw new Error(e);console.warn(e)}},e.fetchAllData=function(){var t=v(C.mark((function t(){var e,r;return C.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.fetcher.fetchAllData();case 2:return r=t.sent,this.tracker.trackFetch(),this.mergeBundle(r),null==(e=this.onBundleFetched)||e.call(this),t.abrupt("return",r);case 7:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),e.mergeBundle=function(t){var e;this.bundle=Q(t,this.bundle),null==(e=this.onBundleMerged)||e.call(this)},e.getBundle=function(){return this.bundle},e.clearCache=function(){this.bundle={modules:{browser:[],server:[]},components:[],globalGroups:[],external:[],projects:[],activeSplits:[]}},t}();function H(){for(var t,e,r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return Array.isArray(n[0])?(t=n[0],e=n[1]):(t=n,e=void 0),{specs:t,opts:e}}var $=function(){function t(t){var o=this;this.opts=t,this.subs=[],this.roots=[],this.globalVariants=[],this.substitutedComponents={},this.substitutedGlobalVariantHooks={},this.registry=n.Registry.getInstance(),this.tracker=new n.PlasmicTracker({projectIds:t.projects.map((function(t){return t.id})),platform:t.platform,preview:t.preview}),this.reactServerLoader=new U({opts:t,fetcher:new n.PlasmicModulesFetcher(t),tracker:this.tracker,onBundleMerged:function(){o.refreshRegistry()},onBundleFetched:function(){o.roots.forEach((function(t){return null==t.onDataFetched?void 0:t.onDataFetched()}))}}),this.registerModules({react:u,"react-dom":s,"react/jsx-runtime":l,"react/jsx-dev-runtime":c,"@plasmicapp/query":i,"@plasmicapp/data-sources-context":e,"@plasmicapp/host":r,"@plasmicapp/loader-runtime-registry":{components:this.substitutedComponents,globalVariantHooks:this.substitutedGlobalVariantHooks}})}var a=t.prototype;return a.getBundle=function(){return this.reactServerLoader.getBundle()},a.setGlobalVariants=function(t){this.globalVariants=t},a.getGlobalVariants=function(){return this.globalVariants},a.registerModules=function(t){var e=this;if(Object.keys(t).some((function(r){return e.registry.getRegisteredModule(r)!==t[r]}))){this.registry.isEmpty()||(console.warn("Calling PlasmicComponentLoader.registerModules() after Plasmic component has rendered; starting over."),this.registry.clear());for(var r=0,n=Object.keys(t);r<n.length;r++){var o=n[r];this.registry.register(o,t[o])}}},a.substituteComponent=function(t,e){this.registry.isEmpty()||(console.warn("Calling PlasmicComponentLoader.registerSubstitution() after Plasmic component has rendered; starting over."),this.registry.clear()),this.subs.push({lookup:e,component:t})},a.registerComponent=function(t,e){var n;this.substituteComponent(t,{name:e.name,isCode:!0}),r.registerComponent(t,g({},e,{importPath:null!=(n=e.importPath)?n:""}))},a.registerGlobalContext=function(t,e){var n;this.substituteComponent(t,{name:e.name,isCode:!0}),r.registerGlobalContext(t,g({},e,{importPath:null!=(n=e.importPath)?n:""}))},a.registerTrait=function(t,e){r.registerTrait(t,e)},a.registerPrefetchedBundle=function(t){if(!P&&void 0!==t.localId){var e,r=null==(e=W.__PLASMIC_BUNDLES)?void 0:e[t.localId];r&&this.reactServerLoader.mergeBundle(r)}this.reactServerLoader.mergeBundle(t)},a.subscribePlasmicRoot=function(t){this.roots.push(t)},a.unsubscribePlasmicRoot=function(t){var e=this.roots.indexOf(t);e>=0&&this.roots.splice(e,1)},a.clearCache=function(){this.reactServerLoader.clearCache(),this.registry.clear()},a.getLookup=function(){return new A(this.getBundle(),this.registry)},a.maybeFetchComponentData=function(){var t;return(t=this.reactServerLoader).maybeFetchComponentData.apply(t,arguments)},a.fetchComponentData=function(){var t;return(t=this.reactServerLoader).fetchComponentData.apply(t,arguments)},a.fetchPages=function(t){return this.reactServerLoader.fetchPages(t)},a.fetchComponents=function(){return this.reactServerLoader.fetchComponents()},a.getActiveSplits=function(){return this.reactServerLoader.getActiveSplits()},a.trackConversion=function(t){void 0===t&&(t=0),this.tracker.trackConversion(t)},a.getActiveVariation=function(){var t=v(C.mark((function t(e){return C.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.reactServerLoader.fetchComponents();case 2:return t.abrupt("return",o.getActiveVariation(g({},e,{splits:this.getBundle().activeSplits})));case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),a.getTeamIds=function(){return F(this.getBundle().projects.map((function(t){return t.teamId?t.teamId+(t.indirect?"@indirect":""):null})).filter((function(t){return!!t})))},a.getProjectIds=function(){return F(this.getBundle().projects.map((function(t){return t.id+(t.indirect?"@indirect":"")})))},a.trackRender=function(t){this.tracker.trackRender(t)},a.refreshRegistry=function(){for(var t,e=this,r=function(){var r=t.value;L(e.getBundle().components,r.lookup).forEach((function(t){e.substitutedComponents[t.id]=r.component}))},n=w(this.subs);!(t=n()).done;)r();for(var o,i=w(this.getBundle().globalGroups);!(o=i()).done;){var a=o.value;"global-screen"!==a.type&&(this.substitutedGlobalVariantHooks[a.id]=T(a.name,a.projectId))}this.registry.updateModules(this.getBundle())},t}(),Y=function(){function t(t){this.warnedRegisterComponent=!1,this.__internal=t}var e=t.prototype;return e.setGlobalVariants=function(t){this.__internal.setGlobalVariants(t)},e.registerModules=function(t){this.__internal.registerModules(t)},e.substituteComponent=function(t,e){this.__internal.substituteComponent(t,e)},e.registerComponent=function(t,e){e&&"object"==typeof e&&"props"in e?this.__internal.registerComponent(t,e):this.substituteComponent(t,e)},e.registerGlobalContext=function(t,e){this.__internal.registerGlobalContext(t,e)},e.registerTrait=function(t,e){this.__internal.registerTrait(t,e)},e.fetchComponentData=function(){var t=v(C.mark((function t(){var e,r=arguments;return C.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",(e=this.__internal).fetchComponentData.apply(e,r));case 1:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),e.maybeFetchComponentData=function(){var t=v(C.mark((function t(){var e,r=arguments;return C.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",(e=this.__internal).maybeFetchComponentData.apply(e,r));case 1:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),e.fetchPages=function(){var t=v(C.mark((function t(e){return C.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.__internal.fetchPages(e));case 1:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.fetchComponents=function(){var t=v(C.mark((function t(){return C.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.__internal.fetchComponents());case 1:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),e._getActiveVariation=function(){var t=v(C.mark((function t(e){return C.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.__internal.getActiveVariation(e));case 1:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.getActiveVariation=function(){var t=v(C.mark((function t(e){return C.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this._getActiveVariation({traits:e.traits,getKnownValue:function(t){return e.known?e.known[t]:Object.fromEntries(document.cookie.split("; ").filter((function(t){return t.includes("plasmic:")})).map((function(t){return t.split("=")})).map((function(t){var e=t[1];return[t[0].split(":")[1],e]})))[t]},updateKnownValue:function(t,r){e.known||M(t,r)}}));case 1:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.getExternalVariation=function(t){return o.getExternalIds(this.getActiveSplits(),t)},e.getActiveSplits=function(){return this.__internal.getActiveSplits()},e.trackConversion=function(t){void 0===t&&(t=0),this.__internal.trackConversion(t)},e.clearCache=function(){return this.__internal.clearCache()},t}(),W=globalThis;function J(t,e){void 0===e&&(e={});var r=B();if(!r)throw new Error("You can only use usePlasmicComponent if wrapped in <PlasmicRootProvider />");var n=r.loader,o=n.getLookup(),i=o.hasComponent(t)?o.getComponent(t,e):void 0,u=function(t){return function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var n=a.useState(e),o=n[0],i=n[1];return a.useEffect((function(){(e.length!==o.length||e.some((function(t,e){return!k(t,o[e])})))&&i(e)}),[e,o]),o}(t)[0]}(t),s=function(){var t=a.useRef(!1),e=a.useCallback((function(){return t.current}),[]);return a.useEffect((function(){return t.current=!0,function(){t.current=!1}}),[]),e}(),c=j();return a.useEffect((function(){i||v(C.mark((function t(){return C.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.fetchComponentData(u);case 2:s()&&c();case 3:case"end":return t.stop()}}),t)})))()}),[i,u]),i}var K=["loader","globalContextsProps","variation","userAuthToken","isUserLoading"],z=a.createContext(!1);function X(t){var e=t.component,r=t.projectId,n=t.componentProps,o=t.forceOriginal,i=B(),u=!a.useContext(z);if(!i)throw new Error("You must use <PlasmicRootProvider/> at the root of your app");var s=i.loader,c=i.globalContextsProps,l=i.variation,p=i.userAuthToken,f=i.isUserLoading,h=function(t,e){if(null==t)return{};var r,n,o={},i=Object.keys(t);for(n=0;n<i.length;n++)e.indexOf(r=i[n])>=0||(o[r]=t[r]);return o}(i,K),d=J({name:e,projectId:r,isCode:!1},{forceOriginal:o});return a.useEffect((function(){if(u){var t=s.getLookup().getComponentMeta({name:e,projectId:r});t&&s.trackRender({renderCtx:{rootProjectId:t.projectId,rootComponentId:t.id,rootComponentName:e,teamIds:s.getTeamIds(),projectIds:s.getProjectIds()},variation:l})}}),[e,r,s,l]),a.useMemo((function(){if(!d)return null;var t=a.createElement(d,Object.assign({},n));if(u){var o=s.getLookup(),i=o.getRootProvider(),l=o.getGlobalContextsProvider({name:e,projectId:r});t=a.createElement(i,Object.assign({},h,{userAuthToken:p,isUserLoading:f}),a.createElement(Z,{cond:!!l,wrapper:function(t){return a.createElement(l,Object.assign({},c),t)}},a.createElement(z.Provider,{value:!0},t)))}return t}),[d,n,s,u,e,r,c,p,f])}function Z(t){return t.cond?t.wrapper(t.children):t.children}function tt(t){return et.apply(this,arguments)}function et(){return(et=v(C.mark((function t(e){var r,n;return C.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=new Map,t.prev=1,t.next=4,rt(u.createElement(i.PlasmicPrepassContext,{cache:r},e));case 4:t.next=9;break;case 6:t.prev=6,t.t0=t.catch(1),console.warn("PLASMIC: Error encountered while pre-rendering",t.t0);case 9:return n=Object.fromEntries(Array.from(r.entries()).filter((function(t){var e=t[1];return!t[0].startsWith("$swr$")&&void 0!==e}))),t.prev=10,t.abrupt("return",JSON.parse(JSON.stringify(n,(function(t,e){return void 0!==e?e:null}))));case 14:return t.prev=14,t.t1=t.catch(10),t.abrupt("return",n);case 17:case"end":return t.stop()}}),t,null,[[1,6],[10,14]])})))).apply(this,arguments)}function rt(t){return nt.apply(this,arguments)}function nt(){return(nt=v(C.mark((function t(e){return C.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,f(ot(e));case 2:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function ot(t){return u.createElement(it,null,function t(e){return u.cloneElement(e,e.type===X?at(e.props):(r=e.props)&&"object"==typeof r?Object.fromEntries(Object.entries(r).map((function(e){var r=e[1];return[e[0],u.isValidElement(r)?t(r):r]}))):r);var r}(t))}var it=function(t){var e,r;function n(e){return t.call(this,e)||this}r=t,(e=n).prototype=Object.create(r.prototype),e.prototype.constructor=e,y(e,r);var o=n.prototype;return o.componentDidCatch=function(t){console.log("Plasmic: Encountered error while prepass rendering:",t)},o.render=function(){return u.createElement(u.Fragment,null,this.props.children)},n}(u.Component);function at(t){return t?h.isFragment(t)?u.createElement(u.Fragment,null,u.Children.map(t.props.children,at)):u.isValidElement(t)?u.createElement(it,null,t):Array.isArray(t)?t.map(at):(e=t)&&"object"==typeof e&&e.constructor===Object?Object.fromEntries(Object.entries(t).map((function(t){return[t[0],at(t[1])]}))):t:t;var e}function ut(){return(ut=v(C.mark((function t(e,r,n,o){return C.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===o&&(o={}),t.abrupt("return",new Promise((function(t){var i=lt(e,n,o);s.render(i,r,(function(){return t()}))})));case 2:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function st(){return(st=v(C.mark((function t(e,r,n){var o;return C.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===n&&(n={}),o=lt(e,r,n),t.abrupt("return",tt(o));case 3:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function ct(){return(ct=v(C.mark((function t(e,r,n,o){return C.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===o&&(o={}),t.abrupt("return",new Promise((function(t){var i=lt(e,n,o);s.hydrate(i,r,(function(){return t()}))})));case 2:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function lt(t,e,r){return void 0===r&&(r={}),u.createElement(N,{loader:t,prefetchedData:r.prefetchedData,globalVariants:r.globalVariants,prefetchedQueryData:r.prefetchedQueryData},u.createElement(X,{component:"string"==typeof e?e:e.name,projectId:"string"==typeof e?void 0:e.projectId,componentProps:r.componentProps}))}Object.defineProperty(exports,"DataCtxReader",{enumerable:!0,get:function(){return r.DataCtxReader}}),Object.defineProperty(exports,"DataProvider",{enumerable:!0,get:function(){return r.DataProvider}}),Object.defineProperty(exports,"PageParamsProvider",{enumerable:!0,get:function(){return r.PageParamsProvider}}),Object.defineProperty(exports,"PlasmicCanvasContext",{enumerable:!0,get:function(){return r.PlasmicCanvasContext}}),Object.defineProperty(exports,"PlasmicCanvasHost",{enumerable:!0,get:function(){return r.PlasmicCanvasHost}}),Object.defineProperty(exports,"repeatedElement",{enumerable:!0,get:function(){return r.repeatedElement}}),Object.defineProperty(exports,"useDataEnv",{enumerable:!0,get:function(){return r.useDataEnv}}),Object.defineProperty(exports,"usePlasmicCanvasContext",{enumerable:!0,get:function(){return r.usePlasmicCanvasContext}}),Object.defineProperty(exports,"useSelector",{enumerable:!0,get:function(){return r.useSelector}}),Object.defineProperty(exports,"useSelectors",{enumerable:!0,get:function(){return r.useSelectors}}),Object.defineProperty(exports,"usePlasmicQueryData",{enumerable:!0,get:function(){return i.usePlasmicQueryData}}),exports.InternalPlasmicComponentLoader=$,exports.PlasmicComponent=X,exports.PlasmicComponentLoader=Y,exports.PlasmicRootProvider=N,exports.convertBundlesToComponentRenderData=function(t,e){return 0===t.length?null:q(t.reduce((function(t,e){return Q(t,e)})),e)},exports.extractPlasmicQueryData=tt,exports.extractPlasmicQueryDataFromElement=function(t,e,r){return st.apply(this,arguments)},exports.hydrateFromElement=function(t,e,r,n){return ct.apply(this,arguments)},exports.initPlasmicLoader=function(t){var e=new $(t);return new Y(e)},exports.matchesPagePath=_,exports.plasmicPrepass=rt,exports.renderToElement=function(t,e,r,n){return ut.apply(this,arguments)},exports.renderToString=function(t,e,r){void 0===r&&(r={});var n=lt(t,e,r);return d.renderToString(n)},exports.usePlasmicComponent=J;
2
2
  //# sourceMappingURL=loader-react.cjs.production.min.js.map