@plitzi/plitzi-sdk 0.38.5 → 0.38.6

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/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # @plitzi/plitzi-sdk
2
2
 
3
+ ## 0.38.6
4
+
5
+ ### Patch Changes
6
+
7
+ - 3bce653: ## Fixes
8
+
9
+ - **The dev tools draw their icons again.** The panel lives in a shadow root of its own, which the page's stylesheets
10
+ never reach, and Font Awesome moved to a sheet of its own in 0.38.5 (`plitzi-sdk-icons.css`): the badge and every tab
11
+ lost their icons. The panel now links that sheet inside its root, beside its own. Where it is served is the SDK's
12
+ new `sdkIconsStylePath` — the page server sends `/sdk-assets/plitzi-sdk-icons.css`, the same sheet the document
13
+ links — which the `iframe` and `shadow` render modes read too: they had `/plitzi-sdk-icons.css` hard-coded, a path a
14
+ page server does not serve.
15
+
16
+ - Updated dependencies [3bce653]
17
+ - @plitzi/sdk-auth@0.38.6
18
+ - @plitzi/sdk-dev-tools@0.38.6
19
+ - @plitzi/sdk-elements@0.38.6
20
+ - @plitzi/sdk-event-bridge@0.38.6
21
+ - @plitzi/sdk-interactions@0.38.6
22
+ - @plitzi/sdk-navigation@0.38.6
23
+ - @plitzi/sdk-plugins@0.38.6
24
+ - @plitzi/sdk-schema@0.38.6
25
+ - @plitzi/sdk-shared@0.38.6
26
+ - @plitzi/sdk-style@0.38.6
27
+ - @plitzi/sdk-variables@0.38.6
28
+
3
29
  ## 0.38.5
4
30
 
5
31
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -119,6 +119,9 @@ export type PlitziSdkProps = {
119
119
  overQuota?: boolean;
120
120
  externalStyle?: string;
121
121
  sdkDevToolsStylePath?: string;
122
+ /** Where Font Awesome's sheet is served, for the panels the SDK draws in a root of their own (the dev tools, the
123
+ * `iframe` and `shadow` render modes). Defaults to `/plitzi-sdk-icons.css`, beside the SDK's own stylesheet. */
124
+ sdkIconsStylePath?: string;
122
125
  /** Where this render reports SPA navigations and interactions, and with what key. Injected by a server that
123
126
  * renders the page; derived from `server` + `webKey` for a client-side render; absent means report nothing. */
124
127
  analytics?: AnalyticsConfig;
@@ -14,6 +14,7 @@ export type AppMainProps = {
14
14
  renderMode?: RenderMode;
15
15
  sdkStylePath?: string;
16
16
  sdkDevToolsStylePath?: string;
17
+ sdkIconsStylePath?: string;
17
18
  previewMode?: boolean;
18
19
  debugMode?: boolean;
19
20
  /** Set by the server that metered this render: the account behind this space is over its quota. */
@@ -33,5 +34,5 @@ export type AppMainProps = {
33
34
  onInitStateManager?: (instance: RuntimeStateInstance) => void;
34
35
  onInitEventBridge?: (instance: EventBridgeContextValue) => void;
35
36
  };
36
- declare const AppMain: ({ revision, webKey, webId, environment, currentPageId, server, isHydrating, offlineMode, offlineData, offlineDataType, instanceId, renderMode, sdkStylePath, sdkDevToolsStylePath, previewMode, debugMode, overQuota, analytics, onInitEventBridge, hostData, hostActions, flags, serverFlags, forcedFlags, onInitStateManager, ...sdkProps }: AppMainProps) => import('react').JSX.Element;
37
+ declare const AppMain: ({ revision, webKey, webId, environment, currentPageId, server, isHydrating, offlineMode, offlineData, offlineDataType, instanceId, renderMode, sdkStylePath, sdkDevToolsStylePath, sdkIconsStylePath, previewMode, debugMode, overQuota, analytics, onInitEventBridge, hostData, hostActions, flags, serverFlags, forcedFlags, onInitStateManager, ...sdkProps }: AppMainProps) => import('react').JSX.Element;
37
38
  export default AppMain;
@@ -58,7 +58,7 @@ return e.createElement(e.Fragment,null,f.map(t=>/* @__PURE__ */e.createElement("
58
58
  return e.createElement(rS,{...c,"aria-current":C,className:k,ref:u,style:A,to:o,viewTransition:s},"function"==typeof l?l(T):l)});iS.displayName="NavLink";var aS=e.forwardRef(({discover:t="render",fetcherKey:n,navigate:r,reloadDocument:i,replace:a,state:o,method:s=Dx,action:l,onSubmit:c,relative:u,preventScrollReset:d,viewTransition:p,defaultShouldRevalidate:f,...h},m)=>{let{useTransitions:g}=e.useContext(dx),y=function(){let{router:t}=oS("useSubmit"),{basename:n}=e.useContext(dx),r=_x("useRouteId"),i=t.fetch,a=t.navigate;return e.useCallback(async(e,t={})=>{let{action:o,method:s,encType:l,formData:c,body:u}=function(e,t){let n,r,i,a,o;if(Rx(s=e)&&"form"===s.tagName.toLowerCase()){let o=e.getAttribute("action");r=o?Rk(o,t):null,n=e.getAttribute("method")||Dx,i=Fx(e.getAttribute("enctype"))||zx,a=new FormData(e)}else if(function(e){return Rx(e)&&"button"===e.tagName.toLowerCase()}(e)||function(e){return Rx(e)&&"input"===e.tagName.toLowerCase()}(e)&&("submit"===e.type||"image"===e.type)){let o=e.form;if(null==o)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let s=e.getAttribute("formaction")||o.getAttribute("action");if(r=s?Rk(s,t):null,n=e.getAttribute("formmethod")||o.getAttribute("method")||Dx,i=Fx(e.getAttribute("formenctype"))||Fx(o.getAttribute("enctype"))||zx,a=new FormData(o,e),!function(){if(null===jx)try{new FormData(document.createElement("form"),0),jx=!1}catch(DO){jx=!0}return jx}()){let{name:t,type:n,value:r}=e;if("image"===n){let e=t?`${t}.`:"";a.append(`${e}x`,"0"),a.append(`${e}y`,"0")}else t&&a.append(t,r)}}else{if(Rx(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Dx,r=null,i=zx,o=e}var s;return a&&"text/plain"===i&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}(e,n);if(!1===t.navigate){let e=t.fetcherKey||lS();await i(e,r,t.action||o,{defaultShouldRevalidate:t.defaultShouldRevalidate,preventScrollReset:t.preventScrollReset,formData:c,body:u,formMethod:t.method||s,formEncType:t.encType||l,flushSync:t.flushSync})}else await a(t.action||o,{defaultShouldRevalidate:t.defaultShouldRevalidate,preventScrollReset:t.preventScrollReset,formData:c,body:u,formMethod:t.method||s,formEncType:t.encType||l,replace:t.replace,state:t.state,fromRouteId:r,flushSync:t.flushSync,viewTransition:t.viewTransition})},[i,a,n,r])}(),b=function(t,{relative:n}={}){let{basename:r}=e.useContext(dx),i=e.useContext(fx);mk(i,"useFormAction must be used inside a RouteContext");let[a]=i.matches.slice(-1),o={...kx(t||".",{relative:n})},s=yx();if(null==t){o.search=s.search;let e=new URLSearchParams(o.search),t=e.getAll("index");if(t.some(e=>""===e)){e.delete("index"),t.filter(e=>e).forEach(t=>e.append("index",t));let n=e.toString();o.search=n?`?${n}`:""}}return t&&"."!==t||!a.route.index||(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),"/"!==r&&(o.pathname="/"===o.pathname?r:Uk([r,o.pathname])),vk(o)}(l,{relative:u}),v="get"===s.toLowerCase()?"get":"post",w="string"==typeof l&&dk.test(l);/* @__PURE__ */
59
59
  return e.createElement("form",{ref:m,method:v,action:b,onSubmit:i?c:t=>{if(c&&c(t),t.defaultPrevented)return;t.preventDefault();let i=t.nativeEvent.submitter,l=i?.getAttribute("formmethod")||s,h=()=>y(i||t.currentTarget,{fetcherKey:n,method:l,navigate:r,replace:a,state:o,relative:u,preventScrollReset:d,viewTransition:p,defaultShouldRevalidate:f});g&&!1!==r?e.startTransition(()=>h()):h()},...h,"data-discover":w||"render"!==t?void 0:"true"})});function oS(t){let n=e.useContext(ox);return mk(n,function(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}(t)),n}aS.displayName="Form";var sS=0,lS=()=>`__${String(++sS)}__`;function cS({basename:t,children:n,location:r="/"}){"string"==typeof r&&(r=wk(r));let i={pathname:r.pathname||"/",search:r.search||"",hash:r.hash||"",state:null!=r.state?r.state:null,key:r.key||"default",mask:void 0},a={createHref:uS,encodeLocation:dS,push(e){throw new Error(`You cannot use navigator.push() on the server because it is a stateless environment. This error was probably triggered when you did a \`navigate(${JSON.stringify(e)})\` somewhere in your app.`)},replace(e){throw new Error(`You cannot use navigator.replace() on the server because it is a stateless environment. This error was probably triggered when you did a \`navigate(${JSON.stringify(e)}, { replace: true })\` somewhere in your app.`)},go(e){throw new Error(`You cannot use navigator.go() on the server because it is a stateless environment. This error was probably triggered when you did a \`navigate(${e})\` somewhere in your app.`)},back(){throw new Error("You cannot use navigator.back() on the server because it is a stateless environment.")},forward(){throw new Error("You cannot use navigator.forward() on the server because it is a stateless environment.")}};/* @__PURE__ */
60
60
  return e.createElement(Lx,{basename:t,children:n,location:i,navigationType:"POP",navigator:a,static:!0,useTransitions:!1})}function uS(e){return"string"==typeof e?e:vk(e)}function dS(e){let t="string"==typeof e?e:vk(e);t=t.replace(/ $/,"%20");let n=dk.test(t)?new URL(t):new URL(t,"http://localhost");return{pathname:n.pathname,search:n.search,hash:n.hash}}var pS,fS=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"],hS=()=>{const e=new URLSearchParams(window.location.search),t={};for(const n of fS){const r=e.get(n);r&&(t[n.slice(4)]=r)}return Object.keys(t).length>0?t:void 0},mS=()=>"undefined"!=typeof crypto&&"randomUUID"in crypto?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`,gS=e=>{pS=e},yS=(e,t)=>{pS?.track(e,t)},bS=({analytics:e})=>{const t=yx(),n=x(!0===e?.firstViewCounted);return g(()=>{if(!e?.endpoint||!e.key)return;const t=((e,t=20,n=5e3)=>{const r=[],i=`${e.endpoint.replace(/\/+$/,"")}/batch?k=${encodeURIComponent(e.key)}`;let a;const o=()=>{0!==r.length&&(e=>{const t=JSON.stringify({events:e});"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon&&navigator.sendBeacon(i,t)||fetch(i,{method:"POST",headers:{"Content-Type":"text/plain;charset=UTF-8"},body:t,keepalive:!0,mode:"no-cors"}).catch(()=>{})})(r.splice(0,r.length))},s=e=>{r.push(e),r.length>=t&&o()},l=()=>({path:window.location.pathname,title:document.title||void 0});return"undefined"!=typeof window&&(a=setInterval(o,n),document.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState&&o()}),window.addEventListener("pagehide",o)),{trackRender:()=>{s({id:mS(),type:"render",ts:Date.now(),page:l(),ref:{referrer:document.referrer||void 0,utm:hS()}})},track:(e,t)=>{s({id:mS(),type:"interaction",ts:Date.now(),page:l(),name:e,props:t})},flush:o,stop:()=>{a&&(clearInterval(a),a=void 0),o()}}})(e);return gS(t),()=>{gS(void 0),t.stop()}},[e]),g(()=>{n.current?n.current=!1:pS?.trackRender()},[t.pathname,t.search]),null},vS=W("AuthContext",{}),wS=({server:e,routerLocation:t})=>{let n=k(()=>typeof window<"u"?window.location:sr(e,"location",{pathname:"/"}),[e]),r=k(()=>{if(!t)return n;let{origin:e,host:r,hostname:i,protocol:a,href:o}=n,{pathname:s,search:l}=t;return{origin:e,host:r,hostname:i,protocol:a,pathname:s,search:l,hash:"",href:e?`${e}${s}${l}`:o}},[n,t]),i=k(()=>function(e){!e&&typeof window<"u"&&(e=window.location.search);let t={};if(!e||0===e.length)return t;let n=e.replace("?","").split("&");for(let r=0;r<n.length;r++){let e=n[r].split("="),i=decodeURIComponent(e[0]),a=decodeURIComponent(e[1]);void 0===t[i]?t[i]=decodeURIComponent(a):"string"==typeof t[i]?t[i]=[t[i],decodeURIComponent(a)]:t[i].push(decodeURIComponent(a))}return t}(r.search),[r.search]),a=k(()=>r.hostname?r.hostname:"localhost",[r.hostname]),o=r.origin||"";return k(()=>({queryParams:i,hostname:a,origin:o,location:r}),[i,a,o,r])},kS=({authenticated:e,user:t})=>{let n=t?.details,r={authenticated:!0===e};return n?{...r,email:n.email,username:n.username,roles:n.roles}:r},xS=["wheel","touchmove","keydown","pointerdown"],SS=e=>{const t=document.getElementById(e);return t?.scrollIntoView({block:"start"}),null!==t},TS=({children:e,currentPageId:t})=>{const{server:n}=f(Lc),r=Nt(),{renderMode:i,previewMode:a,environment:o}=X(),[[s,l,c,u,d]]=zt(["schema.pageFolders","pageDefinitions","schema.variables","schema.flags","flags.overrides"]),p=n.ssr?.renderResult,m="widget"!==i?yx():void 0,{queryParams:y,hostname:b,origin:v,location:w}=wS({server:n,routerLocation:m}),S=x(l);S.current=l;const T=x(s);T.current=s;const{authenticated:C,user:A}=f(vS),E="widget"!==i?wx():void 0,O=x(E);g(()=>{O.current=E},[E]);const N=k(()=>lu(l,s,C,n.basePath,a),[l,s,C,n.basePath,a]),{action:M,pageId:P="",pathMatch:L}=k(()=>"widget"===i?{action:{type:"normal",path:""},pageId:t}:cu(N,w.pathname,C),[N,w.pathname,C,i,t]),D=t||P;(({hash:e,navigationKey:t,enabled:n})=>{g(()=>{const t=(e=>{const t=e.replace(/^#/,"");try{return decodeURIComponent(t)}catch{return t}})(e);if(!n||!t||"undefined"==typeof document||SS(t))return;const r=new AbortController,i=new MutationObserver(()=>{SS(t)&&r.abort()}),a=setTimeout(()=>r.abort(),3e3);return r.signal.addEventListener("abort",()=>{i.disconnect(),clearTimeout(a)}),i.observe(document.body,{childList:!0,subtree:!0}),xS.forEach(e=>window.addEventListener(e,()=>r.abort(),{once:!0,passive:!0,signal:r.signal})),()=>r.abort()},[e,t,n])})({hash:m?.hash??"",navigationKey:m?.key,enabled:a&&"widget"!==i}),g(()=>{Vl.info("navigation",/* @__PURE__ */_("span",{children:["Navigated to page"," ",
61
- /* @__PURE__ */I("b",{children:sr(l,`${D}.attributes.name`,D||"Unknown")})]}),{status:M.type,elementId:D})},[M.type,D,l]);const z=h(e=>ou(S.current,T.current,e),[]),R=x(0),j=h((e,t=!1)=>{if(t&&"undefined"!=typeof window)return void(window.location.href=e);const n=z(e),i=++R.current;if(!r.get("rsc.enabled"))return r.set("navigation.pendingLocation",""),void O.current?.(n);r.set("navigation.pendingLocation",n);const a=vu(r,void 0,void 0,n).finally(()=>{R.current===i&&r.set("navigation.pendingLocation","")}),o=()=>{R.current===i&&O.current?.(n)};Promise.race([a,new Promise(e=>setTimeout(e,1500))]).then(o,o)},[z,r]),$=k(()=>{const e=N.find(e=>e.pageId===D&&!e.isRaw);return e?{...uu(e.path).reduce((e,t)=>({...e,[t]:""}),{}),...sr(L,"params",{})}:sr(L,"params",{})},[N,L,D]),F=oc($),q=oc(y),B=k(()=>new URLSearchParams(w.search),[w.search]),U=v?`${v}${w.pathname}${w.search}`:"";Rt(["navigation.urlSearchParams","navigation.routeParams","navigation.queryParams","navigation.hostname","navigation.origin","navigation.href","navigation.currentPageId","navigation.navigate"],[B,F,q,b,v,U,D,j],{raw:!0});const H=Object.hasOwn(l,D)?l[D].definition.flag:void 0,W=void 0!==H&&!ac(H,ic(rc(u,{environment:o,hostname:b,routeParams:F,queryParams:q,user:kS({authenticated:C,user:A})},d)));if("notFound"===M.type||W)return p&&(p.status=404),"Not Found";if("accessDenied"===M.type)return p&&(p.status=403),"Access Denied";if("redirect"===M.type){const e=Bl(c,{queryParams:y,routeParams:F,hostname:b,environment:o}),t=M.path?String(Fn(M.path,{variables:e},!1,!0)):"";if(t&&tu(t)){const e=new URL(t);return e.searchParams.has("redirect")||e.searchParams.set("redirect",(e=>e.href?e.href:`${e.protocol||"https:"}//${e.host||e.hostname}${e.pathname}${e.search}`)(w)),p?(p.redirect=e.toString(),null):(window.location.assign(e.toString()),null)}return p?(p.redirect=M.path??"",null):/* @__PURE__ */I(Px,{to:M.path??"",replace:!0})}return e},CS=(e,{src:t,type:n,isMain:r},i=!1)=>{let a,o=`${e}/${t}`,s=btoa(o);return a="style"===n&&o.endsWith(".css")?{type:"link",id:s,params:{href:o,rel:"stylesheet",type:"text/css"},isMain:r}:{type:"script",id:s,params:{src:o,type:"text/javascript"},isMain:r},i&&delete a.isMain,a},AS=(e,t)=>{try{let{resource:n,settings:r,type:i}=e,{definition:{name:a="Plitzi's Demo Plugin",owner:o="Plitzi",verified:s=!1,license:l="MIT",website:c="https://plitzi.com",backgroundColor:u="#4422ee",icon:d="https://cdn.plitzi.com/resources/img/favicon.svg"},assets:p,assetsSettings:f,pluginSchema:h}=t;return Object.values(sr(t,"pluginSchema",{})).reduce((e,m)=>{let{definition:g,builder:y,defaultStyle:b,attributes:v}=m,w=[];return g.type===i&&(w=Object.keys(hr(h,[i]))),{...e,[g.type]:{attributes:v,builder:y,defaultStyle:b,definition:g,market:{owner:o,verified:s,license:l,website:c,backgroundColor:u,icon:d,category:a},resource:n,isMain:g.type===i,manifest:t,type:i,settings:r,assetsSettings:Object.values(f).filter(({src:e})=>!!e&&[".css",".js",".mjs",".cjs"].some(t=>e.endsWith(t))).map(e=>CS(n,e,!0)),assets:Object.values(p).filter(({src:e})=>!!e&&[".css",".js",".mjs",".cjs"].some(t=>e.endsWith(t))).map(e=>CS(n,e)),subPlugins:w}}},{})}catch{return{}}},ES=async(e=[])=>{let t={};if(!Array.isArray(e))return t;let n=await(async e=>{if(!Array.isArray(e)||0===e.length)return{};let t=e.map(e=>(async e=>{try{let t=await fetch(e,{headers:{Accept:"application/json"}});return t.ok?await t.json():void 0}catch{return}})(e));return(await Promise.allSettled(t)).reduce((e,t)=>"fulfilled"===t.status&&t.value?{...e,[sr(t.value,"root","")]:t.value}:e,{})})(e.filter(e=>e.resource).reduce((e,t)=>[...e,`${t.resource}/plugin-manifest.json`],[]));return e.forEach(e=>{let{type:r}=e,i=sr(n,r);t={...t,...AS(e,i)}}),t},IS=class extends Error{failure;statusCode;constructor(e,t,n){super(e),this.name="GraphqlRequestError",this.failure=t,this.statusCode=n}},_S=({children:e,server:t,revision:n,webKey:r="",webId:i,userKey:a="",instanceId:o,offlineMode:s=!1,offlineData:l,offlineDataType:c="json"})=>{const{environment:u,debugMode:d}=X(),p=$t(),m=s&&!!l&&!!l.schema,y=k(()=>((e,t)=>({request:async(n,r)=>{let i;try{i=await fetch(e,{method:"POST",headers:{accept:"application/graphql-response+json, application/json;q=0.9","content-type":"application/json","sdk-version":"0.38.5",authorization:t?`Bearer ${t}`:""},body:JSON.stringify({query:n,variables:r})})}catch(DO){throw new IS(DO instanceof Error?DO.message:"Network request failed","network")}const a=(e=>{try{return JSON.parse(e)}catch{return}})(await i.text());if(!i.ok){const t=ti(i.status,a);throw t&&Qr({reason:t,url:e}),new IS(`Response not successful: Received status code ${i.status}`,"http",i.status)}const o=(e=>{const t=nr(e)?e.errors:void 0;return Array.isArray(t)?t.map(e=>nr(e)&&"string"==typeof e.message?e.message:"Unknown error"):[]})(a);if(o.length)throw new IS(o.join("\n"),"graphql",i.status);if(!nr(a)||!nr(a.data))throw new IS("The server answered without data","graphql",i.status);return a.data}}))(t.serverUrl,r),[t.serverUrl,r]),[b,v]=S(!(s&&l)),[w,x]=S(void 0),{components:T}=f(Fr),[C,A]=S(()=>m&&"json"===c?{...l,plugins:{}}:{plugins:{}}),E=h(async(e,t)=>{try{return{success:!0,result:await y.request(Fc[e],{environment:u,...t})}}catch(DO){return{success:!1,result:void 0,error:DO instanceof Error?DO:String(DO)}}},[y,u]),O=h(async(e,t,n=!0)=>{const r=$c[e];if(!r)return{success:!1,result:void 0,error:"Mutation Not Found"};try{return{success:!0,result:await y.request(r,n?{environment:u,...t}:t)}}catch(DO){return{success:!1,result:void 0,error:DO instanceof Error?DO:String(DO)}}},[y,u]),N=async()=>{let e=n;"number"==typeof n&&0!==n||(e=void 0);const t=await E("Init",{environment:u,revision:e});if(t.error)return v(!1),void x((e=>e instanceof IS?401===e.statusCode?"Access not authorized":"network"===e.failure?"Service not available":e.message:"string"==typeof e?e:e.message)(t.error));if(t.success&&t.result){const{Space:e}=ur(t.result);if(!e)return x(/* @__PURE__ */_("span",{children:["Space not found, publish to ",
61
+ /* @__PURE__ */I("b",{children:sr(l,`${D}.attributes.name`,D||"Unknown")})]}),{status:M.type,elementId:D})},[M.type,D,l]);const z=h(e=>ou(S.current,T.current,e),[]),R=x(0),j=h((e,t=!1)=>{if(t&&"undefined"!=typeof window)return void(window.location.href=e);const n=z(e),i=++R.current;if(!r.get("rsc.enabled"))return r.set("navigation.pendingLocation",""),void O.current?.(n);r.set("navigation.pendingLocation",n);const a=vu(r,void 0,void 0,n).finally(()=>{R.current===i&&r.set("navigation.pendingLocation","")}),o=()=>{R.current===i&&O.current?.(n)};Promise.race([a,new Promise(e=>setTimeout(e,1500))]).then(o,o)},[z,r]),$=k(()=>{const e=N.find(e=>e.pageId===D&&!e.isRaw);return e?{...uu(e.path).reduce((e,t)=>({...e,[t]:""}),{}),...sr(L,"params",{})}:sr(L,"params",{})},[N,L,D]),F=oc($),q=oc(y),B=k(()=>new URLSearchParams(w.search),[w.search]),U=v?`${v}${w.pathname}${w.search}`:"";Rt(["navigation.urlSearchParams","navigation.routeParams","navigation.queryParams","navigation.hostname","navigation.origin","navigation.href","navigation.currentPageId","navigation.navigate"],[B,F,q,b,v,U,D,j],{raw:!0});const H=Object.hasOwn(l,D)?l[D].definition.flag:void 0,W=void 0!==H&&!ac(H,ic(rc(u,{environment:o,hostname:b,routeParams:F,queryParams:q,user:kS({authenticated:C,user:A})},d)));if("notFound"===M.type||W)return p&&(p.status=404),"Not Found";if("accessDenied"===M.type)return p&&(p.status=403),"Access Denied";if("redirect"===M.type){const e=Bl(c,{queryParams:y,routeParams:F,hostname:b,environment:o}),t=M.path?String(Fn(M.path,{variables:e},!1,!0)):"";if(t&&tu(t)){const e=new URL(t);return e.searchParams.has("redirect")||e.searchParams.set("redirect",(e=>e.href?e.href:`${e.protocol||"https:"}//${e.host||e.hostname}${e.pathname}${e.search}`)(w)),p?(p.redirect=e.toString(),null):(window.location.assign(e.toString()),null)}return p?(p.redirect=M.path??"",null):/* @__PURE__ */I(Px,{to:M.path??"",replace:!0})}return e},CS=(e,{src:t,type:n,isMain:r},i=!1)=>{let a,o=`${e}/${t}`,s=btoa(o);return a="style"===n&&o.endsWith(".css")?{type:"link",id:s,params:{href:o,rel:"stylesheet",type:"text/css"},isMain:r}:{type:"script",id:s,params:{src:o,type:"text/javascript"},isMain:r},i&&delete a.isMain,a},AS=(e,t)=>{try{let{resource:n,settings:r,type:i}=e,{definition:{name:a="Plitzi's Demo Plugin",owner:o="Plitzi",verified:s=!1,license:l="MIT",website:c="https://plitzi.com",backgroundColor:u="#4422ee",icon:d="https://cdn.plitzi.com/resources/img/favicon.svg"},assets:p,assetsSettings:f,pluginSchema:h}=t;return Object.values(sr(t,"pluginSchema",{})).reduce((e,m)=>{let{definition:g,builder:y,defaultStyle:b,attributes:v}=m,w=[];return g.type===i&&(w=Object.keys(hr(h,[i]))),{...e,[g.type]:{attributes:v,builder:y,defaultStyle:b,definition:g,market:{owner:o,verified:s,license:l,website:c,backgroundColor:u,icon:d,category:a},resource:n,isMain:g.type===i,manifest:t,type:i,settings:r,assetsSettings:Object.values(f).filter(({src:e})=>!!e&&[".css",".js",".mjs",".cjs"].some(t=>e.endsWith(t))).map(e=>CS(n,e,!0)),assets:Object.values(p).filter(({src:e})=>!!e&&[".css",".js",".mjs",".cjs"].some(t=>e.endsWith(t))).map(e=>CS(n,e)),subPlugins:w}}},{})}catch{return{}}},ES=async(e=[])=>{let t={};if(!Array.isArray(e))return t;let n=await(async e=>{if(!Array.isArray(e)||0===e.length)return{};let t=e.map(e=>(async e=>{try{let t=await fetch(e,{headers:{Accept:"application/json"}});return t.ok?await t.json():void 0}catch{return}})(e));return(await Promise.allSettled(t)).reduce((e,t)=>"fulfilled"===t.status&&t.value?{...e,[sr(t.value,"root","")]:t.value}:e,{})})(e.filter(e=>e.resource).reduce((e,t)=>[...e,`${t.resource}/plugin-manifest.json`],[]));return e.forEach(e=>{let{type:r}=e,i=sr(n,r);t={...t,...AS(e,i)}}),t},IS=class extends Error{failure;statusCode;constructor(e,t,n){super(e),this.name="GraphqlRequestError",this.failure=t,this.statusCode=n}},_S=({children:e,server:t,revision:n,webKey:r="",webId:i,userKey:a="",instanceId:o,offlineMode:s=!1,offlineData:l,offlineDataType:c="json"})=>{const{environment:u,debugMode:d}=X(),p=$t(),m=s&&!!l&&!!l.schema,y=k(()=>((e,t)=>({request:async(n,r)=>{let i;try{i=await fetch(e,{method:"POST",headers:{accept:"application/graphql-response+json, application/json;q=0.9","content-type":"application/json","sdk-version":"0.38.6",authorization:t?`Bearer ${t}`:""},body:JSON.stringify({query:n,variables:r})})}catch(DO){throw new IS(DO instanceof Error?DO.message:"Network request failed","network")}const a=(e=>{try{return JSON.parse(e)}catch{return}})(await i.text());if(!i.ok){const t=ti(i.status,a);throw t&&Qr({reason:t,url:e}),new IS(`Response not successful: Received status code ${i.status}`,"http",i.status)}const o=(e=>{const t=nr(e)?e.errors:void 0;return Array.isArray(t)?t.map(e=>nr(e)&&"string"==typeof e.message?e.message:"Unknown error"):[]})(a);if(o.length)throw new IS(o.join("\n"),"graphql",i.status);if(!nr(a)||!nr(a.data))throw new IS("The server answered without data","graphql",i.status);return a.data}}))(t.serverUrl,r),[t.serverUrl,r]),[b,v]=S(!(s&&l)),[w,x]=S(void 0),{components:T}=f(Fr),[C,A]=S(()=>m&&"json"===c?{...l,plugins:{}}:{plugins:{}}),E=h(async(e,t)=>{try{return{success:!0,result:await y.request(Fc[e],{environment:u,...t})}}catch(DO){return{success:!1,result:void 0,error:DO instanceof Error?DO:String(DO)}}},[y,u]),O=h(async(e,t,n=!0)=>{const r=$c[e];if(!r)return{success:!1,result:void 0,error:"Mutation Not Found"};try{return{success:!0,result:await y.request(r,n?{environment:u,...t}:t)}}catch(DO){return{success:!1,result:void 0,error:DO instanceof Error?DO:String(DO)}}},[y,u]),N=async()=>{let e=n;"number"==typeof n&&0!==n||(e=void 0);const t=await E("Init",{environment:u,revision:e});if(t.error)return v(!1),void x((e=>e instanceof IS?401===e.statusCode?"Access not authorized":"network"===e.failure?"Service not available":e.message:"string"==typeof e?e:e.message)(t.error));if(t.success&&t.result){const{Space:e}=ur(t.result);if(!e)return x(/* @__PURE__ */_("span",{children:["Space not found, publish to ",
62
62
  /* @__PURE__ */I("b",{children:u})," environment"]})),void v(!1);let n={};e.plugins.length>0&&(n=await ES(e.plugins.filter(e=>!T.current[e.type]))),p("render.overQuota",e.render?.overQuota??!1),A({schema:{...Nc,...jc(e.schema)},plugins:n,style:e.style})}v(!1)};g(()=>{s&&l?m&&(async()=>{let e={};l?.plugins&&l.plugins.length>0&&(e=await ES(l.plugins.filter(e=>!T.current[e.type]))),A(t=>({...t,plugins:e})),v(!1)})():(v(e=>e||!0),N())},[m,s&&c,r,u,d]);const M=k(()=>({query:E,mutate:O,webKey:r,webId:i,server:t,environment:u,instanceId:o,userKey:a}),[E,O,r,i,t,u,o,a]);return w?/* @__PURE__ */I("div",{children:w}):b?null:/* @__PURE__ */I(Lc,{value:M,children:/* @__PURE__ */I(Dc,{value:C,children:e})})},OS=W("PluginsContext",{assets:{}}),NS=({children:e,plugins:t,sdkStylePath:n="./plitzi-sdk.css",sdkIconsPath:r="./plitzi-sdk-icons.css"})=>{const{renderMode:i}=X(),[a,o]=S({}),s=f(Dc),l=k(()=>t||s.plugins,[t,s]),{components:c}=f(Fr),u=h((e,t,n="")=>t?sr(l,`${e}.settings.${t}`,n):sr(l,`${e}.settings`,{}),[l]),d=h((e=[])=>{const t=e.reduce((e,t)=>{let n="";return n="script"===t.type?t.params.src:t.params.href,n?(n=btoa(n),{...e,[n]:{...t,key:n}}):e},{});0!==Object.keys(t).length&&o(e=>({...e,...t}))},[]),p=h((e=[])=>{const t=e.filter(e=>!function(e){return null==e||"number"!=typeof e&&"boolean"!=typeof e&&"function"!=typeof e&&"symbol"!=typeof e&&("string"==typeof e||Array.isArray(e)?0===e.length:e instanceof Map||e instanceof Set?0===e.size:"object"==typeof e&&0===Object.keys(e).length)}(e)).map(e=>btoa(e));o(e=>hr(e,t))},[]),m=k(()=>(e=>Object.values(e).reduce((e,t)=>({...e,...sr(t,"assets",[]).filter(e=>"link"===e.type).reduce((e,t)=>({...e,[btoa(t.id)]:t}),{})}),{}))(l),[l]),g=k(()=>Object.keys(c.current).filter(e=>"local-custom"===c.current[e].origin).reduce((e,t)=>({...e,...sr(c,`${t}.assets`,[]).reduce((e,n,r)=>({...e,[`${t}-${r}`]:{type:"link",id:`${t}-${r}`,params:n}}),{})}),{}),[c.current]),y=k(()=>{const e={};return"iframe"!==i&&"shadow"!==i||(e["static-99"]={type:"link",id:"static-99",params:{type:"text/css",href:n,rel:"stylesheet"}},e["static-100"]={type:"link",id:"static-100",params:{type:"text/css",href:r,rel:"stylesheet"}}),{...e,...g,...m,...a}},[g,m,a,i,n,r]),b=k(()=>({assets:y,getSettings:u,plugins:l,registerCustomAssets:d,unregisterCustomAssets:p}),[y,u,l,d,p]),v=k(()=>Object.values({...m,...a}).map((e,t)=>/* @__PURE__ */I(e.type,{...e.params},t)),[m,a]);/* @__PURE__ */
63
63
  return _(E,{children:[/* @__PURE__ */I(qp,{children:("raw"===i||"widget"===i)&&v}),/* @__PURE__ */I(OS,{value:b,children:e})]})},MS=({children:e,schema:t})=>{const n=f(Dc),r=k(()=>({...Nc,...t||n.schema}),[t,n.schema]);Rt("schema",r);const i=k(()=>cr(sr(r,"flat",{}),sr(r,"pages",[])),[r.pages]);return Rt("pageDefinitions",i),e},PS=l({});PS.displayName="ContainerRootContext";var LS=({className:e="",children:t,...n})=>{let r=x(null),i=h(()=>r.current instanceof HTMLElement?r.current.getRootNode():void 0,[r]),a=h(()=>i()instanceof ShadowRoot,[i]),o=k(()=>({getHost:i,rootRef:r,isRootShadow:a}),[i,r,a]);/* @__PURE__ */
64
64
  return I("div",{...n,ref:r,className:e,children:/* @__PURE__ */I(PS,{value:o,children:t})})},DS=W("InteractionsContext",{}),zS=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/,RS=/^rgba?\(\s*(\d{1,3}%?\s*,\s*){2,3}\d{1,3}%?\s*\)$/,jS=/^hsla?\(\s*\d{1,3}(deg|rad|turn)?\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%(\s*,\s*(0|0?\.\d+|1))?\s*\)$/,$S=/* @__PURE__ */new Set(["black","white","red","green","blue","yellow","cyan","magenta","orange","purple","brown","pink","gray","lime","teal","navy","silver","maroon","olive","aqua","fuchsia"]),FS=({children:e,contentDidMount:t,contentDidDismount:n})=>(g(()=>(t?.(),()=>{n?.()}),[]),e),qS=({ref:e,className:t="",ssrMode:r=!1,id:i="",css:a="",style:o,zoom:s=1,assets:l,viewport:c="width=device-width, initial-scale=1",children:u,contentDidMount:d,contentDidDismount:p,contentDidUpdate:f,onLoad:m})=>{t=hs("ContainerFrame",{className:t,componentKey:"root"});let y=x(null);v(e,()=>y.current,[y]);let[b,w]=S(!1),[k,T]=S(null),C=h((e,t,n)=>{let r=[...t.childNodes],i=n.getElementById("customStyle");Object.values(e).forEach(e=>{let a=n.createElement(e.type);e.id&&a.setAttribute("data-id",e.id),Object.keys(e.params).forEach(t=>{("link"===e.type||"script"===e.type)&&a.setAttribute(t,e.params[t])}),r.find(t=>"link"===e.type&&t.href===a.href||"script"===e.type&&t.src===a.src)||(t.insertBefore(a,i),r.push(a))})},[]),A=h((e,t)=>{let{head:n}=e,r=n.querySelectorAll('*:not([asset-static="true"])');Object.values(r).forEach(e=>{n.removeChild(e)}),t&&C(t,n,e)},[C]),[N]=S(()=>(e=>{if(!e)return"";let t=[];return Object.values(e).forEach(e=>{t.push(`<${e.type} ${Object.keys(e.params).map(t=>`${t}="${e.params[t]}"`).join(" ")}>`)}),t.join("")})(l)),M=h(()=>d?.(),[d]);g(()=>{b&&k&&A(k,l)},[b,l,k,A]);let P=h(()=>{let e=y.current&&k,t=y.current?.contentDocument===k;!e||t?b||(m?.(y.current),w(!0),T(y.current?.contentDocument)):T(y.current?.contentDocument)},[b,k,m]);return g(()=>{k&&(k.body.style.zoom=1===s?"":`${s}`)},[k,s]),/* @__PURE__ */_("iframe",{ref:y,className:t,title:"#",srcDoc:`<!DOCTYPE html><html><head>${N}</head><body></body></html>`,id:i,onLoad:P,style:o,children:[b&&k&&O(/* @__PURE__ */_(E,{children:[
@@ -128,8 +128,9 @@ return _(hI,{children:[o.map((e,t)=>/* @__PURE__ */I(hI.Link,{href:e.params.href
128
128
  /* @__PURE__ */I(oI,{})]})})]})}),gI=e=>{},yI=({head:e})=>((e=>{g(()=>{if(typeof document>"u")return;let{head:t}=document,n=[];if(e.preconnect.forEach(e=>{if(t.querySelector(`link[rel="preconnect"][href="${CSS.escape(e.href)}"]`))return;let r=document.createElement("link");r.rel="preconnect",r.href=e.href,e.crossorigin&&(r.crossOrigin=""),t.appendChild(r),n.push(r)}),e.links.forEach(e=>{if(t.querySelector(`link[rel="${e.rel}"][href="${CSS.escape(e.href)}"]`))return;let r=document.createElement("link");r.rel=e.rel,r.href=e.href,e.as&&(r.as=e.as),e.type&&(r.type=e.type),e.crossorigin&&(r.crossOrigin=""),t.appendChild(r),n.push(r)}),e.faces&&!t.querySelector(`style[${sc}]`)){let r=document.createElement("style");r.setAttribute(sc,""),r.textContent=e.faces,t.appendChild(r),n.push(r)}return()=>n.forEach(e=>e.remove())},[e])})(e),null),bI=[],vI=({externalStyle:e="",sdkStylePath:t="./plitzi-sdk.css",server:n})=>{const{resolvedTheme:r}=eu(),{assets:i}=f(OS),a=x(null),{rootRef:o}=f(PS),[[s,l,c,u=qr,d=bI]]=zt(["schema.settings","style.cache","navigation.currentPageId","runtime.sources.variables","style.fonts"]),{renderMode:p,previewMode:m,debugMode:y,environment:v,isHydrating:w}=X();(e=>{let t=Nt(),n=b(),[r]=Mt("schema.rsc",{mode:"mount"}),[i]=Mt(["navigation.routeParams","navigation.queryParams","navigation.currentPageId","navigation.href"]),a=JSON.stringify(i),{rscData:o,rscPath:s}=e??{},l=(r?.enabled??!1)&&!!s;Pt(["rsc.enabled","rsc.endpoint","rsc.instance"],[l,s,n]),Pt(["rsc.data","rsc.loaded","rsc.location"],[o?.serverData??{},void 0!==o,pu()],{mode:"mount"}),g(()=>()=>(e=>{hu.get(e)?.inFlight.forEach(e=>e.controller.abort()),hu.delete(e)})(n),[n]),g(()=>{!l||t.get("rsc.loaded")&&t.get("rsc.location")===pu()&&!t.get("rsc.stale")||vu(t)},[l,a,t])})(n?.ssr),(e=>{Pt(["actions.endpoint"],[e?.actionPath])})(n?.ssr),(e=>{Pt(["realtime.endpoint","realtime.transport"],[e?.realtimePath,e?.realtimeTransport])})(n?.ssr),(e=>{Pt(["images.endpoint"],[e?.imagePath])})(n?.ssr);const S=k(()=>((e,t)=>{let n=[],r=[],i=[],a=/* @__PURE__ */new Map,o=/* @__PURE__ */new Set,s=(e,t)=>{e&&(o.add(e),a.set(e,(a.get(e)??!1)||t))},l=e.filter(e=>"google"===e.source);if(l.length>0){let e=(e=>{let t=[...e].sort((e,t)=>((e,t)=>e===t?0:e<t?-1:1)(e.family,t.family)).map(e=>{let t=(e=>{let t=[...new Set(e.weights)].filter(e=>Number.isFinite(e)).sort((e,t)=>e-t);return t.length>0?t:[400]})(e);if(!e.styles.includes("italic"))return`family=${Tc(e.family)}:wght@${t.join(";")}`;let n=[0,1].flatMap(e=>t.map(t=>`${e},${t}`));return`family=${Tc(e.family)}:ital,wght@${n.join(";")}`}),n=[...new Set(e.map(e=>e.display??"swap"))],r=1===n.length?n[0]:"swap";return`${yc}/css2?${t.join("&")}&display=${r}`})(l);s(yc,!1),s("https://fonts.gstatic.com",!0),l.some(e=>e.preload)&&r.push({href:e,rel:"preload",as:"style"}),n.push({href:e,rel:"stylesheet"})}return e.forEach(e=>{if("remote"===e.source&&e.stylesheet&&vc(e.stylesheet))return s(wc(e.stylesheet),!1),e.preload&&r.push({href:e.stylesheet,rel:"preload",as:"style"}),void n.push({href:e.stylesheet,rel:"stylesheet"});"remote"===e.source&&e.files?e.files.filter(e=>vc(e.url)).forEach(t=>{s(wc(t.url),!0),i.push(Cc(e,{...t,url:t.url})),e.preload&&r.push({href:t.url,rel:"preload",as:"font",type:bc[t.format],crossorigin:!0})}):"hosted"===e.source&&e.files.forEach(n=>{let a=t(n.path);s(wc(a),!0),i.push(Cc(e,{...n,url:a})),e.preload&&r.push({href:a,rel:"preload",as:"font",type:bc[n.format],crossorigin:!0})})}),{preconnect:[...a].map(([e,t])=>t?{href:e,crossorigin:t}:{href:e}),links:[...r,...n],faces:i.join(""),origins:[...o]}})(d,((e="/fonts")=>t=>`${e.replace(/\/+$/,"")}/${t.replace(/^\/+/,"")}`)(n?.fontsBaseUrl)),[d,n?.fontsBaseUrl]),T=k(()=>{const t=(e=>e?Object.keys(e).filter(t=>"string"==typeof e[t]||"number"==typeof e[t]).map(t=>{let n=e[t];return(e=>{if(!e||"string"!=typeof e)return!1;let t=e.trim().toLowerCase();return zS.test(t)||RS.test(t)||jS.test(t)||$S.has(t)})(n)?`--${t}:${n};`:`--${t}:"${n}";`}).join("\n"):"")(u),n=((e="",t={},n={missing:""})=>{let r=n.missing??"";return e.replace(/\{\{\s*([a-z0-9_\-.$]+)\s*\}\}/gi,(e,n)=>{let i=n.split("."),a=t;for(let t of i){if("object"!=typeof a||!a)return r;if(!(t in a))return r;a=a[t]}return"string"==typeof a||"number"==typeof a||"boolean"==typeof a?String(a):r})})(l,u),r=`.plitzi-sdk{${t}}\n${(e=>`${Ac}${e}${Ec}`)(n)}\n${s.customCss}\n${e}`;return`@layer plitzi-sdk-plugin, ${mc};@layer ${mc}{${r}}`},[u,l,s.customCss,e]),C=k(()=>({...i,...gc(S)}),[i,S]),A=h(()=>a.current?a.current.contentWindow:"undefined"!=typeof window?window:{innerWidth:1440,innerHeight:900},[a]),O=m?"":c,N=k(()=>({settings:{isHydrating:w,previewMode:m,debugMode:y,renderMode:p,environment:v,...s,theme:r},root:{baseElementId:O},utils:{displayBorderComponents:!1,getWindow:A,rootRef:o},customContexts:{},contexts:{ComponentContext:Fr,NetworkContext:Lc,PluginsContext:OS,EventBridgeContext:Wu,InteractionsContext:DS}}),[w,m,y,O,p,v,s,r,A,o]);/* @__PURE__ */
129
129
  return _(E,{children:["iframe"!==p&&/* @__PURE__ */I(yI,{head:S}),("raw"===p||"widget"===p)&&/* @__PURE__ */I(lI,{renderMode:p,style:T,plitziContextValue:N,pageId:c}),"shadow"===p&&/* @__PURE__ */I(mI,{sdkStylePath:t,style:T,plitziContextValue:N,pageId:c,assets:i}),!["raw","widget","shadow"].includes(p)&&/* @__PURE__ */I(sI,{style:S.faces?`${S.faces}\n${T}`:T,plitziContextValue:N,pageId:c,assets:C,ref:a})]})};vI.Plugin=gI;var wI,kI,xI,SI=vI,TI=e=>{let[t,n]=e.split("."),r=Number(t);if(!Number.isFinite(r)||r<=0)return;let i=Number(n);return{expiresAt:r,refreshExpiresAt:Number.isFinite(i)&&i>0?i:void 0}},CI=e=>{if(e&&typeof document<"u")for(let t of document.cookie.split(";")){let n=t.indexOf("=");if(-1!==n&&t.slice(0,n).trim()===e)return TI(decodeURIComponent(t.slice(n+1).trim()))}},AI=class{kind;key;constructor(e,t){this.kind=e,this.key=t}get area(){try{if("localStorage"===this.kind&&typeof localStorage<"u")return localStorage;if("sessionStorage"===this.kind&&typeof sessionStorage<"u")return sessionStorage}catch{}}read(){let e=this.area?.getItem(this.key);if(e)try{let t=JSON.parse(e);return(e=>"object"==typeof e&&!!e&&1===e.version)(t)?t:void 0}catch{return}}write(e){try{this.area?.setItem(this.key,JSON.stringify({version:1,...e}))}catch{}}clear(){try{this.area?.removeItem(this.key)}catch{}}subscribe(e){if("localStorage"!==this.kind||typeof window>"u")return()=>{};let t=t=>{(null===t.key||t.key===this.key)&&e(this.read())};return window.addEventListener("storage",t),()=>window.removeEventListener("storage",t)}},EI=e=>{if(!e)return;let t=e.split(".");if(3!==t.length)return;let n=(e=>{try{let t=e.replaceAll("-","+").replaceAll("_","/"),n=t.padEnd(t.length+(4-t.length%4)%4,"="),r=JSON.parse(atob(n));return"object"==typeof r&&r?r:void 0}catch{return}})(t[1])?.exp;return"number"==typeof n&&Number.isFinite(n)?n:void 0},II=()=>Math.floor(Date.now()/1e3),_I=e=>{if("number"==typeof e&&Number.isFinite(e)&&!(e<=0))return Math.floor(e>1e11?e/1e3:e)},OI=class{state="init";session={validatedAt:0};store;gate;hintCookie;revalidateSeconds;listeners=/* @__PURE__ */new Set;renewal;epoch=0;renewalTimer;detachListeners;offline=!1;spaceKey;constructor({spaceKey:e="",tokenStorage:t="localStorage",sessionHintCookie:n,sessionGate:r="optimistic",sessionRevalidateSeconds:i=300,storageKey:a="plitzi_auth_session"}={}){this.spaceKey=e,this.store=new AI(t,a),this.gate=r,this.hintCookie=n,this.revalidateSeconds=i}get endpoints(){return[]}requestExchange(){return Promise.resolve(void 0)}consumeRedirect(){return Promise.resolve(void 0)}get user(){return this.session.user}get token(){return this.session.token}getState(){return this.state}can(e){let t=this.session.user?.permissions;return Array.isArray(t)&&t.includes(e)}peekState(){return this.peek().state}peek(){let e=this.store.read(),t=CI(this.hintCookie);if(this.hintCookie&&!t)return{state:"guest"};let n=e?.token,r=_I(n?.expiresAt)??EI(n?.accessToken);return n?.accessToken&&(void 0===r||r-60>II())&&e?.user?{state:"authenticated",user:e.user,token:e.token}:n?.accessToken||n?.refreshToken||t?{state:"init",user:e?.user,token:e?.token}:{state:"guest"}}async init(e={}){this.attach(),await this.decide(e),this.settle()}settle(){("init"===this.state||"initLoading"===this.state)&&this.setState(this.session.user||this.hasLiveToken()?"authenticated":"guest","settled")}async decide(e){if(e.skipAuth)return void this.setState("guest","skip-auth");let t=await this.consumeRedirect();if(t)return void(t.ok?(this.adopt(t),await this.handOffToServer(),this.emit({type:"login",token:this.session.token})):this.endSession(t.reason));if(e.user)return void this.adopt({ok:!0,user:e.user,token:e.accessToken?{accessToken:e.accessToken,expiresAt:e.expiresAt??null,refreshToken:null}:this.session.token},!0,"bootstrap");let n=this.store.read(),r=CI(this.hintCookie);if(this.session={user:n?.user,token:n?.token,validatedAt:n?.validatedAt??0},!this.hintCookie||r){if(this.hasLiveToken()&&this.session.user){this.setState("authenticated","restored"),this.scheduleRenewal();let e=this.isFresh()&&"strict"!==this.gate?void 0:this.revalidate(!0);return void("strict"===this.gate&&await e)}this.hasEvidence()?(this.setState("initLoading","no-evidence"),this.hasLiveToken()&&this.capabilities.identity?await this.loadIdentity():this.capabilities.renew?await this.renew():this.capabilities.identity?await this.loadIdentity():this.endSession()):this.endSession(void 0,"no-evidence")}else this.endSession(void 0,"hint-missing")}dispose(){clearTimeout(this.renewalTimer),this.renewalTimer=void 0,this.detachListeners?.(),this.detachListeners=void 0}async login(e){this.epoch+=1,this.setState("authenticating","authenticating");let t=await this.requestLogin(e);if(!t.ok&&"mfa"===t.reason)return this.endSession(),t;if(!t.ok)return this.endSession(t.reason),{ok:!1,reason:t.reason};this.adopt(t);let n=await this.handOffToServer();return n?{ok:!1,reason:n}:(!this.session.user&&this.capabilities.identity&&await this.loadIdentity(),"authenticated"===this.state?(this.emit({type:"login",token:this.session.token}),{ok:!0,...this.session.token??{accessToken:"",expiresAt:null,refreshToken:null}}):{ok:!1,reason:"inactive"})}async handOffToServer(){let e=await this.requestExchange();if(e)return e.ok?void this.adopt(e):"network"===e.reason?void(this.offline=!0):(this.endSession(e.reason),e.reason)}async refresh(){return await this.renew(),this.session.token}async revalidate(e=!1){return this.hasEvidence()?!e&&this.isFresh()&&this.hasLiveToken()?"authenticated"===this.state:this.hasLiveToken()&&this.capabilities.identity?this.loadIdentity():this.capabilities.renew?this.renew():this.capabilities.identity?this.loadIdentity():(this.hasLiveToken()||this.endSession("expired"),"authenticated"===this.state):("guest"!==this.state&&this.endSession(),!1)}invalidate(e="expired"){this.recover(e)}async recover(e){return"network"===e?(this.offline=!0,!1):this.renewable(e)?this.renew():(this.endSession(e),!1)}async logout(){await this.requestLogout(),this.endSession(),this.emit({type:"logout"})}on(e){let t=Array.isArray(e)?e:[e];return t.forEach(e=>this.listeners.add(e)),()=>t.forEach(e=>this.listeners.delete(e))}emit(e){for(let t of this.listeners)t(e)}setState(e,t){this.state!==e&&(this.state=e,this.emit({type:"state",state:e,reason:t}))}async renew(){return this.renewal??=this.performRenewal().finally(()=>{this.renewal=void 0}),this.renewal}async performRenewal(){let e=this.epoch,t=await this.requestRenewal(this.session.token?.refreshToken??void 0);return e===this.epoch?t.ok?(this.adopt(t),!this.session.user&&this.capabilities.identity?this.loadIdentity():"authenticated"===this.state):(this.handleFailure(t.reason),!1):"authenticated"===this.state}async loadIdentity(){let e=this.epoch,t=await this.requestIdentity();return e===this.epoch?t.ok?(this.adopt(t),"authenticated"===this.state):this.renewable(t.reason)&&!this.renewal?this.renew():(this.handleFailure(t.reason),!1):"authenticated"===this.state}handleFailure(e){"network"!==e?this.endSession(e):this.offline=!0}adopt(e,t=!0,n="granted"){this.session={user:e.user??this.session.user,token:e.token??this.session.token,validatedAt:II()},this.offline=!1,t&&this.store.write(this.session),this.scheduleRenewal(),this.setState(this.session.user||this.hasLiveToken()?"authenticated":"guest",n)}endSession(e,t="signed-out"){this.epoch+=1,clearTimeout(this.renewalTimer),this.renewalTimer=void 0,this.session={validatedAt:II()},this.store.write(this.session),this.setState("guest",t),e&&this.emit({type:"expired",reason:e})}expiresAt(){return _I(this.session.token?.expiresAt)??EI(this.session.token?.accessToken)}renewable(e){if(!this.capabilities.renew)return!1;if("expired"===e)return!0;if("missing"!==e)return!1;if(this.session.token?.refreshToken)return!0;let t=CI(this.hintCookie);return void 0!==t&&(void 0===t.refreshExpiresAt||t.refreshExpiresAt>II())}hasLiveToken(){if(!this.session.token?.accessToken)return!1;let e=this.expiresAt();return void 0===e||e-60>II()}isFresh(){return II()-this.session.validatedAt<this.revalidateSeconds}hasEvidence(){if(this.session.token?.accessToken||this.session.token?.refreshToken)return!0;let e=CI(this.hintCookie);return!(void 0!==e?.refreshExpiresAt&&e.refreshExpiresAt<=II()||!e)}scheduleRenewal(){clearTimeout(this.renewalTimer),this.renewalTimer=void 0;let e=this.expiresAt();if(void 0===e||typeof window>"u"||"guest"===this.state)return;let t=Math.min(1e3*(e-60-II()),2147483647);t<=0?this.onRenewalDue():this.renewalTimer=setTimeout(()=>this.onRenewalDue(),t)}onRenewalDue(){this.capabilities.renew?this.renew():this.endSession("expired")}attach(){if(typeof window>"u"||this.detachListeners)return;let e=()=>{"visible"===document.visibilityState&&this.revalidate()},t=()=>{this.offline&&this.revalidate(!0)},n=this.store.subscribe(e=>this.adoptFromStorage(e)),r=(e=>(Zr.add(e),()=>Zr.delete(e)))(({reason:e,url:t})=>{let n=this.endpoints.filter(Boolean);return!(0!==n.length&&!n.some(e=>((e,t)=>{if(!e||!t)return!1;try{let n=typeof window>"u"?void 0:window.location.href;return ni(new URL(e,n).hostname)===ni(new URL(t,n).hostname)}catch{return!1}})(e,t)))&&this.recover(e)});document.addEventListener("visibilitychange",e),window.addEventListener("online",t),this.detachListeners=()=>{document.removeEventListener("visibilitychange",e),window.removeEventListener("online",t),n(),r()}}adoptFromStorage(e){if(this.epoch+=1,!e?.token&&!e?.user)return clearTimeout(this.renewalTimer),this.renewalTimer=void 0,this.session={validatedAt:II()},this.setState("guest","another-tab"),void this.emit({type:"logout"});this.adopt({ok:!0,user:e.user,token:e.token},!1)}},NI=(e,t)=>sr(e,t,void 0),MI=(e,t)=>{let n=NI(e,t);return"string"==typeof n&&""!==n?n:null},PI=(e,t)=>{let n=NI(e,t),r="string"==typeof n?Number(n):n;return"number"==typeof r&&Number.isFinite(r)?r:null},LI=e=>"string"==typeof e?e:"number"==typeof e&&Number.isFinite(e)?String(e):"",DI=class extends OI{name="basic";options;constructor({loginUrl:e="",userUrl:t="",refreshUrl:n="",logoutUrl:r="",sessionExchangeUrl:i="",mfaUrl:a="",detailsPath:o="details",tokenPath:s="access_token",refreshTokenPath:l="refresh_token",expirationTimePath:c="expire_at",refreshExpirationTimePath:u="refresh_expire_at",...d}={}){super(d),this.options={loginUrl:e,userUrl:t,refreshUrl:n,logoutUrl:r,sessionExchangeUrl:i,mfaUrl:a,detailsPath:o,tokenPath:s,refreshTokenPath:l,expirationTimePath:c,refreshExpirationTimePath:u}}get capabilities(){return{renew:!!this.options.refreshUrl,identity:!!this.options.userUrl}}get endpoints(){let{loginUrl:e,userUrl:t,refreshUrl:n,logoutUrl:r}=this.options;return[e,t,n,r]}async requestLogin(e){let t=LI(e.token).trim();if("token"===e.mode)return t?this.adoptToken(t):{ok:!1,reason:"missing"};if("mfa"===e.mode){let t=LI(e.mfaToken).trim();return this.options.mfaUrl&&t?this.toResult(await this.request(this.options.mfaUrl,{method:"POST",body:JSON.stringify({mfaToken:t,code:LI(e.code).trim()})})):{ok:!1,reason:"missing"}}if(!this.options.loginUrl)return{ok:!1,reason:"missing"};let n=await this.request(this.options.loginUrl,{method:"POST",body:JSON.stringify({username:LI(e.username),password:LI(e.password)})});return this.challengeOf(n)??this.toResult(n)}async adoptToken(e){if(!this.options.userUrl)return{ok:!1,reason:"missing"};let t=await this.request(this.options.userUrl,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}}),n=this.toResult(t);return n.ok?{ok:!0,user:n.user,token:{accessToken:e,expiresAt:null,refreshToken:null}}:n}async requestRenewal(e){if(!this.options.refreshUrl)return{ok:!1,reason:"missing"};let t=await this.request(this.options.refreshUrl,{method:"POST",body:JSON.stringify(e?{[this.options.refreshTokenPath]:e}:{})});return this.toResult(t)}async requestExchange(){let e=this.token?.accessToken;if(!this.options.sessionExchangeUrl||!e)return;let t=await this.request(this.options.sessionExchangeUrl,{method:"POST",headers:{"Content-Type":"application/json",...this.spaceKey?{"x-access-token":this.spaceKey}:{}},body:JSON.stringify({provider:this.name,token:e})});return this.toResult(t)}async requestIdentity(){if(!this.options.userUrl)return{ok:!1,reason:"missing"};let e=await this.request(this.options.userUrl,{method:"GET"});return this.toResult(e)}async requestLogout(){this.options.logoutUrl&&await this.request(this.options.logoutUrl,{method:"POST"})}async request(e,t){let n,r;try{n=await fetch(e,{credentials:"include",headers:{"Content-Type":"application/json"},...t})}catch{return{status:0,reason:"network"}}try{r=await n.json()}catch{r=void 0}return{data:r,status:n.status,reason:n.ok?void 0:ti(n.status,r)??"network"}}challengeOf(e){let t=NI(e.data,"mfaToken");return!e.reason&&!0===NI(e.data,"mfaRequired")&&"string"==typeof t&&t?{ok:!1,reason:"mfa",mfaToken:t}:void 0}toResult(e){if(e.reason)return{ok:!1,reason:e.reason};let t=NI(e.data,this.options.detailsPath);return{ok:!0,user:"object"==typeof t&&t?t:void 0,token:this.tokenFrom(e.data)}}tokenFrom(e){let t=MI(e,this.options.tokenPath);if(!t)return;let n=NI(e,"errors");return{..."object"==typeof n&&n?{errors:n}:{},accessToken:t,expiresAt:PI(e,this.options.expirationTimePath),refreshToken:MI(e,this.options.refreshTokenPath),refreshExpiresAt:PI(e,this.options.refreshExpirationTimePath)}}},zI=class extends OI{name="server";loginUrl;logoutUrl;constructor({loginUrl:e="",logoutUrl:t="",...n}={}){super({...n,tokenStorage:""}),this.loginUrl=e||"/auth/sign-in",this.logoutUrl=t||"/auth/logout"}get capabilities(){return{renew:!1,identity:!1}}requestLogin(){let e=`${window.location.pathname}${window.location.search}`;return window.location.assign(`${this.loginUrl}?return=${encodeURIComponent(e)}`),new Promise(()=>{})}requestRenewal(){return Promise.resolve({ok:!1,reason:"expired"})}requestIdentity(){return Promise.resolve({ok:!1,reason:"missing"})}async requestLogout(){await fetch(this.logoutUrl,{method:"POST",credentials:"same-origin"})}revalidate(){return Promise.resolve("authenticated"===this.getState())}},RI=/* @__PURE__ */new Map([["basic",e=>new DI(e)],["server",e=>new zI(e)]]),jI=class{providerType;provider;settings;listeners;constructor(e,t,n){this.providerType=e,this.settings=n,this.listeners=Array.isArray(t)?t:[t];let r=RI.get(e);r&&(this.provider=r(n),this.provider.on(this.listeners))}getProviderType(){return this.providerType}getProvider(){return this.provider}getState(){return this.provider?.getState()??"guest"}peekState(){return this.peek().state}peek(){return(this.provider??new DI(this.settings)).peek()}can(e){return this.provider?.can(e)??!1}init(e){if(!this.provider){let t=this.peekState(),n=e?.user||"authenticated"===t?"authenticated":"guest";return this.listeners.forEach(e=>e({type:"state",state:n,reason:"no-provider"})),Promise.resolve()}return this.provider.init(e)}login(...e){return this.provider?.login(...e)??Promise.resolve({ok:!1,reason:"missing"})}refresh(){return this.provider?.refresh()??Promise.resolve(void 0)}revalidate(e){return this.provider?.revalidate(e)??Promise.resolve(!1)}invalidate(e){this.provider?.invalidate(e)}logout(){return this.provider?.logout()??Promise.resolve()}dispose(){this.provider?.dispose()}on(e){return this.provider?.on(e)}},$I=["loginUrl","userUrl","refreshUrl","logoutUrl","detailsPath","tokenPath","refreshTokenPath","expirationTimePath","refreshExpirationTimePath","sessionHintCookie","sessionExchangeUrl","mfaUrl"],FI=({children:e,server:t})=>{let{previewMode:n,isHydrating:r,environment:i}=X(),{webKey:a}=f(Lc),[[o,s]]=Mt(["schema.settings","schema.variables"]),{queryParams:l,hostname:c}=wS({server:t}),u=k(()=>({queryParams:l,hostname:c,environment:i}),[l,c,i]),d=k(()=>Array.isArray(s)?s.reduce((e,t)=>{let{name:n,value:r,subValues:i}=t;if(!Array.isArray(i)||0===i.length)return{...e,[n]:r};let a=i.find(e=>Ma(e.when,u));return a?{...e,[n]:a.value}:{...e,[n]:r}},{}):{},[s,u]),p=k(()=>{let e=Object.fromEntries($I.map(e=>[e,o[e]]));try{return JSON.parse(Fn(JSON.stringify(e),d))}catch{return e}},[o,d]),m=k(()=>({...p,spaceKey:a,tokenStorage:o.tokenStorage??"localStorage",sessionGate:o.sessionGate,sessionRevalidateSeconds:o.sessionRevalidateSeconds}),[p,o,a]),{manager:y,loading:b,authenticated:v,state:w,bootstrapUser:T,bootstrapToken:C,peekedUser:A,peekedToken:E}=(({server:e,isHydrating:t=!1,provider:n="",settings:r})=>{let i=e?.authenticated?e.user?.details:void 0,a="string"==typeof e?.user?.accessToken?e.user.accessToken:void 0,[o,s]=S("init"),l=h(e=>{"state"===e.type&&s(e.state)},[]),c=k(()=>new jI(n,l,r),[n,l,r]),u=k(()=>t||i?void 0:c.peek(),[c,t,i]),d="init"!==o&&"initLoading"!==o||!!i||t||"authenticated"===u?.state||"guest"===u?.state;return g(()=>(c.init({user:i,accessToken:a,expiresAt:e?.user?.expiresAt,skipAuth:e?.skipAuth}),()=>c.dispose()),[c,i,a,e?.user?.expiresAt,e?.skipAuth]),k(()=>({manager:c,state:o,bootstrapUser:i,bootstrapToken:a,peekedUser:u?.user,peekedToken:u?.token?.accessToken,loading:"initLoading"===o||!d,authenticated:"authenticated"===o||"init"===o&&(!!i||"authenticated"===u?.state)}),[c,o,i,a,d,u])})({server:t,isHydrating:r,provider:o.userProvider??"",settings:m}),_=y.getProvider(),{user:O,accessToken:N}=(e=>{let{state:t,provider:n,bootstrap:r,peeked:i}=e;return n?.user?{user:n.user,accessToken:n.accessToken}:"guest"===t?{}:r?.user?{user:r.user,accessToken:r.accessToken}:i?.user?{user:i.user,accessToken:i.accessToken}:{}})({state:w,provider:{user:_?.user,accessToken:_?.token?.accessToken},bootstrap:{user:T,accessToken:C},peeked:{user:A,accessToken:E}}),M=x(void 0),P=k(()=>{let e=O?{details:O,accessToken:N}:void 0,t=M.current;return t?.accessToken===e?.accessToken&&((e,t)=>{if(e===t)return!0;if(!e||!t)return!1;let n=e,r=t;return[.../* @__PURE__ */new Set([...Object.keys(n),...Object.keys(r)])].every(e=>JSON.stringify(n[e])===JSON.stringify(r[e]))})(t?.details,e?.details)||(M.current=e),M.current},[O,N]);(e=>{let t=x(e);wt(()=>{t.current!==e&&(t.current=e,eA.reset({refetch:""!==e}))},[e])})(v?String(P?.details?.id??""):"");let L=k(()=>({login:y.login.bind(y),refresh:y.refresh.bind(y),revalidate:y.revalidate.bind(y),invalidate:y.invalidate.bind(y),can:y.can.bind(y),logout:y.logout.bind(y),state:w,authenticated:v||!n,user:P}),[y,w,v,n,P]);/* @__PURE__ */
130
130
  return I(vS,{value:L,children:!b&&e})},qI=(e,t=0,n=/* @__PURE__ */new WeakSet)=>{if("function"!=typeof e)return"object"==typeof e&&e?n.has(e)||t>12?"[…]":(n.add(e),Array.isArray(e)?e.map(e=>qI(e,t+1,n)):Object.fromEntries(Object.entries(e).map(([e,r])=>[e,qI(r,t+1,n)]).filter(([,e])=>void 0!==e))):e},BI=(e,...t)=>{let n=e;for(let r of t)n=nr(n)?n[r]:void 0;return nr(n)?n:{}},UI=e=>Array.isArray(e)?e:[],HI=e=>Object.entries(BI(e,"definition","bindings")).flatMap(([e,t])=>UI(t).flatMap(t=>{let{to:n,source:r,transformers:i}=BI(t),a=UI(i).map(e=>BI(e,"params").template).find(e=>"string"==typeof e);return"string"==typeof n&&"string"==typeof r?[{category:e,to:n,source:r,..."string"==typeof a?{template:a}:{}}]:[]})),WI=(e,t,n)=>{let{element:r,inComponent:i}=((e,t)=>{let n=BI(e,"flat");if(Object.hasOwn(n,t))return{element:n[t]};for(let[r,i]of Object.entries(BI(e,"components"))){let e=BI(i,"flat");if(Object.hasOwn(e,t))return{element:e[t],inComponent:r}}return{}})(BI(e,"schema"),t),a=Array.from(n.querySelectorAll(`[data-id="${t}"]`));if(!nr(r)&&0===a.length)return;let o=a.at(0),s=o?.getBoundingClientRect(),l=o?getComputedStyle(o):void 0,c=void 0!==s&&s.width>0&&s.height>0&&"none"!==l?.display&&"hidden"!==l?.visibility,u=BI(r,"definition").type,d=BI(r,"attributes"),p="reference"===u&&"component"===d.referenceType&&"string"==typeof d.referenceId?d.referenceId:void 0,f=BI(e,"runtime","elements")[t];return{id:t,..."string"==typeof u?{type:u}:{},...void 0===i?{}:{inComponent:i},...void 0===p?{}:{instanceOf:p},...nr(r)?{attributes:BI(qI(r),"attributes"),bindings:HI(r)}:{},...void 0===f?{}:{state:qI(f)},copies:a.length,visible:c,...s?{box:{x:Math.round(s.x),y:Math.round(s.y),width:Math.round(s.width),height:Math.round(s.height)}}:{}}},VI=e=>{let t=m(mt),n=Dt();g(()=>{if(!e||!t)return;let r=[],i=!1,a=Vl.addListener(e=>{let t=(e=>{if("interactions"!==e.category||!(e=>"object"==typeof e&&"nodes"in e&&"startTime"in e&&"node"in e)(e.params))return;let{node:t,hostElementId:n,status:r,startTime:i,endTime:a,nodes:o}=e.params,s=Object.values(o).filter(e=>e.node.id!==t.id).toSorted((e,t)=>e.startTime-t.startTime).map(e=>{let t=(e=>{if("failed"===e.status)return e.result instanceof Error?e.result.message:"string"==typeof e.result?e.result:void 0})(e);return{title:e.node.title,action:e.node.action,status:e.status,ms:Math.round(e.endTime-e.startTime),...void 0===t?{}:{error:t}}});return{at:e.time??"",trigger:`${t.title} [${t.action}]`,...void 0===n?{}:{on:n},status:r,ms:Math.round(a-i),steps:s}})(e);t&&(r.push(t),r.length>100&&r.shift())},{replay:!0}),o=(({root:e,writeState:t,stores:n,runs:r,setWatching:i,document:a})=>({help:()=>"window.__plitzi — this page, in text (debug mode only):\n state(key?) runtime.state, or one key of it\n setState(key, value) writes runtime.state.<key>, as a setState step would\n sources(name?) every source's current value by name (apiContainer_site, list_products…), or one\n element(id) an element by its id, in a page or a component: type, attributes, what it reads, its own state,\n the component it places, copies, on screen, box\n flows(limit = 20) the last flows that ran: trigger, element, status, every step with its time and error\n watch(on = true) one console line per flow as it ends",state:t=>{let n=BI(e.getState(),"runtime","state");return qI(void 0===t?n:n[t])},setState:t,sources:t=>{let r={};for(let i of[e,...n()])Object.assign(r,BI(i.getOwnState(),"runtime","sources"));return qI(void 0===t?r:r[t])},element:t=>WI(e.getState(),t,a),flows:(e=20)=>r().slice(-e),watch:(e=!0)=>(i(e),e?"Each flow is said in the console as it ends.":"Flows are no longer said in the console.")}))({root:t,writeState:(e,t)=>n(`runtime.state.${e}`,t),stores:()=>tt().map(e=>e.store),runs:()=>r,setWatching:e=>{i=e},document:document});return window.__plitzi=o,()=>{a(),window.__plitzi===o&&delete window.__plitzi}},[e,t,n])},GI=({children:e})=>{let[t,n]=S([]),[r,i]=S({}),a=x(!1),o=h((e,t,r,i,a)=>{n(n=>[...n,{logType:e,category:t,message:r,time:a,params:i}])},[n]),s=h((e,t)=>i(n=>({...n,[e]:t})),[]),l=h(e=>i(t=>hr(t,[e])),[]),c=h((e,...t)=>{if(e&&"function"==typeof r[e])return r[e](...t)},[r]),u=h(()=>n([]),[]);a.current||=(Vl.setCallback(o),Vl.setCallbackAddProvider(s),Vl.setCallbackRemoveProvider(l),!0),g(()=>(Vl.setCallback(o),Vl.setCallbackAddProvider(s),Vl.setCallbackRemoveProvider(l),Vl.processPendingLogs(),()=>{Vl.setCallback(void 0),Vl.setCallbackAddProvider(void 0),Vl.setCallbackRemoveProvider(void 0),Vl.flush()}),[o,s,l]);let d=k(()=>({providers:r,logs:t,setLogs:n,clearLogs:u,getData:c}),[r,t,n,u,c]);/* @__PURE__ */
131
- return I(Ul,{value:d,children:e})},KI={display:"contents"},YI=({children:e})=>{let t=x(null),n=x(void 0),r=x(void 0),i=m(mt),a=f(Yc),o=f(OS),s=f(Fr),l=f(Wa);return w(()=>{let e=t.current;if(e)return clearTimeout(r.current),n.current??=C(e),()=>{let e=n.current;r.current=setTimeout(()=>{e?.unmount(),n.current===e&&(n.current=void 0)},0)}},[]),w(()=>{n.current?.render(/* @__PURE__ */I(mt,{value:i,children:/* @__PURE__ */I(Wa,{value:l,children:/* @__PURE__ */I(Yc,{value:a,children:/* @__PURE__ */I(OS,{value:o,children:/* @__PURE__ */I(Fr,{value:s,children:e})})})})}))}),/* @__PURE__ */I("div",{ref:t,style:KI})},JI=[],XI=/* @__PURE__ */new Set,ZI=[],QI=()=>{ZI=[...JI];for(let e of XI)e()},e_=e=>(XI.add(e),()=>{XI.delete(e)}),t_=()=>ZI,n_=()=>wI,r_=e=>{wI!==e&&(wI=e,QI())},i_=()=>({instanceIds:T(e_,t_,t_),selectedId:T(e_,n_,n_)}),a_=()=>()=>{},o_=(e,t,n)=>{window.dispatchEvent(new CustomEvent("customstorage-changed",{detail:{key:e,oldValue:t,newValue:n}}))},s_=()=>{let e={};if(typeof document>"u"||!document.cookie)return e;for(let t of document.cookie.split(";")){let n=t.indexOf("=");-1!==n&&(e[t.slice(0,n).trim()]=decodeURIComponent(t.slice(n+1).trim()))}return e},l_=e=>new Proxy(e,{get(e,t,n){if("setItem"===t)return(t,n)=>{let r=e.getItem(t);e.setItem.call(e,t,n),r!==n&&o_(t,r,n)};if("removeItem"===t)return t=>{let n=e.getItem(t);e.removeItem.call(e,t),null!==n&&o_(t,n,null)};let r=Reflect.get(e,t,n);return"function"==typeof r?r.bind(e):r}}),c_=e=>"cookie"===e?typeof document<"u"?l_((()=>{let e={getItem(e){let t=s_();return e in t?t[e]:null},setItem(e,t){typeof document<"u"&&(document.cookie=`${e}=${encodeURIComponent(t)}; path=/; max-age=31536000; samesite=lax`)},removeItem(e){typeof document<"u"&&(document.cookie=`${e}=; path=/; max-age=0; samesite=lax`)},clear(){for(let t of Object.keys(s_()))e.removeItem(t)},key:e=>Object.keys(s_())[e]??null,get length(){return Object.keys(s_()).length}};return e})()):void 0:"sessionStorage"===e?typeof sessionStorage<"u"?l_(sessionStorage):void 0:typeof localStorage<"u"?l_(localStorage):void 0,u_=function(e,t,n="localStorage",r=!0){let[i,a]=k(()=>{if(e.includes(".")){let t=e.split(".").filter(Boolean);return[t.shift(),t.join(".")]}return[e,""]},[e]),o=x(c_(n));Cs(()=>{o.current=c_(n)},[n]);let[s,l]=S(()=>{try{if(!o.current)return t;let e=o.current.getItem(i);if(!e)return t;let n=JSON.parse(e);return a?sr(n,a,t):n}catch{return t}});g(()=>{try{if(!o.current)return;let e=s;if(a){let t=o.current.getItem(i);e=$l(t?JSON.parse(t):{},e=>{lr(e,a,s)})}o.current.setItem(i,JSON.stringify(e))}catch(DO){}},[i,a,s]);let c=h(e=>{if(e.key===i)try{let n=e.newValue?JSON.parse(e.newValue):t;l(a?sr(n,a,t):n)}catch{}},[i,a,t]),u=h(e=>{if(e.detail.key===i)try{let n=e.detail.newValue?JSON.parse(e.detail.newValue):t;l(a?sr(n,a,t):n)}catch{}},[i,a,t]);return g(()=>{if(typeof window<"u"&&r)return window.addEventListener("storage",c),window.addEventListener("customstorage-changed",u),()=>{window.removeEventListener("storage",c),window.removeEventListener("customstorage-changed",u)}},[c,u,n,r]),[s,l]},d_=d(()=>import("./plitzi-sdk-devtools-DdY_8y58.js")),p_="horizontal",f_=0,h_=({children:e,className:t,innerClassName:n,enabled:r=!1,instanceId:i,renderMode:a="default",scroll:s="container",qa:l=!1,devToolsStyle:c="",devToolsStyleLink:u=""})=>{let{resolvedTheme:d}=eu(),[p,f]=u_("plitzi-sdk.dev-tools.orientation",p_),[y,b]=u_("plitzi-sdk.dev-tools.collapsed",!0),[v,w]=u_("plitzi-sdk.dev-tools.tab","logs"),[k,C]=S(),A=x(void 0),E=x(null);A.current||="sdk-instance-"+ ++f_;let O=i||A.current,N=T(a_,()=>!0,()=>!1),M=N?p:p_,P=((e,t)=>{g(()=>{if(t)return(e=>(JI.push(e),void 0===wI&&(wI=e),QI(),()=>{let t=JI.indexOf(e);-1!==t&&JI.splice(t,1),wI===e&&(wI=JI[0]),QI()}))(e)},[t,e]);let n=T(e_,n_,n_);return t&&n===e})(O,r);(e=>{let t=m(mt);g(()=>{if(e&&!Ne&&t)return Qe(t)},[e,t])})(r),((e,t)=>{g(()=>{if(e)return Qe(eA.store,t,"Queries")},[e,t])})(P,O),VI(P);let L=h(e=>f(e),[f]),D=h(e=>{e&&w("logs"),C(e),b(!1)},[b,w]),z=h(()=>b(!0),[b]),R=h(e=>{C(void 0),w(e)},[w]);if(!r)return e;let j="document"===s&&(!N||y),$=P&&N&&/* @__PURE__ */I(YI,{children:/* @__PURE__ */I(GI,{children:/* @__PURE__ */_(o,{fallback:null,children:["default"===a&&/* @__PURE__ */I(d_,{className:U({dark:"dark"===d}),collapsed:y,orientation:M,tabSelected:v,logTypeFilter:k,onOpen:D,onCollapse:z,onTabSelect:R,onChangeOrientation:L,pageRef:E,qa:l}),"shadow"===a&&/* @__PURE__ */_(hI,{children:[u&&/* @__PURE__ */I(hI.Link,{href:u}),/* @__PURE__ */_(hI.Content,{children:[/* @__PURE__ */I("style",{dangerouslySetInnerHTML:{__html:c}}),/* @__PURE__ */I(d_,{className:U({dark:"dark"===d}),collapsed:y,orientation:M,tabSelected:v,logTypeFilter:k,onOpen:D,onCollapse:z,onTabSelect:R,onChangeOrientation:L,pageRef:E,qa:l})]})]})]})})});/* @__PURE__ */
132
- return _("div",{className:U("relative flex min-w-0 grow",{"overflow-auto":!j,"flex-col":j||"horizontal"===M,"h-screen":!j&&"vertical"===M},t),children:[/* @__PURE__ */I(ht,{value:O,children:/* @__PURE__ */I("div",{ref:E,className:U("grow",{"basis-0 flex-col overflow-auto":!j},n),children:e})}),j?/* @__PURE__ */I("div",{className:"sticky bottom-0 h-0",children:$}):$]})},m_=({children:e})=>{let{environment:t}=X(),[[n,r,i,a,o,s,l,c=""]]=Mt(["schema.variables","navigation.routeParams","navigation.queryParams","navigation.hostname","navigation.origin","navigation.href","navigation.currentPageId","navigation.pendingLocation"]),u=oc(k(()=>Bl(n,{routeParams:r,queryParams:i,hostname:a,environment:t}),[t,a,i,r,n])),d=h(()=>Ur(u).map(e=>({path:e,name:`variables.${e}`})),[u]);ql({id:"global",source:"variables",name:"Variables",fields:d}),Pt("runtime.sources.variables",u);let[p={}]=Mt("pageDefinitions"),m=k(()=>Object.values(p).map(e=>({value:e.id,label:sr(e,"attributes.name",e.id)})),[p]),y=k(()=>({routeParams:r,queryParams:i,origin:o,href:s,currentPageId:l,pending:""!==c,pendingLocation:c}),[r,i,o,s,l,c]),b=h(()=>[...Ur({routeParams:r,queryParams:i}).map(e=>({path:e,name:`navigation.${e}`})),{path:"origin",name:"Origin"},{path:"href",name:"This page’s address"},{path:"pending",name:"A navigation is on its way"},{path:"pendingLocation",name:"Where a navigation is going"},m.length>0?{path:"currentPageId",name:"Current Page",inputType:"select",values:m}:{path:"currentPageId",name:"Current Page"}],[r,i,m]);ql({id:"global",source:"navigation",name:"Navigation",fields:b}),Pt("runtime.sources.navigation",y);let v=f(vS),{user:w,authenticated:S,state:T}=v,[C="basic"]=Mt("schema.settings.userProvider"),A=k(()=>""===C?{}:{isAuthenticated:S,...void 0===T?{}:{status:T},accessToken:w?.accessToken??"",details:{username:"",email:"",roles:"",permissions:"",verified:"",...w?.details??{}}},[C,w,S,T]),E=h(()=>Ur(A).map(e=>({path:e,name:`user.${e}`})),[A]);ql({id:"global",source:"auth",name:"Auth State",fields:E}),Pt("runtime.sources.auth",A);let I=(e=>{let{environment:t}=X(),[[n,r,i,a,o]]=Mt(["schema.flags","navigation.routeParams","navigation.queryParams","navigation.hostname","flags.overrides"]),{authenticated:s,user:l}=e,c=k(()=>kS({authenticated:s,user:l}),[s,l]);return oc(k(()=>rc(n,{environment:t,hostname:a,routeParams:r,queryParams:i,user:c},o),[n,t,a,r,i,c,o]))})(v),_=k(()=>ic(I),[I]),O=h(()=>Object.keys(_).map(e=>({path:e,name:`flags.${e}`,inputType:"checkbox"})),[_]);ql({id:"global",source:"flags",name:"Feature Flags",fields:O}),Pt("runtime.sources.flags",_),Pt("flags.resolved",I);let[N,M]=Mt(["schema.flags","flags.overrides"])[0],P=oc(((e,t)=>tc.flatMap(n=>Object.keys(t[n]??{}).filter(t=>!Object.hasOwn(e??{},t)).map(e=>({layer:n,name:e}))))(N,M??{}));g(()=>{P.forEach(({layer:e,name:t})=>console.warn(`[plitzi] The ${e} sets the feature flag "${t}", which this space does not declare: the override is ignored. Declare the flag in the space, or remove the override.`))},[P]);let[L]=Mt("runtime.state"),D=h(()=>Ur(L).map(e=>({path:e,name:`state.${e}`})),[L]);ql({id:"global",source:"state",name:"State",fields:D}),Pt("runtime.sources.state",L);let[z]=Mt("runtime.host"),R=h(()=>Ur(z).map(e=>({path:e,name:`host.${e}`})),[z]);ql({id:"global",source:"host",name:"Host",fields:R}),Pt("runtime.sources.host",z);let{theme:j,resolvedTheme:$}=eu(Qc),F=k(()=>({mode:j,resolved:$}),[j,$]),q=h(()=>Ur(F).map(e=>({path:e,name:`theme.${e}`})),[F]);ql({id:"global",source:"theme",name:"Theme",fields:q}),Pt("runtime.sources.theme",F);let[B]=Mt("schema.settings.computed"),U=x(void 0),H=k(()=>si(B??{},{variables:u,navigation:y,auth:A,state:L??{},host:z??{},theme:F,flags:_},U.current),[B,u,y,A,L,z,F,_]);U.current=H;let W=h(()=>Ur(H).map(e=>({path:e,name:`computed.${e}`})),[H]);return ql({id:"global",source:"computed",name:"Computed",fields:W}),Pt("runtime.sources.computed",H),e},g_=class{debugMode=!1;events;listeners=/* @__PURE__ */new Map;counts=/* @__PURE__ */new Map;constructor({events:e,debugMode:t=!1}={}){this.events=e??{},this.debugMode=t;for(let[n,r]of Object.entries(this.events))this.counts.set(n,Object.keys(r).length)}has(e,t){if(!e)throw Error("Module name is required");return this.events[e]&&this.events[e][t]}on(e,t,n,r={}){let{filter:i,override:a=!1}=r;if(!e)throw Error("Module name is required");if(!n||"function"!=typeof n)throw Error("Callback must be a function");this.events[e]||(this.events[e]={}),this.events[e][t]||this.counts.set(e,(this.counts.get(e)??0)+1),(!this.events[e][t]||a&&this.events[e][t].length>0)&&(this.events[e][t]=[]),this.events[e][t].push({callback:n,filter:i})}get(e,t){return this.has(e,t)?this.events[e]?.[t]:[]}off(e,t,n){if(this.has(e,t)&&this.events[e]&&(this.events[e][t]=n?this.events[e][t]?.filter(e=>e.callback!==n):[],0===this.events[e][t]?.length)){delete this.events[e][t];let n=(this.counts.get(e)??1)-1;n>0?this.counts.set(e,n):(this.counts.delete(e),delete this.events[e])}}async emit(e,t=[],...n){let r;this.debugMode&&Vl.info("eventBridge","Event Triggered",{module:e,events:t,data:n}),r=Array.isArray(t)?t:[t];let i=[];r.forEach(t=>{if(!this.has(e,t))return;let r=this.get(e,t);r&&r.forEach(e=>{let{callback:t,filter:r}=e;(!r||"function"!=typeof r||r(...n))&&i.push(t(...n))})});let a=await Promise.all(i);return this.touch(r.reduce((e,t)=>({...e,[t]:n}),{})),a}async emitWithResponse(e,t,...n){if(!this.has(e,t))return;let r=this.get(e,t);if(!r)return;let i=await Promise.all(r.filter(e=>!e.filter||e.filter(...n)).map(e=>e.callback(...n)));return 1===i.length?i[0]:i}once(e,t,n,r){if(!e)throw Error("Module name is required");let i=async r=>{await n(r),this.off(e,t,i)};this.on(e,t,i,{filter:r})}clear(e){if(!e)return this.events={},void this.counts.clear();this.events[e]&&(delete this.events[e],this.counts.delete(e))}getEvents(e){return e?this.events[e]?this.events[e]:{}:this.events}getModuleEventsNames(e){return e&&this.events[e]?Object.keys(this.events[e]):[]}getModuleEventsCount(e){return this.getModuleEventsNames(e).length}listen(e,t){let n=Array.isArray(e)?e:[e];return n.forEach(e=>{this.listeners.has(e)||this.listeners.set(e,/* @__PURE__ */new Set),this.listeners.get(e)?.add(t)}),()=>{n.forEach(e=>{let n=this.listeners.get(e);n&&(n.delete(t),0===n.size&&this.listeners.delete(e))})}}touch(e){for(let t in e){let n=this.listeners.get(t);if(n)for(let t of n)t(e)}}},y_=({children:e,debugMode:t,onInit:n})=>{let r=k(()=>new g_({debugMode:t}),[t]);g(()=>()=>{r.clear()},[r]);let i=k(()=>({eventBridge:r}),[r]);return g(()=>{n?.(i)},[n,i]),/* @__PURE__ */I(Wu,{value:i,children:e})},b_=({id:e,interactions:t,triggers:n,callbacks:r,getAdditionalParams:i})=>{let{interactionsManager:a}=f(DS);g(()=>{if(e)return a.subscribe(e),()=>{a.unsubscribe(e)}},[e,a]),g(()=>{e&&a.update(e,t,n,r,i)},[e,t,n,r,i,a])},v_=(e,t)=>"function"==typeof e.type?e.type(t):e.type,w_=(e,t)=>{if("string"!=typeof t)return t;if("number"===e){let e=t.trim();if(""===e)return;let n=Number(e);return Number.isFinite(n)?n:t}return"boolean"!==e||"true"!==t&&"false"!==t?t:"true"===t},k_=(e,t)=>{if(!e)return t;let n="function"==typeof e?e(t):e,r={...t};for(let[i,a]of Object.entries(n))Object.hasOwn(t,i)&&(r[i]=w_(v_(a,t),t[i]));return r},x_={action:"delayTime",title:"Delay Time",type:"utility",params:{time:{label:"Time (Milliseconds)",type:"number"}},preview:{},callback:({time:e},t)=>new Promise(n=>{let r=t?.signal;if(r?.aborted)return void n(void 0);let i=()=>{clearTimeout(a),r?.removeEventListener("abort",i),n(void 0)},a=setTimeout(i,e);r?.addEventListener("abort",i,{once:!0})})},S_={action:"twigTemplate",title:"Twig Template",type:"utility",params:{returnMode:{label:"Mode",canBind:!1,type:"select",defaultValue:"text",options:[{label:"Text",value:"text"},{label:"Json Text",value:"json"},{label:"Json Object",value:"jsonObject"}]},template:{label:"Template",canBind:!1,defaultValue:"",type:e=>{let{returnMode:t}=e;return"text"===t?"codemirror-text":"codemirror-json"}}},preview:e=>{let{template:t,returnMode:n}=e;if("jsonObject"===n)try{let n=JSON.parse(Fn(t,e));if(n&&"object"==typeof n)return{template:"",content:Ur(n).reduce((e,t)=>({...e,[t]:""}),{})}}catch{}return{template:"",content:""}},callback:e=>{let{template:t,returnMode:n}=e,r="";try{r=Fn(t,e)}catch(DO){console.error(DO)}if("jsonObject"===n)try{return{content:JSON.parse(r)}}catch(DO){console.error(DO)}else if("json"===n)try{return JSON.parse(r),{content:r}}catch{return{content:""}}return{content:r}}},T_={origin:"Requests to the same site",all:"All cached requests",elements:"Only these containers",none:"None — this only reads"},C_=(e,t=()=>!0)=>({invalidateQueries:{type:"select",description:"What to refresh once the write succeeded, so the page shows the new data: the cached requests to the same site, all of them, only the api containers named in `invalidateElements`, or none for a step that only reads. Containers on screen ask again at once; the rest when they are shown.",default:e[0],options:[...e],optionLabels:Object.fromEntries(e.map(e=>[e,T_[e]])),label:"Refresh cached requests",canBind:!1,when:t},invalidateElements:{type:"elementIds",elementType:"apiContainer",description:"The api containers to refresh, by element id.",default:[],label:"Containers (ids)",when:e=>t(e)&&"elements"===e.invalidateQueries}}),A_=e=>{let t="string"==typeof e.method?e.method.toLowerCase():"get";return"get"===t||"head"===t},E_={title:"Webhook",type:"utility",strictParams:!0,params:{url:{type:"text",description:"The URL to call.",default:"",label:"Url"},method:{type:"select",description:"HTTP method.",default:"get",options:["get","post","put","delete","patch","head"],canBind:!1},body:{type:"json",description:'Request body: an object of fields (sent as JSON, or as form data when one of them is a file). Pass a real object, with templates for its values — `{ email: "{{ submitted.values.email }}" }`.',default:"",builderType:"textarea"},authorizationToken:{type:"text",description:"Value sent as the Authorization header.",default:""},headers:{type:"json",description:'Headers of the request, as an object of name to value, with templates for the values like the body: `{ "x-api-key": "{{ apiKey }}" }`. Authorization is set by `authorizationToken` and the content type follows the body, so neither is set here.',default:"",builderType:"textarea"},credentials:{type:"select",description:"fetch credentials mode.",default:"same-origin",options:["include","omit","same-origin"],optionLabels:{"same-origin":"Same Origin"}},cache:{type:"boolean",description:"Serve a GET from the page’s query cache while it is fresh, and keep the answer there — shared with any api container asking the same thing.",default:!1,label:"Cache response",when:A_},staleTime:{type:"number",description:"With `cache`: seconds the answer is served without asking again.",default:30,label:"Fresh for (s)",when:e=>A_(e)&&(!0===e.cache||"true"===e.cache)},...C_(["origin","all","elements","none"],e=>!A_(e))},preview:{response:{status:"",data:""}}},I_=/* @__PURE__ */new Set(["GET","HEAD"]),__=/* @__PURE__ */new Set(["GET","HEAD","DELETE"]),O_=e=>{let t=Number(e);return 1e3*(Number.isFinite(t)&&t>=0?t:Number(E_.params.staleTime.default))},N_=e=>e?{Authorization:`Bearer ${e}`}:{},M_=/* @__PURE__ */new Set(["authorization","content-type"]),P_=e=>"object"==typeof e&&e?Object.fromEntries(Object.entries(e).flatMap(([e,t])=>"string"!=typeof t&&"number"!=typeof t||""===t||M_.has(e.toLowerCase())?[]:[[e,String(t)]])):{},L_=async({url:e,authorizationToken:t,headers:n,body:r,credentials:i},a,o)=>{let s=(e=>"object"==typeof e&&e?e:{})(r),l=Object.values(s).some(e=>e instanceof Blob),c={method:a,headers:{...P_(n),...l?{}:{"Content-Type":"application/json"},...N_(t)},credentials:i,...o?{signal:o}:{}};if(!__.has(a))if(l){let e=new FormData;Object.entries(s).forEach(([t,n])=>{e.append(t,n)}),c.body=e}else c.body=JSON.stringify(s);let u=await fetch(e,c).catch(t=>{throw Error(`${a} ${e} got no answer: ${t instanceof Error?t.message:String(t)}`)}),d="";try{d=await u.json()}catch{}return{status:u.status,data:d}},D_=_d("webHook",E_,async(e,t)=>{let n=(e.method||"get").toUpperCase();if(I_.has(n)){if(!0!==e.cache&&"true"!==e.cache)return{response:await L_(e,n,t?.signal)};let r=sA({method:n,url:e.url,credentials:e.credentials,headers:{...P_(e.headers),...N_(e.authorizationToken)}});return{response:await eA.fetchQuery(r,{meta:{url:e.url},fetcher:()=>L_(e,n),staleTime:O_(e.staleTime),isCacheable:e=>e.status<400})}}let r=await L_(e,n,t?.signal);return r.status>=200&&r.status<300&&lA({mode:e.invalidateQueries,fallback:"origin",elements:e.invalidateElements,url:e.url}),{response:r}}),z_={delayTime:x_,twigTemplate:S_,webHook:D_},R_=(e,t,n,r,i)=>{if("utility"===e&&"twigTemplate"===i)return t;let a={...n,...r},o=(e,t,n)=>{if("string"==typeof e){let{value:n,unresolved:r}=((e,t)=>{let n=e,r=5;for((e=>"string"==typeof e&&/\{\{[\s\S]*?\}\}|\{%[\s\S]*?%\}/.test(e))(n)&&!Qn(e)&&(n=Wn(e,t),r--);"string"==typeof n&&Qn(n)&&r>0;)n=Wn(n,t),r--;return{value:n,unresolved:"string"==typeof n&&Qn(n)}})(e,a);return r&&Vl.warning("interactions",/* @__PURE__ */_("span",{children:["Twig token resolution exceeded ",5," passes for ",
131
+ return I(Ul,{value:d,children:e})},KI={display:"contents"},YI=({children:e})=>{let t=x(null),n=x(void 0),r=x(void 0),i=m(mt),a=f(Yc),o=f(OS),s=f(Fr),l=f(Wa);return w(()=>{let e=t.current;if(e)return clearTimeout(r.current),n.current??=C(e),()=>{let e=n.current;r.current=setTimeout(()=>{e?.unmount(),n.current===e&&(n.current=void 0)},0)}},[]),w(()=>{n.current?.render(/* @__PURE__ */I(mt,{value:i,children:/* @__PURE__ */I(Wa,{value:l,children:/* @__PURE__ */I(Yc,{value:a,children:/* @__PURE__ */I(OS,{value:o,children:/* @__PURE__ */I(Fr,{value:s,children:e})})})})}))}),/* @__PURE__ */I("div",{ref:t,style:KI})},JI=[],XI=/* @__PURE__ */new Set,ZI=[],QI=()=>{ZI=[...JI];for(let e of XI)e()},e_=e=>(XI.add(e),()=>{XI.delete(e)}),t_=()=>ZI,n_=()=>wI,r_=e=>{wI!==e&&(wI=e,QI())},i_=()=>({instanceIds:T(e_,t_,t_),selectedId:T(e_,n_,n_)}),a_=()=>()=>{},o_=(e,t,n)=>{window.dispatchEvent(new CustomEvent("customstorage-changed",{detail:{key:e,oldValue:t,newValue:n}}))},s_=()=>{let e={};if(typeof document>"u"||!document.cookie)return e;for(let t of document.cookie.split(";")){let n=t.indexOf("=");-1!==n&&(e[t.slice(0,n).trim()]=decodeURIComponent(t.slice(n+1).trim()))}return e},l_=e=>new Proxy(e,{get(e,t,n){if("setItem"===t)return(t,n)=>{let r=e.getItem(t);e.setItem.call(e,t,n),r!==n&&o_(t,r,n)};if("removeItem"===t)return t=>{let n=e.getItem(t);e.removeItem.call(e,t),null!==n&&o_(t,n,null)};let r=Reflect.get(e,t,n);return"function"==typeof r?r.bind(e):r}}),c_=e=>"cookie"===e?typeof document<"u"?l_((()=>{let e={getItem(e){let t=s_();return e in t?t[e]:null},setItem(e,t){typeof document<"u"&&(document.cookie=`${e}=${encodeURIComponent(t)}; path=/; max-age=31536000; samesite=lax`)},removeItem(e){typeof document<"u"&&(document.cookie=`${e}=; path=/; max-age=0; samesite=lax`)},clear(){for(let t of Object.keys(s_()))e.removeItem(t)},key:e=>Object.keys(s_())[e]??null,get length(){return Object.keys(s_()).length}};return e})()):void 0:"sessionStorage"===e?typeof sessionStorage<"u"?l_(sessionStorage):void 0:typeof localStorage<"u"?l_(localStorage):void 0,u_=function(e,t,n="localStorage",r=!0){let[i,a]=k(()=>{if(e.includes(".")){let t=e.split(".").filter(Boolean);return[t.shift(),t.join(".")]}return[e,""]},[e]),o=x(c_(n));Cs(()=>{o.current=c_(n)},[n]);let[s,l]=S(()=>{try{if(!o.current)return t;let e=o.current.getItem(i);if(!e)return t;let n=JSON.parse(e);return a?sr(n,a,t):n}catch{return t}});g(()=>{try{if(!o.current)return;let e=s;if(a){let t=o.current.getItem(i);e=$l(t?JSON.parse(t):{},e=>{lr(e,a,s)})}o.current.setItem(i,JSON.stringify(e))}catch(DO){}},[i,a,s]);let c=h(e=>{if(e.key===i)try{let n=e.newValue?JSON.parse(e.newValue):t;l(a?sr(n,a,t):n)}catch{}},[i,a,t]),u=h(e=>{if(e.detail.key===i)try{let n=e.detail.newValue?JSON.parse(e.detail.newValue):t;l(a?sr(n,a,t):n)}catch{}},[i,a,t]);return g(()=>{if(typeof window<"u"&&r)return window.addEventListener("storage",c),window.addEventListener("customstorage-changed",u),()=>{window.removeEventListener("storage",c),window.removeEventListener("customstorage-changed",u)}},[c,u,n,r]),[s,l]},d_=d(()=>import("./plitzi-sdk-devtools-DdY_8y58.js")),p_="horizontal",f_=0,h_=({children:e,className:t,innerClassName:n,enabled:r=!1,instanceId:i,renderMode:a="default",scroll:s="container",qa:l=!1,devToolsStyle:c="",devToolsStyleLink:u="",devToolsIconsLink:d=""})=>{let{resolvedTheme:p}=eu(),[f,y]=u_("plitzi-sdk.dev-tools.orientation",p_),[b,v]=u_("plitzi-sdk.dev-tools.collapsed",!0),[w,k]=u_("plitzi-sdk.dev-tools.tab","logs"),[C,A]=S(),E=x(void 0),O=x(null);E.current||="sdk-instance-"+ ++f_;let N=i||E.current,M=T(a_,()=>!0,()=>!1),P=M?f:p_,L=((e,t)=>{g(()=>{if(t)return(e=>(JI.push(e),void 0===wI&&(wI=e),QI(),()=>{let t=JI.indexOf(e);-1!==t&&JI.splice(t,1),wI===e&&(wI=JI[0]),QI()}))(e)},[t,e]);let n=T(e_,n_,n_);return t&&n===e})(N,r);(e=>{let t=m(mt);g(()=>{if(e&&!Ne&&t)return Qe(t)},[e,t])})(r),((e,t)=>{g(()=>{if(e)return Qe(eA.store,t,"Queries")},[e,t])})(L,N),VI(L);let D=h(e=>y(e),[y]),z=h(e=>{e&&k("logs"),A(e),v(!1)},[v,k]),R=h(()=>v(!0),[v]),j=h(e=>{A(void 0),k(e)},[k]);if(!r)return e;let $="document"===s&&(!M||b),F=L&&M&&/* @__PURE__ */I(YI,{children:/* @__PURE__ */I(GI,{children:/* @__PURE__ */_(o,{fallback:null,children:["default"===a&&/* @__PURE__ */I(d_,{className:U({dark:"dark"===p}),collapsed:b,orientation:P,tabSelected:w,logTypeFilter:C,onOpen:z,onCollapse:R,onTabSelect:j,onChangeOrientation:D,pageRef:O,qa:l}),"shadow"===a&&/* @__PURE__ */_(hI,{children:[d&&/* @__PURE__ */I(hI.Link,{href:d}),u&&/* @__PURE__ */I(hI.Link,{href:u}),
132
+ /* @__PURE__ */_(hI.Content,{children:[/* @__PURE__ */I("style",{dangerouslySetInnerHTML:{__html:c}}),/* @__PURE__ */I(d_,{className:U({dark:"dark"===p}),collapsed:b,orientation:P,tabSelected:w,logTypeFilter:C,onOpen:z,onCollapse:R,onTabSelect:j,onChangeOrientation:D,pageRef:O,qa:l})]})]})]})})});/* @__PURE__ */
133
+ return _("div",{className:U("relative flex min-w-0 grow",{"overflow-auto":!$,"flex-col":$||"horizontal"===P,"h-screen":!$&&"vertical"===P},t),children:[/* @__PURE__ */I(ht,{value:N,children:/* @__PURE__ */I("div",{ref:O,className:U("grow",{"basis-0 flex-col overflow-auto":!$},n),children:e})}),$?/* @__PURE__ */I("div",{className:"sticky bottom-0 h-0",children:F}):F]})},m_=({children:e})=>{let{environment:t}=X(),[[n,r,i,a,o,s,l,c=""]]=Mt(["schema.variables","navigation.routeParams","navigation.queryParams","navigation.hostname","navigation.origin","navigation.href","navigation.currentPageId","navigation.pendingLocation"]),u=oc(k(()=>Bl(n,{routeParams:r,queryParams:i,hostname:a,environment:t}),[t,a,i,r,n])),d=h(()=>Ur(u).map(e=>({path:e,name:`variables.${e}`})),[u]);ql({id:"global",source:"variables",name:"Variables",fields:d}),Pt("runtime.sources.variables",u);let[p={}]=Mt("pageDefinitions"),m=k(()=>Object.values(p).map(e=>({value:e.id,label:sr(e,"attributes.name",e.id)})),[p]),y=k(()=>({routeParams:r,queryParams:i,origin:o,href:s,currentPageId:l,pending:""!==c,pendingLocation:c}),[r,i,o,s,l,c]),b=h(()=>[...Ur({routeParams:r,queryParams:i}).map(e=>({path:e,name:`navigation.${e}`})),{path:"origin",name:"Origin"},{path:"href",name:"This page’s address"},{path:"pending",name:"A navigation is on its way"},{path:"pendingLocation",name:"Where a navigation is going"},m.length>0?{path:"currentPageId",name:"Current Page",inputType:"select",values:m}:{path:"currentPageId",name:"Current Page"}],[r,i,m]);ql({id:"global",source:"navigation",name:"Navigation",fields:b}),Pt("runtime.sources.navigation",y);let v=f(vS),{user:w,authenticated:S,state:T}=v,[C="basic"]=Mt("schema.settings.userProvider"),A=k(()=>""===C?{}:{isAuthenticated:S,...void 0===T?{}:{status:T},accessToken:w?.accessToken??"",details:{username:"",email:"",roles:"",permissions:"",verified:"",...w?.details??{}}},[C,w,S,T]),E=h(()=>Ur(A).map(e=>({path:e,name:`user.${e}`})),[A]);ql({id:"global",source:"auth",name:"Auth State",fields:E}),Pt("runtime.sources.auth",A);let I=(e=>{let{environment:t}=X(),[[n,r,i,a,o]]=Mt(["schema.flags","navigation.routeParams","navigation.queryParams","navigation.hostname","flags.overrides"]),{authenticated:s,user:l}=e,c=k(()=>kS({authenticated:s,user:l}),[s,l]);return oc(k(()=>rc(n,{environment:t,hostname:a,routeParams:r,queryParams:i,user:c},o),[n,t,a,r,i,c,o]))})(v),_=k(()=>ic(I),[I]),O=h(()=>Object.keys(_).map(e=>({path:e,name:`flags.${e}`,inputType:"checkbox"})),[_]);ql({id:"global",source:"flags",name:"Feature Flags",fields:O}),Pt("runtime.sources.flags",_),Pt("flags.resolved",I);let[N,M]=Mt(["schema.flags","flags.overrides"])[0],P=oc(((e,t)=>tc.flatMap(n=>Object.keys(t[n]??{}).filter(t=>!Object.hasOwn(e??{},t)).map(e=>({layer:n,name:e}))))(N,M??{}));g(()=>{P.forEach(({layer:e,name:t})=>console.warn(`[plitzi] The ${e} sets the feature flag "${t}", which this space does not declare: the override is ignored. Declare the flag in the space, or remove the override.`))},[P]);let[L]=Mt("runtime.state"),D=h(()=>Ur(L).map(e=>({path:e,name:`state.${e}`})),[L]);ql({id:"global",source:"state",name:"State",fields:D}),Pt("runtime.sources.state",L);let[z]=Mt("runtime.host"),R=h(()=>Ur(z).map(e=>({path:e,name:`host.${e}`})),[z]);ql({id:"global",source:"host",name:"Host",fields:R}),Pt("runtime.sources.host",z);let{theme:j,resolvedTheme:$}=eu(Qc),F=k(()=>({mode:j,resolved:$}),[j,$]),q=h(()=>Ur(F).map(e=>({path:e,name:`theme.${e}`})),[F]);ql({id:"global",source:"theme",name:"Theme",fields:q}),Pt("runtime.sources.theme",F);let[B]=Mt("schema.settings.computed"),U=x(void 0),H=k(()=>si(B??{},{variables:u,navigation:y,auth:A,state:L??{},host:z??{},theme:F,flags:_},U.current),[B,u,y,A,L,z,F,_]);U.current=H;let W=h(()=>Ur(H).map(e=>({path:e,name:`computed.${e}`})),[H]);return ql({id:"global",source:"computed",name:"Computed",fields:W}),Pt("runtime.sources.computed",H),e},g_=class{debugMode=!1;events;listeners=/* @__PURE__ */new Map;counts=/* @__PURE__ */new Map;constructor({events:e,debugMode:t=!1}={}){this.events=e??{},this.debugMode=t;for(let[n,r]of Object.entries(this.events))this.counts.set(n,Object.keys(r).length)}has(e,t){if(!e)throw Error("Module name is required");return this.events[e]&&this.events[e][t]}on(e,t,n,r={}){let{filter:i,override:a=!1}=r;if(!e)throw Error("Module name is required");if(!n||"function"!=typeof n)throw Error("Callback must be a function");this.events[e]||(this.events[e]={}),this.events[e][t]||this.counts.set(e,(this.counts.get(e)??0)+1),(!this.events[e][t]||a&&this.events[e][t].length>0)&&(this.events[e][t]=[]),this.events[e][t].push({callback:n,filter:i})}get(e,t){return this.has(e,t)?this.events[e]?.[t]:[]}off(e,t,n){if(this.has(e,t)&&this.events[e]&&(this.events[e][t]=n?this.events[e][t]?.filter(e=>e.callback!==n):[],0===this.events[e][t]?.length)){delete this.events[e][t];let n=(this.counts.get(e)??1)-1;n>0?this.counts.set(e,n):(this.counts.delete(e),delete this.events[e])}}async emit(e,t=[],...n){let r;this.debugMode&&Vl.info("eventBridge","Event Triggered",{module:e,events:t,data:n}),r=Array.isArray(t)?t:[t];let i=[];r.forEach(t=>{if(!this.has(e,t))return;let r=this.get(e,t);r&&r.forEach(e=>{let{callback:t,filter:r}=e;(!r||"function"!=typeof r||r(...n))&&i.push(t(...n))})});let a=await Promise.all(i);return this.touch(r.reduce((e,t)=>({...e,[t]:n}),{})),a}async emitWithResponse(e,t,...n){if(!this.has(e,t))return;let r=this.get(e,t);if(!r)return;let i=await Promise.all(r.filter(e=>!e.filter||e.filter(...n)).map(e=>e.callback(...n)));return 1===i.length?i[0]:i}once(e,t,n,r){if(!e)throw Error("Module name is required");let i=async r=>{await n(r),this.off(e,t,i)};this.on(e,t,i,{filter:r})}clear(e){if(!e)return this.events={},void this.counts.clear();this.events[e]&&(delete this.events[e],this.counts.delete(e))}getEvents(e){return e?this.events[e]?this.events[e]:{}:this.events}getModuleEventsNames(e){return e&&this.events[e]?Object.keys(this.events[e]):[]}getModuleEventsCount(e){return this.getModuleEventsNames(e).length}listen(e,t){let n=Array.isArray(e)?e:[e];return n.forEach(e=>{this.listeners.has(e)||this.listeners.set(e,/* @__PURE__ */new Set),this.listeners.get(e)?.add(t)}),()=>{n.forEach(e=>{let n=this.listeners.get(e);n&&(n.delete(t),0===n.size&&this.listeners.delete(e))})}}touch(e){for(let t in e){let n=this.listeners.get(t);if(n)for(let t of n)t(e)}}},y_=({children:e,debugMode:t,onInit:n})=>{let r=k(()=>new g_({debugMode:t}),[t]);g(()=>()=>{r.clear()},[r]);let i=k(()=>({eventBridge:r}),[r]);return g(()=>{n?.(i)},[n,i]),/* @__PURE__ */I(Wu,{value:i,children:e})},b_=({id:e,interactions:t,triggers:n,callbacks:r,getAdditionalParams:i})=>{let{interactionsManager:a}=f(DS);g(()=>{if(e)return a.subscribe(e),()=>{a.unsubscribe(e)}},[e,a]),g(()=>{e&&a.update(e,t,n,r,i)},[e,t,n,r,i,a])},v_=(e,t)=>"function"==typeof e.type?e.type(t):e.type,w_=(e,t)=>{if("string"!=typeof t)return t;if("number"===e){let e=t.trim();if(""===e)return;let n=Number(e);return Number.isFinite(n)?n:t}return"boolean"!==e||"true"!==t&&"false"!==t?t:"true"===t},k_=(e,t)=>{if(!e)return t;let n="function"==typeof e?e(t):e,r={...t};for(let[i,a]of Object.entries(n))Object.hasOwn(t,i)&&(r[i]=w_(v_(a,t),t[i]));return r},x_={action:"delayTime",title:"Delay Time",type:"utility",params:{time:{label:"Time (Milliseconds)",type:"number"}},preview:{},callback:({time:e},t)=>new Promise(n=>{let r=t?.signal;if(r?.aborted)return void n(void 0);let i=()=>{clearTimeout(a),r?.removeEventListener("abort",i),n(void 0)},a=setTimeout(i,e);r?.addEventListener("abort",i,{once:!0})})},S_={action:"twigTemplate",title:"Twig Template",type:"utility",params:{returnMode:{label:"Mode",canBind:!1,type:"select",defaultValue:"text",options:[{label:"Text",value:"text"},{label:"Json Text",value:"json"},{label:"Json Object",value:"jsonObject"}]},template:{label:"Template",canBind:!1,defaultValue:"",type:e=>{let{returnMode:t}=e;return"text"===t?"codemirror-text":"codemirror-json"}}},preview:e=>{let{template:t,returnMode:n}=e;if("jsonObject"===n)try{let n=JSON.parse(Fn(t,e));if(n&&"object"==typeof n)return{template:"",content:Ur(n).reduce((e,t)=>({...e,[t]:""}),{})}}catch{}return{template:"",content:""}},callback:e=>{let{template:t,returnMode:n}=e,r="";try{r=Fn(t,e)}catch(DO){console.error(DO)}if("jsonObject"===n)try{return{content:JSON.parse(r)}}catch(DO){console.error(DO)}else if("json"===n)try{return JSON.parse(r),{content:r}}catch{return{content:""}}return{content:r}}},T_={origin:"Requests to the same site",all:"All cached requests",elements:"Only these containers",none:"None — this only reads"},C_=(e,t=()=>!0)=>({invalidateQueries:{type:"select",description:"What to refresh once the write succeeded, so the page shows the new data: the cached requests to the same site, all of them, only the api containers named in `invalidateElements`, or none for a step that only reads. Containers on screen ask again at once; the rest when they are shown.",default:e[0],options:[...e],optionLabels:Object.fromEntries(e.map(e=>[e,T_[e]])),label:"Refresh cached requests",canBind:!1,when:t},invalidateElements:{type:"elementIds",elementType:"apiContainer",description:"The api containers to refresh, by element id.",default:[],label:"Containers (ids)",when:e=>t(e)&&"elements"===e.invalidateQueries}}),A_=e=>{let t="string"==typeof e.method?e.method.toLowerCase():"get";return"get"===t||"head"===t},E_={title:"Webhook",type:"utility",strictParams:!0,params:{url:{type:"text",description:"The URL to call.",default:"",label:"Url"},method:{type:"select",description:"HTTP method.",default:"get",options:["get","post","put","delete","patch","head"],canBind:!1},body:{type:"json",description:'Request body: an object of fields (sent as JSON, or as form data when one of them is a file). Pass a real object, with templates for its values — `{ email: "{{ submitted.values.email }}" }`.',default:"",builderType:"textarea"},authorizationToken:{type:"text",description:"Value sent as the Authorization header.",default:""},headers:{type:"json",description:'Headers of the request, as an object of name to value, with templates for the values like the body: `{ "x-api-key": "{{ apiKey }}" }`. Authorization is set by `authorizationToken` and the content type follows the body, so neither is set here.',default:"",builderType:"textarea"},credentials:{type:"select",description:"fetch credentials mode.",default:"same-origin",options:["include","omit","same-origin"],optionLabels:{"same-origin":"Same Origin"}},cache:{type:"boolean",description:"Serve a GET from the page’s query cache while it is fresh, and keep the answer there — shared with any api container asking the same thing.",default:!1,label:"Cache response",when:A_},staleTime:{type:"number",description:"With `cache`: seconds the answer is served without asking again.",default:30,label:"Fresh for (s)",when:e=>A_(e)&&(!0===e.cache||"true"===e.cache)},...C_(["origin","all","elements","none"],e=>!A_(e))},preview:{response:{status:"",data:""}}},I_=/* @__PURE__ */new Set(["GET","HEAD"]),__=/* @__PURE__ */new Set(["GET","HEAD","DELETE"]),O_=e=>{let t=Number(e);return 1e3*(Number.isFinite(t)&&t>=0?t:Number(E_.params.staleTime.default))},N_=e=>e?{Authorization:`Bearer ${e}`}:{},M_=/* @__PURE__ */new Set(["authorization","content-type"]),P_=e=>"object"==typeof e&&e?Object.fromEntries(Object.entries(e).flatMap(([e,t])=>"string"!=typeof t&&"number"!=typeof t||""===t||M_.has(e.toLowerCase())?[]:[[e,String(t)]])):{},L_=async({url:e,authorizationToken:t,headers:n,body:r,credentials:i},a,o)=>{let s=(e=>"object"==typeof e&&e?e:{})(r),l=Object.values(s).some(e=>e instanceof Blob),c={method:a,headers:{...P_(n),...l?{}:{"Content-Type":"application/json"},...N_(t)},credentials:i,...o?{signal:o}:{}};if(!__.has(a))if(l){let e=new FormData;Object.entries(s).forEach(([t,n])=>{e.append(t,n)}),c.body=e}else c.body=JSON.stringify(s);let u=await fetch(e,c).catch(t=>{throw Error(`${a} ${e} got no answer: ${t instanceof Error?t.message:String(t)}`)}),d="";try{d=await u.json()}catch{}return{status:u.status,data:d}},D_=_d("webHook",E_,async(e,t)=>{let n=(e.method||"get").toUpperCase();if(I_.has(n)){if(!0!==e.cache&&"true"!==e.cache)return{response:await L_(e,n,t?.signal)};let r=sA({method:n,url:e.url,credentials:e.credentials,headers:{...P_(e.headers),...N_(e.authorizationToken)}});return{response:await eA.fetchQuery(r,{meta:{url:e.url},fetcher:()=>L_(e,n),staleTime:O_(e.staleTime),isCacheable:e=>e.status<400})}}let r=await L_(e,n,t?.signal);return r.status>=200&&r.status<300&&lA({mode:e.invalidateQueries,fallback:"origin",elements:e.invalidateElements,url:e.url}),{response:r}}),z_={delayTime:x_,twigTemplate:S_,webHook:D_},R_=(e,t,n,r,i)=>{if("utility"===e&&"twigTemplate"===i)return t;let a={...n,...r},o=(e,t,n)=>{if("string"==typeof e){let{value:n,unresolved:r}=((e,t)=>{let n=e,r=5;for((e=>"string"==typeof e&&/\{\{[\s\S]*?\}\}|\{%[\s\S]*?%\}/.test(e))(n)&&!Qn(e)&&(n=Wn(e,t),r--);"string"==typeof n&&Qn(n)&&r>0;)n=Wn(n,t),r--;return{value:n,unresolved:"string"==typeof n&&Qn(n)}})(e,a);return r&&Vl.warning("interactions",/* @__PURE__ */_("span",{children:["Twig token resolution exceeded ",5," passes for ",
133
134
  /* @__PURE__ */I("b",{children:t}),", leaving unresolved tokens"]}),{param:t,value:n}),n}return n>=5||"object"!=typeof e||!e?e:Array.isArray(e)?e.map(e=>o(e,t,n+1)):Object.fromEntries(Object.entries(e).map(([e,r])=>[e,o(r,t,n+1)]))};return Object.keys(t).reduce((n,r)=>{let i="trigger"===e?t[r]:o(t[r],r,0);return{...n,[r]:i}},{})},j_=e=>Object.fromEntries(Object.entries(e).filter(e=>(e=>"function"!=typeof e&&"symbol"!=typeof e&&"bigint"!=typeof e)(e[1]))),$_=e=>"object"==typeof e&&!!e&&"then"in e&&"function"==typeof e.then,F_=(e,t={},n={},r={},i={})=>{let a=[],{id:o,action:s,enabled:l,params:c,elementId:u,type:d,when:p}=e;if(!s||!l)return{status:"disabled",result:{},postCallbacks:a};let f=j_({...r,...n,[o]:c});if(p&&!Ma(p,f))return{status:"skipped",result:{},postCallbacks:a,whenParams:f};let h,m=t=>(Vl.danger("interactions",/* @__PURE__ */_("span",{children:["Interaction node failed ",/* @__PURE__ */I("b",{children:s})]}),{error:t instanceof Error?t.message:String(t),node:e}),{status:"failed",result:{},postCallbacks:a,whenParams:f});switch(d){case"callback":case"globalCallback":if(!u)return Vl.warning("interactions",/* @__PURE__ */_("span",{children:["Step ",
134
135
  /* @__PURE__ */I("b",{children:s})," names no element, so there is nothing to run it on"]}),{node:e}),{status:"failed",result:{},postCallbacks:a,whenParams:f};if(h=sr(t,`${u}.${s}`),!h)return Vl.warning("interactions",/* @__PURE__ */_("span",{children:["Nothing is registered as ",
135
136
  /* @__PURE__ */I("b",{children:`${u}.${s}`}),", so this step did nothing"]}),{node:e,available:Object.keys(sr(t,u,{}))}),{status:"failed",result:{},postCallbacks:a,whenParams:f};break;case"utility":h=sr(z_,s,{});break;default:return{status:"success",result:{},postCallbacks:a,whenParams:f}}try{let e={...n,...r,...k_(h.params,R_(d,c,n,r,s))},{callback:t,postCallback:l}=h,u=t=>(l&&a.push({id:o,callback:l,params:{...e,[o]:t}}),{status:"success",result:t,postCallbacks:a,whenParams:f}),p=t?t(e,i):{};return $_(p)?Promise.resolve(p).then(u,m):u(p)}catch(DO){return m(DO)}},q_=async(e=[])=>{let t={};return await Promise.all(e.reverse().map(async({id:e,callback:n,params:r})=>{t[e]=await(n?.(hr(r,[e]),r[e]))})),t},B_=()=>({}),U_=async(e,t={},n={},r={},i=B_,a=[],o={},s={})=>{let l=e,c=r;for(;l;){if(s.signal?.aborted)return o;let e=sr(t,l.afterNode);if(!e)return a.length>0&&await q_(a),o;let r=Vl.getTime().valueOf(),u=F_(e,n,c,i(),s),d=$_(u)?await u:u,{result:p,postCallbacks:f,whenParams:h}=d,m="failed"===d.status&&s.signal?.aborted?"skipped":d.status;o[e.id]={node:e,status:m,result:p,postCallbacks:f,whenParams:h,startTime:r,endTime:Vl.getTime().valueOf()},a.push(...f),c={...c,[e.id]:p},l=e}return o},H_=(e,t,n={},r,i)=>{let a=Vl.getTime().valueOf(),o="skipped"===r?"skipped":"success",s=/* @__PURE__ */_("span",{children:["Interaction triggered ",
@@ -145,11 +146,11 @@ return I(DS,{value:a,children:e})},K_={runServerAction:{source:"actions",title:"
145
146
  /* @__PURE__ */I("b",{children:n})," could not be reached"]}),{actionId:n,error:e instanceof Error?e.message:String(e)}),o(t?.hostElementId,"onFlowError",{actionId:n,runId:"",error:"",reason:"failed"}),J_}let g=await h.json().catch(()=>({}));return h.ok?(m({status:"completed"===g.status?"completed":"failed",...g.runId?{runId:g.runId}:{},...g.output?{output:g.output}:{},...g.error?{error:g.error}:{},...g.steps?{steps:g.steps}:{},...g.trace?{trace:g.trace}:{}}),{status:g.status??"completed",runId:g.runId??"",output:g.output??{},...g.error?{error:g.error}:{}}):(Z_(h.status,g,r),m({status:"failed",...g.runId?{runId:g.runId}:{},...g.reason?{reason:g.reason}:{},...g.error?{error:g.error}:{},...g.steps?{steps:g.steps}:{}}),Vl.warning("actions",/* @__PURE__ */_("span",{children:["Server action ",
146
147
  /* @__PURE__ */I("b",{children:n})," was refused"]}),{actionId:n,mode:i,runId:g.runId,reason:g.reason,error:g.error,status:String(h.status)}),{status:"failed",reason:g.reason??"failed",runId:g.runId??"",output:{},...g.error?{error:g.error}:{}})},[r,o]),l=h(async e=>{if(!r||!e.runId)return{cancelled:!1};try{let t=204===(await fetch(`${r}/run/${e.runId}`,{method:"DELETE",credentials:"same-origin"})).status;return Vl.info("actions",/* @__PURE__ */_("span",{children:["Server action run ",
147
148
  /* @__PURE__ */I("b",{children:e.runId})," ",t?"cancelled":"was not cancelled"]}),{actionId:"",mode:"cancel",runId:e.runId,status:t?"aborted":"failed"}),{cancelled:t}}catch{return{cancelled:!1}}},[r]),c=k(()=>(i??[]).map(e=>({label:`${e.name} (${e.identifier})`,value:e.identifier})),[i]);return t({id:"actions",callbacks:k(()=>Od(K_,{cancelServerAction:l,runServerAction:s},{runServerAction:{params:e=>{let t=Id(K_.runServerAction.params),n=(i??[]).find(t=>t.identifier===e.actionId),r=Object.entries(n?.input??{});return{...t,actionId:{...t.actionId,type:()=>c.length>0?"select":"text",canBind:!0,label:!1===a?"Action — this space has no server to run it":"Action",options:c},input:{...t.input,canBind:!0,label:r.length>0?`Input — ${r.map(([e,t])=>`${e}${t.required?"*":""}: ${t.type}`).join(", ")}`:"Input"}}}}}),[s,l,c,i,a])}),e},eO={login:{source:"auth",title:"Auth Login",strictParams:!0,params:{mode:{type:"select",description:"Credentials to sign in with: a username and password, or a token obtained elsewhere.",default:"normal",options:["normal","token","mfa"],optionLabels:{normal:"User and Password",token:"Token",mfa:"Second factor"},canBind:!1},username:{type:"text",description:"Username.",default:"",when:e=>"normal"===e.mode},password:{type:"text",description:"Password.",default:"",when:e=>"normal"===e.mode},token:{type:"text",description:"A token to exchange for a session.",default:"",when:e=>"token"===e.mode},mfaToken:{type:"text",description:"The challenge a sign-in answered with when it owed a second factor: `{{ login.mfaToken }}`.",default:"",when:e=>"mfa"===e.mode},code:{type:"text",description:"The code from the authenticator app, or a recovery code.",default:"",when:e=>"mfa"===e.mode}},preview:{ok:"",reason:"",mfaToken:"",errors:{username:"",password:"",token:""},accessToken:"",expiresAt:"",refreshToken:""}},refreshDetails:{source:"auth",title:"Auth Refresh Details",strictParams:!0,params:{},preview:{errors:"",accessToken:"",expiresAt:"",refreshToken:""}},logout:{source:"auth",title:"Auth Logout",strictParams:!0,params:{}}},tO=({children:e,authProvider:t="basic"})=>{let{login:n,refresh:r,logout:i}=f(vS),{useInteractions:a}=f(DS),o=h(e=>n(e),[n]),s=h(e=>r(e),[r]),l=h(()=>i(),[i]);return a({id:"auth",callbacks:k(()=>""===t?{}:Od(eO,{login:o,refreshDetails:s,logout:l}),[o,l,s,t])}),e},nO={hostAction:{source:"host",title:"Host Action",strictParams:!0,params:{action:{type:"text",description:"The name the host registered the handler under — `openSpace`, `signOut`, whatever it offers.",default:""},value:{type:"scalar",description:"What the action is about: the space to open, the workspace to switch to. Optional.",default:""}}}},rO=({children:e,actions:t})=>{let{useInteractions:n}=f(DS),r=h(e=>{let{action:n,value:r}=e,i=n?t?.[n]:void 0;i&&i({...e,value:r})},[t]);return n({id:"host",callbacks:k(()=>Od(nO,{hostAction:r}),[r])}),e},iO={navigate:{source:"navigation",title:"Navigate",strictParams:!0,params:{urlType:{type:"select",description:"Target kind: a space page, an internal space path, or an external URL.",options:["page","internal","external"],optionLabels:{page:"Space Page",internal:"Inside Space",external:"Outside Space"}},url:{type:"text",description:'Destination — a page id when urlType is "page", otherwise a URL/path.',when:e=>!!e.urlType,builderType:e=>"page"===e.urlType?"select":"text"}}}},aO=({children:e,previewMode:t=!1})=>{let{useInteractions:n}=f(DS),[[r,i,a]]=zt(["schema.pages","pageDefinitions","navigation.navigate"]),o=k(()=>{let e=cr(i,r);return Object.keys(e).reduce((t,n)=>{let r=e[n];return[...t,{key:n,label:sr(r,"attributes.name",n),defaultPage:sr(r,"attributes.default",!1)}]},[])},[i,r]),s=h(e=>{if(!t)return;let{url:n,urlType:r}=e;"page"===r||"internal"===r?a(n):a(n,!0)},[a,t]);return n({id:"navigation",callbacks:k(()=>{let{urlType:e,url:t}=Id(iO.navigate.params);return Od(iO,{navigate:s},{navigate:{params:{urlType:e,url:{...t,defaultValue:o.find(e=>e.defaultPage)?.key??"",options:o.map(e=>({value:e.key,label:e.label}))}}}})},[s,o])}),e},oO={invalidateQueries:{source:"queries",title:"Invalidate Queries",strictParams:!0,params:{elements:{type:"elementIds",elementType:"apiContainer",description:"The api containers to refresh, by element id — the way to name a request whose URL is a template. Leave both this and `url` empty to refresh every cached request on the page.",default:[],label:"Containers (ids)"},url:{type:"text",description:"Only the requests whose URL starts with this — `/api/orders` covers `/api/orders?page=2`. With `elements` too, a request must match both.",default:"",label:"URL prefix"}},preview:{}}},sO=({children:e})=>{let{useInteractions:t}=f(DS),n=h(e=>oA({url:e.url??"",elements:iA(e.elements)}),[]);return t({id:"queries",callbacks:k(()=>Od(oO,{invalidateQueries:n}),[n])}),e},lO={setState:{source:"state",title:"Set State",strictParams:!0,params:{key:{type:"text",description:"The state key/path to set. Stored under `runtime.state.<key>`.",default:""},type:{type:"select",description:'The value type. What is stored is coerced to it — a boolean is a real boolean, not "true"; `json` stores an object or a list (a template naming one, or JSON text).',options:["boolean","number","text","json"],optionLabels:{boolean:"True / False",number:"Numeric",text:"Text",json:"Object / List (JSON)"}},value:{type:"json",description:"The value to store — its type follows the `type` param (a real boolean/number, text, or an object/list).",when:e=>!!e.type,builderType:e=>"boolean"===e.type?"select":"text",options:["true","false"]}}},toggleState:{source:"state",title:"Toggle State",strictParams:!0,params:{key:{type:"text",description:"The state key/path to flip, under `runtime.state.<key>`. Anything not already true is treated as false, so a key that has never been set toggles to true.",default:""}}},appendState:{source:"state",title:"Append To State",strictParams:!0,params:{key:{type:"text",description:"The state key/path holding the list, under `runtime.state.<key>`. Created if it is not there.",default:""},value:{type:"scalar",description:"What to add to the end of the list.",default:""},unique:{type:"boolean",description:"Skip the append when the list already holds this value. For a list whose entries are their own identity — anything referring to one refers to it by value, so a second copy is indistinguishable.",default:!1},withId:{type:"boolean",description:"Store the entry as `{ id, value }` with an id of its own, so two entries that read the same are still two entries. Anything reading one back names `.value`; anything referring to one names `.id`.",default:!1}}},removeState:{source:"state",title:"Remove From State",strictParams:!0,params:{key:{type:"text",description:"The state key/path holding the list, under `runtime.state.<key>`.",default:""},value:{type:"scalar",description:"The entry to drop, by value — every copy of it. Prefer this wherever the list can change under the person: a position is only true until something before it moves.",default:""},by:{type:"text",description:"The FIELD carrying the identity, for a list of records rather than of scalars — `id` for entries appended with `withId`. Without it the whole entry is compared, which never matches a record.",default:""},index:{type:"text",description:"Which entry to drop, by position, when there is no value to go on. Inside a controlled list, `{{ <listSource>.index }}` is the row own position. An index that resolves to nothing removes nothing.",default:""}}},moveState:{source:"state",title:"Move Between Lists",strictParams:!0,params:{from:{type:"text",description:"The list to take it out of, under `runtime.state.<key>`.",default:""},to:{type:"text",description:"The list to put it into. It is not added twice.",default:""},value:{type:"scalar",description:"The entry to move. Absent from `from` means nothing happens.",default:""}}},toggleInState:{source:"state",title:"Toggle In List",strictParams:!0,params:{key:{type:"text",description:"The list to add to or drop from, under `runtime.state.<key>`.",default:""},value:{type:"scalar",description:"The entry the box stands for.",default:""}}},clearState:{source:"state",title:"Clear State",strictParams:!0,params:{key:{type:"text",description:"The list to empty, under `runtime.state.<key>`. Left blank it empties EVERYTHING the space is keeping — which on a page that holds notes beside a list means losing the notes to clear the list.",default:""}}}},cO=0,uO=({children:e})=>{let{useInteractions:t}=f(DS),n=Dt(),r=h(e=>{let{key:t,type:r}=e,i=e.value;if("boolean"===r)i=!0===i||"true"===i;else if("number"===r)i="number"==typeof i?i:parseFloat(String(i));else if("json"===r)return void n(`runtime.state.${t}`,((e,t)=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch{throw Error(`setState "${e}" is typed json, and its value is not JSON: ${t.slice(0,80)}`)}})(t,i));n(`runtime.state.${t}`,i)},[n]),i=h(e=>{let{key:t}=e;t&&n(`runtime.state.${t}`,e=>!0!==e&&"true"!==e)},[n]),a=e=>!0===e||"true"===e,o=h(e=>{let{key:t,value:r,unique:i,withId:o}=e;t&&n(`runtime.state.${t}`,e=>{let t=Array.isArray(e)?e:[];return a(o)?[...t,{id:typeof crypto<"u"&&"function"==typeof crypto.randomUUID?crypto.randomUUID():`e${++cO}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,value:r}]:a(i)&&t.includes(r)?t:[...t,r]})},[n]),s=h(e=>{let{key:t,index:r,value:i,by:a}=e;if(!t)return;if(void 0!==i&&""!==i)return void n(`runtime.state.${t}`,e=>Array.isArray(e)?e.filter(e=>a?e?.[a]!==i:e!==i):[]);let o="number"==typeof r?r:parseInt(r??"",10);Number.isNaN(o)||n(`runtime.state.${t}`,e=>Array.isArray(e)?e.filter((e,t)=>t!==o):[])},[n]),l=h(e=>{let{from:t,to:r,value:i}=e;if(!t||!r||void 0===i||""===i)return;let a={moved:!1};n(`runtime.state.${t}`,e=>{let t=Array.isArray(e)?e:[];return a.moved=t.includes(i),a.moved?t.filter(e=>e!==i):t}),a.moved&&n(`runtime.state.${r}`,e=>{let t=Array.isArray(e)?e:[];return t.includes(i)?t:[...t,i]})},[n]),c=h(e=>{let{key:t,value:r}=e;t&&void 0!==r&&""!==r&&n(`runtime.state.${t}`,e=>{let t=Array.isArray(e)?e:[];return t.includes(r)?t.filter(e=>e!==r):[...t,r]})},[n]),u=h(e=>{let{key:t}=e;n(t?`runtime.state.${t}`:"runtime.state",t?[]:{})},[n]);return t({id:"state",callbacks:k(()=>Od(lO,{setState:r,toggleState:i,appendState:o,removeState:s,moveState:l,toggleInState:c,clearState:u}),[r,i,o,s,l,c,u])}),e},dO=({children:e,hostActions:t})=>{let[[n="basic",r,i,a]]=zt(["schema.settings.userProvider","navigation.routeParams","navigation.queryParams","navigation.currentPageId"]),{previewMode:o}=X();/* @__PURE__ */
148
- return I(G_,{currentPageId:a,routeParams:r,queryParams:i,children:/* @__PURE__ */I(tO,{authProvider:n,children:/* @__PURE__ */I(uO,{children:/* @__PURE__ */I(Q_,{children:/* @__PURE__ */I(sO,{children:/* @__PURE__ */I(aO,{previewMode:o,children:/* @__PURE__ */I(rO,{actions:t,children:e})})})})})})})},pO=W("StyleContext",{}),fO=({children:e,style:t})=>{let{style:n}=f(Dc),r=k(()=>({}),[]);return qt("style",t??(n||dc)),/* @__PURE__ */I(pO,{value:r,children:e})},hO="/plitzi-sdk.css",mO=({revision:e,webKey:t="",webId:n,environment:r="main",currentPageId:i,server:a,isHydrating:o=!1,offlineMode:s=!1,offlineData:l,offlineDataType:c="json",instanceId:u,renderMode:d=J.renderMode,sdkStylePath:p="./plitzi-sdk.css",sdkDevToolsStylePath:h,previewMode:m=!0,debugMode:y=!1,overQuota:b=!1,analytics:v,onInitEventBridge:w,hostData:x,hostActions:T,flags:C,serverFlags:A,forcedFlags:E,onInitStateManager:O,...N})=>{const M=f(mt),[P,L]=S(!o);g(()=>L(!0),[]),Rt(["render.previewMode","render.debugMode","render.renderMode","render.environment","render.isHydrating","render.hydrated","render.overQuota"],[m,y,d,r,o,P,b]),Rt(["runtime.host"],[x]),Rt(["flags.overrides.server","flags.overrides.sdk","flags.overrides.qa"],[oc(A),oc(C),E]);const D=k(()=>M?.withBase("runtime.state"),[M]),z=k(()=>({get state(){return D?.getState()??{}},setState:e=>D?.setState(void 0,e),setStateByKey:(e,t)=>D?.setState(e,t),clearState:()=>D?.setState(void 0,{}),subscribe:e=>D?D.subscribe(()=>e(D.getState()??{})):()=>{}}),[D]);return g(()=>{O?.(z)},[O,z]),/* @__PURE__ */I(_S,{webKey:t,webId:n,instanceId:u,server:a,offlineMode:s,offlineData:l,offlineDataType:c,revision:e,children:/* @__PURE__ */I(MS,{children:/* @__PURE__ */I(NS,{sdkStylePath:hO,sdkIconsPath:"/plitzi-sdk-icons.css",children:/* @__PURE__ */I(fO,{children:/* @__PURE__ */I(y_,{onInit:w,debugMode:y,children:/* @__PURE__ */I(FI,{server:a,children:/* @__PURE__ */_(TS,{currentPageId:i,children:[/* @__PURE__ */I(bS,{analytics:v}),/* @__PURE__ */I(m_,{children:/* @__PURE__ */I(dO,{hostActions:T,children:/* @__PURE__ */I(h_,{enabled:y,instanceId:u,devToolsStyleLink:h||"/plitzi-sdk-devtools.css",renderMode:"shadow",scroll:"document",qa:!0,innerClassName:U({flex:"iframe"===d}),children:/* @__PURE__ */I(SI,{sdkStylePath:hO,server:a,...N})})})})]})})})})})})})},gO=({scope:e,theme:t,children:n})=>{const[[r="system"]]=zt(["style.theme.default"]);/* @__PURE__ */
149
+ return I(G_,{currentPageId:a,routeParams:r,queryParams:i,children:/* @__PURE__ */I(tO,{authProvider:n,children:/* @__PURE__ */I(uO,{children:/* @__PURE__ */I(Q_,{children:/* @__PURE__ */I(sO,{children:/* @__PURE__ */I(aO,{previewMode:o,children:/* @__PURE__ */I(rO,{actions:t,children:e})})})})})})})},pO=W("StyleContext",{}),fO=({children:e,style:t})=>{let{style:n}=f(Dc),r=k(()=>({}),[]);return qt("style",t??(n||dc)),/* @__PURE__ */I(pO,{value:r,children:e})},hO="/plitzi-sdk.css",mO=({revision:e,webKey:t="",webId:n,environment:r="main",currentPageId:i,server:a,isHydrating:o=!1,offlineMode:s=!1,offlineData:l,offlineDataType:c="json",instanceId:u,renderMode:d=J.renderMode,sdkStylePath:p="./plitzi-sdk.css",sdkDevToolsStylePath:h,sdkIconsStylePath:m="/plitzi-sdk-icons.css",previewMode:y=!0,debugMode:b=!1,overQuota:v=!1,analytics:w,onInitEventBridge:x,hostData:T,hostActions:C,flags:A,serverFlags:E,forcedFlags:O,onInitStateManager:N,...M})=>{const P=f(mt),[L,D]=S(!o);g(()=>D(!0),[]),Rt(["render.previewMode","render.debugMode","render.renderMode","render.environment","render.isHydrating","render.hydrated","render.overQuota"],[y,b,d,r,o,L,v]),Rt(["runtime.host"],[T]),Rt(["flags.overrides.server","flags.overrides.sdk","flags.overrides.qa"],[oc(E),oc(A),O]);const z=k(()=>P?.withBase("runtime.state"),[P]),R=k(()=>({get state(){return z?.getState()??{}},setState:e=>z?.setState(void 0,e),setStateByKey:(e,t)=>z?.setState(e,t),clearState:()=>z?.setState(void 0,{}),subscribe:e=>z?z.subscribe(()=>e(z.getState()??{})):()=>{}}),[z]);return g(()=>{N?.(R)},[N,R]),/* @__PURE__ */I(_S,{webKey:t,webId:n,instanceId:u,server:a,offlineMode:s,offlineData:l,offlineDataType:c,revision:e,children:/* @__PURE__ */I(MS,{children:/* @__PURE__ */I(NS,{sdkStylePath:hO,sdkIconsPath:m,children:/* @__PURE__ */I(fO,{children:/* @__PURE__ */I(y_,{onInit:x,debugMode:b,children:/* @__PURE__ */I(FI,{server:a,children:/* @__PURE__ */_(TS,{currentPageId:i,children:[/* @__PURE__ */I(bS,{analytics:w}),/* @__PURE__ */I(m_,{children:/* @__PURE__ */I(dO,{hostActions:C,children:/* @__PURE__ */I(h_,{enabled:b,instanceId:u,devToolsStyleLink:h||"/plitzi-sdk-devtools.css",devToolsIconsLink:m,renderMode:"shadow",scroll:"document",qa:!0,innerClassName:U({flex:"iframe"===d}),children:/* @__PURE__ */I(SI,{sdkStylePath:hO,server:a,...M})})})})]})})})})})})})},gO=({scope:e,theme:t,children:n})=>{const[[r="system"]]=zt(["style.theme.default"]);/* @__PURE__ */
149
150
  return I(Zc,{defaultTheme:r,scope:e,theme:t,children:n})},yO=`[data-motion-on="view"]:not([${rp}])`,bO=()=>{const{rootRef:e}=f(PS);return g(()=>{const t=e.current;if(t)return(e=>{let t=e=>e.setAttribute(rp,""),n=e=>[...e.matches(yO)?[e]:[],...Array.from(e.querySelectorAll(yO))];if("function"!=typeof Reflect.get(globalThis,"IntersectionObserver"))return n(e).forEach(t),()=>{};let r=new IntersectionObserver(e=>{for(let n of e)n.isIntersecting&&(t(n.target),r.unobserve(n.target))}),i=e=>n(e).forEach(e=>r.observe(e)),a=new MutationObserver(e=>{for(let t of e)"attributes"===t.type&&t.target instanceof Element&&i(t.target),t.addedNodes.forEach(e=>{e instanceof Element&&i(e)})});return i(e),a.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-motion-on"]}),()=>{r.disconnect(),a.disconnect()}})(t)},[e]),null},vO=({className:e,scoped:t=!1,children:n})=>{const{theme:r}=eu(),[[i=!1]]=zt(["render.hydrated"]);/* @__PURE__ */
150
151
  return _(LS,{className:U(e,t&&"system"!==r&&r),"data-hydrated":i?"":void 0,children:[/* @__PURE__ */I(bO,{}),n]})},wO=/* @__PURE__ */$({ComponentHelper_exports:()=>kO,getPlugins:()=>xO,nestedInject:()=>TO,processLocalCustomPlugins:()=>CO,processLocalPlugins:()=>SO}),kO=/* @__PURE__ */US({getPlugins:()=>xO,nestedInject:()=>TO,processLocalCustomPlugins:()=>CO,processLocalPlugins:()=>SO}),xO=e=>{let t={};if(!e)return t;t[e.type]=e;let{plugins:n}=e;return n&&Object.keys(n).length>0&&Object.keys(n).forEach(e=>{Object.assign(t,xO(n[e]))}),t},SO=e=>{let t={};return e&&Object.values(e).forEach(e=>{e.type&&Object.assign(t,xO(e))}),t},TO=(e,t)=>{if(!e)return{};let n={};return Object.keys(e).forEach(r=>{let i=e[r],{version:a,pluginSettings:o,initialItems:s,plugins:l,extraProps:c}=i;n[r]=kd(i),n[r].origin=t,n[r].version=a,n[r].type=r,n[r].initialItems=s,n[r].pluginSettings=o,n[r].extraProps=c,n[r].plugins=TO(l,t)}),n},CO=e=>{let t={};return e&&Object.values(e).forEach(e=>{if(!e.type)return;let{type:n,pluginSettings:r,version:i,initialItems:a,plugins:o,assets:s,content:l,extraProps:c}=e,u=kd(e);u.version=i,u.type=n,u.assets=s,u.initialItems=a,u.pluginSettings=r,u.origin="local-custom",u.content=l,u.extraProps=c,u.plugins=TO(o,"local-custom"),Object.assign(t,xO(u))}),t},AO=p(({plitziJsxSkipHOC:e=!0,as:t="",internalProps:n,children:r,...i})=>{let{contexts:{PluginsContext:a}}=cc(),{components:o}=f(Fr),{plugins:s}=f(a),l=t?o.current[t]:void 0,c=k(()=>l?void 0:Wr({type:t,plugins:s}),[l,s,t]);return t?!l&&c?/* @__PURE__ */I(Hr,{internalProps:n,url:c.url,type:t,plitziJsxSkipHOC:e,plitziJsxProps:i}):(l||=SC,/* @__PURE__ */I(l,{plitziJsxSkipHOC:e,...i,internalProps:n,children:r})):null}),EO=e=>{let[t]=Mt(`runtime.sources.flags.${e}`);return!0===t},IO={dropdown:yT,notFound:TC,loading:wC,custom:YS,reference:oT,blockHtml:WS,nodeHtml:XS,blockJsx:GS,page:IC,container:VA,layoutContainer:bC,dialogContainer:JA,modalContainer:oE,tabContainer:bE,carousel:UA,heading:vT,image:jC,video:VC,embed:OC,svg:HC,fontAwesome:MC,button:uT,paragraph:AT,text:DT,themeToggle:UT,list:rE,link:xT,markdown:TT,richText:PT,pagination:cE,form:GT,formControl:pC,apiContainer:hA,channel:EA},_O=({localComponents:e,localCustomComponents:t,children:n})=>{let r=k(()=>({...SO(IO),...SO(e),...CO(t)}),[e,t]),i=x({}),a=k(()=>({current:{...i.current,...r}}),[r]),o=h((e=[],t=!1)=>{if("string"==typeof e&&!t)return a.current[e];if("string"==typeof e&&t){let t=a.current[e];return t?{[e]:t,...hr(xO(t),[e])}:{}}let n={};return e.forEach(e=>{let r=a.current[e];r&&(t?n={...n,...hr(xO(r),[e])}:n[e]=r)}),n},[a]),s=h((e=[])=>{let t={};return Array.isArray(e)||(e=[e]),e.forEach(e=>{e.type&&!a.current[e.type]&&(t={...t,[e.type]:e,...xO(e)})}),0===Object.keys(t).length||(a.current={...i.current,...t,...r},i.current={...i.current,...t}),t},[a,r]),l=h(e=>{if(!e)return[];Array.isArray(e)||(e=[e]);let t=e;return e.forEach(e=>{let n=o([e],!0);Object.keys(n).length>0&&(t=[...t,...Object.keys(hr(n,e))])}),a.current={...hr(i.current,t),...r},i.current=hr(i.current,t),t},[a,o,r]),c=x(Object.keys(a.current).reduce((e,t)=>{let n=sr(a.current,t,void 0);return n&&n.content?{...e,[t]:{...n.content,initialItems:n.initialItems}}:e},{})),u=h(e=>{c.current={...c.current,...e}},[]),d=h(e=>{let t=sr(c.current,`${e}.builder.pluginChildren`,[]);c.current=hr(c.current,[e,...t])},[]),p=k(()=>({components:a,componentDefinitions:c,getComponent:o,register:s,unregister:l,unregisterDefinition:d,registerDefinition:u}),[a,s,l,u,d,o]);/* @__PURE__ */
151
152
  return I(Fr,{value:p,children:n})},OO=e=>({apiServer:"https://api.plitzi.com",ssrServer:"https://ssr.plitzi.com",serverUrl:"https://server.plitzi.com",websocketServer:"wss://server.plitzi.com",subscriptionServer:"wss://server.plitzi.com/subscriptions",...e}),NO={Button:vs,ContentEditable:af,Input:Es,Heading:sf,ContainerResizable:Yp,ContainerCollapsable:Gp,Text:uk,Markdown:ok,ContainerTabs:nf},MO=({className:e="min-h-screen",children:t,webKey:r="",server:a,renderMode:o=J.renderMode,routing:s="browser",debugMode:l=!1,themeScope:c="document",theme:d,state:p,forcedFlags:f,...m})=>{const y=k(()=>function(e){if(!e)return 0;let t={};try{let n=e.split(".")[1],r=typeof window<"u"?window.atob(n):Buffer.from(n,"base64").toString();t=JSON.parse(r)}catch{return 0}let n=Number(sr(t,"sub",0));return Number.isInteger(n)&&n>0?n:0}(r),[r]),b=x(p).current,v=k(()=>({runtime:{sources:{},state:b??{}},render:J}),[b]),w=k(()=>(e=>{let t=e?.split(":")[1];return t?`plitzi_debug_${t}`:"plitzi_debug"})("undefined"==typeof window?void 0:window.location.host),[]),[T,C]=S(()=>(e=>{if("undefined"==typeof document)return!0;for(const t of document.cookie.split(";")){const n=t.indexOf("=");if(-1!==n&&t.slice(0,n).trim()===e)return"false"!==decodeURIComponent(t.slice(n+1).trim())}return!0})(w)),A=l&&T,[E]=S(()=>f||!l||"undefined"==typeof window?f:((e,t)=>(e=>e?Object.fromEntries(e.split(",").map(e=>e.split(":")).filter(([e,t])=>Xl(e)&&("1"===t||"0"===t)).map(([e,t])=>[e,"1"===t])):{})(ci(e,Zl(t))))(ui(),window.location.host)),_=k(()=>OO(a),[a]);g(()=>{},[]);const O=h(()=>{const e=!T;((e,t)=>{"undefined"!=typeof document&&(document.cookie=`${e}=${JSON.stringify(t)}; path=/; max-age=31536000; samesite=lax`)})(w,e),C(e)},[w,T]);(({authorized:e,onToggle:t})=>{const n=h(e=>{var n;e.shiftKey&&"F12"===e.key?t():!e.shiftKey||!e.altKey||"KeyD"!==e.code||(n=e.target)instanceof HTMLElement&&(n.isContentEditable||["INPUT","TEXTAREA","SELECT"].includes(n.tagName))||(e.preventDefault(),t())},[t]);g(()=>{if(e)return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[e,n])})({authorized:l,onToggle:O}),g(()=>{},[l,T,w]),g(()=>{if(A)return window.plitziTracing={lastCommitId:vd.lastCommitId,commitsSince:vd.commitsSince},()=>{delete window.plitziTracing}},[A]),g(()=>{m.isHydrating&&vd.setHydrated()},[m.isHydrating]);const N=k(()=>{const e={};return n.forEach(t,t=>{if(!u(t))return;if(t.type!==gI)return;const{renderType:n,component:r,assets:i=[],...a}=t.props;if(!n||!r)return;const o=r;o.type=n,o.assets=i,o.extraProps=a,e[n]=o}),e},[t]);"undefined"==typeof window&&_.requestUrl;const M="widget"===o?i:"undefined"==typeof window?cS:"memory"===s?Mx:nS,P="widget"===o?{}:{..."memory"===s&&"undefined"!=typeof window?{}:{basename:sr(_,"basePath","/"),location:"undefined"==typeof window?_.requestUrl??"":void 0}};/* @__PURE__ */
152
153
  return I(At,{value:v,middlewares:[me(Gl("sdk")),Mu(y),...A?[()=>({onChange:e=>vd.recordStoreChange(e)}),pe({shouldRecord:e=>!(e?.startsWith("runtime.elements")||e?.startsWith("rsc")||e?.startsWith("theme")||e?.startsWith("flags"))})]:[]],children:/* @__PURE__ */I(gO,{scope:c,theme:d,children:/* @__PURE__ */I(ck,{components:NO,children:/* @__PURE__ */I(vO,{scoped:"container"===c,className:U("plitzi-sdk flex",e,{"sdk-debug-mode":A}),children:/* @__PURE__ */I(jp,{children:/* @__PURE__ */I(M,{...P,children:/* @__PURE__ */I(_O,{localCustomComponents:N,localComponents:LO,children:/* @__PURE__ */I(mO,{server:_,webKey:r,renderMode:o,debugMode:A,webId:y,forcedFlags:E,...m})})})})})})})})},PO=kd(({ref:e,className:t,spaceKey:n,environment:r="main"})=>{const{settings:{previewMode:i},contexts:{NetworkContext:a}}=cc(),{server:o}=f(a);/* @__PURE__ */
153
154
  return I(ap,{ref:e,className:U("plitzi-component__plitzi-sdk",t,{"with__plitzi-sdk":!i}),children:n&&/* @__PURE__ */I(MO,{webKey:n,environment:r,renderMode:"widget",server:o,className:"h-full w-full"})})}),LO={plitziSdk:Object.assign(PO,{type:"plitziSdk",content:{attributes:{spaceId:"",spaceKey:"",environment:"main"},definition:{label:"Plitzi Sdk",type:"plitziSdk",bindings:{},styleSelectors:{base:""},initialState:{visibility:!0}},builder:{canDelete:!0,canSelect:!0,canDragDrop:!0,canMove:!0,canSnippet:!0,itemsAllowed:[],itemsNotAllowed:[]},market:{category:"advanced",owner:"Plitzi",verified:!0,license:"MIT",website:"https://plitzi.com",backgroundColor:"#4422ee",icon:/* @__PURE__ */I(q,{})},defaultStyle:{name:"Plitzi Sdk",displayMode:"desktop",style:{base:{default:{}}}},settings:{}}})},DO=class extends Error{stage;log;constructor(e,t){super(`${"link"===e?"program failed to link":`${e} shader failed`}: ${t.trim()||"no log given"}`),this.name="ShaderError",this.stage=e,this.log=t}},zO=(e,t,n)=>{let r=e.createShader("vertex"===t?e.VERTEX_SHADER:e.FRAGMENT_SHADER);if(!r)throw new DO(t,"the context made no shader (it is lost)");if(e.shaderSource(r,n),e.compileShader(r),!0!==e.getShaderParameter(r,e.COMPILE_STATUS)){let n=e.getShaderInfoLog(r)??"";throw e.deleteShader(r),new DO(t,n)}return r},RO=(e,{vertex:t,fragment:n})=>{let r=zO(e,"vertex",t),i=zO(e,"fragment",n),a=e.createProgram();if(e.attachShader(a,r),e.attachShader(a,i),e.linkProgram(a),e.deleteShader(r),e.deleteShader(i),!0!==e.getProgramParameter(a,e.LINK_STATUS)){let t=e.getProgramInfoLog(a)??"";throw e.deleteProgram(a),new DO("link",t)}return a},jO="(prefers-reduced-motion: reduce)",$O=()=>"function"==typeof window.matchMedia&&window.matchMedia(jO).matches||document.documentElement.classList.contains("plitzi-reduced-motion"),FO=e=>{let t="function"==typeof window.matchMedia?window.matchMedia(jO):void 0;t?.addEventListener("change",e);let n=new MutationObserver(e);return n.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>{t?.removeEventListener("change",e),n.disconnect()}},qO=()=>T(FO,$O,()=>!1),BO=e=>(document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)),UO=()=>"hidden"!==document.visibilityState,HO=(e,{paused:t=!1,fps:n,target:r}={})=>{let i=cc().settings.previewMode??!0,a=qO(),o=T(BO,UO,()=>!1),s=(e=>{let[t,n]=S(!0);return g(()=>{let t=e?.current;if(!t||typeof IntersectionObserver>"u")return;let r=new IntersectionObserver(e=>n(e.some(e=>e.isIntersecting)));return r.observe(t),()=>r.disconnect()},[e]),t})(r),l=i&&!a&&!t&&o&&s,c=x(e);g(()=>{c.current=e},[e]);let u=x({time:0,frame:0});return g(()=>{if(!l)return;let e,t=n&&n>0?1e3/n:0,r=0,i=0,a=n=>{let o=void 0===e?0:n-e;if(e=n,i+=o,i>=t){let e=t>0?i:o;i=t>0?i%t:0,u.current={time:u.current.time+e,frame:u.current.frame+1},c.current({...u.current,delta:e})}r=requestAnimationFrame(a)};return r=requestAnimationFrame(a),()=>cancelAnimationFrame(r)},[l,n]),{running:l}},WO=(e,{setup:t,draw:n,maxPixelRatio:r=2,paused:i,fps:a})=>{let o=(e=>`[plugin ${e?.definition?.type??"canvas"}${e?.id?` "${e.id}"`:""}]`)(f(V)),s=x(null),[l,c]=S(null),[u,d]=S({width:0,height:0,pixelRatio:1}),[p,m]=S(),[y,b]=S(!1),[v,w]=S(0),k=x(null),T=x({acquire:e,setup:t,draw:n});g(()=>{T.current={acquire:e,setup:t,draw:n}},[e,t,n]);let C=h(e=>{let t=e instanceof Error?e.message:String(e);console.error(`${o} ${t}`),m(t)},[o]),A=h(e=>{s.current=e,c(e)},[]);g(()=>{if(!l)return;let e=()=>{let e=l.getBoundingClientRect(),t=Math.min(window.devicePixelRatio||1,r);l.width=Math.max(1,Math.round(e.width*t)),l.height=Math.max(1,Math.round(e.height*t)),d({width:e.width,height:e.height,pixelRatio:t})};if(e(),typeof ResizeObserver>"u")return;let t=new ResizeObserver(e);return t.observe(l),()=>t.disconnect()},[l,r]),g(()=>{if(!l)return;let e=e=>{e.preventDefault(),k.current=null,b(!1)},t=()=>w(e=>e+1);return l.addEventListener("webglcontextlost",e),l.addEventListener("webglcontextrestored",t),()=>{l.removeEventListener("webglcontextlost",e),l.removeEventListener("webglcontextrestored",t)}},[l]),g(()=>{if(l&&0!==u.width&&void 0===p)try{let e=T.current.acquire(l);if(!e)return void C(/* @__PURE__ */Error("the browser gave no drawing context (WebGL may be off)"));e.prepare(u);let t=T.current.setup?T.current.setup(e.context,u):void 0;k.current={handle:e,state:t}}catch(DO){C(DO)}},[l,u,v,p,C]);let E=h(e=>{let t=k.current;if(t&&void 0===p)try{t.handle.prepare(u),T.current.draw(t.handle.context,{...e,...u,state:t.state}),b(!0)}catch(e){k.current=null,C(e)}},[u,p,C]),{running:I}=HO(E,{paused:i||void 0!==p,fps:a,target:s});return g(()=>{!I&&u.width>0&&E({time:0,delta:0,frame:0})},[I,u,v,E]),{ref:A,ready:y,error:p,running:I}},VO=({attributes:e,...t})=>WO(h(t=>{let n=t.getContext("2d",e);return n&&{context:n,prepare:({pixelRatio:e})=>n.setTransform(e,0,0,e,0,0)}},[e]),t),GO=({attributes:e,...t})=>WO(h(t=>{let n=t.getContext("webgl",e);return n&&{context:n,prepare:()=>n.viewport(0,0,t.width,t.height)}},[e]),t),KO=({attributes:e,...t})=>WO(h(t=>{let n=t.getContext("webgl2",e);return n&&{context:n,prepare:()=>n.viewport(0,0,t.width,t.height)}},[e]),t),YO=e=>"string"==typeof e&&e?e:void 0,JO=e=>n.toArray(e).flatMap(e=>{if(!u(e))return[];let t=(e=>{let t=e.props;return e.type===Xr?YO(t.id):YO(t.internalProps?.id)})(e);return void 0===t?[]:[{id:t,node:e}]}),XO=e=>"function"==typeof e.checkVisibility?e.checkVisibility():e.getClientRects().length>0,ZO=e=>{let{utils:{rootRef:t}}=cc(),[n,r]=S(void 0);return g(()=>{let n=t.current,i=n?.ownerDocument.defaultView;if(!n||!i||!e)return;let a=`[data-plitzi-el="${i.CSS.escape(e)}"]`,o=()=>r([...n.querySelectorAll(a)].some(XO)),s=0,l=new i.MutationObserver(()=>{s||=i.requestAnimationFrame(()=>{s=0,o()})});return l.observe(n,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["class","style"]}),i.addEventListener("resize",o),o(),()=>{l.disconnect(),i.removeEventListener("resize",o),i.cancelAnimationFrame(s)}},[e,t]),n},QO=e=>{let[t]=Mt("actions.endpoint");return h((n="/")=>{if(!t)return;let r=((e,t="/")=>`/fn/plugins/${encodeURIComponent(e)}${t.startsWith("/")?t:`/${t}`}`)(e,n);return typeof window>"u"?r:new URL(r,new URL(t,window.location.href)).href},[t,e])},eN={mobile:`(max-width: ${fc("tablet")})`,tablet:`(max-width: ${fc("desktop")})`},tN=e=>typeof window>"u"||"function"!=typeof window.matchMedia?void 0:window.matchMedia(e),nN=()=>tN(eN.mobile)?.matches?"mobile":tN(eN.tablet)?.matches?"tablet":"desktop",rN=e=>{let t=[tN(eN.mobile),tN(eN.tablet)].filter(e=>void 0!==e);return t.forEach(t=>{t.addEventListener("change",e)}),()=>{t.forEach(t=>{t.removeEventListener("change",e)})}},iN=()=>"desktop",aN=()=>T(rN,nN,iN),oN=(e,t)=>new Promise(n=>{const r=document.createElement("link");r.rel="stylesheet",r.href=e,r.dataset.plitziPlugin=t,r.onload=()=>n(),r.onerror=()=>n(),document.head.append(r)}),sN=(e,{load:t,css:n,declaration:r})=>{let i;const a=(r,{content:s,version:l,initialItems:c,plugins:u})=>{const p=d(async()=>({default:r.reduce((t,n)=>{const r=t.plugins?.[n];if(!r)throw new Error(`[plitzi] plugin "${e}" was loaded without the "${n}" it declared`);return r},await(i??=Promise.all([t(),n?oN(n,e):void 0]).then(([e])=>e.default)))})),f=e=>/* @__PURE__ */I(o,{fallback:null,children:/* @__PURE__ */I(p,{...e})});return f.displayName=`Deferred(${r.at(-1)??e})`,Object.assign(f,{content:s,version:l,initialItems:c,plugins:u?Object.fromEntries(Object.entries(u).map(([e,t])=>[e,a([...r,e],t)])):void 0})};return a([],r)},lN=e=>{try{return JSON.stringify({...e},(e,t)=>"function"==typeof t?void 0:t)}catch{return}},cN=e=>{const t=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map,r=/* @__PURE__ */new Map;return{plugins:Object.fromEntries(Object.entries(e).map(([e,i])=>{t.set(e,i.component);const a=((e,r)=>{const i=(e=>t=>{const r=n.get(e)??/* @__PURE__ */new Set;return r.add(t),n.set(e,r),()=>{r.delete(t)}})(e),a=()=>t.get(e)??r,o=e=>{const t=T(i,a,a);/* @__PURE__ */
154
155
  return I(t,{...e})};return o.displayName=`Hot(${r.displayName??r.name})`,Object.assign(o,r)})(e,i.component);return r.set(e,a),[e,{...i,component:a}]})),replace:(e,i)=>{const a=t.get(e),o=r.get(e);return!(!a||!o||lN(a)!==lN(i)||(t.set(e,i),n.get(e)?.forEach(e=>{e()}),0))}}};Promise.resolve({ });function uN(e,t={},n={},r=!1,i=!1,{hotPlugins:a=!1}={}){const o=Object.fromEntries(Object.entries(n).map(([e,t])=>{if("component"in t)return[e,t];const{load:n,css:r,declaration:i,...a}=t;return[e,{...a,component:sN(e,{load:n,css:r,declaration:i})}]})),s=a?cN(o):void 0,l=s?.plugins??o,{actionRuns:c,styleCacheInDocument:u,...d}=(e=>{if(e.analytics||e.offlineMode||!e.webKey)return e;const{apiServer:t}=OO(e.server);return t?{...e,analytics:{endpoint:`${t.replace(/\/+$/,"")}/v1/collect`,key:e.webKey}}:e})(t),p="undefined"!=typeof document?document.getElementById(e):void 0,f=u?((e,t)=>{const{offlineData:n}=e;if(!n||!t)return e;const r=(e=>{let t=e.querySelector('style[data-id="plitzi-runtime-style"]')?.textContent??"",n=t.indexOf(Ac),r=t.indexOf(Ec,n);if(!(n<0||r<0))return t.slice(n+22,r)})(t);return void 0===r?(console.error("[plitzi] The server-rendered stylesheet is missing from the page: it renders without its styles."),e):{...e,offlineData:{...n,style:{...n.style,cache:r}}}})(d,p):d,m=f.debugMode??r;m&&c?.length&&lt(c);const y=({isHydrating:e=!1})=>{const[t,n]=S(!e);g(()=>n(!0),[]);const r=Object.keys(l).filter(e=>t||!l[e].clientOnly);m||(()=>{if(typeof window>"u")return;let e=()=>{},t=window.__REACT_DEVTOOLS_GLOBAL_HOOK__;"object"==typeof t&&Object.keys(t).forEach(n=>{let r=t[n];t[n]="function"==typeof r?e:null})})();const i=h(e=>{kI=e},[]),a=h(e=>{xI=e},[]);/* @__PURE__ */
155
- return I(MO,{...f,debugMode:m,isHydrating:e,onInitStateManager:i,onInitEventBridge:a,children:r.filter(e=>!!l[e].component).map(e=>/* @__PURE__ */I(SI.Plugin,{renderType:e,component:l[e].component,...l[e].props},e))})};if(!p)return;const b=i?A(p,/* @__PURE__ */I(y,{isHydrating:!0})):C(p);return i||b.render(/* @__PURE__ */I(y,{})),{unmount:()=>b.unmount(),replacePlugin:(e,t)=>s?.replace(e,t)??!1}}var dN=({debugMode:e=!1,isHydrating:t=!1,children:n,webKey:r="",environment:i="main",renderMode:a=J.renderMode,...o})=>/* @__PURE__ */I(MO,{...o,isHydrating:t,renderMode:a,debugMode:e,webKey:r,environment:i,children:n});dN.Plugin=SI.Plugin;var pN=cc,fN="0.38.5",hN=()=>kI,mN=()=>xI;export{sr as A,U as B,La as C,Fr as ComponentContext,_O as ComponentProvider,qr as D,ha as E,ot as F,et as I,AO as JsxManager,tt as L,vt as M,mt as N,Rr as O,dt as P,uc as PlitziServiceProvider,ZS as PluginManager,Hr as PluginRemote,Oe as R,QS as ReplicaProvider,ap as RootElement,ws as S,DO as ShaderError,ma as T,hc as _,eA as a,Ul as b,Wy as c,RO as createShaderProgram,Kp as d,dN as default,JO as elementChildren,ip as f,Pc as g,mN as getEventBridge,hN as getStateManager,eu as h,WI as i,Mt as j,gr as k,rf as l,Xu as m,r_ as n,OS as o,vd as p,i_ as r,uN as render,Jy as s,LO as sdkComponents,u_ as t,yS as track,Xp as u,HO as useAnimationFrame,VO as useCanvas2d,SA as useChannel,aN as useDisplayMode,xd as useElement,ZO as useElementVisible,EO as useFlag,pN as usePlitziServiceContext,QO as usePluginRoute,qO as useReducedMotion,KC as useRscData,wu as useRscRefresh,zt as useStore,GO as useWebGL,KO as useWebGL2,Ql as v,fN as version,ya as w,kd as withElement,Is as x,ec as y,ue as z};
156
+ return I(MO,{...f,debugMode:m,isHydrating:e,onInitStateManager:i,onInitEventBridge:a,children:r.filter(e=>!!l[e].component).map(e=>/* @__PURE__ */I(SI.Plugin,{renderType:e,component:l[e].component,...l[e].props},e))})};if(!p)return;const b=i?A(p,/* @__PURE__ */I(y,{isHydrating:!0})):C(p);return i||b.render(/* @__PURE__ */I(y,{})),{unmount:()=>b.unmount(),replacePlugin:(e,t)=>s?.replace(e,t)??!1}}var dN=({debugMode:e=!1,isHydrating:t=!1,children:n,webKey:r="",environment:i="main",renderMode:a=J.renderMode,...o})=>/* @__PURE__ */I(MO,{...o,isHydrating:t,renderMode:a,debugMode:e,webKey:r,environment:i,children:n});dN.Plugin=SI.Plugin;var pN=cc,fN="0.38.6",hN=()=>kI,mN=()=>xI;export{sr as A,U as B,La as C,Fr as ComponentContext,_O as ComponentProvider,qr as D,ha as E,ot as F,et as I,AO as JsxManager,tt as L,vt as M,mt as N,Rr as O,dt as P,uc as PlitziServiceProvider,ZS as PluginManager,Hr as PluginRemote,Oe as R,QS as ReplicaProvider,ap as RootElement,ws as S,DO as ShaderError,ma as T,hc as _,eA as a,Ul as b,Wy as c,RO as createShaderProgram,Kp as d,dN as default,JO as elementChildren,ip as f,Pc as g,mN as getEventBridge,hN as getStateManager,eu as h,WI as i,Mt as j,gr as k,rf as l,Xu as m,r_ as n,OS as o,vd as p,i_ as r,uN as render,Jy as s,LO as sdkComponents,u_ as t,yS as track,Xp as u,HO as useAnimationFrame,VO as useCanvas2d,SA as useChannel,aN as useDisplayMode,xd as useElement,ZO as useElementVisible,EO as useFlag,pN as usePlitziServiceContext,QO as usePluginRoute,qO as useReducedMotion,KC as useRscData,wu as useRscRefresh,zt as useStore,GO as useWebGL,KO as useWebGL2,Ql as v,fN as version,ya as w,kd as withElement,Is as x,ec as y,ue as z};
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plitzi/plitzi-sdk",
3
- "version": "0.38.5",
3
+ "version": "0.38.6",
4
4
  "homepage": "./",
5
5
  "license": "AGPL-3.0",
6
6
  "files": [
@@ -33,17 +33,17 @@
33
33
  "@fortawesome/fontawesome-free": "^7.3.1",
34
34
  "@plitzi/nexus": "^1.4.0",
35
35
  "@plitzi/plitzi-ui": "^1.6.31",
36
- "@plitzi/sdk-auth": "0.38.5",
37
- "@plitzi/sdk-dev-tools": "0.38.5",
38
- "@plitzi/sdk-elements": "0.38.5",
39
- "@plitzi/sdk-event-bridge": "0.38.5",
40
- "@plitzi/sdk-interactions": "0.38.5",
41
- "@plitzi/sdk-navigation": "0.38.5",
42
- "@plitzi/sdk-plugins": "0.38.5",
43
- "@plitzi/sdk-schema": "0.38.5",
44
- "@plitzi/sdk-shared": "0.38.5",
45
- "@plitzi/sdk-style": "0.38.5",
46
- "@plitzi/sdk-variables": "0.38.5",
36
+ "@plitzi/sdk-auth": "0.38.6",
37
+ "@plitzi/sdk-dev-tools": "0.38.6",
38
+ "@plitzi/sdk-elements": "0.38.6",
39
+ "@plitzi/sdk-event-bridge": "0.38.6",
40
+ "@plitzi/sdk-interactions": "0.38.6",
41
+ "@plitzi/sdk-navigation": "0.38.6",
42
+ "@plitzi/sdk-plugins": "0.38.6",
43
+ "@plitzi/sdk-schema": "0.38.6",
44
+ "@plitzi/sdk-shared": "0.38.6",
45
+ "@plitzi/sdk-style": "0.38.6",
46
+ "@plitzi/sdk-variables": "0.38.6",
47
47
  "clsx": "^2.1.1",
48
48
  "react-router-dom": "^7.18.4"
49
49
  },