@kizenapps/cli 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/electron/icon.png +0 -0
  2. package/dist/electron/main.js +38 -2
  3. package/dist/electron/main.js.map +1 -1
  4. package/dist/index.js +85 -9
  5. package/dist/index.js.map +1 -1
  6. package/dist/viewer/assets/index--m1PKX6N.js +17 -0
  7. package/dist/viewer/assets/index-2OcBnmZB.js +17 -0
  8. package/dist/viewer/assets/index-7ah1RuPy.js +17 -0
  9. package/dist/viewer/assets/index-B3gNsKTt.js +17 -0
  10. package/dist/viewer/assets/index-B40AtXqk.js +17 -0
  11. package/dist/viewer/assets/index-B4ikC-wc.js +17 -0
  12. package/dist/viewer/assets/index-BKOfPpLS.js +17 -0
  13. package/dist/viewer/assets/index-BM3JrC-1.js +17 -0
  14. package/dist/viewer/assets/index-BUnK11-F.js +17 -0
  15. package/dist/viewer/assets/index-Bc7IZVr6.js +17 -0
  16. package/dist/viewer/assets/index-C1KzcpVj.js +17 -0
  17. package/dist/viewer/assets/index-CBBwr2o_.js +17 -0
  18. package/dist/viewer/assets/index-CHtXWYIY.js +17 -0
  19. package/dist/viewer/assets/index-CN9NvJkQ.js +17 -0
  20. package/dist/viewer/assets/index-CNKPBxhv.js +17 -0
  21. package/dist/viewer/assets/index-C_6izRRh.js +17 -0
  22. package/dist/viewer/assets/index-CgzK6zig.js +17 -0
  23. package/dist/viewer/assets/index-Cw2cxYy2.js +17 -0
  24. package/dist/viewer/assets/index-D06uhGtQ.js +17 -0
  25. package/dist/viewer/assets/index-DAHWT-g0.js +17 -0
  26. package/dist/viewer/assets/index-DAxJgHat.js +17 -0
  27. package/dist/viewer/assets/index-DF_geUaW.js +17 -0
  28. package/dist/viewer/assets/index-DUgUEouL.css +2 -0
  29. package/dist/viewer/assets/index-DcGGXuA3.js +17 -0
  30. package/dist/viewer/assets/index-DlVmY-nR.js +17 -0
  31. package/dist/viewer/assets/index-FZw9Ev_R.js +17 -0
  32. package/dist/viewer/assets/index-M1Obm_99.js +17 -0
  33. package/dist/viewer/assets/index-_kM1Ri7v.js +17 -0
  34. package/dist/viewer/assets/index-aTt_sTlu.js +17 -0
  35. package/dist/viewer/assets/index-vYFGGFc2.js +17 -0
  36. package/dist/viewer/icon.png +0 -0
  37. package/dist/viewer/index.html +2 -2
  38. package/package.json +1 -1
  39. package/dist/viewer/1024.png +0 -0
  40. package/dist/viewer/assets/index-B0iU58_K.css +0 -2
  41. package/dist/viewer/assets/index-BLljooBS.js +0 -17
  42. package/dist/viewer/favicon.png +0 -0
  43. package/dist/viewer/favicon.svg +0 -4
@@ -0,0 +1,17 @@
1
+ import{n as e,t}from"./rolldown-runtime-DF2fYuay.js";import{C as n,S as r,_ as i,a,b as o,c as s,d as c,f as l,g as u,h as d,i as f,l as p,m,n as h,o as g,p as _,r as v,s as y,t as b,u as x,v as S,x as C,y as w}from"./fa-core-BU3ZZt7W.js";import{n as T,t as E}from"./react-C90crogl.js";import{$ as D,$i as O,$n as k,$r as A,$t as j,A as M,Ai as N,An as P,Ar as F,At as I,B as L,Bi as R,Bn as z,Br as B,Bt as V,C as ee,Ci as te,Cn as H,Cr as ne,Ct as re,D as ie,Di as ae,Dn as oe,Dr as se,Dt as ce,E as le,Ei as ue,En as de,Er as U,Et as fe,F as pe,Fi as me,Fn as he,Fr as ge,Ft as _e,G as ve,Gi as ye,Gn as be,Gr as xe,Gt as Se,H as Ce,Hi as we,Hn as Te,Hr as Ee,Ht as De,I as Oe,Ii as ke,In as Ae,Ir as je,It as Me,J as Ne,Ji as Pe,Jn as Fe,Jr as W,Jt as Ie,K as Le,Ki as Re,Kn as ze,Kr as Be,Kt as Ve,L as He,Li as Ue,Ln as We,Lr as Ge,Lt as Ke,M as qe,Mi as Je,Mn as Ye,Mr as Xe,Mt as Ze,N as Qe,Ni as $e,Nn as et,Nr as tt,Nt as nt,O as rt,Oi as it,On as at,Or as ot,Ot as st,P as ct,Pi as lt,Pn as ut,Pr as dt,Pt as ft,Q as pt,Qi as mt,Qn as ht,Qr as gt,Qt as _t,R as vt,Ri as yt,Rn as bt,Rr as xt,Rt as St,S as Ct,Sa as wt,Si as Tt,Sn as Et,Sr as Dt,St as Ot,T as kt,Ti as At,Tn as jt,Tr as Mt,Tt as Nt,U as Pt,Ui as Ft,Un as It,Ur as Lt,Ut as Rt,V as zt,Vi as Bt,Vn as Vt,Vr as Ht,Vt as Ut,W as Wt,Wi as Gt,Wn as Kt,Wr as qt,Wt as Jt,X as Yt,Xi as Xt,Xn as Zt,Xr as Qt,Xt as $t,Y as en,Yi as tn,Yn as nn,Yr as rn,Yt as an,Z as on,Zi as sn,Zn as cn,Zr as ln,Zt as un,_ as dn,_a as fn,_i as pn,_n as mn,_r as hn,_t as gn,a as _n,aa as vn,ai as yn,an as bn,ar as xn,at as Sn,b as Cn,ba as wn,bi as Tn,bn as En,br as Dn,bt as On,c as kn,ca as An,ci as jn,cn as Mn,cr as Nn,ct as Pn,d as Fn,da as In,di as Ln,dn as Rn,dr as zn,dt as Bn,ea as Vn,ei as Hn,en as Un,er as Wn,et as Gn,f as Kn,fa as qn,fi as Jn,fn as Yn,fr as Xn,ft as Zn,g as Qn,ga as $n,gi as er,gn as tr,gr as nr,gt as rr,h as ir,ha as ar,hi as or,hn as sr,hr as cr,ht as lr,i as ur,ia as dr,ii as fr,in as pr,ir as mr,it as hr,j as gr,ji as _r,jn as vr,jr as yr,jt as br,k as xr,ki as Sr,kn as Cr,kr as wr,kt as Tr,l as Er,la as Dr,li as Or,ln as kr,lr as Ar,lt as jr,m as Mr,ma as Nr,mi as Pr,mn as Fr,mr as Ir,mt as Lr,n as Rr,na as zr,ni as Br,nn as Vr,nr as Hr,nt as Ur,o as Wr,oa as Gr,oi as Kr,on as qr,or as Jr,ot as Yr,p as Xr,pa as Zr,pi as Qr,pn as $r,pr as ei,pt as ti,q as ni,qi as ri,qn as ii,qr as ai,qt as oi,r as si,ra as ci,ri as li,rn as ui,rr as di,rt as fi,s as pi,sa as mi,si as hi,sn as gi,sr as _i,st as vi,t as yi,ta as bi,ti as xi,tn as Si,tr as Ci,tt as wi,u as Ti,ua as Ei,ui as Di,un as Oi,ur as ki,ut as Ai,v as ji,va as Mi,vi as Ni,vn as Pi,vr as Fi,vt as Ii,w as Li,wi as Ri,wn as zi,wr as Bi,wt as Vi,x as Hi,xa as Ui,xi as Wi,xn as Gi,xr as Ki,xt as qi,y as Ji,ya as Yi,yi as Xi,yn as Zi,yr as Qi,yt as $i,z as ea,zi as ta,zn as na,zr as ra,zt as ia}from"./fa-pro-icons-D4afj0tU.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var G=e(n(),1);G.use;var aa=typeof window<`u`?G.useLayoutEffect:G.useEffect;function oa(e){let t=G.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function sa(e,t,n={},r={}){G.useEffect(()=>{if(!e.current||r.disabled||typeof IntersectionObserver!=`function`)return;let i=new IntersectionObserver(([e])=>{t(e)},n);return i.observe(e.current),()=>{i.disconnect()}},[t,n,r.disabled,e])}function ca(e){let t=G.useRef(null);return G.useImperativeHandle(e,()=>t.current,[]),t}function la(e){return e[e.length-1]}function ua(e){return typeof e==`function`}function da(e,t){return ua(e)?e(t):e}var fa=Object.prototype.hasOwnProperty,pa=Object.prototype.propertyIsEnumerable,ma=()=>Object.create(null),ha=(e,t)=>ga(e,t,ma);function ga(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=ba(e)&&ba(i);if(!a&&!(va(e)&&va(i)))return i;let o=a?e:_a(e);if(!o)return i;let s=a?i:_a(i);if(!s)return i;let c=o.length,l=s.length,u=a?Array(l):n(),d=0;for(let t=0;t<l;t++){let o=a?t:s[t],l=e[o],f=i[o];if(l===f){u[o]=l,(a?t<c:fa.call(e,o))&&d++;continue}if(l===null||f===null||typeof l!=`object`||typeof f!=`object`){u[o]=f;continue}let p=ga(l,f,n,r+1);u[o]=p,p===l&&d++}return c===l&&d===c?e:u}function _a(e){let t=Object.getOwnPropertyNames(e);for(let n of t)if(!pa.call(e,n))return!1;let n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;let r=t;for(let t of n){if(!pa.call(e,t))return!1;r.push(t)}return r}function va(e){if(!ya(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!ya(n)||!n.hasOwnProperty(`isPrototypeOf`))}function ya(e){return Object.prototype.toString.call(e)===`[object Object]`}function ba(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function xa(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0,i=e.length;r<i;r++)if(!xa(e[r],t[r],n))return!1;return!0}if(va(e)&&va(t)){let r=n?.ignoreUndefined??!0;if(n?.partial){for(let i in t)if((!r||t[i]!==void 0)&&!xa(e[i],t[i],n))return!1;return!0}let i=0;if(!r)i=Object.keys(e).length;else for(let t in e)e[t]!==void 0&&i++;let a=0;for(let o in t)if((!r||t[o]!==void 0)&&(a++,a>i||!xa(e[o],t[o],n)))return!1;return i===a}return!1}function Sa(e){let t,n,r=new Promise((e,r)=>{t=e,n=r});return r.status=`pending`,r.resolve=n=>{r.status=`resolved`,r.value=n,t(n),e?.(n)},r.reject=e=>{r.status=`rejected`,n(e)},r}function Ca(e){return!!(e&&typeof e==`object`&&typeof e.then==`function`)}function wa(e){return e.replace(/[\x00-\x1f\x7f]/g,``)}function Ta(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return wa(t)}var Ea=[`http:`,`https:`,`mailto:`,`tel:`];function Da(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function Oa(e){if(!e||!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith(`//`))return{path:e,handledProtocolRelativeURL:!1};let t=/%25|%5C/gi,n=0,r=``,i;for(;(i=t.exec(e))!==null;)r+=Ta(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=Ta(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function ka(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Aa(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function ja(){throw Error(`Invariant failed`)}function Ma(e){let t=new Map,n,r,i=e=>{e.next&&(e.prev?(e.prev.next=e.next,e.next.prev=e.prev,e.next=void 0,r&&(r.next=e,e.prev=r)):(e.next.prev=void 0,n=e.next,e.next=void 0,r&&(e.prev=r,r.next=e)),r=e)};return{get(e){let n=t.get(e);if(n)return i(n),n.value},set(a,o){if(t.size>=e&&n){let e=n;t.delete(e.key),e.next&&(n=e.next,e.next.prev=void 0),e===r&&(r=void 0)}let s=t.get(a);if(s)s.value=o,i(s);else{let e={key:a,value:o,prev:r};r&&(r.next=e),r=e,n||=e,t.set(a,e)}},clear(){t.clear(),n=void 0,r=void 0}}}var Na=4,Pa=5;function Fa(e){let t=e.indexOf(`{`);if(t===-1)return null;let n=e.indexOf(`}`,t);return n===-1||t+1>=e.length?null:[t,n]}function Ia(e,t,n=new Uint16Array(6)){let r=e.indexOf(`/`,t),i=r===-1?e.length:r,a=e.substring(t,i);if(!a||!a.includes(`$`))return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n;if(a===`$`){let r=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=r,n[4]=r,n[5]=r,n}if(a.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=i,n[4]=i,n[5]=i,n;let o=Fa(a);if(o){let[r,s]=o,c=a.charCodeAt(r+1);if(c===45){if(r+2<a.length&&a.charCodeAt(r+2)===36){let e=r+3,a=s;if(e<a)return n[0]=3,n[1]=t+r,n[2]=t+e,n[3]=t+a,n[4]=t+s+1,n[5]=i,n}}else if(c===36){let a=r+1,o=r+2;return o===s?(n[0]=2,n[1]=t+r,n[2]=t+a,n[3]=t+o,n[4]=t+s+1,n[5]=e.length,n):(n[0]=1,n[1]=t+r,n[2]=t+o,n[3]=t+s,n[4]=t+s+1,n[5]=i,n)}}return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n}function La(e,t,n,r,i,a,o){o?.(n);let s=r;{let r=n.fullPath??n.from,o=r.length,c=n.options?.caseSensitive??e,l=!!(n.options?.params?.parse&&n.options?.skipRouteOnParseError?.params);for(;s<o;){let e=Ia(r,s,t),o,u=s,d=e[5];switch(s=d+1,a++,e[0]){case 0:{let t=r.substring(e[2],e[3]);if(c){let e=i.static?.get(t);if(e)o=e;else{i.static??=new Map;let e=Ba(n.fullPath??n.from);e.parent=i,e.depth=a,o=e,i.static.set(t,e)}}else{let e=t.toLowerCase(),r=i.staticInsensitive?.get(e);if(r)o=r;else{i.staticInsensitive??=new Map;let t=Ba(n.fullPath??n.from);t.parent=i,t.depth=a,o=t,i.staticInsensitive.set(e,t)}}break}case 1:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),f=c&&!!(t||s),p=t?f?t:t.toLowerCase():void 0,m=s?f?s:s.toLowerCase():void 0,h=!l&&i.dynamic?.find(e=>!e.skipOnParamError&&e.caseSensitive===f&&e.prefix===p&&e.suffix===m);if(h)o=h;else{let e=Va(1,n.fullPath??n.from,f,p,m);o=e,e.depth=a,e.parent=i,i.dynamic??=[],i.dynamic.push(e)}break}case 3:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),f=c&&!!(t||s),p=t?f?t:t.toLowerCase():void 0,m=s?f?s:s.toLowerCase():void 0,h=!l&&i.optional?.find(e=>!e.skipOnParamError&&e.caseSensitive===f&&e.prefix===p&&e.suffix===m);if(h)o=h;else{let e=Va(3,n.fullPath??n.from,f,p,m);o=e,e.parent=i,e.depth=a,i.optional??=[],i.optional.push(e)}break}case 2:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),l=c&&!!(t||s),f=t?l?t:t.toLowerCase():void 0,p=s?l?s:s.toLowerCase():void 0,m=Va(2,n.fullPath??n.from,l,f,p);o=m,m.parent=i,m.depth=a,i.wildcard??=[],i.wildcard.push(m)}}i=o}if(l&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf(`/`)+1)===95){let e=Ba(n.fullPath??n.from);e.kind=Pa,e.parent=i,a++,e.depth=a,i.pathless??=[],i.pathless.push(e),i=e}let u=(n.path||!n.children)&&!n.isRoot;if(u&&r.endsWith(`/`)){let e=Ba(n.fullPath??n.from);e.kind=Na,e.parent=i,a++,e.depth=a,i.index=e,i=e}i.parse=n.options?.params?.parse??null,i.skipOnParamError=l,i.parsingPriority=n.options?.skipRouteOnParseError?.priority??0,u&&!i.route&&(i.route=n,i.fullPath=n.fullPath??n.from)}if(n.children)for(let r of n.children)La(e,t,r,s,i,a,o)}function Ra(e,t){if(e.skipOnParamError&&!t.skipOnParamError)return-1;if(!e.skipOnParamError&&t.skipOnParamError)return 1;if(e.skipOnParamError&&t.skipOnParamError&&(e.parsingPriority||t.parsingPriority))return t.parsingPriority-e.parsingPriority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function za(e){if(e.pathless)for(let t of e.pathless)za(t);if(e.static)for(let t of e.static.values())za(t);if(e.staticInsensitive)for(let t of e.staticInsensitive.values())za(t);if(e.dynamic?.length){e.dynamic.sort(Ra);for(let t of e.dynamic)za(t)}if(e.optional?.length){e.optional.sort(Ra);for(let t of e.optional)za(t)}if(e.wildcard?.length){e.wildcard.sort(Ra);for(let t of e.wildcard)za(t)}}function Ba(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,skipOnParamError:!1,parsingPriority:0}}function Va(e,t,n,r,i){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,skipOnParamError:!1,parsingPriority:0,caseSensitive:n,prefix:r,suffix:i}}function Ha(e,t){let n=Ba(`/`),r=new Uint16Array(6);for(let t of e)La(!1,r,t,1,n,0);za(n),t.masksTree=n,t.flatCache=Ma(1e3)}function Ua(e,t){e||=`/`;let n=t.flatCache.get(e);if(n)return n;let r=Ja(e,t.masksTree);return t.flatCache.set(e,r),r}function Wa(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=Ba(`/`),La(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),Ja(r,o,n)}function Ga(e,t,n=!1){let r=n?e:`nofuzz\0${e}`,i=t.matchCache.get(r);if(i!==void 0)return i;e||=`/`;let a;try{a=Ja(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=Xa(a.route)),t.matchCache.set(r,a),a}function Ka(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function qa(e,t=!1,n){let r=Ba(e.fullPath),i=new Uint16Array(6),a={},o={},s=0;return La(t,i,e,1,r,0,e=>{if(n?.(e,s),e.id in a&&ja(),a[e.id]=e,s!==0&&e.path){let t=Ka(e.fullPath);(!o[t]||e.fullPath.endsWith(`/`))&&(o[t]=e)}s++}),za(r),{processedTree:{segmentTree:r,singleCache:Ma(1e3),matchCache:Ma(1e3),flatCache:null,masksTree:null},routesById:a,routesByPath:o}}function Ja(e,t,n=!1){let r=e.split(`/`),i=Qa(e,r,t,n);if(!i)return null;let[a]=Ya(e,r,i);return{route:i.node.route,rawParams:a,parsedParams:i.parsedParams}}function Ya(e,t,n){let r=Za(n.node),i=null,a=Object.create(null),o=n.extract?.part??0,s=n.extract?.node??0,c=n.extract?.path??0,l=n.extract?.segment??0;for(;s<r.length;o++,s++,c++,l++){let u=r[s];if(u.kind===Na)break;if(u.kind===Pa){l--,o--,c--;continue}let d=t[o],f=c;if(d&&(c+=d.length),u.kind===1){i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0;if(e.charCodeAt(t)===123){let n=u.suffix?.length??0,r=e.substring(t+2,e.length-n-1),i=d.substring(t,d.length-n);a[r]=decodeURIComponent(i)}else{let t=e.substring(1);a[t]=decodeURIComponent(d)}}else if(u.kind===3){if(n.skipped&1<<s){o--,c=f-1;continue}i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0,r=u.suffix?.length??0,p=e.substring(t+3,e.length-r-1),m=u.suffix||u.prefix?d.substring(t,d.length-r):d;m&&(a[p]=decodeURIComponent(m))}else if(u.kind===2){let t=u,n=e.substring(f+(t.prefix?.length??0),e.length-(t.suffix?.length??0)),r=decodeURIComponent(n);a[`*`]=r,a._splat=r;break}}return n.rawParams&&Object.assign(a,n.rawParams),[a,{part:o,node:s,path:c,segment:l}]}function Xa(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function Za(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function Qa(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!la(t),a=i&&e!==`/`,o=t.length-+!!i,s=[{node:n,index:1,skipped:0,depth:1,statics:1,dynamics:0,optionals:0}],c=null,l=null,u=null;for(;s.length;){let n=s.pop(),{node:i,index:d,skipped:f,depth:p,statics:m,dynamics:h,optionals:g}=n,{extract:_,rawParams:v,parsedParams:y}=n;if(i.skipOnParamError){if(!$a(e,t,n))continue;v=n.rawParams,_=n.extract,y=n.parsedParams}r&&i.route&&i.kind!==Na&&eo(l,n)&&(l=n);let b=d===o;if(b&&(i.route&&!a&&eo(u,n)&&(u=n),!i.optional&&!i.wildcard&&!i.index&&!i.pathless))continue;let x=b?void 0:t[d],S;if(b&&i.index){let n={node:i.index,index:d,skipped:f,depth:p+1,statics:m,dynamics:h,optionals:g,extract:_,rawParams:v,parsedParams:y},r=!0;if(i.index.skipOnParamError&&($a(e,t,n)||(r=!1)),r){if(m===o&&!h&&!g&&!f)return n;eo(u,n)&&(u=n)}}if(i.wildcard&&eo(c,n))for(let n of i.wildcard){let{prefix:r,suffix:i}=n;if(r&&(b||!(n.caseSensitive?x:S??=x.toLowerCase()).startsWith(r)))continue;if(i){if(b)continue;let e=t.slice(d).join(`/`).slice(-i.length);if((n.caseSensitive?e:e.toLowerCase())!==i)continue}let a={node:n,index:o,skipped:f,depth:p,statics:m,dynamics:h,optionals:g,extract:_,rawParams:v,parsedParams:y};if(!(n.skipOnParamError&&!$a(e,t,a))){c=a;break}}if(i.optional){let e=f|1<<p,t=p+1;for(let n=i.optional.length-1;n>=0;n--){let r=i.optional[n];s.push({node:r,index:d,skipped:e,depth:t,statics:m,dynamics:h,optionals:g,extract:_,rawParams:v,parsedParams:y})}if(!b)for(let e=i.optional.length-1;e>=0;e--){let n=i.optional[e],{prefix:r,suffix:a}=n;if(r||a){let e=n.caseSensitive?x:S??=x.toLowerCase();if(r&&!e.startsWith(r)||a&&!e.endsWith(a))continue}s.push({node:n,index:d+1,skipped:f,depth:t,statics:m,dynamics:h,optionals:g+1,extract:_,rawParams:v,parsedParams:y})}}if(!b&&i.dynamic&&x)for(let e=i.dynamic.length-1;e>=0;e--){let t=i.dynamic[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?x:S??=x.toLowerCase();if(n&&!e.startsWith(n)||r&&!e.endsWith(r))continue}s.push({node:t,index:d+1,skipped:f,depth:p+1,statics:m,dynamics:h+1,optionals:g,extract:_,rawParams:v,parsedParams:y})}if(!b&&i.staticInsensitive){let e=i.staticInsensitive.get(S??=x.toLowerCase());e&&s.push({node:e,index:d+1,skipped:f,depth:p+1,statics:m+1,dynamics:h,optionals:g,extract:_,rawParams:v,parsedParams:y})}if(!b&&i.static){let e=i.static.get(x);e&&s.push({node:e,index:d+1,skipped:f,depth:p+1,statics:m+1,dynamics:h,optionals:g,extract:_,rawParams:v,parsedParams:y})}if(i.pathless){let e=p+1;for(let t=i.pathless.length-1;t>=0;t--){let n=i.pathless[t];s.push({node:n,index:d,skipped:f,depth:e,statics:m,dynamics:h,optionals:g,extract:_,rawParams:v,parsedParams:y})}}}if(u&&c)return eo(c,u)?u:c;if(u)return u;if(c)return c;if(r&&l){let n=l.index;for(let e=0;e<l.index;e++)n+=t[e].length;let r=n===e.length?`/`:e.slice(n);return l.rawParams??=Object.create(null),l.rawParams[`**`]=decodeURIComponent(r),l}return null}function $a(e,t,n){try{let[r,i]=Ya(e,t,n);n.rawParams=r,n.extract=i;let a=n.node.parse(r);return n.parsedParams=Object.assign(Object.create(null),n.parsedParams,a),!0}catch{return null}}function eo(e,t){return e?t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===Na)>(e.node.kind===Na)||t.node.kind===Na==(e.node.kind===Na)&&t.depth>e.depth))):!0}function to(e){return no(e.filter(e=>e!==void 0).join(`/`))}function no(e){return e.replace(/\/{2,}/g,`/`)}function ro(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function io(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/{1,}$/,``):e}function ao(e){return io(ro(e))}function oo(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function so(e,t,n){return oo(e,n)===oo(t,n)}function co({base:e,to:t,trailingSlash:n=`never`,cache:r}){let i=t.startsWith(`/`),a=!i&&t===`.`,o;if(r){o=i?t:a?e:e+`\0`+t;let n=r.get(o);if(n)return n}let s;if(a)s=e.split(`/`);else if(i)s=t.split(`/`);else{for(s=e.split(`/`);s.length>1&&la(s)===``;)s.pop();let n=t.split(`/`);for(let e=0,t=n.length;e<t;e++){let r=n[e];r===``?e?e===t-1&&s.push(r):s=[r]:r===`..`?s.pop():r===`.`||s.push(r)}}s.length>1&&(la(s)===``?n===`never`&&s.pop():n===`always`&&s.push(``));let c,l=``;for(let e=0;e<s.length;e++){e>0&&(l+=`/`);let t=s[e];if(!t)continue;c=Ia(t,0,c);let n=c[0];if(n===0){l+=t;continue}let r=c[5],i=t.substring(0,c[1]),a=t.substring(c[4],r),o=t.substring(c[2],c[3]);n===1?l+=i||a?`${i}{$${o}}${a}`:`$${o}`:n===2?l+=i||a?`${i}{$}${a}`:`$`:l+=`${i}{-$${o}}${a}`}l=no(l);let u=l||`/`;return o&&r&&r.set(o,u),u}function lo(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=Array.from(t.keys()).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),r=new RegExp(n,`g`);return e=>e.replace(r,e=>t.get(e)??e)}function uo(e,t,n){let r=t[e];return typeof r==`string`?e===`_splat`?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split(`/`).map(e=>po(e,n)).join(`/`):po(r,n):r}function fo({path:e,params:t,decoder:n,...r}){let i=!1,a=Object.create(null);if(!e||e===`/`)return{interpolatedPath:`/`,usedParams:a,isMissingParams:i};if(!e.includes(`$`))return{interpolatedPath:e,usedParams:a,isMissingParams:i};let o=e.length,s=0,c,l=``;for(;s<o;){let r=s;c=Ia(e,r,c);let o=c[5];if(s=o+1,r===o)continue;let u=c[0];if(u===0){l+=`/`+e.substring(r,o);continue}if(u===2){let s=t._splat;a._splat=s,a[`*`]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o);if(!s){i=!0,(u||d)&&(l+=`/`+u+d);continue}let f=uo(`_splat`,t,n);l+=`/`+u+f+d;continue}if(u===1){let s=e.substring(c[2],c[3]);!i&&!(s in t)&&(i=!0),a[s]=t[s];let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=uo(s,t,n)??`undefined`;l+=`/`+u+f+d;continue}if(u===3){let i=e.substring(c[2],c[3]),s=t[i];if(s==null)continue;a[i]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=uo(i,t,n)??``;l+=`/`+u+f+d;continue}}return e.endsWith(`/`)&&(l+=`/`),{usedParams:a,interpolatedPath:l||`/`,isMissingParams:i}}function po(e,t){let n=encodeURIComponent(e);return t?.(n)??n}function mo(e){return!!e?.isNotFound}function ho(){try{return typeof window<`u`&&typeof window.sessionStorage==`object`?window.sessionStorage:void 0}catch{return}}var go=`tsr-scroll-restoration-v1_3`;function _o(){let e=ho();if(!e)return null;let t={};try{let n=JSON.parse(e.getItem(`tsr-scroll-restoration-v1_3`)||`{}`);va(n)&&(t=n)}catch{}return{get state(){return t},set:e=>{t=da(e,t)||t},persist:()=>{try{e.setItem(go,JSON.stringify(t))}catch{}}}}var vo=_o(),yo=e=>e.state.__TSR_key||e.href;function bo(e){let t=[],n;for(;n=e.parentNode;)t.push(`${e.tagName}:nth-child(${Array.prototype.indexOf.call(n.children,e)+1})`),e=n;return`${t.reverse().join(` > `)}`.toLowerCase()}var xo=!1,So=`window`,Co=`data-scroll-restoration-id`;function wo(e,t){if(!vo)return;let n=vo;if((t??e.options.scrollRestoration??!1)&&(e.isScrollRestoring=!0),e.isScrollRestorationSetup||!n)return;e.isScrollRestorationSetup=!0,xo=!1;let r=e.options.getScrollRestorationKey||yo,i=new Map;window.history.scrollRestoration=`manual`;let a=t=>{if(!(xo||!e.isScrollRestoring))if(t.target===document||t.target===window)i.set(So,{scrollX:window.scrollX||0,scrollY:window.scrollY||0});else{let e=t.target;i.set(e,{scrollX:e.scrollLeft||0,scrollY:e.scrollTop||0})}},o=t=>{if(!e.isScrollRestoring||!t||i.size===0||!n)return;let r=n.state[t]||={};for(let[e,t]of i){let n;if(e===So)n=So;else if(e.isConnected){let t=e.getAttribute(Co);n=t?`[${Co}="${t}"]`:bo(e)}n&&(r[n]=t)}};document.addEventListener(`scroll`,a,!0),e.subscribe(`onBeforeLoad`,e=>{o(e.fromLocation?r(e.fromLocation):void 0),i.clear()}),window.addEventListener(`pagehide`,()=>{o(r(e.stores.resolvedLocation.state??e.stores.location.state)),n.persist()}),e.subscribe(`onRendered`,t=>{let a=r(t.toLocation),o=e.options.scrollRestorationBehavior,s=e.options.scrollToTopSelectors;if(i.clear(),!e.resetNextScroll){e.resetNextScroll=!0;return}if(!(typeof e.options.scrollRestoration==`function`&&!e.options.scrollRestoration({location:e.latestLocation}))){xo=!0;try{let t=e.isScrollRestoring?n.state[a]:void 0,r=!1;if(t)for(let e in t){let n=t[e];if(!va(n))continue;let{scrollX:i,scrollY:a}=n;if(!(!Number.isFinite(i)||!Number.isFinite(a))){if(e===So)window.scrollTo({top:a,left:i,behavior:o}),r=!0;else if(e){let t;try{t=document.querySelector(e)}catch{continue}t&&(t.scrollLeft=i,t.scrollTop=a,r=!0)}}}if(!r){let t=e.history.location.hash.slice(1);if(t){let e=window.history.state?.__hashScrollIntoViewOptions??!0;if(e){let n=document.getElementById(t);n&&n.scrollIntoView(e)}}else{let e={top:0,left:0,behavior:o};if(window.scrollTo(e),s)for(let t of s){if(t===So)continue;let n=typeof t==`function`?t():document.querySelector(t);n&&n.scrollTo(e)}}}}finally{xo=!1}e.isScrollRestoring&&n.set(e=>(e[a]||={},e))}})}function To(e,t=String){let n=new URLSearchParams;for(let r in e){let i=e[r];i!==void 0&&n.set(r,t(i))}return n.toString()}function Eo(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function Do(e){let t=new URLSearchParams(e),n=Object.create(null);for(let[e,r]of t.entries()){let t=n[e];t==null?n[e]=Eo(r):Array.isArray(t)?t.push(Eo(r)):n[e]=[t,Eo(r)]}return n}var Oo=Ao(JSON.parse),ko=jo(JSON.stringify,JSON.parse);function Ao(e){return t=>{t[0]===`?`&&(t=t.substring(1));let n=Do(t);for(let t in n){let r=n[t];if(typeof r==`string`)try{n[t]=e(r)}catch{}}return n}}function jo(e,t){let n=typeof t==`function`;function r(r){if(typeof r==`object`&&r)try{return e(r)}catch{}else if(n&&typeof r==`string`)try{return t(r),e(r)}catch{}return r}return e=>{let t=To(e,r);return t?`?${t}`:``}}var Mo=`__root__`;function No(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&!e.reloadDocument&&typeof e.href==`string`)try{new URL(e.href),e.reloadDocument=!0}catch{}let t=new Headers(e.headers);e.href&&t.get(`Location`)===null&&t.set(`Location`,e.href);let n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function Po(e){return e instanceof Response&&!!e.options}function Fo(e){return{input:({url:t})=>{for(let n of e)t=Lo(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=Ro(e[n],t);return t}}}function Io(e){let t=ao(e.basepath),n=`/${t}`,r=`${n}/`,i=e.caseSensitive?n:n.toLowerCase(),a=e.caseSensitive?r:r.toLowerCase();return{input:({url:t})=>{let r=e.caseSensitive?t.pathname:t.pathname.toLowerCase();return r===i?t.pathname=`/`:r.startsWith(a)&&(t.pathname=t.pathname.slice(n.length)),t},output:({url:e})=>(e.pathname=to([`/`,t,e.pathname]),e)}}function Lo(e,t){let n=e?.input?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function Ro(e,t){let n=e?.output?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function zo(e,t){let{createMutableStore:n,createReadonlyStore:r,batch:i,init:a}=t,o=new Map,s=new Map,c=new Map,l=n(e.status),u=n(e.loadedAt),d=n(e.isLoading),f=n(e.isTransitioning),p=n(e.location),m=n(e.resolvedLocation),h=n(e.statusCode),g=n(e.redirect),_=n([]),v=n([]),y=n([]),b=r(()=>Bo(o,_.state)),x=r(()=>Bo(s,v.state)),S=r(()=>Bo(c,y.state)),C=r(()=>_.state[0]),w=r(()=>_.state.some(e=>o.get(e)?.state.status===`pending`)),T=r(()=>({locationHref:p.state.href,resolvedLocationHref:m.state?.href,status:l.state})),E=r(()=>({status:l.state,loadedAt:u.state,isLoading:d.state,isTransitioning:f.state,matches:b.state,location:p.state,resolvedLocation:m.state,statusCode:h.state,redirect:g.state})),D=Ma(64);function O(e){let t=D.get(e);return t||(t=r(()=>{let t=_.state;for(let n of t){let t=o.get(n);if(t&&t.routeId===e)return t.state}}),D.set(e,t)),t}let k={status:l,loadedAt:u,isLoading:d,isTransitioning:f,location:p,resolvedLocation:m,statusCode:h,redirect:g,matchesId:_,pendingMatchesId:v,cachedMatchesId:y,activeMatchesSnapshot:b,pendingMatchesSnapshot:x,cachedMatchesSnapshot:S,firstMatchId:C,hasPendingMatches:w,matchRouteReactivity:T,activeMatchStoresById:o,pendingMatchStoresById:s,cachedMatchStoresById:c,__store:E,getMatchStoreByRouteId:O,setActiveMatches:A,setPendingMatches:j,setCachedMatches:M};A(e.matches),a?.(k);function A(e){Vo(e,o,_,n,i)}function j(e){Vo(e,s,v,n,i)}function M(e){Vo(e,c,y,n,i)}return k}function Bo(e,t){let n=[];for(let r of t){let t=e.get(r);t&&n.push(t.state)}return n}function Vo(e,t,n,r,i){let a=e.map(e=>e.id),o=new Set(a);i(()=>{for(let e of t.keys())o.has(e)||t.delete(e);for(let n of e){let e=t.get(n.id);if(!e){let e=r(n);e.routeId=n.routeId,t.set(n.id,e);continue}e.routeId=n.routeId,e.state!==n&&e.setState(()=>n)}Aa(n.state,a)||n.setState(()=>a)})}var Ho=e=>{if(!e.rendered)return e.rendered=!0,e.onReady?.()},Uo=e=>e.stores.matchesId.state.some(t=>e.stores.activeMatchStoresById.get(t)?.state._forcePending),Wo=(e,t)=>!!(e.preload&&!e.router.stores.activeMatchStoresById.has(t)),Go=(e,t,n=!0)=>{let r={...e.router.options.context??{}},i=n?t:t-1;for(let t=0;t<=i;t++){let n=e.matches[t];if(!n)continue;let i=e.router.getMatch(n.id);i&&Object.assign(r,i.__routeContext,i.__beforeLoadContext)}return r},Ko=(e,t)=>{if(!e.matches.length)return;let n=t.routeId,r=e.matches.findIndex(t=>t.routeId===e.router.routeTree.id),i=r>=0?r:0,a=n?e.matches.findIndex(e=>e.routeId===n):e.firstBadMatchIndex??e.matches.length-1;a<0&&(a=i);for(let t=a;t>=0;t--){let n=e.matches[t];if(e.router.looseRoutesById[n.routeId].options.notFoundComponent)return t}return n?a:i},qo=(e,t,n)=>{if(!(!Po(n)&&!mo(n)))throw Po(n)&&n.redirectHandled&&!n.options.reloadDocument?n:(t&&(t._nonReactive.beforeLoadPromise?.resolve(),t._nonReactive.loaderPromise?.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0,t._nonReactive.error=n,e.updateMatch(t.id,r=>({...r,status:Po(n)?`redirected`:r.status===`pending`?`success`:r.status,context:Go(e,t.index),isFetching:!1,error:n})),mo(n)&&!n.routeId&&(n.routeId=t.routeId),t._nonReactive.loadPromise?.resolve()),Po(n)&&(e.rendered=!0,n.options._fromLocation=e.location,n.redirectHandled=!0,n=e.router.resolveRedirect(n)),n)},Jo=(e,t)=>{let n=e.router.getMatch(t);return!!(!n||n._nonReactive.dehydrated)},Yo=(e,t,n)=>{let r=Go(e,n);e.updateMatch(t,e=>({...e,context:r}))},Xo=(e,t,n,r)=>{let{id:i,routeId:a}=e.matches[t],o=e.router.looseRoutesById[a];if(n instanceof Promise)throw n;n.routerCode=r,e.firstBadMatchIndex??=t,qo(e,e.router.getMatch(i),n);try{o.options.onError?.(n)}catch(t){n=t,qo(e,e.router.getMatch(i),n)}e.updateMatch(i,e=>(e._nonReactive.beforeLoadPromise?.resolve(),e._nonReactive.beforeLoadPromise=void 0,e._nonReactive.loadPromise?.resolve(),{...e,error:n,status:`error`,isFetching:!1,updatedAt:Date.now(),abortController:new AbortController})),!e.preload&&!Po(n)&&!mo(n)&&(e.serialError??=n)},Zo=(e,t,n,r)=>{if(r._nonReactive.pendingTimeout!==void 0)return;let i=n.options.pendingMs??e.router.options.defaultPendingMs;if(e.onReady&&!Wo(e,t)&&(n.options.loader||n.options.beforeLoad||cs(n))&&typeof i==`number`&&i!==1/0&&(n.options.pendingComponent??e.router.options?.defaultPendingComponent)){let t=setTimeout(()=>{Ho(e)},i);r._nonReactive.pendingTimeout=t}},Qo=(e,t,n)=>{let r=e.router.getMatch(t);if(!r._nonReactive.beforeLoadPromise&&!r._nonReactive.loaderPromise)return;Zo(e,t,n,r);let i=()=>{let n=e.router.getMatch(t);n.preload&&(n.status===`redirected`||n.status===`notFound`)&&qo(e,n,n.error)};return r._nonReactive.beforeLoadPromise?r._nonReactive.beforeLoadPromise.then(i):i()},$o=(e,t,n,r)=>{let i=e.router.getMatch(t),a=i._nonReactive.loadPromise;i._nonReactive.loadPromise=Sa(()=>{a?.resolve(),a=void 0});let{paramsError:o,searchError:s}=i;o&&Xo(e,n,o,`PARSE_PARAMS`),s&&Xo(e,n,s,`VALIDATE_SEARCH`),Zo(e,t,r,i);let c=new AbortController,l=!1,u=()=>{l||(l=!0,e.updateMatch(t,e=>({...e,isFetching:`beforeLoad`,fetchCount:e.fetchCount+1,abortController:c})))},d=()=>{i._nonReactive.beforeLoadPromise?.resolve(),i._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,e=>({...e,isFetching:!1}))};if(!r.options.beforeLoad){e.router.batch(()=>{u(),d()});return}i._nonReactive.beforeLoadPromise=Sa();let f={...Go(e,n,!1),...i.__routeContext},{search:p,params:m,cause:h}=i,g=Wo(e,t),_={search:p,abortController:c,params:m,preload:g,context:f,location:e.location,navigate:t=>e.router.navigate({...t,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:g?`preload`:h,matches:e.matches,routeId:r.id,...e.router.options.additionalContext},v=r=>{if(r===void 0){e.router.batch(()=>{u(),d()});return}(Po(r)||mo(r))&&(u(),Xo(e,n,r,`BEFORE_LOAD`)),e.router.batch(()=>{u(),e.updateMatch(t,e=>({...e,__beforeLoadContext:r})),d()})},y;try{if(y=r.options.beforeLoad(_),Ca(y))return u(),y.catch(t=>{Xo(e,n,t,`BEFORE_LOAD`)}).then(v)}catch(t){u(),Xo(e,n,t,`BEFORE_LOAD`)}v(y)},es=(e,t)=>{let{id:n,routeId:r}=e.matches[t],i=e.router.looseRoutesById[r],a=()=>s(),o=()=>$o(e,n,t,i),s=()=>{if(Jo(e,n))return;let t=Qo(e,n,i);return Ca(t)?t.then(o):o()};return a()},ts=(e,t,n)=>{let r=e.router.getMatch(t);if(!r||!n.options.head&&!n.options.scripts&&!n.options.headers)return;let i={ssr:e.router.options.ssr,matches:e.matches,match:r,params:r.params,loaderData:r.loaderData};return Promise.all([n.options.head?.(i),n.options.scripts?.(i),n.options.headers?.(i)]).then(([e,t,n])=>({meta:e?.meta,links:e?.links,headScripts:e?.scripts,headers:n,scripts:t,styles:e?.styles}))},ns=(e,t,n,r,i)=>{let a=t[r-1],{params:o,loaderDeps:s,abortController:c,cause:l}=e.router.getMatch(n),u=Go(e,r),d=Wo(e,n);return{params:o,deps:s,preload:!!d,parentMatchPromise:a,abortController:c,context:u,location:e.location,navigate:t=>e.router.navigate({...t,_fromLocation:e.location}),cause:d?`preload`:l,route:i,...e.router.options.additionalContext}},rs=async(e,t,n,r,i)=>{try{let a=e.router.getMatch(n);try{ss(i);let o=i.options.loader,s=typeof o==`function`?o:o?.handler,c=s?.(ns(e,t,n,r,i)),l=!!s&&Ca(c);if((l||i._lazyPromise||i._componentsPromise||i.options.head||i.options.scripts||i.options.headers||a._nonReactive.minPendingPromise)&&e.updateMatch(n,e=>({...e,isFetching:`loader`})),s){let t=l?await c:c;qo(e,e.router.getMatch(n),t),t!==void 0&&e.updateMatch(n,e=>({...e,loaderData:t}))}i._lazyPromise&&await i._lazyPromise;let u=a._nonReactive.minPendingPromise;u&&await u,i._componentsPromise&&await i._componentsPromise,e.updateMatch(n,t=>({...t,error:void 0,context:Go(e,r),status:`success`,isFetching:!1,updatedAt:Date.now()}))}catch(t){let o=t;if(o?.name===`AbortError`){if(a.abortController.signal.aborted){a._nonReactive.loaderPromise?.resolve(),a._nonReactive.loaderPromise=void 0;return}e.updateMatch(n,t=>({...t,status:t.status===`pending`?`success`:t.status,isFetching:!1,context:Go(e,r)}));return}let s=a._nonReactive.minPendingPromise;s&&await s,mo(t)&&await i.options.notFoundComponent?.preload?.(),qo(e,e.router.getMatch(n),t);try{i.options.onError?.(t)}catch(t){o=t,qo(e,e.router.getMatch(n),t)}!Po(o)&&!mo(o)&&await ss(i,[`errorComponent`]),e.updateMatch(n,t=>({...t,error:o,context:Go(e,r),status:`error`,isFetching:!1}))}}catch(t){let r=e.router.getMatch(n);r&&(r._nonReactive.loaderPromise=void 0),qo(e,r,t)}},is=async(e,t,n)=>{async function r(r,a,c,l,d){let f=Date.now()-a.updatedAt,p=r?d.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:d.options.staleTime??e.router.options.defaultStaleTime??0,m=d.options.shouldReload,h=typeof m==`function`?m(ns(e,t,i,n,d)):m,{status:g,invalid:_}=l,v=f>=p&&(!!e.forceStaleReload||l.cause===`enter`||c!==void 0&&c!==l.id);o=g===`success`&&(_||(h??v)),r&&d.options.preload===!1||(o&&!e.sync&&u?(s=!0,(async()=>{try{await rs(e,t,i,n,d);let r=e.router.getMatch(i);r._nonReactive.loaderPromise?.resolve(),r._nonReactive.loadPromise?.resolve(),r._nonReactive.loaderPromise=void 0,r._nonReactive.loadPromise=void 0}catch(t){Po(t)&&await e.router.navigate(t.options)}})()):g!==`success`||o?await rs(e,t,i,n,d):Yo(e,i,n))}let{id:i,routeId:a}=e.matches[n],o=!1,s=!1,c=e.router.looseRoutesById[a],l=c.options.loader,u=((typeof l==`function`?void 0:l?.staleReloadMode)??e.router.options.defaultStaleReloadMode)!==`blocking`;if(Jo(e,i)){if(!e.router.getMatch(i))return e.matches[n];Yo(e,i,n)}else{let t=e.router.getMatch(i),o=e.router.stores.matchesId.state[n],s=(o&&e.router.stores.activeMatchStoresById.get(o)||null)?.routeId===a?o:e.router.stores.activeMatchesSnapshot.state.find(e=>e.routeId===a)?.id,l=Wo(e,i);if(t._nonReactive.loaderPromise){if(t.status===`success`&&!e.sync&&!t.preload&&u)return t;await t._nonReactive.loaderPromise;let n=e.router.getMatch(i),a=n._nonReactive.error||n.error;a&&qo(e,n,a),n.status===`pending`&&await r(l,t,s,n,c)}else{let n=l&&!e.router.stores.activeMatchStoresById.has(i),a=e.router.getMatch(i);a._nonReactive.loaderPromise=Sa(),n!==a.preload&&e.updateMatch(i,e=>({...e,preload:n})),await r(l,t,s,a,c)}}let d=e.router.getMatch(i);s||(d._nonReactive.loaderPromise?.resolve(),d._nonReactive.loadPromise?.resolve(),d._nonReactive.loadPromise=void 0),clearTimeout(d._nonReactive.pendingTimeout),d._nonReactive.pendingTimeout=void 0,s||(d._nonReactive.loaderPromise=void 0),d._nonReactive.dehydrated=void 0;let f=s?d.isFetching:!1;return f!==d.isFetching||d.invalid!==!1?(e.updateMatch(i,e=>({...e,isFetching:f,invalid:!1})),e.router.getMatch(i)):d};async function as(e){let t=e,n=[];Uo(t.router)&&Ho(t);let r;for(let e=0;e<t.matches.length;e++){try{let n=es(t,e);Ca(n)&&await n}catch(e){if(Po(e))throw e;if(mo(e))r=e;else if(!t.preload)throw e;break}if(t.serialError||t.firstBadMatchIndex!=null)break}let i=t.firstBadMatchIndex??t.matches.length,a=r&&!t.preload?Ko(t,r):void 0,o=r&&t.preload?0:a===void 0?i:Math.min(a+1,i),s,c;for(let e=0;e<o;e++)n.push(is(t,n,e));try{await Promise.all(n)}catch{let e=await Promise.allSettled(n);for(let t of e){if(t.status!==`rejected`)continue;let e=t.reason;if(Po(e))throw e;mo(e)?s??=e:c??=e}if(c!==void 0)throw c}let l=s??(r&&!t.preload?r:void 0),u=t.firstBadMatchIndex===void 0?t.matches.length-1:t.firstBadMatchIndex;if(!l&&r&&t.preload)return t.matches;if(l){let e=Ko(t,l);e===void 0&&ja();let n=t.matches[e],r=t.router.looseRoutesById[n.routeId],i=t.router.options?.defaultNotFoundComponent;!r.options.notFoundComponent&&i&&(r.options.notFoundComponent=i),l.routeId=n.routeId;let a=n.routeId===t.router.routeTree.id;t.updateMatch(n.id,e=>({...e,...a?{status:`success`,globalNotFound:!0,error:void 0}:{status:`notFound`,error:l},isFetching:!1})),u=e,await ss(r,[`notFoundComponent`])}else if(!t.preload){let e=t.matches[0];e.globalNotFound||t.router.getMatch(e.id)?.globalNotFound&&t.updateMatch(e.id,e=>({...e,globalNotFound:!1,error:void 0}))}if(t.serialError&&t.firstBadMatchIndex!==void 0){let e=t.router.looseRoutesById[t.matches[t.firstBadMatchIndex].routeId];await ss(e,[`errorComponent`])}for(let e=0;e<=u;e++){let{id:n,routeId:r}=t.matches[e],i=t.router.looseRoutesById[r];try{let e=ts(t,n,i);if(e){let r=await e;t.updateMatch(n,e=>({...e,...r}))}}catch(e){console.error(`Error executing head for route ${r}:`,e)}}let d=Ho(t);if(Ca(d)&&await d,l)throw l;if(t.serialError&&!t.preload&&!t.onReady)throw t.serialError;return t.matches}function os(e,t){let n=t.map(t=>e.options[t]?.preload?.()).filter(Boolean);if(n.length!==0)return Promise.all(n)}function ss(e,t=ls){!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(t=>{let{id:n,...r}=t.options;Object.assign(e.options,r),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0);let n=()=>e._componentsLoaded?void 0:t===ls?(()=>{if(e._componentsPromise===void 0){let t=os(e,ls);t?e._componentsPromise=t.then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0}):e._componentsLoaded=!0}return e._componentsPromise})():os(e,t);return e._lazyPromise?e._lazyPromise.then(n):n()}function cs(e){for(let t of ls)if(e.options[t]?.preload)return!0;return!1}var ls=[`component`,`errorComponent`,`pendingComponent`,`notFoundComponent`],us=`__TSR_index`,ds=`popstate`,fs=`beforeunload`;function ps(e){let t=e.getLocation(),n=new Set,r=r=>{t=e.getLocation(),n.forEach(e=>e({location:t,action:r}))},i=n=>{e.notifyOnIndexChange??!0?r(n):t=e.getLocation()},a=async({task:n,navigateOpts:r,...i})=>{if(r?.ignoreBlocker??!1){n();return}let a=e.getBlockers?.()??[],o=i.type===`PUSH`||i.type===`REPLACE`;if(typeof document<`u`&&a.length&&o)for(let n of a){let r=_s(i.path,i.state);if(await n.blockerFn({currentLocation:t,nextLocation:r,action:i.type})){e.onBlocked?.();return}}n()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:e=>(n.add(e),()=>{n.delete(e)}),push:(n,i,o)=>{let s=t.state[us];i=ms(s+1,i),a({task:()=>{e.pushState(n,i),r({type:`PUSH`})},navigateOpts:o,type:`PUSH`,path:n,state:i})},replace:(n,i,o)=>{let s=t.state[us];i=ms(s,i),a({task:()=>{e.replaceState(n,i),r({type:`REPLACE`})},navigateOpts:o,type:`REPLACE`,path:n,state:i})},go:(t,n)=>{a({task:()=>{e.go(t),i({type:`GO`,index:t})},navigateOpts:n,type:`GO`})},back:t=>{a({task:()=>{e.back(t?.ignoreBlocker??!1),i({type:`BACK`})},navigateOpts:t,type:`BACK`})},forward:t=>{a({task:()=>{e.forward(t?.ignoreBlocker??!1),i({type:`FORWARD`})},navigateOpts:t,type:`FORWARD`})},canGoBack:()=>t.state[us]!==0,createHref:t=>e.createHref(t),block:t=>{if(!e.setBlockers)return()=>{};let n=e.getBlockers?.()??[];return e.setBlockers([...n,t]),()=>{let n=e.getBlockers?.()??[];e.setBlockers?.(n.filter(e=>e!==t))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r}}function ms(e,t){t||={};let n=vs();return{...t,key:n,__TSR_key:n,[us]:e}}function hs(e){let t=e?.window??(typeof document<`u`?window:void 0),n=t.history.pushState,r=t.history.replaceState,i=[],a=()=>i,o=e=>i=e,s=e?.createHref??(e=>e),c=e?.parseLocation??(()=>_s(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=vs();t.history.replaceState({[us]:0,key:e,__TSR_key:e},``)}let l=c(),u,d=!1,f=!1,p=!1,m=!1,h=()=>l,g,_,v=()=>{g&&(C._ignoreSubscribers=!0,(g.isPush?t.history.pushState:t.history.replaceState)(g.state,``,g.href),C._ignoreSubscribers=!1,g=void 0,_=void 0,u=void 0)},y=(e,t,n)=>{let r=s(t);_||(u=l),l=_s(t,n),g={href:r,state:n,isPush:g?.isPush||e===`push`},_||=Promise.resolve().then(()=>v())},b=e=>{l=c(),C.notify({type:e})},x=async()=>{if(f){f=!1;return}let e=c(),n=e.state[us]-l.state[us],r=n===1,i=n===-1,o=!r&&!i||d;d=!1;let s=o?`GO`:i?`BACK`:`FORWARD`,u=o?{type:`GO`,index:n}:{type:i?`BACK`:`FORWARD`};if(p)p=!1;else{let n=a();if(typeof document<`u`&&n.length){for(let r of n)if(await r.blockerFn({currentLocation:l,nextLocation:e,action:s})){f=!0,t.history.go(1),C.notify(u);return}}}l=c(),C.notify(u)},S=e=>{if(m){m=!1;return}let t=!1,n=a();if(typeof document<`u`&&n.length)for(let e of n){let n=e.enableBeforeUnload??!0;if(n===!0){t=!0;break}if(typeof n==`function`&&n()===!0){t=!0;break}}if(t)return e.preventDefault(),e.returnValue=``},C=ps({getLocation:h,getLength:()=>t.history.length,pushState:(e,t)=>y(`push`,e,t),replaceState:(e,t)=>y(`replace`,e,t),back:e=>(e&&(p=!0),m=!0,t.history.back()),forward:e=>{e&&(p=!0),m=!0,t.history.forward()},go:e=>{d=!0,t.history.go(e)},createHref:e=>s(e),flush:v,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(fs,S,{capture:!0}),t.removeEventListener(ds,x)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return t.addEventListener(fs,S,{capture:!0}),t.addEventListener(ds,x),t.history.pushState=function(...e){let r=n.apply(t.history,e);return C._ignoreSubscribers||b(`PUSH`),r},t.history.replaceState=function(...e){let n=r.apply(t.history,e);return C._ignoreSubscribers||b(`REPLACE`),n},C}function gs(e){let t=e.replace(/[\x00-\x1f\x7f]/g,``);return t.startsWith(`//`)&&(t=`/`+t.replace(/^\/+/,``)),t}function _s(e,t){let n=gs(e),r=n.indexOf(`#`),i=n.indexOf(`?`),a=vs();return{href:n,pathname:n.substring(0,r>0?i>0?Math.min(r,i):r:i>0?i:n.length),hash:r>-1?n.substring(r):``,search:i>-1?n.slice(i,r===-1?void 0:r):``,state:t||{[us]:0,key:a,__TSR_key:a}}}function vs(){return(Math.random()+1).toString(36).substring(7)}function ys(e,t){let n=t,r=e;return{fromLocation:n,toLocation:r,pathChanged:n?.pathname!==r.pathname,hrefChanged:n?.href!==r.href,hashChanged:n?.hash!==r.hash}}var bs=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.isScrollRestoring=!1,this.isScrollRestorationSetup=!1,this.startTransition=e=>e(),this.update=e=>{let t=this.options,n=this.basepath??t?.basepath??`/`,r=this.basepath===void 0,i=t?.rewrite;if(this.options={...t,...e},this.isServer=this.options.isServer??typeof document>`u`,this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=lo(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=hs()),this.origin=this.options.origin,this.origin||(window?.origin&&window.origin!==`null`?this.origin=window.origin:this.origin=`http://localhost`),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let e;this.resolvePathCache=Ma(1e3),e=this.buildRouteTree(),this.setRoutes(e)}if(!this.stores&&this.latestLocation){let e=this.getStoreConfig(this);this.batch=e.batch,this.stores=zo(Cs(this.latestLocation),e),wo(this)}let a=!1,o=this.options.basepath??`/`,s=this.options.rewrite;if(r||n!==o||i!==s){this.basepath=o;let e=[],t=ao(o);t&&t!==`/`&&e.push(Io({basepath:o})),s&&e.push(s),this.rewrite=e.length===0?void 0:e.length===1?e[0]:Fo(e),this.history&&this.updateLatestLocation(),a=!0}a&&this.stores&&this.stores.location.setState(()=>this.latestLocation),typeof window<`u`&&`CSS`in window&&typeof window.CSS?.supports==`function`&&(this.isViewTransitionTypesSupported=window.CSS.supports(`selector(:active-view-transition-type(a)`))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=qa(this.routeTree,this.options.caseSensitive,(e,t)=>{e.init({originalIndex:t})});return this.options.routeMasks&&Ha(this.options.routeMasks,e.processedTree),e},this.subscribe=(e,t)=>{let n={eventType:e,fn:t};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=e=>{this.subscribers.forEach(t=>{t.eventType===e.type&&t.fn(e)})},this.parseLocation=(e,t)=>{let n=({pathname:e,search:n,hash:r,href:i,state:a})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(e)){let i=this.options.parseSearch(n),o=this.options.stringifySearch(i);return{href:e+o+r,publicHref:e+o+r,pathname:Oa(e).path,external:!1,searchStr:o,search:ha(t?.search,i),hash:Oa(r.slice(1)).path,state:ga(t?.state,a)}}let o=new URL(i,this.origin),s=Lo(this.rewrite,o),c=this.options.parseSearch(s.search),l=this.options.stringifySearch(c);return s.search=l,{href:s.href.replace(s.origin,``),publicHref:i,pathname:Oa(s.pathname).path,external:!!this.rewrite&&s.origin!==this.origin,searchStr:l,search:ha(t?.search,c),hash:Oa(s.hash.slice(1)).path,state:ga(t?.state,a)}},r=n(e),{__tempLocation:i,__tempKey:a}=r.state;if(i&&(!a||a===this.tempLocationKey)){let e=n(i);return e.state.key=r.state.key,e.state.__TSR_key=r.state.__TSR_key,delete e.state.__tempLocation,{...e,maskedLocation:r}}return r},this.resolvePathWithBase=(e,t)=>co({base:e,to:no(t),trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(e,t,n)=>typeof e==`string`?this.matchRoutesInternal({pathname:e,search:t},n):this.matchRoutesInternal(e,t),this.getMatchedRoutes=e=>Ts({pathname:e,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=e=>{let t=this.getMatch(e);t&&(t.abortController.abort(),clearTimeout(t._nonReactive.pendingTimeout),t._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{this.stores.pendingMatchesId.state.forEach(e=>{this.cancelMatch(e)}),this.stores.matchesId.state.forEach(e=>{if(this.stores.pendingMatchStoresById.has(e))return;let t=this.stores.activeMatchStoresById.get(e)?.state;t&&(t.status===`pending`||t.isFetching===`loader`)&&this.cancelMatch(e)})},this.buildLocation=e=>{let t=(t={})=>{let n=t._fromLocation||this.pendingBuiltLocation||this.latestLocation,r=this.matchRoutesLightweight(n);t.from;let i=t.unsafeRelative===`path`?n.pathname:t.from??r.fullPath,a=this.resolvePathWithBase(i,`.`),o=r.search,s=Object.assign(Object.create(null),r.params),c=t.to?this.resolvePathWithBase(a,`${t.to}`):this.resolvePathWithBase(a,`.`),l=t.params===!1||t.params===null?Object.create(null):(t.params??!0)===!0?s:Object.assign(s,da(t.params,s)),u=this.getMatchedRoutes(c),d=u.matchedRoutes;if((!u.foundRoute||u.foundRoute.path!==`/`&&u.routeParams[`**`])&&this.options.notFoundRoute&&(d=[...d,this.options.notFoundRoute]),Object.keys(l).length>0)for(let e of d){let t=e.options.params?.stringify??e.options.stringifyParams;if(t)try{Object.assign(l,t(l))}catch{}}let f=e.leaveParams?c:Oa(fo({path:c,params:l,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path,p=o;if(e._includeValidateSearch&&this.options.search?.strict){let e={};d.forEach(t=>{if(t.options.validateSearch)try{Object.assign(e,ws(t.options.validateSearch,{...e,...p}))}catch{}}),p=e}p=Es({search:p,dest:t,destRoutes:d,_includeValidateSearch:e._includeValidateSearch}),p=ha(o,p);let m=this.options.stringifySearch(p),h=t.hash===!0?n.hash:t.hash?da(t.hash,n.hash):void 0,g=h?`#${h}`:``,_=t.state===!0?n.state:t.state?da(t.state,n.state):{};_=ga(n.state,_);let v=`${f}${m}${g}`,y,b,x=!1;if(this.rewrite){let e=new URL(v,this.origin),t=Ro(this.rewrite,e);y=e.href.replace(e.origin,``),t.origin===this.origin?b=t.pathname+t.search+t.hash:(b=t.href,x=!0)}else y=ka(v),b=y;return{publicHref:b,href:y,pathname:f,search:p,searchStr:m,state:_,hash:h??``,external:x,unmaskOnReload:t.unmaskOnReload}},n=(n={},r)=>{let i=t(n),a=r?t(r):void 0;if(!a){let n=Object.create(null);if(this.options.routeMasks){let o=Ua(i.pathname,this.processedTree);if(o){Object.assign(n,o.rawParams);let{from:i,params:s,...c}=o.route,l=s===!1||s===null?Object.create(null):(s??!0)===!0?n:Object.assign(n,da(s,n));r={from:e.from,...c,params:l},a=t(r)}}}return a&&(i.maskedLocation=a),i};return e.mask?n(e,{from:e.from,...e.mask}):n(e)},this.commitLocation=async({viewTransition:e,ignoreBlocker:t,...n})=>{let r=()=>{let e=[`key`,`__TSR_key`,`__TSR_index`,`__hashScrollIntoViewOptions`];e.forEach(e=>{n.state[e]=this.latestLocation.state[e]});let t=xa(n.state,this.latestLocation.state);return e.forEach(e=>{delete n.state[e]}),t},i=io(this.latestLocation.href)===io(n.href),a=this.commitLocationPromise;if(this.commitLocationPromise=Sa(()=>{a?.resolve(),a=void 0}),i&&r())this.load();else{let{maskedLocation:r,hashScrollIntoView:i,...a}=n;r&&(a={...r,state:{...r.state,__tempKey:void 0,__tempLocation:{...a,search:a.searchStr,state:{...a.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(a.unmaskOnReload??this.options.unmaskOnReload??!1)&&(a.state.__tempKey=this.tempLocationKey)),a.state.__hashScrollIntoViewOptions=i??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=e,this.history[n.replace?`replace`:`push`](a.publicHref,a.state,{ignoreBlocker:t})}return this.resetNextScroll=n.resetScroll??!0,this.history.subscribers.size||this.load(),this.commitLocationPromise},this.buildAndCommitLocation=({replace:e,resetScroll:t,hashScrollIntoView:n,viewTransition:r,ignoreBlocker:i,href:a,...o}={})=>{if(a){let t=this.history.location.state.__TSR_index,n=_s(a,{__TSR_index:e?t:t+1}),r=new URL(n.pathname,this.origin);o.to=Lo(this.rewrite,r).pathname,o.search=this.options.parseSearch(n.search),o.hash=n.hash.slice(1)}let s=this.buildLocation({...o,_includeValidateSearch:!0});this.pendingBuiltLocation=s;let c=this.commitLocation({...s,viewTransition:r,replace:e,resetScroll:t,hashScrollIntoView:n,ignoreBlocker:i});return Promise.resolve().then(()=>{this.pendingBuiltLocation===s&&(this.pendingBuiltLocation=void 0)}),c},this.navigate=async({to:e,reloadDocument:t,href:n,publicHref:r,...i})=>{let a=!1;if(n)try{new URL(`${n}`),a=!0}catch{}if(a&&!t&&(t=!0),t){if(e!==void 0||!n){let t=this.buildLocation({to:e,...i});n??=t.publicHref,r??=t.publicHref}let t=!a&&r?r:n;if(Da(t,this.protocolAllowlist))return Promise.resolve();if(!i.ignoreBlocker){let e=this.history.getBlockers?.()??[];for(let t of e)if(t?.blockerFn&&await t.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:`PUSH`}))return Promise.resolve()}return i.replace?window.location.replace(t):window.location.href=t,Promise.resolve()}return this.buildAndCommitLocation({...i,href:n,to:e,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();let e=this.matchRoutes(this.latestLocation),t=this.stores.cachedMatchesSnapshot.state.filter(t=>!e.some(e=>e.id===t.id));this.batch(()=>{this.stores.status.setState(()=>`pending`),this.stores.statusCode.setState(()=>200),this.stores.isLoading.setState(()=>!0),this.stores.location.setState(()=>this.latestLocation),this.stores.setPendingMatches(e),this.stores.setCachedMatches(t)})},this.load=async e=>{let t,n,r,i=this.stores.resolvedLocation.state??this.stores.location.state;for(r=new Promise(a=>{this.startTransition(async()=>{try{this.beforeLoad();let t=this.latestLocation,n=this.stores.resolvedLocation.state,r=ys(t,n);this.stores.redirect.state||this.emit({type:`onBeforeNavigate`,...r}),this.emit({type:`onBeforeLoad`,...r}),await as({router:this,sync:e?.sync,forceStaleReload:i.href===t.href,matches:this.stores.pendingMatchesSnapshot.state,location:t,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let e=null,t=null,n=null,r=null;this.batch(()=>{let i=this.stores.pendingMatchesSnapshot.state,a=i.length,o=this.stores.activeMatchesSnapshot.state;e=a?o.filter(e=>!this.stores.pendingMatchStoresById.has(e.id)):null;let s=new Set;for(let e of this.stores.pendingMatchStoresById.values())e.routeId&&s.add(e.routeId);let c=new Set;for(let e of this.stores.activeMatchStoresById.values())e.routeId&&c.add(e.routeId);t=a?o.filter(e=>!s.has(e.routeId)):null,n=a?i.filter(e=>!c.has(e.routeId)):null,r=a?i.filter(e=>c.has(e.routeId)):o,this.stores.isLoading.setState(()=>!1),this.stores.loadedAt.setState(()=>Date.now()),a&&(this.stores.setActiveMatches(i),this.stores.setPendingMatches([]),this.stores.setCachedMatches([...this.stores.cachedMatchesSnapshot.state,...e.filter(e=>e.status!==`error`&&e.status!==`notFound`&&e.status!==`redirected`)]),this.clearExpiredCache())});for(let[e,i]of[[t,`onLeave`],[n,`onEnter`],[r,`onStay`]])if(e)for(let t of e)this.looseRoutesById[t.routeId].options[i]?.(t)})})}})}catch(e){Po(e)?(t=e,this.navigate({...t.options,replace:!0,ignoreBlocker:!0})):mo(e)&&(n=e);let r=t?t.status:n?404:this.stores.activeMatchesSnapshot.state.some(e=>e.status===`error`)?500:200;this.batch(()=>{this.stores.statusCode.setState(()=>r),this.stores.redirect.setState(()=>t)})}this.latestLoadPromise===r&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),a()})}),this.latestLoadPromise=r,await r;this.latestLoadPromise&&r!==this.latestLoadPromise;)await this.latestLoadPromise;let a;this.hasNotFoundMatch()?a=404:this.stores.activeMatchesSnapshot.state.some(e=>e.status===`error`)&&(a=500),a!==void 0&&this.stores.statusCode.setState(()=>a)},this.startViewTransition=e=>{let t=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,t&&typeof document<`u`&&`startViewTransition`in document&&typeof document.startViewTransition==`function`){let n;if(typeof t==`object`&&this.isViewTransitionTypesSupported){let r=this.latestLocation,i=this.stores.resolvedLocation.state,a=typeof t.types==`function`?t.types(ys(r,i)):t.types;if(a===!1){e();return}n={update:e,types:a}}else n=e;document.startViewTransition(n)}else e()},this.updateMatch=(e,t)=>{this.startTransition(()=>{let n=this.stores.pendingMatchStoresById.get(e);if(n){n.setState(t);return}let r=this.stores.activeMatchStoresById.get(e);if(r){r.setState(t);return}let i=this.stores.cachedMatchStoresById.get(e);if(i){let n=t(i.state);n.status===`redirected`?this.stores.cachedMatchStoresById.delete(e)&&this.stores.cachedMatchesId.setState(t=>t.filter(t=>t!==e)):i.setState(()=>n)}})},this.getMatch=e=>this.stores.cachedMatchStoresById.get(e)?.state??this.stores.pendingMatchStoresById.get(e)?.state??this.stores.activeMatchStoresById.get(e)?.state,this.invalidate=e=>{let t=t=>e?.filter?.(t)??!0?{...t,invalid:!0,...e?.forcePending||t.status===`error`||t.status===`notFound`?{status:`pending`,error:void 0}:void 0}:t;return this.batch(()=>{this.stores.setActiveMatches(this.stores.activeMatchesSnapshot.state.map(t)),this.stores.setCachedMatches(this.stores.cachedMatchesSnapshot.state.map(t)),this.stores.setPendingMatches(this.stores.pendingMatchesSnapshot.state.map(t))}),this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.getParsedLocationHref=e=>e.publicHref||`/`,this.resolveRedirect=e=>{let t=e.headers.get(`Location`);if(!e.options.href||e.options._builtLocation){let t=e.options._builtLocation??this.buildLocation(e.options),n=this.getParsedLocationHref(t);e.options.href=n,e.headers.set(`Location`,n)}else if(t)try{let n=new URL(t);if(this.origin&&n.origin===this.origin){let t=n.pathname+n.search+n.hash;e.options.href=t,e.headers.set(`Location`,t)}}catch{}if(e.options.href&&!e.options._builtLocation&&Da(e.options.href,this.protocolAllowlist))throw Error(`Redirect blocked: unsafe protocol`);return e.headers.get(`Location`)||e.headers.set(`Location`,e.options.href),e},this.clearCache=e=>{let t=e?.filter;t===void 0?this.stores.setCachedMatches([]):this.stores.setCachedMatches(this.stores.cachedMatchesSnapshot.state.filter(e=>!t(e)))},this.clearExpiredCache=()=>{let e=Date.now();this.clearCache({filter:t=>{let n=this.looseRoutesById[t.routeId];if(!n.options.loader)return!0;let r=(t.preload?n.options.preloadGcTime??this.options.defaultPreloadGcTime:n.options.gcTime??this.options.defaultGcTime)??300*1e3;return t.status===`error`?!0:e-t.updatedAt>=r}})},this.loadRouteChunk=ss,this.preloadRoute=async e=>{let t=e._builtLocation??this.buildLocation(e),n=this.matchRoutes(t,{throwOnError:!0,preload:!0,dest:e}),r=new Set([...this.stores.matchesId.state,...this.stores.pendingMatchesId.state]),i=new Set([...r,...this.stores.cachedMatchesId.state]),a=n.filter(e=>!i.has(e.id));if(a.length){let e=this.stores.cachedMatchesSnapshot.state;this.stores.setCachedMatches([...e,...a])}try{return n=await as({router:this,matches:n,location:t,preload:!0,updateMatch:(e,t)=>{r.has(e)?n=n.map(n=>n.id===e?t(n):n):this.updateMatch(e,t)}}),n}catch(e){if(Po(e))return e.options.reloadDocument?void 0:await this.preloadRoute({...e.options,_fromLocation:t});mo(e)||console.error(e);return}},this.matchRoute=(e,t)=>{let n={...e,to:e.to?this.resolvePathWithBase(e.from||``,e.to):void 0,params:e.params||{},leaveParams:!0},r=this.buildLocation(n);if(t?.pending&&this.stores.status.state!==`pending`)return!1;let i=(t?.pending===void 0?!this.stores.isLoading.state:t.pending)?this.latestLocation:this.stores.resolvedLocation.state||this.stores.location.state,a=Wa(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,i.pathname,this.processedTree);return!a||e.params&&!xa(a.rawParams,e.params,{partial:!0})?!1:t?.includeSearch??!0?xa(i.search,r.search,{partial:!0})?a.rawParams:!1:a.rawParams},this.hasNotFoundMatch=()=>this.stores.activeMatchesSnapshot.state.some(e=>e.status===`notFound`||e.globalNotFound),this.getStoreConfig=t,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??`fuzzy`,stringifySearch:e.stringifySearch??ko,parseSearch:e.parseSearch??Oo,protocolAllowlist:e.protocolAllowlist??Ea}),typeof document<`u`&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.stores.__store.state}setRoutes({routesById:e,routesByPath:t,processedTree:n}){this.routesById=e,this.routesByPath=t,this.processedTree=n;let r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}get looseRoutesById(){return this.routesById}getParentContext(e){return e?.id?e.context??this.options.context??void 0:this.options.context??void 0}matchRoutesInternal(e,t){let n=this.getMatchedRoutes(e.pathname),{foundRoute:r,routeParams:i,parsedParams:a}=n,{matchedRoutes:o}=n,s=!1;(r?r.path!==`/`&&i[`**`]:io(e.pathname))&&(this.options.notFoundRoute?o=[...o,this.options.notFoundRoute]:s=!0);let c=s?Os(this.options.notFoundMode,o):void 0,l=Array(o.length),u=new Map;for(let e of this.stores.activeMatchStoresById.values())e.routeId&&u.set(e.routeId,e.state);for(let n=0;n<o.length;n++){let r=o[n],s=l[n-1],d,f,p;{let n=s?.search??e.search,i=s?._strictSearch??void 0;try{let e=ws(r.options.validateSearch,{...n})??void 0;d={...n,...e},f={...i,...e},p=void 0}catch(e){let r=e;if(e instanceof xs||(r=new xs(e.message,{cause:e})),t?.throwOnError)throw r;d=n,f={},p=r}}let m=r.options.loaderDeps?.({search:d})??``,h=m?JSON.stringify(m):``,{interpolatedPath:g,usedParams:_}=fo({path:r.fullPath,params:i,decoder:this.pathParamsDecoder,server:this.isServer}),v=r.id+g+h,y=this.getMatch(v),b=u.get(r.id),x=y?._strictParams??_,S;if(!y)try{ks(r,_,a,x)}catch(e){if(S=mo(e)||Po(e)?e:new Ss(e.message,{cause:e}),t?.throwOnError)throw S}Object.assign(i,x);let C=b?`stay`:`enter`,w;if(y)w={...y,cause:C,params:b?.params??i,_strictParams:x,search:ha(b?b.search:y.search,d),_strictSearch:f};else{let e=r.options.loader||r.options.beforeLoad||r.lazyFn||cs(r)?`pending`:`success`;w={id:v,ssr:r.options.ssr,index:n,routeId:r.id,params:b?.params??i,_strictParams:x,pathname:g,updatedAt:Date.now(),search:b?ha(b.search,d):d,_strictSearch:f,searchError:void 0,status:e,isFetching:!1,error:void 0,paramsError:S,__routeContext:void 0,_nonReactive:{loadPromise:Sa()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:C,loaderDeps:b?ga(b.loaderDeps,m):m,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:r.options.staticData||{},fullPath:r.fullPath}}t?.preload||(w.globalNotFound=c===r.id),w.searchError=p;let T=this.getParentContext(s);w.context={...T,...w.__routeContext,...w.__beforeLoadContext},l[n]=w}for(let t=0;t<l.length;t++){let n=l[t],r=this.looseRoutesById[n.routeId],a=this.getMatch(n.id),o=u.get(n.routeId);if(n.params=o?ha(o.params,i):i,!a){let i=l[t-1],a=this.getParentContext(i);if(r.options.context){let t={deps:n.loaderDeps,params:n.params,context:a??{},location:e,navigate:t=>this.navigate({...t,_fromLocation:e}),buildLocation:this.buildLocation,cause:n.cause,abortController:n.abortController,preload:!!n.preload,matches:l,routeId:r.id};n.__routeContext=r.options.context(t)??void 0}n.context={...a,...n.__routeContext,...n.__beforeLoadContext}}}return l}matchRoutesLightweight(e){let{matchedRoutes:t,routeParams:n,parsedParams:r}=this.getMatchedRoutes(e.pathname),i=la(t),a={...e.search};for(let e of t)try{Object.assign(a,ws(e.options.validateSearch,a))}catch{}let o=la(this.stores.matchesId.state),s=o&&this.stores.activeMatchStoresById.get(o)?.state,c=s&&s.routeId===i.id&&s.pathname===e.pathname,l;if(c)l=s.params;else{let e=Object.assign(Object.create(null),n);for(let i of t)try{ks(i,n,r??{},e)}catch{}l=e}return{matchedRoutes:t,fullPath:i.fullPath,search:a,params:l}}},xs=class extends Error{},Ss=class extends Error{};function Cs(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:`idle`,resolvedLocation:void 0,location:e,matches:[],statusCode:200}}function ws(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new xs(`Async validation not supported`);if(n.issues)throw new xs(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return`parse`in e?e.parse(t):typeof e==`function`?e(t):{}}function Ts({pathname:e,routesById:t,processedTree:n}){let r=Object.create(null),i=io(e),a,o,s=Ga(i,n,!0);return s&&(a=s.route,Object.assign(r,s.rawParams),o=Object.assign(Object.create(null),s.parsedParams)),{matchedRoutes:s?.branch||[t.__root__],routeParams:r,foundRoute:a,parsedParams:o}}function Es({search:e,dest:t,destRoutes:n,_includeValidateSearch:r}){return Ds(n)(e,t,r??!1)}function Ds(e){let t={dest:null,_includeValidateSearch:!1,middlewares:[]};for(let n of e)`search`in n.options?n.options.search?.middlewares&&t.middlewares.push(...n.options.search.middlewares):(n.options.preSearchFilters||n.options.postSearchFilters)&&t.middlewares.push(({search:e,next:t})=>{let r=e;`preSearchFilters`in n.options&&n.options.preSearchFilters&&(r=n.options.preSearchFilters.reduce((e,t)=>t(e),e));let i=t(r);return`postSearchFilters`in n.options&&n.options.postSearchFilters?n.options.postSearchFilters.reduce((e,t)=>t(e),i):i}),n.options.validateSearch&&t.middlewares.push(({search:e,next:r})=>{let i=r(e);if(!t._includeValidateSearch)return i;try{return{...i,...ws(n.options.validateSearch,i)??void 0}}catch{return i}});t.middlewares.push(({search:e})=>{let n=t.dest;return n.search?n.search===!0?e:da(n.search,e):{}});let n=(e,t,r)=>{if(e>=r.length)return t;let i=r[e];return i({search:t,next:t=>n(e+1,t,r)})};return function(e,r,i){return t.dest=r,t._includeValidateSearch=i,n(0,e,t.middlewares)}}function Os(e,t){if(e!==`root`)for(let e=t.length-1;e>=0;e--){let n=t[e];if(n.children)return n.id}return Mo}function ks(e,t,n,r){let i=e.options.params?.parse??e.options.parseParams;if(i)if(e.options.skipRouteOnParseError)for(let e in t)e in n&&(r[e]=n[e]);else{let e=i(r);Object.assign(r,e)}}var As=`Error preloading route! ☝️`,js=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=e=>{this.originalIndex=e.originalIndex;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=Mo:this.parentRoute||ja();let r=n?Mo:t?.path;r&&r!==`/`&&(r=ro(r));let i=t?.id||r,a=n?Mo:to([this.parentRoute.id===`__root__`?``:this.parentRoute.id,i]);r===`__root__`&&(r=`/`),a!==`__root__`&&(a=to([`/`,a]));let o=a===`__root__`?`/`:to([this.parentRoute.fullPath,r]);this._path=r,this._id=a,this._fullPath=o,this._to=io(o)},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e==`object`&&e&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.redirect=e=>No({from:this.fullPath,...e}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw Error(`Route cannot have both an 'id' and a 'path' option.`)}},Ms=class extends js{constructor(e){super(e)}};function Ns(e){if(typeof document<`u`&&document.querySelector){let t=e.stores.location.state,n=t.state.__hashScrollIntoViewOptions??!0;if(n&&t.hash!==``){let e=document.getElementById(t.hash);e&&e.scrollIntoView(n)}}}var K=r();function Ps(e){let t=e.errorComponent??Is;return(0,K.jsx)(Fs,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:r})=>n?G.createElement(t,{error:n,reset:r}):e.children})}var Fs=class extends G.Component{constructor(...e){super(...e),this.state={error:null}}static getDerivedStateFromProps(e){return{resetKey:e.getResetKey()}}static getDerivedStateFromError(e){return{error:e}}reset(){this.setState({error:null})}componentDidUpdate(e,t){t.error&&t.resetKey!==this.state.resetKey&&this.reset()}componentDidCatch(e,t){this.props.onCatch&&this.props.onCatch(e,t)}render(){return this.props.children({error:this.state.resetKey===this.props.getResetKey()?this.state.error:null,reset:()=>{this.reset()}})}};function Is({error:e}){let[t,n]=G.useState(!1);return(0,K.jsxs)(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[(0,K.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[(0,K.jsx)(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),(0,K.jsx)(`button`,{style:{appearance:`none`,fontSize:`.6em`,border:`1px solid currentColor`,padding:`.1rem .2rem`,fontWeight:`bold`,borderRadius:`.25rem`},onClick:()=>n(e=>!e),children:t?`Hide Error`:`Show Error`})]}),(0,K.jsx)(`div`,{style:{height:`.25rem`}}),t?(0,K.jsx)(`div`,{children:(0,K.jsx)(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e.message?(0,K.jsx)(`code`,{children:e.message}):null})}):null]})}function Ls({children:e,fallback:t=null}){return Rs()?(0,K.jsx)(G.Fragment,{children:e}):(0,K.jsx)(G.Fragment,{children:t})}function Rs(){return G.useSyncExternalStore(zs,()=>!0,()=>!1)}function zs(){return()=>{}}var Bs=G.createContext(null);function Vs(e){return G.useContext(Bs)}var Hs=G.createContext(void 0),Us=G.createContext(void 0),q=(e=>(e[e.None=0]=`None`,e[e.Mutable=1]=`Mutable`,e[e.Watching=2]=`Watching`,e[e.RecursedCheck=4]=`RecursedCheck`,e[e.Recursed=8]=`Recursed`,e[e.Dirty=16]=`Dirty`,e[e.Pending=32]=`Pending`,e))(q||{});function Ws({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(!0)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(!0)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function Gs(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var Ks=[],qs=0,{link:Js,unlink:Ys,propagate:Xs,checkDirty:Zs,shallowPropagate:Qs}=Ws({update(e){return e._update()},notify(e){Ks[ec++]=e,e.flags&=~q.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=q.Mutable|q.Dirty,ic(e))}}),$s=0,ec=0,tc,nc=0;function rc(e){try{++nc,e()}finally{--nc||ac()}}function ic(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=Ys(n,e)}function ac(){if(!(nc>0)){for(;$s<ec;){let e=Ks[$s];Ks[$s++]=void 0,e.notify()}$s=0,ec=0}}function oc(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?q.None:q.Mutable,get(){return tc!==void 0&&Js(i,tc,qs),i._snapshot},subscribe(e){let t=Gs(e),n={current:!1},r=sc(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=tc,o=t?.compare??Object.is;if(n)tc=i,++qs,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=q.Mutable|q.RecursedCheck);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{tc=a,n&&(i.flags&=~q.RecursedCheck),ic(i)}}};return n?(i.flags=q.Mutable|q.Dirty,i.get=function(){let e=i.flags;if(e&q.Dirty||e&q.Pending&&Zs(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&Qs(e)}}else e&q.Pending&&(i.flags=e&~q.Pending);return tc!==void 0&&Js(i,tc,qs),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(Xs(e),Qs(e),ac())}},i}function sc(e){let t=()=>{let t=tc;tc=n,++qs,n.depsTail=void 0,n.flags=q.Watching|q.RecursedCheck;try{return e()}finally{tc=t,n.flags&=~q.RecursedCheck,ic(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:q.Watching|q.RecursedCheck,notify(){let e=this.flags;e&q.Dirty||e&q.Pending&&Zs(this.deps,this)?t():this.flags=q.Watching},stop(){this.flags=q.None,this.depsTail=void 0,ic(this)}};return t(),n}var cc=class{constructor(e){this.atom=oc(e)}setState(e){this.atom.set(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(Gs(e))}},lc=class{constructor(e){this.atom=oc(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(Gs(e))}};function uc(e){return typeof e==`function`?new lc(e):new cc(e)}var dc=t((e=>{var t=n();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=t.useState,o=t.useEffect,s=t.useLayoutEffect,c=t.useDebugValue;function l(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,l=r[1];return s(function(){i.value=n,i.getSnapshot=t,u(i)&&l({inst:i})},[e,n,t]),o(function(){return u(i)&&l({inst:i}),e(function(){u(i)&&l({inst:i})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),fc=t(((e,t)=>{t.exports=dc()})),pc=t((e=>{var t=n(),r=fc();function i(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var a=typeof Object.is==`function`?Object.is:i,o=r.useSyncExternalStore,s=t.useRef,c=t.useEffect,l=t.useMemo,u=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var d=s(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=l(function(){function e(e){if(!o){if(o=!0,s=e,e=r(e),i!==void 0&&f.hasValue){var t=f.value;if(i(t,e))return c=t}return c=e}if(t=c,a(s,e))return t;var n=r(e);return i!==void 0&&i(t,n)?(s=e,t):(s=e,c=n)}var o=!1,s,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,i]);var p=o(e,d[0],d[1]);return c(function(){f.hasValue=!0,f.value=p},[p]),u(p),p}})),mc=t(((e,t)=>{t.exports=pc()}))();function hc(e,t){return e===t}function gc(e,t,n=hc){let r=(0,G.useCallback)(t=>{if(!e)return()=>{};let{unsubscribe:n}=e.subscribe(t);return n},[e]),i=(0,G.useCallback)(()=>e?.get(),[e]);return(0,mc.useSyncExternalStoreWithSelector)(r,i,i,t,n)}var _c={state:void 0,get:()=>void 0,subscribe:()=>()=>{}};function vc(e){let t=Vs(),n=G.useContext(e.from?Us:Hs),r=e.from??n,i=r?e.from?t.stores.getMatchStoreByRouteId(r):t.stores.activeMatchStoresById.get(r):void 0,a=G.useRef(void 0);return gc(i??_c,n=>{if((e.shouldThrow??!0)&&!n&&ja(),n===void 0)return;let r=e.select?e.select(n):n;if(e.structuralSharing??t.options.defaultStructuralSharing){let e=ga(a.current,r);return a.current=e,e}return r})}function yc(e){return vc({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function bc(e){let{select:t,...n}=e;return vc({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function xc(e){return vc({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function Sc(e){return vc({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function Cc(e){let t=Vs();return G.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function wc(e){return vc({...e,select:t=>e.select?e.select(t.context):t.context})}var Tc=T();function Ec(e,t){let n=Vs(),r=ca(t),{activeProps:i,inactiveProps:a,activeOptions:o,to:s,preload:c,preloadDelay:l,hashScrollIntoView:u,replace:d,startTransition:f,resetScroll:p,viewTransition:m,children:h,target:g,disabled:_,style:v,className:y,onClick:b,onBlur:x,onFocus:S,onMouseEnter:C,onMouseLeave:w,onTouchStart:T,ignoreBlocker:E,params:D,search:O,hash:k,state:A,mask:j,reloadDocument:M,unsafeRelative:N,from:P,_fromLocation:F,...I}=e,L=Rs(),R=G.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),z=gc(n.stores.location,e=>e,(e,t)=>e.href===t.href),B=G.useMemo(()=>{let e={_fromLocation:z,...R};return n.buildLocation(e)},[n,z,R]),V=B.maskedLocation?B.maskedLocation.publicHref:B.publicHref,ee=B.maskedLocation?B.maskedLocation.external:B.external,te=G.useMemo(()=>Fc(V,ee,n.history,_),[_,ee,V,n.history]),H=G.useMemo(()=>{if(te?.external)return Da(te.href,n.protocolAllowlist)?void 0:te.href;if(!Ic(s)&&!(typeof s!=`string`||s.indexOf(`:`)===-1))try{return new URL(s),Da(s,n.protocolAllowlist)?void 0:s}catch{}},[s,te,n.protocolAllowlist]),ne=G.useMemo(()=>{if(H)return!1;if(o?.exact){if(!so(z.pathname,B.pathname,n.basepath))return!1}else{let e=oo(z.pathname,n.basepath),t=oo(B.pathname,n.basepath);if(!(e.startsWith(t)&&(e.length===t.length||e[t.length]===`/`)))return!1}return(o?.includeSearch??!0)&&!xa(z.search,B.search,{partial:!o?.exact,ignoreUndefined:!o?.explicitUndefined})?!1:o?.includeHash?L&&z.hash===B.hash:!0},[o?.exact,o?.explicitUndefined,o?.includeHash,o?.includeSearch,z,H,L,B.hash,B.pathname,B.search,n.basepath]),re=ne?da(i,{})??Oc:Dc,ie=ne?Dc:da(a,{})??Dc,ae=[y,re.className,ie.className].filter(Boolean).join(` `),oe=(v||re.style||ie.style)&&{...v,...re.style,...ie.style},[se,ce]=G.useState(!1),le=G.useRef(!1),ue=e.reloadDocument||H?!1:c??n.options.defaultPreload,de=l??n.options.defaultPreloadDelay??0,U=G.useCallback(()=>{n.preloadRoute({...R,_builtLocation:B}).catch(e=>{console.warn(e),console.warn(As)})},[n,R,B]);sa(r,G.useCallback(e=>{e?.isIntersecting&&U()},[U]),Nc,{disabled:!!_||ue!==`viewport`}),G.useEffect(()=>{le.current||!_&&ue===`render`&&(U(),le.current=!0)},[_,U,ue]);let fe=e=>{let t=e.currentTarget.getAttribute(`target`),r=g===void 0?t:g;if(!_&&!Rc(e)&&!e.defaultPrevented&&(!r||r===`_self`)&&e.button===0){e.preventDefault(),(0,Tc.flushSync)(()=>{ce(!0)});let t=n.subscribe(`onResolved`,()=>{t(),ce(!1)});n.navigate({...R,replace:d,resetScroll:p,hashScrollIntoView:u,startTransition:f,viewTransition:m,ignoreBlocker:E})}};if(H)return{...I,ref:r,href:H,...h&&{children:h},...g&&{target:g},..._&&{disabled:_},...v&&{style:v},...y&&{className:y},...b&&{onClick:b},...x&&{onBlur:x},...S&&{onFocus:S},...C&&{onMouseEnter:C},...w&&{onMouseLeave:w},...T&&{onTouchStart:T}};let pe=e=>{if(_||ue!==`intent`)return;if(!de){U();return}let t=e.currentTarget;if(Mc.has(t))return;let n=setTimeout(()=>{Mc.delete(t),U()},de);Mc.set(t,n)},me=e=>{_||ue!==`intent`||U()},he=e=>{if(_||!ue||!de)return;let t=e.currentTarget,n=Mc.get(t);n&&(clearTimeout(n),Mc.delete(t))};return{...I,...re,...ie,href:te?.href,ref:r,onClick:Pc([b,fe]),onBlur:Pc([x,he]),onFocus:Pc([S,pe]),onMouseEnter:Pc([C,pe]),onMouseLeave:Pc([w,he]),onTouchStart:Pc([T,me]),disabled:!!_,target:g,...oe&&{style:oe},...ae&&{className:ae},..._&&kc,...ne&&Ac,...L&&se&&jc}}var Dc={},Oc={className:`active`},kc={role:`link`,"aria-disabled":!0},Ac={"data-status":`active`,"aria-current":`page`},jc={"data-transitioning":`transitioning`},Mc=new WeakMap,Nc={rootMargin:`100px`},Pc=e=>t=>{for(let n of e)if(n){if(t.defaultPrevented)return;n(t)}};function Fc(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||`/`,external:!1}}function Ic(e){if(typeof e!=`string`)return!1;let t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var Lc=G.forwardRef((e,t)=>{let{_asChild:n,...r}=e,{type:i,...a}=Ec(r,t),o=typeof r.children==`function`?r.children({isActive:a[`data-status`]===`active`}):r.children;if(!n){let{disabled:e,...t}=a;return G.createElement(`a`,t,o)}return G.createElement(n,a,o)});function Rc(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var zc=class extends js{constructor(e){super(e),this.useMatch=e=>vc({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>wc({...e,from:this.id}),this.useSearch=e=>Sc({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>xc({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>bc({...e,from:this.id}),this.useLoaderData=e=>yc({...e,from:this.id}),this.useNavigate=()=>Cc({from:this.fullPath}),this.Link=G.forwardRef((e,t)=>(0,K.jsx)(Lc,{ref:t,from:this.fullPath,...e}))}};function Bc(e){return new zc(e)}var Vc=class extends Ms{constructor(e){super(e),this.useMatch=e=>vc({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>wc({...e,from:this.id}),this.useSearch=e=>Sc({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>xc({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>bc({...e,from:this.id}),this.useLoaderData=e=>yc({...e,from:this.id}),this.useNavigate=()=>Cc({from:this.fullPath}),this.Link=G.forwardRef((e,t)=>(0,K.jsx)(Lc,{ref:t,from:this.fullPath,...e}))}};function Hc(e){return new Vc(e)}function Uc(e){let t=Vs(),n=`not-found-${gc(t.stores.location,e=>e.pathname)}-${gc(t.stores.status,e=>e)}`;return(0,K.jsx)(Ps,{getResetKey:()=>n,onCatch:(t,n)=>{if(mo(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(mo(t))return e.fallback?.(t);throw t},children:e.children})}function Wc(){return(0,K.jsx)(`p`,{children:`Not Found`})}function Gc(e){return(0,K.jsx)(K.Fragment,{children:e.children})}function Kc(e,t,n){return t.options.notFoundComponent?(0,K.jsx)(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?(0,K.jsx)(e.options.defaultNotFoundComponent,{...n}):(0,K.jsx)(Wc,{})}var qc=G.memo(function({matchId:e}){let t=Vs(),n=t.stores.activeMatchStoresById.get(e);n||ja();let r=gc(t.stores.loadedAt,e=>e),i=gc(n,e=>e);return(0,K.jsx)(Jc,{router:t,matchId:e,resetKey:r,matchState:G.useMemo(()=>{let e=i.routeId,n=t.routesById[e].parentRoute?.id;return{routeId:e,ssr:i.ssr,_displayPending:i._displayPending,parentRouteId:n}},[i._displayPending,i.routeId,i.ssr,t.routesById])})});function Jc({router:e,matchId:t,resetKey:n,matchState:r}){let i=e.routesById[r.routeId],a=i.options.pendingComponent??e.options.defaultPendingComponent,o=a?(0,K.jsx)(a,{}):null,s=i.options.errorComponent??e.options.defaultErrorComponent,c=i.options.onCatch??e.options.defaultOnCatch,l=i.isRoot?i.options.notFoundComponent??e.options.notFoundRoute?.options.component:i.options.notFoundComponent,u=r.ssr===!1||r.ssr===`data-only`,d=(!i.isRoot||i.options.wrapInSuspense||u)&&(i.options.wrapInSuspense??a??(i.options.errorComponent?.preload||u))?G.Suspense:Gc,f=s?Ps:Gc,p=l?Uc:Gc;return(0,K.jsxs)(i.isRoot?i.options.shellComponent??Gc:Gc,{children:[(0,K.jsx)(Hs.Provider,{value:t,children:(0,K.jsx)(d,{fallback:o,children:(0,K.jsx)(f,{getResetKey:()=>n,errorComponent:s||Is,onCatch:(e,t)=>{if(mo(e))throw e.routeId??=r.routeId,e;c?.(e,t)},children:(0,K.jsx)(p,{fallback:e=>{if(e.routeId??=r.routeId,!l||e.routeId&&e.routeId!==r.routeId||!e.routeId&&!i.isRoot)throw e;return G.createElement(l,e)},children:u||r._displayPending?(0,K.jsx)(Ls,{fallback:o,children:(0,K.jsx)(Xc,{matchId:t})}):(0,K.jsx)(Xc,{matchId:t})})})})}),r.parentRouteId===`__root__`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Yc,{resetKey:n}),(e.options.scrollRestoration,null)]}):null]})}function Yc({resetKey:e}){let t=Vs(),n=G.useRef(void 0);return aa(()=>{let e=t.latestLocation.href;(n.current===void 0||n.current!==e)&&(t.emit({type:`onRendered`,...ys(t.stores.location.state,t.stores.resolvedLocation.state)}),n.current=e)},[t.latestLocation.state.__TSR_key,e,t]),null}var Xc=G.memo(function({matchId:e}){let t=Vs(),n=t.stores.activeMatchStoresById.get(e);n||ja();let r=gc(n,e=>e),i=r.routeId,a=t.routesById[i],o=G.useMemo(()=>{let e=(t.routesById[i].options.remountDeps??t.options.defaultRemountDeps)?.({routeId:i,loaderDeps:r.loaderDeps,params:r._strictParams,search:r._strictSearch});return e?JSON.stringify(e):void 0},[i,r.loaderDeps,r._strictParams,r._strictSearch,t.options.defaultRemountDeps,t.routesById]),s=G.useMemo(()=>{let e=a.options.component??t.options.defaultComponent;return e?(0,K.jsx)(e,{},o):(0,K.jsx)(Zc,{})},[o,a.options.component,t.options.defaultComponent]);if(r._displayPending)throw t.getMatch(r.id)?._nonReactive.displayPendingPromise;if(r._forcePending)throw t.getMatch(r.id)?._nonReactive.minPendingPromise;if(r.status===`pending`){let e=a.options.pendingMinMs??t.options.defaultPendingMinMs;if(e){let n=t.getMatch(r.id);if(n&&!n._nonReactive.minPendingPromise){let t=Sa();n._nonReactive.minPendingPromise=t,setTimeout(()=>{t.resolve(),n._nonReactive.minPendingPromise=void 0},e)}}throw t.getMatch(r.id)?._nonReactive.loadPromise}if(r.status===`notFound`)return mo(r.error)||ja(),Kc(t,a,r.error);if(r.status===`redirected`)throw Po(r.error)||ja(),t.getMatch(r.id)?._nonReactive.loadPromise;if(r.status===`error`)throw r.error;return s}),Zc=G.memo(function(){let e=Vs(),t=G.useContext(Hs),n,r=!1,i;{let a=t?e.stores.activeMatchStoresById.get(t):void 0;[n,r]=gc(a,e=>[e?.routeId,e?.globalNotFound??!1]),i=gc(e.stores.matchesId,e=>e[e.findIndex(e=>e===t)+1])}let a=n?e.routesById[n]:void 0,o=e.options.defaultPendingComponent?(0,K.jsx)(e.options.defaultPendingComponent,{}):null;if(r)return a||ja(),Kc(e,a,void 0);if(!i)return null;let s=(0,K.jsx)(qc,{matchId:i});return n===`__root__`?(0,K.jsx)(G.Suspense,{fallback:o,children:s}):s});function Qc(){let e=Vs(),t=G.useRef({router:e,mounted:!1}),[n,r]=G.useState(!1),i=gc(e.stores.isLoading,e=>e),a=gc(e.stores.hasPendingMatches,e=>e),o=oa(i),s=i||n||a,c=oa(s),l=i||a,u=oa(l);return e.startTransition=e=>{r(!0),G.startTransition(()=>{e(),r(!1)})},G.useEffect(()=>{let t=e.history.subscribe(e.load),n=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return io(e.latestLocation.publicHref)!==io(n.publicHref)&&e.commitLocation({...n,replace:!0}),()=>{t()}},[e,e.history]),aa(()=>{typeof window<`u`&&e.ssr||t.current.router===e&&t.current.mounted||(t.current={router:e,mounted:!0},(async()=>{try{await e.load()}catch(e){console.error(e)}})())},[e]),aa(()=>{o&&!i&&e.emit({type:`onLoad`,...ys(e.stores.location.state,e.stores.resolvedLocation.state)})},[o,e,i]),aa(()=>{u&&!l&&e.emit({type:`onBeforeRouteMount`,...ys(e.stores.location.state,e.stores.resolvedLocation.state)})},[l,u,e]),aa(()=>{if(c&&!s){let t=ys(e.stores.location.state,e.stores.resolvedLocation.state);e.emit({type:`onResolved`,...t}),rc(()=>{e.stores.status.setState(()=>`idle`),e.stores.resolvedLocation.setState(()=>e.stores.location.state)}),t.hrefChanged&&Ns(e)}},[s,c,e]),null}function $c(){let e=Vs(),t=e.routesById.__root__.options.pendingComponent??e.options.defaultPendingComponent,n=t?(0,K.jsx)(t,{}):null,r=(0,K.jsxs)(typeof document<`u`&&e.ssr?Gc:G.Suspense,{fallback:n,children:[(0,K.jsx)(Qc,{}),(0,K.jsx)(el,{})]});return e.options.InnerWrap?(0,K.jsx)(e.options.InnerWrap,{children:r}):r}function el(){let e=Vs(),t=gc(e.stores.firstMatchId,e=>e),n=gc(e.stores.loadedAt,e=>e),r=t?(0,K.jsx)(qc,{matchId:t}):null;return(0,K.jsx)(Hs.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?r:(0,K.jsx)(Ps,{getResetKey:()=>n,errorComponent:Is,onCatch:void 0,children:r})})}var tl=e=>({createMutableStore:uc,createReadonlyStore:uc,batch:rc}),nl=e=>new rl(e),rl=class extends bs{constructor(e){super(e,tl)}};function il({router:e,children:t,...n}){Object.keys(n).length>0&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});let r=(0,K.jsx)(Bs.Provider,{value:e,children:t});return e.options.Wrap?(0,K.jsx)(e.options.Wrap,{children:r}):r}function al({router:e,...t}){return(0,K.jsx)(il,{router:e,...t,children:(0,K.jsx)($c,{})})}function ol(e){let t=Vs({warn:e?.router===void 0}),n=e?.router||t,r=(0,G.useRef)(void 0);return gc(n.stores.__store,t=>{if(e?.select){if(e.structuralSharing??n.options.defaultStructuralSharing){let n=ga(r.current,e.select(t));return r.current=n,n}return e.select(t)}return t})}var sl=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},cl=new class extends sl{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},ll={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},ul=new class{#e=ll;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function dl(e){setTimeout(e,0)}var fl=typeof window>`u`||`Deno`in globalThis;function pl(){}function ml(e,t){return typeof e==`function`?e(t):e}function hl(e){return typeof e==`number`&&e>=0&&e!==1/0}function gl(e,t){return Math.max(e+(t||0)-Date.now(),0)}function _l(e,t){return typeof e==`function`?e(t):e}function vl(e,t){return typeof e==`function`?e(t):e}function yl(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==xl(o,t.options))return!1}else if(!Cl(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function bl(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(Sl(t.options.mutationKey)!==Sl(a))return!1}else if(!Cl(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function xl(e,t){return(t?.queryKeyHashFn||Sl)(e)}function Sl(e){return JSON.stringify(e,(e,t)=>Ol(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function Cl(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>Cl(e[n],t[n])):!1}var wl=Object.prototype.hasOwnProperty;function Tl(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=Dl(e)&&Dl(t);if(!r&&!(Ol(e)&&Ol(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:wl.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=Tl(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function El(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function Dl(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Ol(e){if(!kl(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!kl(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function kl(e){return Object.prototype.toString.call(e)===`[object Object]`}function Al(e){return new Promise(t=>{ul.setTimeout(t,e)})}function jl(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:Tl(e,t)}function Ml(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Nl(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Pl=Symbol();function Fl(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Pl?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Il(e,t){return typeof e==`function`?e(...t):!!e}function Ll(e,t,n){let r=!1,i;return Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var Rl=(()=>{let e=()=>fl;return{isServer(){return e()},setIsServer(t){e=t}}})();function zl(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var Bl=dl;function Vl(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Bl,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var J=Vl(),Hl=new class extends sl{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function Ul(e){return Math.min(1e3*2**e,3e4)}function Wl(e){return(e??`online`)===`online`?Hl.isOnline():!0}var Gl=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Kl(e){let t=!1,n=0,r,i=zl(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new Gl(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>cl.isFocused()&&(e.networkMode===`always`||Hl.isOnline())&&e.canRun(),u=()=>Wl(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(Rl.isServer()?0:3),o=e.retryDelay??Ul,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),Al(s).then(()=>l()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var ql=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),hl(this.gcTime)&&(this.#e=ul.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Rl.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(ul.clearTimeout(this.#e),this.#e=void 0)}},Jl=class extends ql{#e;#t;#n;#r;#i;#a;#o;constructor(e){super(),this.#o=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#r=e.client,this.#n=this.#r.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=Zl(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#i?.promise}setOptions(e){if(this.options={...this.#a,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Zl(this.options);e.data!==void 0&&(this.setState(Xl(e.data,e.dataUpdatedAt)),this.#e=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#n.remove(this)}setData(e,t){let n=jl(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#c({type:`setState`,state:e,setStateOptions:t})}cancel(e){let t=this.#i?.promise;return this.#i?.cancel(e),t?t.then(pl).catch(pl):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#e}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>vl(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Pl||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>_l(e.options.staleTime,this)===`static`):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!gl(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#i?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#i?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#i&&(this.#o||this.#s()?this.#i.cancel({revert:!0}):this.#i.cancelRetry()),this.scheduleGc()),this.#n.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#s(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#i?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#i)return this.#i.continueRetry(),this.#i.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(this.#o=!0,n.signal)})},i=()=>{let e=Fl(this.options,t),n=(()=>{let e={client:this.#r,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#o=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#r,state:this.state,fetchFn:i};return r(e),e})();this.options.behavior?.onFetch(a,this),this.#t=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta}),this.#i=Kl({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Gl&&e.revert&&this.setState({...this.#t,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#i.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#n.config.onSuccess?.(e,this),this.#n.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Gl){if(e.silent)return this.#i.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#n.config.onError?.(e,this),this.#n.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#c(e){this.state=(t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Yl(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Xl(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#t=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}})(this.state),J.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#n.notify({query:this,type:`updated`,action:e})})}};function Yl(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Wl(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Xl(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Zl(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Ql=class extends sl{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=zl(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),eu(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return tu(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return tu(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof vl(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!El(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&nu(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||vl(this.options.enabled,this.#t)!==vl(t.enabled,this.#t)||_l(this.options.staleTime,this.#t)!==_l(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||vl(this.options.enabled,this.#t)!==vl(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return iu(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(pl)),t}#g(){this.#b();let e=_l(this.options.staleTime,this.#t);if(Rl.isServer()||this.#r.isStale||!hl(e))return;let t=gl(this.#r.dataUpdatedAt,e)+1;this.#d=ul.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(Rl.isServer()||vl(this.options.enabled,this.#t)===!1||!hl(this.#p)||this.#p===0)&&(this.#f=ul.setInterval(()=>{(this.options.refetchIntervalInBackground||cl.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(ul.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(ul.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&eu(e,t),o=i&&nu(e,n,t,r);(a||o)&&(l={...l,...Yl(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=jl(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=jl(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0,x={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:ru(e,t),refetch:this.refetch,promise:this.#o,isEnabled:vl(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=x.data!==void 0,r=x.status===`error`&&!t,i=e=>{r?e.reject(x.error):t&&e.resolve(x.data)},a=()=>{i(this.#o=x.promise=zl())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||x.data!==o.value)&&a();break;case`rejected`:(!r||x.error!==o.reason)&&a();break}}return x}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!El(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){J.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function $l(e,t){return vl(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&t.retryOnMount===!1)}function eu(e,t){return $l(e,t)||e.state.data!==void 0&&tu(e,t,t.refetchOnMount)}function tu(e,t,n){if(vl(t.enabled,e)!==!1&&_l(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&ru(e,t)}return!1}function nu(e,t,n,r){return(e!==t||vl(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&ru(e,n)}function ru(e,t){return vl(t.enabled,e)!==!1&&e.isStaleByTime(_l(t.staleTime,e))}function iu(e,t){return!El(e.getCurrentResult(),t)}function au(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{Ll(e,()=>t.signal,()=>n=!0)},u=Fl(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject();if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?Nl:Ml;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?su:ou,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:ou(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function ou(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function su(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var cu=class extends ql{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||lu(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=Kl({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){this.state=(t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}})(this.state),J.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function lu(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var uu=class extends sl{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new cu({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=du(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=du(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=du(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=du(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){J.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>bl(t,e))}findAll(e={}){return this.getAll().filter(t=>bl(e,t))}notify(e){J.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return J.batch(()=>Promise.all(e.map(e=>e.continue().catch(pl))))}};function du(e){return e.options.scope?.id}var fu=class extends sl{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??xl(r,t),a=this.get(i);return a||(a=new Jl({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){J.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>yl(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>yl(e,t)):t}notify(e){J.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){J.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){J.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},pu=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new fu,this.#t=e.mutationCache||new uu,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=cl.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Hl.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(_l(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=ml(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return J.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;J.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return J.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=J.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(pl).catch(pl)}invalidateQueries(e,t={}){return J.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=J.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(pl)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(pl)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(_l(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(pl).catch(pl)}fetchInfiniteQuery(e){return e.behavior=au(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(pl).catch(pl)}ensureInfiniteQueryData(e){return e.behavior=au(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Hl.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(Sl(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Cl(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Sl(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Cl(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=xl(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===Pl&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},mu=G.createContext(void 0),hu=e=>{let t=G.useContext(mu);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},gu=({client:e,children:t})=>(G.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,K.jsx)(mu.Provider,{value:e,children:t})),_u=G.createContext(!1),vu=()=>G.useContext(_u);_u.Provider;function yu(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var bu=G.createContext(yu()),xu=()=>G.useContext(bu),Su=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?Il(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},Cu=e=>{G.useEffect(()=>{e.clearReset()},[e])},wu=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Il(n,[e.error,r])),Tu=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},Eu=(e,t)=>e.isLoading&&e.isFetching&&!t,Du=(e,t)=>e?.suspense&&t.isPending,Ou=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function ku(e,t,n){let r=vu(),i=xu(),a=hu(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash);o._optimisticResults=r?`isRestoring`:`optimistic`,Tu(o),Su(o,i,s),Cu(i);let c=!a.getQueryCache().get(o.queryHash),[l]=G.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&e.subscribed!==!1;if(G.useSyncExternalStore(G.useCallback(e=>{let t=d?l.subscribe(J.batchCalls(e)):pl;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),G.useEffect(()=>{l.setOptions(o)},[o,l]),Du(o,u))throw Ou(o,l,i);if(wu({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,u),o.experimental_prefetchInRender&&!Rl.isServer()&&Eu(u,r)&&(c?Ou(o,l,i):s?.promise)?.catch(pl).finally(()=>{l.updateResult()}),o.notifyOnChangeProps?u:l.trackResult(u)}function Au(e,t){return ku(e,Ql,t)}var ju=E(),Mu={queryKey:[`bundle`],queryFn:async()=>{let e=await fetch(`/api/bundle`);if(!e.ok)throw Error(`Failed to fetch bundle.json`);return e.json()}},Nu=[`go`,`fmo`,`staging`,`integration`,`test1`],Pu=(0,G.createContext)({apiKey:``,userId:``,businessId:``,environment:`go`}),Fu=()=>(0,G.useContext)(Pu),Iu={go:`https://app.go.kizen.com/api`,fmo:`https://app.fmo.kizen.com/api`,staging:`https://staging.kizen.dev/api`,integration:`https://integration.kizen.dev/api`,test1:`https://test1.kizen.dev/api`},Lu={go:`https://go.kizen.com`,fmo:`https://fmo.kizen.com`,staging:`https://v2.staging.kizen.com`,integration:`https://v2.integration.kizen.dev`,test1:`https://test1.kizen.dev`};function Ru(){let{apiKey:e,userId:t,businessId:n,environment:r}=Fu(),i=Iu[r];return(0,G.useCallback)((r,a={})=>fetch(`/api/proxy${r}`,{...a,headers:{"x-proxy-target":i,"X-API-KEY":e,"X-USER-ID":t,"X-BUSINESS-ID":n,...a.headers}}),[i,e,t,n])}function zu(e){let{apiKey:t,userId:n,businessId:r,environment:i}=e;return{queryKey:[`bootstrap`,i,t,n,r],enabled:!!(t&&n&&r),queryFn:async()=>{let e=await fetch(`/api/proxy/auth/bootstrap`,{headers:{"x-proxy-target":Iu[i],"X-API-KEY":t,"X-USER-ID":n,"X-BUSINESS-ID":r}});if(!e.ok)throw Error(`Bootstrap failed: ${String(e.status)} ${e.statusText}`);return e.json()},retry:!1}}function Bu(){let e=hu(),[t,n]=(0,G.useState)([]),[r,i]=(0,G.useState)([]),[a,o]=(0,G.useState)(null);return(0,G.useEffect)(()=>{let t=window.location.protocol===`https:`?`wss:`:`ws:`,r=new WebSocket(`${t}//${window.location.host}`);return r.addEventListener(`message`,t=>{let r;try{r=JSON.parse(t.data)}catch{return}if(r.type===`rebuild`)e.invalidateQueries({queryKey:[`bundle`]});else if(r.type===`open-devtools`)window.electronAPI?.openDevTools();else if(r.type===`log`)n(e=>[...e,r.message]);else if(r.type===`proxy-log`){let e=r.entry??{kind:`info`,message:r.message??``};i(t=>[...t,e])}else o(r.credentials)}),()=>{r.close()}},[e]),{buildLogs:t,proxyLogs:r,serverCredentials:a}}var Vu=`integration:route-change`,Hu=`w-full rounded bg-neutral-800 border border-neutral-700 px-2 py-1 text-[12px] font-mono text-neutral-200 focus:outline-none focus:border-neutral-500`,Uu=`block text-[11px] font-semibold uppercase tracking-widest text-neutral-500 mb-1`;function Wu(e){return e.toTimeString().slice(0,8)}var Gu=()=>{let[e,t]=(0,G.useState)(`/`),[n,r]=(0,G.useState)(``),[i,a]=(0,G.useState)(``),[o,s]=(0,G.useState)([]),c=(0,G.useRef)(null);(0,G.useEffect)(()=>{c.current?.scrollIntoView({behavior:`smooth`})},[o]),(0,G.useEffect)(()=>{let e=e=>{let t=e;s(e=>[...e,{time:new Date,location:t.detail.location}].slice(-50))};return window.addEventListener(Vu,e),()=>{window.removeEventListener(Vu,e)}},[]);let l=()=>{let t=n&&!n.startsWith(`?`)?`?${n}`:n,r=i&&!i.startsWith(`#`)?`#${i}`:i,a={host:window.location.host,origin:window.location.origin,port:window.location.port,protocol:window.location.protocol,pathname:e,search:t,hash:r,href:`${window.location.origin}${e}${t}${r}`};window.dispatchEvent(new CustomEvent(Vu,{detail:{location:a}}))},u=e=>{e.key===`Enter`&&l()};return(0,K.jsxs)(`div`,{className:`flex flex-col gap-3 px-4 py-3`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:Uu,children:`Pathname`}),(0,K.jsx)(`input`,{type:`text`,className:Hu,value:e,onChange:e=>{t(e.target.value)},onKeyDown:u,placeholder:`/client/abc-123/overview`,spellCheck:!1})]}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsxs)(`div`,{className:`flex-1`,children:[(0,K.jsx)(`label`,{className:Uu,children:`Search`}),(0,K.jsx)(`input`,{type:`text`,className:Hu,value:n,onChange:e=>{r(e.target.value)},onKeyDown:u,placeholder:`?tab=notes`,spellCheck:!1})]}),(0,K.jsxs)(`div`,{className:`flex-1`,children:[(0,K.jsx)(`label`,{className:Uu,children:`Hash`}),(0,K.jsx)(`input`,{type:`text`,className:Hu,value:i,onChange:e=>{a(e.target.value)},onKeyDown:u,placeholder:`#section`,spellCheck:!1})]})]}),(0,K.jsx)(`button`,{onClick:l,className:`mt-1 w-full rounded bg-neutral-700 px-3 py-1.5 text-[12px] font-semibold text-neutral-200 hover:bg-neutral-600 active:bg-neutral-500`,children:`Dispatch`})]}),(0,K.jsxs)(`div`,{className:`flex flex-col border-t border-neutral-800 pt-2`,children:[(0,K.jsxs)(`div`,{className:`mb-1 flex items-center justify-between`,children:[(0,K.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-500`,children:`Event Stream`}),o.length>0&&(0,K.jsx)(`button`,{onClick:()=>{s([])},className:`text-[11px] text-neutral-600 hover:text-neutral-300`,children:`clear`})]}),(0,K.jsxs)(`div`,{className:`max-h-40 overflow-y-auto`,children:[o.length===0?(0,K.jsx)(`p`,{className:`text-[12px] text-neutral-600`,children:`No events yet.`}):o.map((e,t)=>(0,K.jsxs)(`div`,{className:`px-2 py-0.5 font-mono text-[11px] leading-5 ${t%2==0?`bg-neutral-900`:`bg-neutral-800/40`}`,children:[(0,K.jsx)(`span`,{className:`text-neutral-600`,children:Wu(e.time)}),(0,K.jsx)(`span`,{className:`ml-2 text-neutral-300`,children:e.location.pathname}),e.location.search&&(0,K.jsx)(`span`,{className:`text-neutral-500`,children:e.location.search}),e.location.hash&&(0,K.jsx)(`span`,{className:`text-neutral-500`,children:e.location.hash})]},t)),(0,K.jsx)(`div`,{ref:c})]})]})]})},Ku=`w-full rounded bg-neutral-800 border border-neutral-700 px-2 py-1 text-[12px] font-mono text-neutral-200 focus:outline-none focus:border-neutral-500`,qu=`block text-[11px] font-semibold uppercase tracking-widest text-neutral-500 mb-1`,Ju=`text-[11px] font-semibold uppercase tracking-widest text-neutral-500`,Yu={log:`text-neutral-400`,info:`text-blue-400`,warn:`text-yellow-400`,error:`text-red-400`};function Xu(e){if(typeof e==`string`)return e;if(e===null)return`null`;if(e===void 0)return`undefined`;try{return JSON.stringify(e)}catch{return`[unserializable]`}}var Zu=({logs:e,height:t})=>{let n=(0,G.useRef)(null);return(0,G.useEffect)(()=>{n.current?.scrollIntoView({behavior:`smooth`})},[e]),(0,K.jsxs)(`div`,{className:`${t} overflow-x-auto overflow-y-auto pb-4`,children:[e.length===0?(0,K.jsx)(`p`,{className:`px-4 text-[12px] text-neutral-600`,children:`No output yet.`}):e.map((e,t)=>(0,K.jsx)(`div`,{className:`whitespace-pre px-4 text-[12px] leading-5 ${Yu[e.level]} ${t%2==0?`bg-neutral-900`:`bg-neutral-800/40`}`,children:e.args.map(Xu).join(` `)},t)),(0,K.jsx)(`div`,{ref:n})]})},Qu=({logs:e,height:t})=>{let n=(0,G.useRef)(null);return(0,G.useEffect)(()=>{n.current?.scrollIntoView({behavior:`smooth`})},[e]),(0,K.jsxs)(`div`,{className:`${t} overflow-x-auto overflow-y-auto pb-4`,children:[e.length===0?(0,K.jsx)(`p`,{className:`px-4 text-[12px] text-neutral-600`,children:`No output yet.`}):e.map((e,t)=>(0,K.jsx)(`div`,{className:`whitespace-pre px-4 text-[12px] leading-5 text-neutral-500`,children:e},t)),(0,K.jsx)(`div`,{ref:n})]})};function $u(e){switch(e.toUpperCase()){case`GET`:return`bg-blue-900/60 text-blue-300`;case`POST`:return`bg-green-900/60 text-green-300`;case`PUT`:return`bg-amber-900/60 text-amber-300`;case`PATCH`:return`bg-orange-900/60 text-orange-300`;case`DELETE`:return`bg-red-900/60 text-red-300`;default:return`bg-neutral-800 text-neutral-400`}}function ed(e){return e===0?`bg-neutral-800 text-neutral-400`:e<300?`bg-green-900/60 text-green-300`:e<400?`bg-yellow-900/60 text-yellow-300`:e<500?`bg-orange-900/60 text-orange-300`:`bg-red-900/60 text-red-300`}var td=({logs:e,height:t})=>{let n=(0,G.useRef)(null),[r,i]=(0,G.useState)(null);return(0,G.useEffect)(()=>{n.current?.scrollIntoView({behavior:`smooth`})},[e]),(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`${t} overflow-x-auto overflow-y-auto pb-4`,children:[e.length===0?(0,K.jsx)(`p`,{className:`px-4 text-[12px] text-neutral-600`,children:`No output yet.`}):e.map((e,t)=>(0,K.jsx)(`div`,{className:`flex items-center gap-1.5 px-3 py-0.5 text-[11px] ${t%2==0?`bg-neutral-900`:`bg-neutral-800/40`}`,children:e.kind===`info`?(0,K.jsx)(`span`,{className:`text-neutral-500`,children:e.message}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`w-12 shrink-0 rounded text-center font-mono font-semibold ${$u(e.method)}`,children:e.method}),(0,K.jsx)(`span`,{className:`w-8 shrink-0 rounded text-center font-mono font-semibold ${ed(e.status)}`,children:e.status===0?`ERR`:e.status}),(0,K.jsx)(`span`,{className:`w-14 shrink-0 rounded text-center font-mono font-semibold ${e.fromCache?`bg-violet-900/60 text-violet-300`:`bg-neutral-800 text-neutral-400`}`,children:e.fromCache?`cache`:`network`}),(0,K.jsx)(`span`,{className:`min-w-0 truncate cursor-default font-mono text-neutral-400`,onMouseEnter:t=>{let n=t.currentTarget.getBoundingClientRect();i({text:e.url,x:n.left,y:n.top})},onMouseLeave:()=>i(null),children:e.url})]})},t)),(0,K.jsx)(`div`,{ref:n})]}),r&&(0,K.jsx)(`div`,{className:`pointer-events-none fixed z-50 max-w-xs break-all rounded bg-neutral-700 px-2 py-1 text-[11px] text-neutral-100 shadow-lg`,style:{left:r.x,top:r.y,transform:`translateY(calc(-100% - 4px))`},children:r.text})]})},nd=({onClose:e,buildLogs:t,proxyLogs:n,consoleLogs:r,onClearConsole:i,credentials:a,onCredentialsChange:s})=>{let[c,l]=(0,G.useState)(()=>{let e=localStorage.getItem(`devtools-creds-open`);return e===null?!(a.environment&&a.apiKey&&a.userId&&a.businessId):e!==`false`}),[u,d]=(0,G.useState)(()=>localStorage.getItem(`devtools-routes-open`)!==`false`),[f,p]=(0,G.useState)(()=>localStorage.getItem(`devtools-console-open`)!==`false`),[m,g]=(0,G.useState)(()=>localStorage.getItem(`devtools-proxy-open`)!==`false`),[_,y]=(0,G.useState)(()=>localStorage.getItem(`devtools-build-open`)!==`false`),b=(e,t)=>{t(t=>{let n=!t;return localStorage.setItem(e,String(n)),n})};return(0,K.jsxs)(`aside`,{className:`flex w-104 shrink-0 flex-col border-l border-neutral-800 bg-neutral-900 text-neutral-100`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between border-b border-neutral-800 px-4 py-3`,children:[(0,K.jsx)(`span`,{className:`text-[12px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Dev Tools`}),(0,K.jsx)(`button`,{onClick:e,className:`text-neutral-500 hover:text-neutral-200`,"aria-label":`Close dev tools`,children:(0,K.jsx)(C,{icon:o,size:`sm`})})]}),(0,K.jsxs)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:[(0,K.jsxs)(`div`,{className:`flex flex-1 flex-col min-h-0`,children:[(0,K.jsxs)(`div`,{className:`flex shrink-0 flex-col border-b border-neutral-800`,children:[(0,K.jsxs)(`button`,{className:`flex items-center justify-between px-4 py-2 hover:bg-neutral-800/50`,onClick:()=>{b(`devtools-creds-open`,l)},children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:Ju,children:`Credentials`}),!c&&(0,K.jsx)(`span`,{className:`text-[11px] font-mono text-neutral-400`,children:a.environment})]}),(0,K.jsx)(C,{icon:c?h:v,className:`text-neutral-600`,size:`xs`})]}),c&&(0,K.jsxs)(`div`,{className:`flex flex-col gap-3 px-4 pb-3`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:qu,children:`Environment`}),(0,K.jsx)(`select`,{className:Ku,value:a.environment,onChange:e=>{s({...a,environment:e.target.value})},children:Nu.map(e=>(0,K.jsx)(`option`,{value:e,children:e},e))})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:qu,children:`API Key`}),(0,K.jsx)(`input`,{type:`password`,className:Ku,value:a.apiKey,onChange:e=>{s({...a,apiKey:e.target.value})},placeholder:`x-api-key`,autoComplete:`off`})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:qu,children:`User ID`}),(0,K.jsx)(`input`,{type:`text`,className:Ku,value:a.userId,onChange:e=>{s({...a,userId:e.target.value})},placeholder:`x-user-id`,autoComplete:`off`})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:qu,children:`Business ID`}),(0,K.jsx)(`input`,{type:`text`,className:Ku,value:a.businessId,onChange:e=>{s({...a,businessId:e.target.value})},placeholder:`x-business-id`,autoComplete:`off`})]})]})]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 flex-col border-t border-neutral-800 overflow-hidden`,children:[(0,K.jsxs)(`button`,{className:`flex items-center justify-between px-4 py-2 hover:bg-neutral-800/50`,onClick:()=>{b(`devtools-routes-open`,d)},children:[(0,K.jsx)(`span`,{className:Ju,children:`Routes`}),(0,K.jsx)(C,{icon:u?h:v,className:`text-neutral-600`,size:`xs`})]}),u&&(0,K.jsx)(Gu,{})]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 flex-col border-t border-neutral-800`,children:[(0,K.jsxs)(`div`,{className:`flex items-center px-4 py-2`,children:[(0,K.jsxs)(`button`,{className:`flex flex-1 items-center gap-2 hover:opacity-70`,onClick:()=>{b(`devtools-console-open`,p)},children:[(0,K.jsx)(`span`,{className:Ju,children:`Console`}),(0,K.jsx)(C,{icon:f?h:v,className:`text-neutral-600`,size:`xs`})]}),f&&r.length>0&&(0,K.jsx)(`button`,{onClick:i,className:`text-[11px] text-neutral-600 hover:text-neutral-300`,children:`clear`})]}),f&&(0,K.jsx)(Zu,{logs:r,height:`min-h-32 max-h-64`})]}),(0,K.jsxs)(`div`,{className:`flex flex-1 flex-col min-h-0 border-t border-neutral-800`,children:[(0,K.jsxs)(`div`,{className:`flex items-center px-4 py-2`,children:[(0,K.jsxs)(`button`,{className:`flex flex-1 items-center gap-2 hover:opacity-70`,onClick:()=>{b(`devtools-proxy-open`,g)},children:[(0,K.jsx)(`span`,{className:Ju,children:`Proxy Log`}),(0,K.jsx)(C,{icon:m?h:v,className:`text-neutral-600`,size:`xs`})]}),m&&(0,K.jsx)(`button`,{onClick:()=>{fetch(`/api/proxy-cache/clear`)},className:`text-[11px] text-neutral-600 hover:text-neutral-300`,children:`clear cache`})]}),m&&(0,K.jsx)(td,{logs:n,height:`flex-1 min-h-0`})]})]}),(0,K.jsxs)(`div`,{className:`flex flex-col border-t border-neutral-800`,children:[(0,K.jsxs)(`button`,{className:`flex items-center justify-between px-4 py-2 hover:bg-neutral-800/50`,onClick:()=>{b(`devtools-build-open`,y)},children:[(0,K.jsx)(`span`,{className:Ju,children:`Build Log`}),(0,K.jsx)(C,{icon:_?h:v,className:`text-neutral-600`,size:`xs`})]}),_&&(0,K.jsx)(Qu,{logs:t,height:`max-h-[60px]`})]})]})]})},rd=(0,G.createContext)(0),id=()=>(0,G.useContext)(rd),ad=(0,G.createContext)(void 0),od=()=>(0,G.useContext)(ad),sd=window.open.bind(window),cd=416,ld={apiKey:``,userId:``,businessId:``,environment:`go`},ud=()=>{let{buildLogs:e,proxyLogs:t,serverCredentials:n}=Bu(),[r,a]=(0,G.useState)([]);(0,G.useEffect)(()=>window.electronAPI?.onConsoleMessage?.(e=>{a(t=>[...t,e])}),[]);let[o,s]=(0,G.useState)(()=>localStorage.getItem(`devtools-sidebar-open`)===`true`),c=()=>{s(e=>{let t=!e;return localStorage.setItem(`devtools-sidebar-open`,String(t)),t})},[l,u]=(0,G.useState)(()=>{try{return{...ld,...JSON.parse(localStorage.getItem(`devtools-credentials`)??`{}`)}}catch{return ld}});(0,G.useEffect)(()=>{fetch(`/api/credentials`).then(e=>e.json()).then(e=>{if(e.apiKey){let t={...ld,...e};u(t),localStorage.setItem(`devtools-credentials`,JSON.stringify(t))}}).catch(()=>{})},[]),(0,G.useEffect)(()=>{if(!n)return;let e={...ld,...n};u(e),localStorage.setItem(`devtools-credentials`,JSON.stringify(e))},[n]);let d=e=>{u(e),localStorage.setItem(`devtools-credentials`,JSON.stringify(e))},{data:f,isLoading:h,isError:g}=Au(Mu),{data:_,isError:v,isLoading:y}=Au(zu(l)),b=Cc(),{location:x}=ol(),S=/^\/([^/]+)\/.+/.exec(x.pathname)?.[1],w=/^\/[^/]+\/([^/]+)$/.exec(x.pathname)?.[1],T=h?`loading`:g?`error`:f?`loaded`:`empty`,E=y?`authenticating`:v?`auth error`:_?`authenticated`:`no auth`,D=h?`bg-neutral-100 text-neutral-400`:g?`bg-red-100 text-red-700`:f?`bg-green-100 text-green-700`:`bg-yellow-100 text-yellow-700`,O=y?`bg-neutral-100 text-neutral-400`:v?`bg-red-100 text-red-700`:_?`bg-green-100 text-green-700`:`bg-yellow-100 text-yellow-700`;return(0,K.jsx)(Pu.Provider,{value:l,children:(0,K.jsx)(rd.Provider,{value:o?cd:0,children:(0,K.jsx)(ad.Provider,{value:_,children:(0,K.jsxs)(`div`,{className:`flex h-screen flex-col overflow-hidden font-mono`,children:[(0,K.jsxs)(`div`,{className:`sticky top-0 z-10 flex items-center gap-3 border-b border-black/10 bg-white/85 px-5 py-3 backdrop-blur-sm`,children:[(0,K.jsx)(`span`,{className:`text-[13px] font-bold tracking-tight text-neutral-900`,children:`Kizen App Builder`}),f&&f.length>0&&(0,K.jsx)(`select`,{value:S??``,onChange:e=>void b({to:`/$apiName/summary`,params:{apiName:e.target.value}}),className:`rounded border border-black/10 bg-transparent px-2 py-0.5 text-[13px] font-mono text-neutral-700 focus:outline-none`,children:f.map(e=>{let t=e.api_name;return(0,K.jsx)(`option`,{value:t,children:e.name??t},t)})}),w&&S&&(0,K.jsxs)(`select`,{value:w,onChange:e=>void b({to:`/${S}/${e.target.value}`}),className:`rounded border border-black/10 bg-transparent px-2 py-0.5 text-[13px] font-mono text-neutral-700 focus:outline-none`,children:[(0,K.jsx)(`option`,{value:`summary`,children:`Summary`}),(0,K.jsx)(`option`,{value:`sandbox`,children:`Sandbox`}),(0,K.jsx)(`option`,{value:`configuration`,children:`Configuration`}),(0,K.jsx)(`option`,{value:`versions`,children:`Versions`})]}),(0,K.jsx)(`div`,{className:`flex-1`}),(0,K.jsx)(`button`,{onClick:()=>{window.location.reload()},className:`text-[14px] text-neutral-400 hover:text-neutral-700`,"aria-label":`Refresh page`,children:(0,K.jsx)(C,{icon:m})}),(0,K.jsx)(`button`,{onClick:()=>{sd(Lu[l.environment],`_blank`,`noopener,height=900`)},className:`text-[14px] text-neutral-400 hover:text-neutral-700`,"aria-label":`Toggle dev tools`,children:(0,K.jsx)(C,{icon:p})}),(0,K.jsx)(`button`,{onClick:c,className:`text-[14px] ${o?`text-neutral-700`:`text-neutral-400`} hover:text-neutral-700`,"aria-label":`Toggle dev tools`,children:(0,K.jsx)(C,{icon:i})}),(0,K.jsx)(`span`,{className:`rounded px-2 py-0.5 text-[11px] font-semibold tracking-wide ${D}`,children:T}),(0,K.jsx)(`span`,{className:`rounded px-2 py-0.5 text-[11px] font-semibold tracking-wide ${O}`,children:E})]}),(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`flex-1 overflow-y-auto p-6`,style:{backgroundImage:`
2
+ linear-gradient(rgba(0,0,0,0.025) 1px, transparent 1px),
3
+ linear-gradient(90deg, rgba(0,0,0,0.025) 1px, transparent 1px)
4
+ `,backgroundSize:`24px 24px`},children:(0,K.jsx)(Zc,{})}),o&&(0,K.jsx)(nd,{onClose:c,buildLogs:e,proxyLogs:t,consoleLogs:r,onClearConsole:()=>{a([])},credentials:l,onCredentialsChange:d})]})]})})})})},Y=({children:e,className:t=``})=>(0,K.jsx)(`div`,{className:`rounded-xl bg-white p-5 shadow-sm ${t}`,children:e}),dd=()=>{let{data:e,isLoading:t,isError:n}=Au(Mu),r=Cc();return(0,G.useEffect)(()=>{e&&e.length>0&&r({to:`/$apiName/summary`,params:{apiName:e[0]?.api_name}})},[e,r]),t?(0,K.jsx)(Y,{children:(0,K.jsx)(`p`,{className:`m-0 text-[13px] text-neutral-400`,children:`Fetching bundle.json…`})}):n?(0,K.jsx)(Y,{children:(0,K.jsx)(`p`,{className:`m-0 text-[13px] text-red-700`,children:`Could not load bundle.json. Make sure the dev server is running from a plugin directory.`})}):!e||e.length===0?(0,K.jsx)(Y,{children:(0,K.jsxs)(`p`,{className:`m-0 text-[13px] text-yellow-700`,children:[`bundle.json is empty. Run`,` `,(0,K.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 py-0.5`,children:`appbuilder build`}),` to generate it.`]})}):null},fd=wt(),pd=Ui(),md=wn(),hd=Yi(),gd=Mi(),_d=fn(),vd=$n(),yd=ar(),bd=Nr(),xd=Zr(),Sd=qn(),Cd=In(),wd=Ei(),Td=Dr(),Ed=An(),Dd=mi(),Od=Gr(),kd=vn(),Ad=dr(),jd=ci(),Md=zr(),Nd=bi(),Pd=Vn(),Fd=O(),Id=mt(),Ld=sn(),Rd=Xt(),zd=tn(),Bd=Pe(),Vd=ri(),Hd=Re(),Ud=ye(),Wd=Gt(),Gd=Ft(),Kd=we(),qd=Bt(),Jd=R(),Yd=ta(),Xd=yt(),Zd=Ue(),Qd=ke(),$d=me(),ef=lt(),tf=$e(),nf=Je(),rf=_r(),af=N(),of=Sr(),sf=it(),cf=ae(),lf=ue(),uf=At(),df=Ri(),ff=te(),pf=Tt(),mf=Wi(),hf=Tn(),gf=Xi(),_f=Ni(),vf=pn(),yf=er(),bf=or(),xf=Pr(),Sf=Qr(),Cf=Jn(),wf=Ln(),Tf=Di(),Ef=Or(),Df=jn(),Of=hi(),kf=Kr(),Af=yn(),jf=fr(),Mf=li(),Nf=Br(),Pf=xi(),Ff=Hn(),If=A(),Lf=gt(),Rf=ln(),zf=Qt(),Bf=rn(),Vf=W(),Hf=ai(),Uf=Be(),Wf=xe(),Gf=qt(),Kf=Lt(),qf=Ee(),Jf=Ht(),Yf=B(),Xf=ra(),Zf=xt(),Qf=Ge(),$f=je(),ep=ge(),tp=dt(),np=tt(),rp=Xe(),ip=yr(),ap=F(),op=wr(),sp=ot(),cp=se(),lp=U(),up=Mt(),dp=Bi(),fp=ne(),pp=Dt(),mp=Ki(),hp=Dn(),gp=Qi(),_p=Fi(),vp=hn(),yp=nr(),bp=cr(),xp=Ir(),Sp=ei(),Cp=Xn(),wp=zn(),Tp=ki(),Ep=Ar(),Dp=Nn(),Op=_i(),kp=Jr(),Ap=xn(),jp=mr(),Mp=di(),Np=Hr(),Pp=Ci(),Fp=Wn(),Ip=k(),Lp=ht(),Rp=cn(),zp=Zt(),Bp=nn(),Vp=Fe(),Hp=ii(),Up=ze(),Wp=be(),Gp=Kt(),Kp=It(),qp=Te(),Jp=Vt(),Yp=z(),Xp=na(),Zp=bt(),Qp=We(),$p=Ae(),em=he(),tm=ut(),nm=et(),rm=Ye(),im=vr(),am=P(),om=Cr(),sm=at(),cm=oe(),lm=de(),um=jt(),dm=zi(),fm=H(),pm=Et(),mm=Gi(),hm=En(),gm=Zi(),_m=Pi(),vm=mn(),ym=tr(),bm=sr(),xm=Fr(),Sm=$r(),Cm=Yn(),wm=Rn(),Tm=Oi(),Em=kr(),Dm=Mn(),Om=gi(),km=qr(),Am=bn(),jm=pr(),Mm=ui(),Nm=Vr(),Pm=Si(),Fm=Un(),Im=j(),Lm=_t(),Rm=un(),zm=$t(),Bm=an(),Vm=Ie(),Hm=oi(),Um=Ve(),Wm=Se(),Gm=Jt(),Km=Rt(),qm=De(),Jm=Ut(),Ym=V(),Xm=ia(),Zm=St(),Qm=Ke(),$m=Me(),eh=_e(),th=ft(),nh=nt(),rh=Ze(),ih=br(),ah=I(),oh=Tr(),sh=st(),ch=ce(),lh=fe(),uh=Nt(),dh=Vi(),fh=re(),ph=Ot(),mh=qi(),hh=On(),gh=$i(),_h=Ii(),vh=gn(),yh=rr(),bh=lr(),xh=Lr(),Sh=ti(),Ch=Zn(),wh=Bn(),Th=Ai(),Eh=jr(),Dh=Pn(),Oh=vi(),kh=Yr(),Ah=Sn(),jh=hr(),Mh=fi(),Nh=Ur(),Ph=wi(),Fh=Gn(),Ih=D(),Lh=pt(),Rh=on(),zh=Yt(),Bh=en(),Vh=Ne(),Hh=ni(),Uh=Le(),Wh=ve(),Gh=Wt(),Kh=Pt(),qh=zt(),Jh=Ce(),Yh=L(),Xh=ea(),Zh=vt(),Qh=He(),$h=Oe(),eg=pe(),tg=ct(),ng=Qe(),rg=qe(),ig=gr(),ag=M(),og=xr(),sg=rt(),cg=ie(),lg=le(),ug=kt(),dg=Li(),fg=ee(),pg=Ct(),mg=Hi(),hg=Cn(),gg=Ji(),_g=ji(),vg=dn(),yg=Qn(),bg=ir(),xg=Mr(),Sg=Xr(),Cg=Kn(),wg=Fn(),Tg=Ti(),Eg=Er(),Dg=kn(),Og=pi(),kg=Wr(),Ag=_n(),jg=ur(),Mg=si(),Ng=Rr(),Pg=yi(),Fg=new Set([`kizen-k`,`form-entity`]),Ig={phone:fd.faPhone,envelope:pd.faEnvelope,"pen-nib":md.faPenNib,"calendar-days":hd.faCalendarDays,paperclip:gd.faPaperclip,file:_d.faFile,clipboard:vd.faClipboard,pen:yd.faPen,tag:bd.faTag,book:xd.faBook,print:Sd.faPrint,"pen-to-square":Cd.faPenToSquare,folder:wd.faFolder,"folder-open":Td.faFolderOpen,thumbtack:Ed.faThumbtack,globe:Dd.faGlobe,city:Od.faCity,briefcase:kd.faBriefcase,compass:Ad.faCompass,"address-book":jd.faAddressBook,"business-time":Md.faBusinessTime,"computer-classic":Nd.faComputerClassic,"pen-fancy":Pd.faPenFancy,"badge-check":Fd.faBadgeCheck,"mug-saucer":Id.faMugSaucer,landmark:Ld.faLandmark,"chart-simple":Rd.faChartSimple,envelopes:zd.faEnvelopes,"diagram-venn":Bd.faDiagramVenn,calendar:Vd.faCalendar,pencil:Hd.faPencil,"phone-volume":Ud.faPhoneVolume,copy:Wd.faCopy,table:Gd.faTable,building:Kd.faBuilding,"network-wired":qd.faNetworkWired,"address-card":Jd.faAddressCard,tags:Yd.faTags,registered:Xd.faRegistered,signature:Zd.faSignature,"phone-office":Qd.faPhoneOffice,projector:$d.faProjector,sitemap:ef.faSitemap,marker:tf.faMarker,badge:nf.faBadge,wallet:rf.faWallet,copyright:af.faCopyright,bullseye:of.faBullseye,calculator:sf.faCalculator,certificate:cf.faCertificate,percent:lf.faPercent,eraser:uf.faEraser,"file-spreadsheet":df.faFileSpreadsheet,glasses:ff.faGlasses,industry:pf.faIndustry,vault:mf.faVault,"user-tie-hair-long":hf.faUserTieHairLong,"user-tie-hair":gf.faUserTieHair,"user-hair-mullet":_f.faUserHairMullet,trademark:vf.faTrademark,"timeline-arrow":yf.faTimelineArrow,timeline:bf.faTimeline,"table-tree":xf.faTableTree,"table-rows":Sf.faTableRows,"table-pivot":Cf.faTablePivot,"table-layout":wf.faTableLayout,"table-columns":Tf.faTableColumns,stapler:Ef.faStapler,"square-poll-vertical":Df.faSquarePollVertical,"square-poll-horizontal":Of.faSquarePollHorizontal,"square-phone-flip":kf.faSquarePhoneFlip,"square-phone":Af.faSquarePhone,"square-pen":jf.faSquarePen,"square-kanban":Mf.faSquareKanban,"square-envelope":Nf.faSquareEnvelope,socks:Pf.faSocks,"slot-machine":Ff.faSlotMachine,"signature-slash":If.faSignatureSlash,"signature-lock":Lf.faSignatureLock,shredder:Rf.faShredder,scissors:zf.faScissors,"scanner-image":Bf.faScannerImage,"scale-unbalanced-flip":Vf.faScaleUnbalancedFlip,"scale-unbalanced":Hf.faScaleUnbalanced,"scale-balanced":Uf.faScaleBalanced,router:Wf.faRouter,"rectangle-pro":Gf.faRectanglePro,"print-slash":Kf.faPrintSlash,"print-magnifying-glass":qf.faPrintMagnifyingGlass,"presentation-screen":Jf.faPresentationScreen,podium:Yf.faPodium,"phone-slash":Xf.faPhoneSlash,"phone-intercom":Zf.faPhoneIntercom,"phone-flip":Qf.faPhoneFlip,"person-chalkboard":$f.faPersonChalkboard,"pen-nib-slash":ep.faPenNibSlash,"pen-clip":tp.faPenClip,paste:np.faPaste,"paperclip-vertical":rp.faPaperclipVertical,notebook:ip.faNotebook,"note-sticky":ap.faNoteSticky,"money-check-pen":op.faMoneyCheckPen,"money-check-dollar-pen":sp.faMoneyCheckDollarPen,"magnifying-glass-chart":cp.faMagnifyingGlassChart,"magnifying-glass-arrow-right":lp.faMagnifyingGlassArrowRight,"list-tree":up.faListTree,"list-timeline":dp.faListTimeline,"list-radio":fp.faListRadio,"list-dropdown":pp.faListDropdown,"list-check":mp.faListCheck,"laptop-file":hp.faLaptopFile,"lamp-desk":gp.faLampDesk,keynote:_p.faKeynote,"industry-windows":vp.faIndustryWindows,inboxes:yp.faInboxes,"inbox-full":bp.faInboxFull,"house-laptop":xp.faHouseLaptop,highlighter:Sp.faHighlighter,folders:Cp.faFolders,"folder-xmark":wp.faFolderXmark,"folder-tree":Tp.faFolderTree,"folder-plus":Ep.faFolderPlus,"folder-minus":Dp.faFolderMinus,"folder-arrow-up":Op.faFolderArrowUp,"folder-arrow-down":kp.faFolderArrowDown,"floppy-disk-circle-xmark":Ap.faFloppyDiskCircleXmark,"floppy-disk-circle-arrow-right":jp.faFloppyDiskCircleArrowRight,"floppy-disk":Mp.faFloppyDisk,"file-user":Np.faFileUser,"file-lines":Pp.faFileLines,"file-circle-plus":Fp.faFileCirclePlus,"file-circle-info":Ip.faFileCircleInfo,"file-chart-pie":Lp.faFileChartPie,"file-chart-column":Rp.faFileChartColumn,fax:zp.faFax,"envelope-open":Bp.faEnvelopeOpen,"envelope-dot":Vp.faEnvelopeDot,"envelope-circle-check":Hp.faEnvelopeCircleCheck,"coffee-pot":Up.faCoffeePot,"cloud-word":Wp.faCloudWord,"clipboard-question":Gp.faClipboardQuestion,"chart-user":Kp.faChartUser,"chart-tree-map":qp.faChartTreeMap,"chart-simple-horizontal":Jp.faChartSimpleHorizontal,"chart-pyramid":Yp.faChartPyramid,"chart-pie-simple":Xp.faChartPieSimple,"chart-pie":Zp.faChartPie,"chart-line-up":Qp.faChartLineUp,"chart-line-down":$p.faChartLineDown,"chart-line":em.faChartLine,"cake-candles":tm.faCakeCandles,"cabinet-filing":nm.faCabinetFiling,bullhorn:rm.faBullhorn,"briefcase-blank":im.faBriefcaseBlank,"briefcase-arrow-right":am.faBriefcaseArrowRight,"brain-arrow-curved-right":om.faBrainArrowCurvedRight,"boxes-packing":sm.faBoxesPacking,"box-archive":cm.faBoxArchive,"book-section":lm.faBookSection,"bars-staggered":um.faBarsStaggered,"bars-progress":dm.faBarsProgress,"badge-percent":fm.faBadgePercent,"badge-dollar":pm.faBadgeDollar,"arrows-to-eye":mm.faArrowsToEye,"arrows-to-dot":hm.faArrowsToDot,"arrows-spin":gm.faArrowsSpin,sparkles:_m.faSparkles,megaphone:vm.faMegaphone,"block-question":ym.faBlockQuestion,"lightbulb-slash":bm.faLightbulbSlash,"comments-dollar":xm.faCommentsDollar,comments:Og.faComments,"bullseye-pointer":Sm.faBullseyePointer,lightbulb:Cm.faLightbulb,"user-group-crown":wm.faUserGroupCrown,"user-crown":Tm.faUserCrown,"signal-stream-slash":Em.faSignalStreamSlash,"signal-stream":Dm.faSignalStream,"rectangle-ad":Om.faRectangleAd,"ranking-star":km.faRankingStar,"person-rays":Am.faPersonRays,"people-group":jm.faPeopleGroup,"messages-dollar":Mm.faMessagesDollar,"message-dollar":Nm.faMessageDollar,"magnifying-glass-location":Pm.faMagnifyingGlassLocation,"magnifying-glass-dollar":Fm.faMagnifyingGlassDollar,"lightbulb-on":Im.faLightbulbOn,"lightbulb-exclamation":Lm.faLightbulbExclamation,"lightbulb-dollar":Rm.faLightbulbDollar,"lightbulb-cfl-on":zm.faLightbulbCflOn,"lightbulb-cfl":Bm.faLightbulbCfl,"hundred-points":Vm.faHundredPoints,"group-arrows-rotate":Hm.faGroupArrowsRotate,"gift-card":Um.faGiftCard,"filter-circle-dollar":Wm.faFilterCircleDollar,"envelopes-bulk":Gm.faEnvelopesBulk,"envelope-open-text":Km.faEnvelopeOpenText,"envelope-open-dollar":qm.faEnvelopeOpenDollar,"comment-dollar":Jm.faCommentDollar,"chart-mixed":Ym.faChartMixed,"bullseye-arrow":Xm.faBullseyeArrow,star:Zm.faStar,heart:Qm.faHeart,"camera-retro":$m.faCameraRetro,"truck-fast":eh.faTruckFast,bell:th.faBell,"cart-shopping":nh.faCartShopping,gift:rh.faGift,barcode:ih.faBarcode,bookmark:ah.faBookmark,camera:oh.faCamera,"thumbs-up":sh.faThumbsUp,"thumbs-down":ch.faThumbsDown,key:lh.faKey,truck:uh.faTruck,balloons:dh.faBalloons,handshake:fh.faHandshake,shop:ph.faShop,shirt:mh.faShirt,"bag-shopping":hh.faBagShopping,moped:gh.faMoped,"cart-plus":_h.faCartPlus,"credit-card":vh.faCreditCard,store:yh.faStore,"cash-register":bh.faCashRegister,"booth-curtain":xh.faBoothCurtain,trophy:Sh.faTrophy,receipt:Ch.faReceipt,"truck-container":wh.faTruckContainer,"truck-clock":Th.faTruckClock,"truck-bolt":Eh.faTruckBolt,"trophy-star":Dh.faTrophyStar,"store-slash":Oh.faStoreSlash,"store-lock":kh.faStoreLock,"star-exclamation":Ah.faStarExclamation,"shop-slash":jh.faShopSlash,"shop-lock":Mh.faShopLock,"rectangle-barcode":Nh.faRectangleBarcode,"person-booth":Ph.faPersonBooth,"nfc-trash":Fh.faNfcTrash,"nfc-symbol":Ih.faNfcSymbol,"nfc-slash":Lh.faNfcSlash,"nfc-signal":Rh.faNfcSignal,"nfc-pen":zh.faNfcPen,"nfc-magnifying-glass":Bh.faNfcMagnifyingGlass,"nfc-lock":Vh.faNfcLock,nfc:Hh.faNfc,"money-check-dollar":Uh.faMoneyCheckDollar,"money-check":Wh.faMoneyCheck,"mobile-signal-out":Gh.faMobileSignalOut,"mobile-signal":Kh.faMobileSignal,"hexagon-vertical-nft-slanted":qh.faHexagonVerticalNftSlanted,"hexagon-vertical-nft":Jh.faHexagonVerticalNft,"hexagon-image":Yh.faHexagonImage,"hand-holding-box":Xh.faHandHoldingBox,gifts:Zh.faGifts,gem:Qh.faGem,"credit-card-front":$h.faCreditCardFront,"credit-card-blank":eg.faCreditCardBlank,"cart-xmark":tg.faCartXmark,"cart-shopping-fast":ng.faCartShoppingFast,"cart-minus":rg.faCartMinus,"cart-circle-xmark":ig.faCartCircleXmark,"cart-circle-plus":ag.faCartCirclePlus,"cart-circle-exclamation":og.faCartCircleExclamation,"cart-circle-check":sg.faCartCircleCheck,"cart-circle-arrow-up":cg.faCartCircleArrowUp,"cart-circle-arrow-down":lg.faCartCircleArrowDown,"cart-arrow-up":ug.faCartArrowUp,"cart-arrow-down":dg.faCartArrowDown,"box-open-full":fg.faBoxOpenFull,"basket-shopping-simple":pg.faBasketShoppingSimple,"basket-shopping":mg.faBasketShopping,"barcode-scan":hg.faBarcodeScan,"barcode-read":gg.faBarcodeRead,balloon:_g.faBalloon,"bags-shopping":vg.faBagsShopping,bars:yg.faBars,browser:bg.faBrowser,"chart-bar":xg.faChartBar,cog:Sg.faCog,database:Tg.faDatabase,"calendar-alt":Cg.faCalendarAlt,play:wg.faPlay,add:Eg.faAdd,"book-alt":Dg.faBookAlt,"arrows-to-circle":kg.faArrowsToCircle,"question-circle":Ag.faQuestionCircle,"chevron-down":jg.faChevronDown,"chevron-up":Mg.faChevronUp,"window-restore":Ng.faWindowRestore,forward:Pg.faForward},Lg=new Set(`phone.envelope.pen-nib.calendar-days.paperclip.file.clipboard.pen.tag.book.print.pen-to-square.folder.folder-open.thumbtack.globe.city.briefcase.compass.address-book.business-time.computer-classic.pen-fancy.badge-check.mug-saucer.landmark.chart-simple.envelopes.diagram-venn.calendar.pencil.phone-volume.copy.table.building.network-wired.address-card.tags.registered.signature.phone-office.projector.sitemap.marker.badge.wallet.copyright.bullseye.calculator.certificate.percent.eraser.file-spreadsheet.glasses.industry.vault.user-tie-hair-long.user-tie-hair.user-hair-mullet.trademark.timeline-arrow.timeline.table-tree.table-rows.table-pivot.table-layout.table-columns.stapler.square-poll-vertical.square-poll-horizontal.square-phone-flip.square-phone.square-pen.square-kanban.square-envelope.socks.slot-machine.signature-slash.signature-lock.shredder.scissors.scanner-image.scale-unbalanced-flip.scale-unbalanced.scale-balanced.router.rectangle-pro.print-slash.print-magnifying-glass.presentation-screen.podium.phone-slash.phone-intercom.phone-flip.person-chalkboard.pen-nib-slash.pen-clip.paste.paperclip-vertical.notebook.note-sticky.money-check-pen.money-check-dollar-pen.magnifying-glass-chart.magnifying-glass-arrow-right.list-tree.list-timeline.list-radio.list-dropdown.list-check.laptop-file.lamp-desk.keynote.industry-windows.inboxes.inbox-full.house-laptop.highlighter.folders.folder-xmark.folder-tree.folder-plus.folder-minus.folder-arrow-up.folder-arrow-down.floppy-disk-circle-xmark.floppy-disk-circle-arrow-right.floppy-disk.file-user.file-lines.file-circle-plus.file-circle-info.file-chart-pie.file-chart-column.fax.envelope-open.envelope-dot.envelope-circle-check.coffee-pot.cloud-word.clipboard-question.chart-user.chart-tree-map.chart-simple-horizontal.chart-pyramid.chart-pie-simple.chart-pie.chart-line-up.chart-line-down.chart-line.cake-candles.cabinet-filing.bullhorn.briefcase-blank.briefcase-arrow-right.brain-arrow-curved-right.boxes-packing.box-archive.book-section.bars-staggered.bars-progress.badge-percent.badge-dollar.arrows-to-eye.arrows-to-dot.arrows-spin.sparkles.megaphone.block-question.lightbulb-slash.comments-dollar.comments.bullseye-pointer.lightbulb.user-group-crown.user-crown.signal-stream-slash.signal-stream.rectangle-ad.ranking-star.person-rays.people-group.messages-dollar.message-dollar.magnifying-glass-location.magnifying-glass-dollar.lightbulb-on.lightbulb-exclamation.lightbulb-dollar.lightbulb-cfl-on.lightbulb-cfl.hundred-points.group-arrows-rotate.gift-card.filter-circle-dollar.envelopes-bulk.envelope-open-text.envelope-open-dollar.comment-dollar.chart-mixed.bullseye-arrow.star.heart.camera-retro.truck-fast.bell.cart-shopping.gift.barcode.bookmark.camera.thumbs-up.thumbs-down.key.truck.balloons.handshake.shop.shirt.bag-shopping.moped.cart-plus.credit-card.store.cash-register.booth-curtain.trophy.receipt.truck-container.truck-clock.truck-bolt.trophy-star.store-slash.store-lock.star-exclamation.shop-slash.shop-lock.rectangle-barcode.person-booth.nfc-trash.nfc-symbol.nfc-slash.nfc-signal.nfc-pen.nfc-magnifying-glass.nfc-lock.nfc.money-check-dollar.money-check.mobile-signal-out.mobile-signal.hexagon-vertical-nft-slanted.hexagon-vertical-nft.hexagon-image.hand-holding-box.gifts.gem.credit-card-front.credit-card-blank.cart-xmark.cart-shopping-fast.cart-minus.cart-circle-xmark.cart-circle-plus.cart-circle-exclamation.cart-circle-check.cart-circle-arrow-up.cart-circle-arrow-down.cart-arrow-up.cart-arrow-down.box-open-full.basket-shopping-simple.basket-shopping.barcode-scan.barcode-read.balloon.bags-shopping.bars.browser.chart-bar.cog.database.calendar-alt.play.kizen-k.add.book-alt.form-entity.arrows-to-circle.question-circle.chevron-down.chevron-up.window-restore.forward`.split(`.`)),Rg=[...Lg].sort(),zg=()=>{let{apiName:e}=xc({strict:!1}),{data:t,isLoading:n,isError:r}=Au(Mu);if(n)return(0,K.jsx)(Y,{children:(0,K.jsx)(`p`,{className:`m-0 text-[13px] text-neutral-400`,children:`Fetching bundle.json…`})});if(r)return(0,K.jsx)(Y,{children:(0,K.jsx)(`p`,{className:`m-0 text-[13px] text-red-700`,children:`Could not load bundle.json.`})});let i=t?.find(t=>t.api_name===e);if(!i)return(0,K.jsx)(Y,{children:(0,K.jsxs)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:[`No app found with api_name`,` `,(0,K.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 py-0.5`,children:e}),`.`]})});let{floating_frames:o,data_adornments:c,routable_pages:l,toolbar_items:d,js_action_templates:f,route_scripts:p,object_settings_menu_items:m,automation_action_configs:h,calendar_sources:v}=i.artifacts,x=o.length>0||c.length>0||l.length>0||d.length>0||f.length>0||p.length>0||m.length>0||h.length>0||v.length>0,T=i.setup_assistant?.fields??[],E=i.user_setup_assistant?.fields??[];return(0,K.jsxs)(`div`,{className:`space-y-4 text-[13px]`,children:[(0,K.jsx)(Y,{children:(0,K.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h1`,{className:`text-lg font-bold leading-tight text-neutral-900`,children:i.name}),(0,K.jsx)(`p`,{className:`mt-0.5 font-mono text-[11px] text-neutral-400`,children:i.api_name})]}),i.description&&(0,K.jsx)(`p`,{className:`text-[13px] leading-relaxed text-neutral-600`,children:i.description}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[i.version&&(0,K.jsxs)(`span`,{className:`rounded bg-neutral-100 px-2 py-0.5 text-[11px] font-semibold tracking-wide text-neutral-600`,children:[`v`,i.version]}),i.engine&&(0,K.jsxs)(`span`,{className:`rounded bg-blue-50 px-2 py-0.5 text-[11px] font-semibold tracking-wide text-blue-600`,children:[`engine: `,i.engine]}),(0,K.jsx)(`span`,{className:`rounded px-2 py-0.5 text-[11px] font-semibold tracking-wide ${i.published?`bg-green-100 text-green-700`:`bg-neutral-100 text-neutral-500`}`,children:i.published?`published`:`unpublished`}),i.release_environments?.map(e=>(0,K.jsx)(`span`,{className:`rounded bg-violet-50 px-2 py-0.5 text-[11px] font-semibold tracking-wide text-violet-600`,children:e},e)),i.block_loading_for_setup&&(0,K.jsx)(`span`,{className:`rounded bg-amber-100 px-2 py-0.5 text-[11px] font-semibold tracking-wide text-amber-700`,children:`blocks app loading`}),i.developer_business_id&&(typeof i.developer_business_id==`string`?(0,K.jsxs)(`span`,{className:`rounded bg-neutral-100 px-2 py-0.5 font-mono text-[11px] tracking-wide text-neutral-500`,children:[`biz: `,i.developer_business_id]}):Object.entries(i.developer_business_id).map(([e,t])=>(0,K.jsxs)(`span`,{className:`rounded bg-neutral-100 px-2 py-0.5 font-mono text-[11px] tracking-wide text-neutral-500`,children:[`biz (`,e,`): `,t]},e)))]})]})}),x?(0,K.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 md:grid-cols-2`,children:[o.length>0&&(0,K.jsxs)(Y,{children:[(0,K.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,K.jsx)(C,{icon:w,className:`text-[12px] text-neutral-400`}),(0,K.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Floating Frames`}),(0,K.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:o.length})]}),(0,K.jsx)(`div`,{className:`divide-y divide-black/5`,children:o.map((e,t)=>(0,K.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.name}),(0,K.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]}),e.default_position&&(0,K.jsx)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-1.5 py-0.5 text-[10px] text-neutral-500`,children:e.default_position})]},t))})]}),c.length>0&&(0,K.jsxs)(Y,{children:[(0,K.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,K.jsx)(C,{icon:u,className:`text-[12px] text-neutral-400`}),(0,K.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Data Adornments`}),(0,K.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:c.length})]}),(0,K.jsx)(`div`,{className:`divide-y divide-black/5`,children:c.map((e,t)=>(0,K.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[e.config.color&&(0,K.jsx)(`span`,{className:`h-2.5 w-2.5 shrink-0 rounded-full`,style:{backgroundColor:e.config.color}}),(0,K.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-neutral-900`,children:e.config.tooltip||e.field_type}),(0,K.jsx)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-1.5 py-0.5 font-mono text-[10px] text-neutral-500`,children:e.field_type})]},t))})]}),l.length>0&&(0,K.jsxs)(Y,{children:[(0,K.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,K.jsx)(C,{icon:y,className:`text-[12px] text-neutral-400`}),(0,K.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Routable Pages`}),(0,K.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:l.length})]}),(0,K.jsx)(`div`,{className:`divide-y divide-black/5`,children:l.map((e,t)=>(0,K.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.name}),(0,K.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]}),e.iframe_url&&(0,K.jsx)(`span`,{className:`shrink-0 rounded bg-purple-100 px-1.5 py-0.5 text-[10px] font-semibold text-purple-600`,children:`iframe`})]},t))})]}),d.length>0&&(0,K.jsxs)(Y,{children:[(0,K.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,K.jsx)(C,{icon:S,className:`text-[12px] text-neutral-400`}),(0,K.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Toolbar Items`}),(0,K.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:d.length})]}),(0,K.jsx)(`div`,{className:`divide-y divide-black/5`,children:d.map((e,t)=>(0,K.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[e.color&&(0,K.jsx)(`span`,{className:`h-2.5 w-2.5 shrink-0 rounded-full`,style:{backgroundColor:e.color}}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.label}),(0,K.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]}),e.icon&&(Ig[e.icon]?(0,K.jsx)(C,{icon:Ig[e.icon],className:`shrink-0 text-[12px] text-neutral-400`}):(0,K.jsx)(`span`,{className:`shrink-0 rounded px-1 font-mono text-[10px] ${Lg.has(e.icon)||Fg.has(e.icon)?`bg-neutral-100 text-neutral-400`:`bg-amber-100 text-amber-600`}`,children:e.icon}))]},t))})]}),f.length>0&&(0,K.jsxs)(Y,{children:[(0,K.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,K.jsx)(C,{icon:a,className:`text-[12px] text-neutral-400`}),(0,K.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`JS Action Templates`}),(0,K.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:f.length})]}),(0,K.jsx)(`div`,{className:`divide-y divide-black/5`,children:f.map((e,t)=>(0,K.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.name}),(0,K.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]}),e.hint_object_name&&(0,K.jsx)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-1.5 py-0.5 text-[10px] text-neutral-500`,children:e.hint_object_name})]},t))})]}),p.length>0&&(0,K.jsxs)(Y,{children:[(0,K.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,K.jsx)(C,{icon:g,className:`text-[12px] text-neutral-400`}),(0,K.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Route Scripts`}),(0,K.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:p.length})]}),(0,K.jsx)(`div`,{className:`divide-y divide-black/5`,children:p.map((e,t)=>(0,K.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.name||e.api_name}),e.name&&(0,K.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]}),e.routes.length>0&&(0,K.jsxs)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-1.5 py-0.5 text-[10px] text-neutral-500`,children:[e.routes.length,` route`,e.routes.length===1?``:`s`]})]},t))})]}),m.length>0&&(0,K.jsxs)(Y,{children:[(0,K.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,K.jsx)(C,{icon:s,className:`text-[12px] text-neutral-400`}),(0,K.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Object Settings`}),(0,K.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:m.length})]}),(0,K.jsx)(`div`,{className:`divide-y divide-black/5`,children:m.map((e,t)=>(0,K.jsx)(`div`,{className:`flex items-center gap-2 py-1.5`,children:(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.label}),(0,K.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]})},t))})]}),h.length>0&&(0,K.jsxs)(Y,{children:[(0,K.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,K.jsx)(C,{icon:_,className:`text-[12px] text-neutral-400`}),(0,K.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Automation Actions`}),(0,K.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:h.length})]}),(0,K.jsx)(`div`,{className:`divide-y divide-black/5`,children:h.map((e,t)=>(0,K.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.name}),(0,K.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.action_step_api_name})]}),e.action_type&&(0,K.jsx)(`span`,{className:`shrink-0 rounded bg-blue-50 px-1.5 py-0.5 text-[10px] font-semibold text-blue-600`,children:e.action_type})]},t))})]}),v.length>0&&(0,K.jsxs)(Y,{children:[(0,K.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,K.jsx)(C,{icon:b,className:`text-[12px] text-neutral-400`}),(0,K.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Calendar Sources`}),(0,K.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:v.length})]}),(0,K.jsx)(`div`,{className:`divide-y divide-black/5`,children:v.map((e,t)=>(0,K.jsx)(`div`,{className:`flex items-center gap-2 py-1.5`,children:(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.name}),(0,K.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]})},t))})]})]}):(0,K.jsx)(Y,{children:(0,K.jsx)(`p`,{className:`text-[13px] text-neutral-400`,children:`No plugin assets defined.`})}),(T.length>0||E.length>0)&&(0,K.jsxs)(Y,{children:[(0,K.jsx)(`div`,{className:`mb-3 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Setup Assistant`}),T.length>0&&(0,K.jsxs)(`div`,{className:`mb-3`,children:[(0,K.jsx)(`div`,{className:`mb-1 text-[11px] text-neutral-400`,children:`Admin setup fields`}),(0,K.jsx)(`div`,{className:`divide-y divide-black/5`,children:T.map((e,t)=>(0,K.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-neutral-900`,children:e.label??e.key}),(0,K.jsx)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-1.5 py-0.5 font-mono text-[10px] text-neutral-500`,children:e.type})]},t))})]}),E.length>0&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`mb-1 text-[11px] text-neutral-400`,children:`User setup fields`}),(0,K.jsx)(`div`,{className:`divide-y divide-black/5`,children:E.map((e,t)=>(0,K.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-neutral-900`,children:e.label??e.key}),(0,K.jsx)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-1.5 py-0.5 font-mono text-[10px] text-neutral-500`,children:e.type})]},t))})]})]}),i.releaseNotes&&(0,K.jsxs)(Y,{children:[(0,K.jsx)(`div`,{className:`mb-3 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Release Notes`}),(0,K.jsx)(`pre`,{className:`whitespace-pre-wrap font-mono text-[12px] leading-relaxed text-neutral-700`,children:i.releaseNotes})]}),(0,K.jsx)(Y,{children:(0,K.jsxs)(`details`,{children:[(0,K.jsxs)(`summary`,{className:`cursor-pointer select-none text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:[`Icon Reference (`,Rg.length,` icons)`]}),(0,K.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-1`,children:Rg.map(e=>(0,K.jsxs)(`div`,{className:`flex w-32 items-center gap-1.5 rounded px-1.5 py-1 hover:bg-black/5`,title:e,children:[Ig[e]?(0,K.jsx)(C,{icon:Ig[e],className:`w-3.5 shrink-0 text-[13px] text-neutral-500`}):Fg.has(e)?(0,K.jsx)(`span`,{className:`w-3.5 shrink-0 text-center font-mono text-[9px] text-neutral-400`,children:`K`}):null,(0,K.jsx)(`span`,{className:`truncate font-mono text-[10px] text-neutral-500`,children:e})]},e))})]})})]})},X={QUERY_REQUEST:`query:request`,UI_OUTPUT:`outputui`,IFRAME_OUTPUT:`iframeoutput`,POSTFORMDATA_REQUEST:`postformdata:request`,SETSTATE:`setstate`,DONE:`done`,RUN:`run`,OPEN_WINDOW:`openwindow`,COMMUNICATE:`communicate`,HIDE:`hide`,SHOW:`show`,EXPAND:`expand`,COLLAPSE:`collapse`,HIDE_HEADER:`hideheader`,SHOW_HEADER:`showheader`,OPEN_CREATE_RECORD_MODAL_REQUEST:`opencreaterecordmodal:request`,OPEN_CREATE_RELATED_RECORD_MODAL_REQUEST:`opencreaterelatedrecordmodal:request`,SHOW_TOAST:`showtoast`,CLEAR_TOASTS:`cleartoasts`,REFRESH_TIMELINE:`refreshtimeline`,REFRESH_ENTITY:`refreshentity`,UPLOADFILE_REQUEST:`uploadfile:request`,UPDATE_SESSION_DATA:`updatesessiondata`,INSTALL_THIRD_PARTY_SCRIPT_REQUEST:`installthirdpartyscript:request`,PROMPT_REQUEST:`prompt:request`,DYNAMIC_PROMPT_REQUEST:`dynamicprompt:request`,RELEASE_BLOCKING_SCRIPT:`releaseblockingscript`,AUTHORIZE:`authorize`,COPY_TO_CLIPBOARD:`copytoclipboard`},Z={QUERY_RESPONSE:`query:response`,POSTFORMDATA_RESPONSE:`postformdata:response`,ERROR:`error`,UPLOADFILE_RESPONSE:`uploadfile:response`,UPLOADFILE_PROGRESS:`uploadfile:progress`,INSTALL_THIRD_PARTY_SCRIPT_RESPONSE:`installthirdpartyscript:response`,PROMPT_RESPONSE:`prompt:response`,REFRESH_ENTITY_RESPONSE:`refreshentity:response`,CREATE_RECORD_RESPONSE:`createrecord:response`,CREATE_RELATED_RECORD_RESPONSE:`createrelatedrecord:response`},Bg={RUN_FRAME_SCRIPT:`runframescript`,SEND_MESSAGE_TO_FRAME:`sendmessagetoframe`,CALL_THIRD_PARTY_SCRIPT:`callthirdpartyscript`},Vg=`integration:route-change`,Hg=`kizen-route-change`,Ug=`kzn-integration-frame`,Wg=/https:\/\/.*widget\.freshworks\.com\/.*\.js/,Gg=/https:\/\/widget\.intercom\.io\/widget\/[a-z0-9]+/,Kg={FRESHWORKS:`freshworks`,INTERCOM:`intercom`},qg=e=>{if(Wg.test(e))return Kg.FRESHWORKS;if(Gg.test(e))return Kg.INTERCOM},Jg={[Kg.FRESHWORKS]:`FreshworksWidget`,[Kg.INTERCOM]:`Intercom`},Yg={[Kg.FRESHWORKS]:e=>{window.fwSettings={widget_id:e.widgetId},(function(...e){if(typeof window[Jg[Kg.FRESHWORKS]]!=`function`){let t=function(){t.q.push(...e)};t.__kizen_pending=!0,t.q=[],window[Jg[Kg.FRESHWORKS]]=t}})()},[Kg.INTERCOM]:()=>{(function(){if(typeof window[Jg[Kg.INTERCOM]]!=`function`){let e=window,t=function(){t.c(arguments)};t.q=[],t.c=function(e){t.q.push(e)},t.__kizen_pending=!0,e[Jg[Kg.INTERCOM]]=t}})()}},Xg={[Kg.FRESHWORKS]:()=>window[Jg[Kg.FRESHWORKS]]?.__kizen_pending!==!0,[Kg.INTERCOM]:()=>window[Jg[Kg.INTERCOM]]?.__kizen_pending!==!0},Zg=()=>({host:window.location.host,hash:window.location.hash,href:window.location.href,origin:window.location.origin,pathname:window.location.pathname,search:window.location.search,port:window.location.port,protocol:window.location.protocol}),Qg=()=>{let e=new Date().getTime();return typeof performance<`u`&&typeof performance.now==`function`&&(e+=performance.now()),`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,t=>{let n=(e+Math.random()*16)%16|0;return e=Math.floor(e/16),(t===`x`?n:n&3|8).toString(16)})};Object.getPrototypeOf(async function(){}).constructor;var $g=e=>`${e?.plugin_api_name??``}-${e?.id??``}-${e?.api_name??``}-${e?.script_id??``}`,e_=Object.create,t_=Object.defineProperty,n_=Object.getOwnPropertyDescriptor,r_=Object.getOwnPropertyNames,i_=Object.getPrototypeOf,a_=Object.prototype.hasOwnProperty,Q=(e,t)=>function(){return t||(0,e[r_(e)[0]])((t={exports:{}}).exports,t),t.exports},o_=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of r_(t))!a_.call(e,i)&&i!==n&&t_(e,i,{get:()=>t[i],enumerable:!(r=n_(t,i))||r.enumerable});return e},s_=(e,t,n)=>(n=e==null?{}:e_(i_(e)),o_(t||!e||!e.__esModule?t_(n,`default`,{value:e,enumerable:!0}):n,e)),{entries:c_,setPrototypeOf:l_,isFrozen:u_,getPrototypeOf:d_,getOwnPropertyDescriptor:f_}=Object,{freeze:p_,seal:m_,create:h_}=Object,{apply:g_,construct:__}=typeof Reflect<`u`&&Reflect;p_||=function(e){return e},m_||=function(e){return e},g_||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},__||=function(e){return new e(...[...arguments].slice(1))};var v_=M_(Array.prototype.forEach),y_=M_(Array.prototype.lastIndexOf),b_=M_(Array.prototype.pop),x_=M_(Array.prototype.push),S_=M_(Array.prototype.splice),C_=M_(String.prototype.toLowerCase),w_=M_(String.prototype.toString),T_=M_(String.prototype.match),E_=M_(String.prototype.replace),D_=M_(String.prototype.indexOf),O_=M_(String.prototype.trim),k_=M_(Object.prototype.hasOwnProperty),A_=M_(RegExp.prototype.test),j_=N_(TypeError);function M_(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return g_(e,t,n)}}function N_(e){return function(){return __(e,[...arguments])}}function $(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:C_;l_&&l_(e,null);let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(u_(t)||(t[r]=e),i=e)}e[i]=!0}return e}function P_(e){for(let t=0;t<e.length;t++)k_(e,t)||(e[t]=null);return e}function F_(e){let t=h_(null);for(let[n,r]of c_(e))k_(e,n)&&(Array.isArray(r)?t[n]=P_(r):r&&typeof r==`object`&&r.constructor===Object?t[n]=F_(r):t[n]=r);return t}function I_(e,t){for(;e!==null;){let n=f_(e,t);if(n){if(n.get)return M_(n.get);if(typeof n.value==`function`)return M_(n.value)}e=d_(e)}function n(){return null}return n}var L_=p_(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),R_=p_(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),z_=p_([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),B_=p_([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),V_=p_(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),H_=p_([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),U_=p_([`#text`]),W_=p_(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns.slot`.split(`.`)),G_=p_(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-rendering.textlength.type.u1.u2.unicode.values.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),K_=p_(`accent.accentunder.align.bevelled.close.columnsalign.columnlines.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lspace.lquote.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),q_=p_([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),J_=m_(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Y_=m_(/<%[\w\W]*|[\w\W]*%>/gm),X_=m_(/\$\{[\w\W]*/gm),Z_=m_(/^data-[\-\w.\u00B7-\uFFFF]+$/),Q_=m_(/^aria-[\-\w]+$/),$_=m_(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ev=m_(/^(?:\w+script|data):/i),tv=m_(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),nv=m_(/^html$/i),rv=m_(/^[a-z][.\w]*(-[.\w]+)+$/i),iv=Object.freeze({__proto__:null,ARIA_ATTR:Q_,ATTR_WHITESPACE:tv,CUSTOM_ELEMENT:rv,DATA_ATTR:Z_,DOCTYPE_NAME:nv,ERB_EXPR:Y_,IS_ALLOWED_URI:$_,IS_SCRIPT_OR_DATA:ev,MUSTACHE_EXPR:J_,TMPLIT_EXPR:X_}),av={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},ov=function(){return typeof window>`u`?null:window},sv=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},cv=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function lv(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ov(),t=e=>lv(e);if(t.version=`3.3.3`,t.removed=[],!e||!e.document||e.document.nodeType!==av.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e,r=n,i=r.currentScript,{DocumentFragment:a,HTMLTemplateElement:o,Node:s,Element:c,NodeFilter:l,NamedNodeMap:u=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:d,DOMParser:f,trustedTypes:p}=e,m=c.prototype,h=I_(m,`cloneNode`),g=I_(m,`remove`),_=I_(m,`nextSibling`),v=I_(m,`childNodes`),y=I_(m,`parentNode`);if(typeof o==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let b,x=``,{implementation:S,createNodeIterator:C,createDocumentFragment:w,getElementsByTagName:T}=n,{importNode:E}=r,D=cv();t.isSupported=typeof c_==`function`&&typeof y==`function`&&S&&S.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:O,ERB_EXPR:k,TMPLIT_EXPR:A,DATA_ATTR:j,ARIA_ATTR:M,IS_SCRIPT_OR_DATA:N,ATTR_WHITESPACE:P,CUSTOM_ELEMENT:F}=iv,{IS_ALLOWED_URI:I}=iv,L=null,R=$({},[...L_,...R_,...z_,...V_,...U_]),z=null,B=$({},[...W_,...G_,...K_,...q_]),V=Object.seal(h_(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ee=null,te=null,H=Object.seal(h_(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),ne=!0,re=!0,ie=!1,ae=!0,oe=!1,se=!0,ce=!1,le=!1,ue=!1,de=!1,U=!1,fe=!1,pe=!0,me=!1,he=!0,ge=!1,_e={},ve=null,ye=$({},[`annotation-xml`,`audio`,`colgroup`,`desc`,`foreignobject`,`head`,`iframe`,`math`,`mi`,`mn`,`mo`,`ms`,`mtext`,`noembed`,`noframes`,`noscript`,`plaintext`,`script`,`style`,`svg`,`template`,`thead`,`title`,`video`,`xmp`]),be=null,xe=$({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Se=null,Ce=$({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),we=`http://www.w3.org/1998/Math/MathML`,Te=`http://www.w3.org/2000/svg`,Ee=`http://www.w3.org/1999/xhtml`,De=Ee,Oe=!1,ke=null,Ae=$({},[we,Te,Ee],w_),je=$({},[`mi`,`mo`,`mn`,`ms`,`mtext`]),Me=$({},[`annotation-xml`]),Ne=$({},[`title`,`style`,`font`,`a`,`script`]),Pe=null,Fe=[`application/xhtml+xml`,`text/html`],W=null,Ie=null,Le=n.createElement(`form`),Re=function(e){return e instanceof RegExp||e instanceof Function},ze=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Ie&&Ie===e)){if((!e||typeof e!=`object`)&&(e={}),e=F_(e),Pe=Fe.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,W=Pe===`application/xhtml+xml`?w_:C_,L=k_(e,`ALLOWED_TAGS`)?$({},e.ALLOWED_TAGS,W):R,z=k_(e,`ALLOWED_ATTR`)?$({},e.ALLOWED_ATTR,W):B,ke=k_(e,`ALLOWED_NAMESPACES`)?$({},e.ALLOWED_NAMESPACES,w_):Ae,Se=k_(e,`ADD_URI_SAFE_ATTR`)?$(F_(Ce),e.ADD_URI_SAFE_ATTR,W):Ce,be=k_(e,`ADD_DATA_URI_TAGS`)?$(F_(xe),e.ADD_DATA_URI_TAGS,W):xe,ve=k_(e,`FORBID_CONTENTS`)?$({},e.FORBID_CONTENTS,W):ye,ee=k_(e,`FORBID_TAGS`)?$({},e.FORBID_TAGS,W):F_({}),te=k_(e,`FORBID_ATTR`)?$({},e.FORBID_ATTR,W):F_({}),_e=k_(e,`USE_PROFILES`)?e.USE_PROFILES:!1,ne=e.ALLOW_ARIA_ATTR!==!1,re=e.ALLOW_DATA_ATTR!==!1,ie=e.ALLOW_UNKNOWN_PROTOCOLS||!1,ae=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,oe=e.SAFE_FOR_TEMPLATES||!1,se=e.SAFE_FOR_XML!==!1,ce=e.WHOLE_DOCUMENT||!1,de=e.RETURN_DOM||!1,U=e.RETURN_DOM_FRAGMENT||!1,fe=e.RETURN_TRUSTED_TYPE||!1,ue=e.FORCE_BODY||!1,pe=e.SANITIZE_DOM!==!1,me=e.SANITIZE_NAMED_PROPS||!1,he=e.KEEP_CONTENT!==!1,ge=e.IN_PLACE||!1,I=e.ALLOWED_URI_REGEXP||$_,De=e.NAMESPACE||Ee,je=e.MATHML_TEXT_INTEGRATION_POINTS||je,Me=e.HTML_INTEGRATION_POINTS||Me,V=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&Re(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(V.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Re(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(V.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements==`boolean`&&(V.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),oe&&(re=!1),U&&(de=!0),_e&&(L=$({},U_),z=h_(null),_e.html===!0&&($(L,L_),$(z,W_)),_e.svg===!0&&($(L,R_),$(z,G_),$(z,q_)),_e.svgFilters===!0&&($(L,z_),$(z,G_),$(z,q_)),_e.mathMl===!0&&($(L,V_),$(z,K_),$(z,q_))),k_(e,`ADD_TAGS`)||(H.tagCheck=null),k_(e,`ADD_ATTR`)||(H.attributeCheck=null),e.ADD_TAGS&&(typeof e.ADD_TAGS==`function`?H.tagCheck=e.ADD_TAGS:(L===R&&(L=F_(L)),$(L,e.ADD_TAGS,W))),e.ADD_ATTR&&(typeof e.ADD_ATTR==`function`?H.attributeCheck=e.ADD_ATTR:(z===B&&(z=F_(z)),$(z,e.ADD_ATTR,W))),e.ADD_URI_SAFE_ATTR&&$(Se,e.ADD_URI_SAFE_ATTR,W),e.FORBID_CONTENTS&&(ve===ye&&(ve=F_(ve)),$(ve,e.FORBID_CONTENTS,W)),e.ADD_FORBID_CONTENTS&&(ve===ye&&(ve=F_(ve)),$(ve,e.ADD_FORBID_CONTENTS,W)),he&&(L[`#text`]=!0),ce&&$(L,[`html`,`head`,`body`]),L.table&&($(L,[`tbody`]),delete ee.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw j_(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw j_(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);b=e.TRUSTED_TYPES_POLICY,x=b.createHTML(``)}else b===void 0&&(b=sv(p,i)),b!==null&&typeof x==`string`&&(x=b.createHTML(``));p_&&p_(e),Ie=e}},Be=$({},[...R_,...z_,...B_]),Ve=$({},[...V_,...H_]),He=function(e){let t=y(e);(!t||!t.tagName)&&(t={namespaceURI:De,tagName:`template`});let n=C_(e.tagName),r=C_(t.tagName);return ke[e.namespaceURI]?e.namespaceURI===Te?t.namespaceURI===Ee?n===`svg`:t.namespaceURI===we?n===`svg`&&(r===`annotation-xml`||je[r]):!!Be[n]:e.namespaceURI===we?t.namespaceURI===Ee?n===`math`:t.namespaceURI===Te?n===`math`&&Me[r]:!!Ve[n]:e.namespaceURI===Ee?t.namespaceURI===Te&&!Me[r]||t.namespaceURI===we&&!je[r]?!1:!Ve[n]&&(Ne[n]||!Be[n]):!!(Pe===`application/xhtml+xml`&&ke[e.namespaceURI]):!1},Ue=function(e){x_(t.removed,{element:e});try{y(e).removeChild(e)}catch{g(e)}},We=function(e,n){try{x_(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{x_(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`)if(de||U)try{Ue(n)}catch{}else try{n.setAttribute(e,``)}catch{}},Ge=function(e){let t=null,r=null;if(ue)e=`<remove></remove>`+e;else{let t=T_(e,/^[\r\n\t ]+/);r=t&&t[0]}Pe===`application/xhtml+xml`&&De===Ee&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=b?b.createHTML(e):e;if(De===Ee)try{t=new f().parseFromString(i,Pe)}catch{}if(!t||!t.documentElement){t=S.createDocument(De,`template`,null);try{t.documentElement.innerHTML=Oe?x:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),De===Ee?T.call(t,ce?`html`:`body`)[0]:ce?t.documentElement:a},Ke=function(e){return C.call(e.ownerDocument||e,e,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},qe=function(e){return e instanceof d&&(typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||!(e.attributes instanceof u)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`)},Je=function(e){return typeof s==`function`&&e instanceof s};function Ye(e,n,r){v_(e,e=>{e.call(t,n,r,Ie)})}let Xe=function(e){let n=null;if(Ye(D.beforeSanitizeElements,e,null),qe(e))return Ue(e),!0;let r=W(e.nodeName);if(Ye(D.uponSanitizeElement,e,{tagName:r,allowedTags:L}),se&&e.hasChildNodes()&&!Je(e.firstElementChild)&&A_(/<[/\w!]/g,e.innerHTML)&&A_(/<[/\w!]/g,e.textContent)||e.nodeType===av.progressingInstruction||se&&e.nodeType===av.comment&&A_(/<[/\w]/g,e.data))return Ue(e),!0;if(!(H.tagCheck instanceof Function&&H.tagCheck(r))&&(!L[r]||ee[r])){if(!ee[r]&&Qe(r)&&(V.tagNameCheck instanceof RegExp&&A_(V.tagNameCheck,r)||V.tagNameCheck instanceof Function&&V.tagNameCheck(r)))return!1;if(he&&!ve[r]){let t=y(e)||e.parentNode,n=v(e)||e.childNodes;if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=h(n[i],!0);r.__removalCount=(e.__removalCount||0)+1,t.insertBefore(r,_(e))}}}return Ue(e),!0}return e instanceof c&&!He(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&A_(/<\/no(script|embed|frames)/i,e.innerHTML)?(Ue(e),!0):(oe&&e.nodeType===av.text&&(n=e.textContent,v_([O,k,A],e=>{n=E_(n,e,` `)}),e.textContent!==n&&(x_(t.removed,{element:e.cloneNode()}),e.textContent=n)),Ye(D.afterSanitizeElements,e,null),!1)},Ze=function(e,t,r){if(te[t]||pe&&(t===`id`||t===`name`)&&(r in n||r in Le))return!1;if(!(re&&!te[t]&&A_(j,t))&&!(ne&&A_(M,t))&&!(H.attributeCheck instanceof Function&&H.attributeCheck(t,e))){if(!z[t]||te[t]){if(!(Qe(e)&&(V.tagNameCheck instanceof RegExp&&A_(V.tagNameCheck,e)||V.tagNameCheck instanceof Function&&V.tagNameCheck(e))&&(V.attributeNameCheck instanceof RegExp&&A_(V.attributeNameCheck,t)||V.attributeNameCheck instanceof Function&&V.attributeNameCheck(t,e))||t===`is`&&V.allowCustomizedBuiltInElements&&(V.tagNameCheck instanceof RegExp&&A_(V.tagNameCheck,r)||V.tagNameCheck instanceof Function&&V.tagNameCheck(r))))return!1}else if(!Se[t]&&!A_(I,E_(r,P,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&D_(r,`data:`)===0&&be[e])&&!(ie&&!A_(N,E_(r,P,``)))&&r)return!1}return!0},Qe=function(e){return e!==`annotation-xml`&&T_(e,F)},$e=function(e){Ye(D.beforeSanitizeAttributes,e,null);let{attributes:n}=e;if(!n||qe(e))return;let r={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:z,forceKeepAttr:void 0},i=n.length;for(;i--;){let{name:a,namespaceURI:o,value:s}=n[i],c=W(a),l=s,u=a===`value`?l:O_(l);if(r.attrName=c,r.attrValue=u,r.keepAttr=!0,r.forceKeepAttr=void 0,Ye(D.uponSanitizeAttribute,e,r),u=r.attrValue,me&&(c===`id`||c===`name`)&&(We(a,e),u=`user-content-`+u),se&&A_(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,u)){We(a,e);continue}if(c===`attributename`&&T_(u,`href`)){We(a,e);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){We(a,e);continue}if(!ae&&A_(/\/>/i,u)){We(a,e);continue}oe&&v_([O,k,A],e=>{u=E_(u,e,` `)});let d=W(e.nodeName);if(!Ze(d,c,u)){We(a,e);continue}if(b&&typeof p==`object`&&typeof p.getAttributeType==`function`&&!o)switch(p.getAttributeType(d,c)){case`TrustedHTML`:u=b.createHTML(u);break;case`TrustedScriptURL`:u=b.createScriptURL(u);break}if(u!==l)try{o?e.setAttributeNS(o,a,u):e.setAttribute(a,u),qe(e)?Ue(e):b_(t.removed)}catch{We(a,e)}}Ye(D.afterSanitizeAttributes,e,null)},et=function e(t){let n=null,r=Ke(t);for(Ye(D.beforeSanitizeShadowDOM,t,null);n=r.nextNode();)Ye(D.uponSanitizeShadowNode,n,null),Xe(n),$e(n),n.content instanceof a&&e(n.content);Ye(D.afterSanitizeShadowDOM,t,null)};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,o=null,c=null,l=null;if(Oe=!e,Oe&&(e=`<!-->`),typeof e!=`string`&&!Je(e))if(typeof e.toString==`function`){if(e=e.toString(),typeof e!=`string`)throw j_(`dirty is not a string, aborting`)}else throw j_(`toString is not a function`);if(!t.isSupported)return e;if(le||ze(n),t.removed=[],typeof e==`string`&&(ge=!1),ge){if(e.nodeName){let t=W(e.nodeName);if(!L[t]||ee[t])throw j_(`root node is forbidden and cannot be sanitized in-place`)}}else if(e instanceof s)i=Ge(`<!---->`),o=i.ownerDocument.importNode(e,!0),o.nodeType===av.element&&o.nodeName===`BODY`||o.nodeName===`HTML`?i=o:i.appendChild(o);else{if(!de&&!oe&&!ce&&e.indexOf(`<`)===-1)return b&&fe?b.createHTML(e):e;if(i=Ge(e),!i)return de?null:fe?x:``}i&&ue&&Ue(i.firstChild);let u=Ke(ge?e:i);for(;c=u.nextNode();)Xe(c),$e(c),c.content instanceof a&&et(c.content);if(ge)return e;if(de){if(U)for(l=w.call(i.ownerDocument);i.firstChild;)l.appendChild(i.firstChild);else l=i;return(z.shadowroot||z.shadowrootmode)&&(l=E.call(r,l,!0)),l}let d=ce?i.outerHTML:i.innerHTML;return ce&&L[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&A_(nv,i.ownerDocument.doctype.name)&&(d=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
5
+ `+d),oe&&v_([O,k,A],e=>{d=E_(d,e,` `)}),b&&fe?b.createHTML(d):d},t.setConfig=function(){ze(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}),le=!0},t.clearConfig=function(){Ie=null,le=!1},t.isValidAttribute=function(e,t,n){return Ie||ze({}),Ze(W(e),W(t),n)},t.addHook=function(e,t){typeof t==`function`&&x_(D[e],t)},t.removeHook=function(e,t){if(t!==void 0){let n=y_(D[e],t);return n===-1?void 0:S_(D[e],n,1)[0]}return b_(D[e])},t.removeHooks=function(e){D[e]=[]},t.removeAllHooks=function(){D=cv()},t}var uv=lv(),dv=Q({"node_modules/.pnpm/jsonify@0.0.1/node_modules/jsonify/lib/parse.js"(e,t){var n,r,i={'"':`"`,"\\":`\\`,"/":`/`,b:`\b`,f:`\f`,n:`
6
+ `,r:`\r`,t:` `},a;function o(e){throw{name:`SyntaxError`,message:e,at:n,text:a}}function s(e){return e&&e!==r&&o(`Expected '`+e+`' instead of '`+r+`'`),r=a.charAt(n),n+=1,r}function c(){var e,t=``;for(r===`-`&&(t=`-`,s(`-`));r>=`0`&&r<=`9`;)t+=r,s();if(r===`.`)for(t+=`.`;s()&&r>=`0`&&r<=`9`;)t+=r;if(r===`e`||r===`E`)for(t+=r,s(),(r===`-`||r===`+`)&&(t+=r,s());r>=`0`&&r<=`9`;)t+=r,s();return e=Number(t),isFinite(e)||o(`Bad number`),e}function l(){var e,t,n=``,a;if(r===`"`)for(;s();)if(r===`"`)return s(),n;else if(r===`\\`)if(s(),r===`u`){for(a=0,t=0;t<4&&(e=parseInt(s(),16),isFinite(e));t+=1)a=a*16+e;n+=String.fromCharCode(a)}else if(typeof i[r]==`string`)n+=i[r];else break;else n+=r;o(`Bad string`)}function u(){for(;r&&r<=` `;)s()}function d(){switch(r){case`t`:return s(`t`),s(`r`),s(`u`),s(`e`),!0;case`f`:return s(`f`),s(`a`),s(`l`),s(`s`),s(`e`),!1;case`n`:return s(`n`),s(`u`),s(`l`),s(`l`),null;default:o(`Unexpected '`+r+`'`)}}function f(){var e=[];if(r===`[`){if(s(`[`),u(),r===`]`)return s(`]`),e;for(;r;){if(e.push(m()),u(),r===`]`)return s(`]`),e;s(`,`),u()}}o(`Bad array`)}function p(){var e,t={};if(r===`{`){if(s(`{`),u(),r===`}`)return s(`}`),t;for(;r;){if(e=l(),u(),s(`:`),Object.prototype.hasOwnProperty.call(t,e)&&o(`Duplicate key "`+e+`"`),t[e]=m(),u(),r===`}`)return s(`}`),t;s(`,`),u()}}o(`Bad object`)}function m(){switch(u(),r){case`{`:return p();case`[`:return f();case`"`:return l();case`-`:return c();default:return r>=`0`&&r<=`9`?c():d()}}t.exports=function(e,t){var i;return a=e,n=0,r=` `,i=m(),u(),r&&o(`Syntax error`),typeof t==`function`?(function e(n,r){var i,a,o=n[r];if(o&&typeof o==`object`)for(i in m)Object.prototype.hasOwnProperty.call(o,i)&&(a=e(o,i),a===void 0?delete o[i]:o[i]=a);return t.call(n,r,o)})({"":i},``):i}}}),fv=Q({"node_modules/.pnpm/jsonify@0.0.1/node_modules/jsonify/lib/stringify.js"(e,t){var n=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,r,i,a={"\b":`\\b`," ":`\\t`,"\n":`\\n`,"\f":`\\f`,"\r":`\\r`,'"':`\\"`,"\\":`\\\\`},o;function s(e){return n.lastIndex=0,n.test(e)?`"`+e.replace(n,function(e){var t=a[e];return typeof t==`string`?t:`\\u`+(`0000`+e.charCodeAt(0).toString(16)).slice(-4)})+`"`:`"`+e+`"`}function c(e,t){var n,a,l,u,d=r,f,p=t[e];switch(p&&typeof p==`object`&&typeof p.toJSON==`function`&&(p=p.toJSON(e)),typeof o==`function`&&(p=o.call(t,e,p)),typeof p){case`string`:return s(p);case`number`:return isFinite(p)?String(p):`null`;case`boolean`:case`null`:return String(p);case`object`:if(!p)return`null`;if(r+=i,f=[],Object.prototype.toString.apply(p)===`[object Array]`){for(u=p.length,n=0;n<u;n+=1)f[n]=c(n,p)||`null`;return l=f.length===0?`[]`:r?`[
7
+ `+r+f.join(`,
8
+ `+r)+`
9
+ `+d+`]`:`[`+f.join(`,`)+`]`,r=d,l}if(o&&typeof o==`object`)for(u=o.length,n=0;n<u;n+=1)a=o[n],typeof a==`string`&&(l=c(a,p),l&&f.push(s(a)+(r?`: `:`:`)+l));else for(a in p)Object.prototype.hasOwnProperty.call(p,a)&&(l=c(a,p),l&&f.push(s(a)+(r?`: `:`:`)+l));return l=f.length===0?`{}`:r?`{
10
+ `+r+f.join(`,
11
+ `+r)+`
12
+ `+d+`}`:`{`+f.join(`,`)+`}`,r=d,l}}t.exports=function(e,t,n){var a;if(r=``,i=``,typeof n==`number`)for(a=0;a<n;a+=1)i+=` `;else typeof n==`string`&&(i=n);if(o=t,t&&typeof t!=`function`&&(typeof t!=`object`||typeof t.length!=`number`))throw Error(`JSON.stringify`);return c(``,{"":e})}}}),pv=Q({"node_modules/.pnpm/jsonify@0.0.1/node_modules/jsonify/index.js"(e){e.parse=dv(),e.stringify=fv()}}),mv=Q({"node_modules/.pnpm/isarray@2.0.5/node_modules/isarray/index.js"(e,t){var n={}.toString;t.exports=Array.isArray||function(e){return n.call(e)==`[object Array]`}}}),hv=Q({"node_modules/.pnpm/object-keys@1.1.1/node_modules/object-keys/isArguments.js"(e,t){var n=Object.prototype.toString;t.exports=function(e){var t=n.call(e),r=t===`[object Arguments]`;return r||=t!==`[object Array]`&&typeof e==`object`&&!!e&&typeof e.length==`number`&&e.length>=0&&n.call(e.callee)===`[object Function]`,r}}}),gv=Q({"node_modules/.pnpm/object-keys@1.1.1/node_modules/object-keys/implementation.js"(e,t){var n;Object.keys||(r=Object.prototype.hasOwnProperty,i=Object.prototype.toString,a=hv(),o=Object.prototype.propertyIsEnumerable,s=!o.call({toString:null},`toString`),c=o.call(function(){},`prototype`),l=[`toString`,`toLocaleString`,`valueOf`,`hasOwnProperty`,`isPrototypeOf`,`propertyIsEnumerable`,`constructor`],u=function(e){var t=e.constructor;return t&&t.prototype===e},d={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},f=(function(){if(typeof window>`u`)return!1;for(var e in window)try{if(!d[`$`+e]&&r.call(window,e)&&window[e]!==null&&typeof window[e]==`object`)try{u(window[e])}catch{return!0}}catch{return!0}return!1})(),p=function(e){if(typeof window>`u`||!f)return u(e);try{return u(e)}catch{return!1}},n=function(e){var t=typeof e==`object`&&!!e,n=i.call(e)===`[object Function]`,o=a(e),u=t&&i.call(e)===`[object String]`,d=[];if(!t&&!n&&!o)throw TypeError(`Object.keys called on a non-object`);var f=c&&n;if(u&&e.length>0&&!r.call(e,0))for(var m=0;m<e.length;++m)d.push(String(m));if(o&&e.length>0)for(var h=0;h<e.length;++h)d.push(String(h));else for(var g in e)!(f&&g===`prototype`)&&r.call(e,g)&&d.push(String(g));if(s)for(var _=p(e),v=0;v<l.length;++v)!(_&&l[v]===`constructor`)&&r.call(e,l[v])&&d.push(l[v]);return d});var r,i,a,o,s,c,l,u,d,f,p;t.exports=n}}),_v=Q({"node_modules/.pnpm/object-keys@1.1.1/node_modules/object-keys/index.js"(e,t){var n=Array.prototype.slice,r=hv(),i=Object.keys,a=i?function(e){return i(e)}:gv(),o=Object.keys;a.shim=function(){return Object.keys?(function(){var e=Object.keys(arguments);return e&&e.length===arguments.length})(1,2)||(Object.keys=function(e){return r(e)?o(n.call(e)):o(e)}):Object.keys=a,Object.keys||a},t.exports=a}}),vv=Q({"node_modules/.pnpm/es-object-atoms@1.1.1/node_modules/es-object-atoms/index.js"(e,t){t.exports=Object}}),yv=Q({"node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/index.js"(e,t){t.exports=Error}}),bv=Q({"node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/eval.js"(e,t){t.exports=EvalError}}),xv=Q({"node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/range.js"(e,t){t.exports=RangeError}}),Sv=Q({"node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/ref.js"(e,t){t.exports=ReferenceError}}),Cv=Q({"node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/syntax.js"(e,t){t.exports=SyntaxError}}),wv=Q({"node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/type.js"(e,t){t.exports=TypeError}}),Tv=Q({"node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/uri.js"(e,t){t.exports=URIError}}),Ev=Q({"node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/abs.js"(e,t){t.exports=Math.abs}}),Dv=Q({"node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/floor.js"(e,t){t.exports=Math.floor}}),Ov=Q({"node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/max.js"(e,t){t.exports=Math.max}}),kv=Q({"node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/min.js"(e,t){t.exports=Math.min}}),Av=Q({"node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/pow.js"(e,t){t.exports=Math.pow}}),jv=Q({"node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/round.js"(e,t){t.exports=Math.round}}),Mv=Q({"node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/isNaN.js"(e,t){t.exports=Number.isNaN||function(e){return e!==e}}}),Nv=Q({"node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/sign.js"(e,t){var n=Mv();t.exports=function(e){return n(e)||e===0?e:e<0?-1:1}}}),Pv=Q({"node_modules/.pnpm/gopd@1.2.0/node_modules/gopd/gOPD.js"(e,t){t.exports=Object.getOwnPropertyDescriptor}}),Fv=Q({"node_modules/.pnpm/gopd@1.2.0/node_modules/gopd/index.js"(e,t){var n=Pv();if(n)try{n([],`length`)}catch{n=null}t.exports=n}}),Iv=Q({"node_modules/.pnpm/es-define-property@1.0.1/node_modules/es-define-property/index.js"(e,t){var n=Object.defineProperty||!1;if(n)try{n({},`a`,{value:1})}catch{n=!1}t.exports=n}}),Lv=Q({"node_modules/.pnpm/has-symbols@1.1.0/node_modules/has-symbols/shams.js"(e,t){t.exports=function(){if(typeof Symbol!=`function`||typeof Object.getOwnPropertySymbols!=`function`)return!1;if(typeof Symbol.iterator==`symbol`)return!0;var e={},t=Symbol(`test`),n=Object(t);if(typeof t==`string`||Object.prototype.toString.call(t)!==`[object Symbol]`||Object.prototype.toString.call(n)!==`[object Symbol]`)return!1;var r=42;for(var i in e[t]=r,e)return!1;if(typeof Object.keys==`function`&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames==`function`&&Object.getOwnPropertyNames(e).length!==0)return!1;var a=Object.getOwnPropertySymbols(e);if(a.length!==1||a[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor==`function`){var o=Object.getOwnPropertyDescriptor(e,t);if(o.value!==r||o.enumerable!==!0)return!1}return!0}}}),Rv=Q({"node_modules/.pnpm/has-symbols@1.1.0/node_modules/has-symbols/index.js"(e,t){var n=typeof Symbol<`u`&&Symbol,r=Lv();t.exports=function(){return typeof n!=`function`||typeof Symbol!=`function`||typeof n(`foo`)!=`symbol`||typeof Symbol(`bar`)!=`symbol`?!1:r()}}}),zv=Q({"node_modules/.pnpm/get-proto@1.0.1/node_modules/get-proto/Reflect.getPrototypeOf.js"(e,t){t.exports=typeof Reflect<`u`&&Reflect.getPrototypeOf||null}}),Bv=Q({"node_modules/.pnpm/get-proto@1.0.1/node_modules/get-proto/Object.getPrototypeOf.js"(e,t){t.exports=vv().getPrototypeOf||null}}),Vv=Q({"node_modules/.pnpm/function-bind@1.1.2/node_modules/function-bind/implementation.js"(e,t){var n=`Function.prototype.bind called on incompatible `,r=Object.prototype.toString,i=Math.max,a=`[object Function]`,o=function(e,t){for(var n=[],r=0;r<e.length;r+=1)n[r]=e[r];for(var i=0;i<t.length;i+=1)n[i+e.length]=t[i];return n},s=function(e,t){for(var n=[],r=t,i=0;r<e.length;r+=1,i+=1)n[i]=e[r];return n},c=function(e,t){for(var n=``,r=0;r<e.length;r+=1)n+=e[r],r+1<e.length&&(n+=t);return n};t.exports=function(e){var t=this;if(typeof t!=`function`||r.apply(t)!==a)throw TypeError(n+t);for(var l=s(arguments,1),u,d=function(){if(this instanceof u){var n=t.apply(this,o(l,arguments));return Object(n)===n?n:this}return t.apply(e,o(l,arguments))},f=i(0,t.length-l.length),p=[],m=0;m<f;m++)p[m]=`$`+m;if(u=Function(`binder`,`return function (`+c(p,`,`)+`){ return binder.apply(this,arguments); }`)(d),t.prototype){var h=function(){};h.prototype=t.prototype,u.prototype=new h,h.prototype=null}return u}}}),Hv=Q({"node_modules/.pnpm/function-bind@1.1.2/node_modules/function-bind/index.js"(e,t){var n=Vv();t.exports=Function.prototype.bind||n}}),Uv=Q({"node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/functionCall.js"(e,t){t.exports=Function.prototype.call}}),Wv=Q({"node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/functionApply.js"(e,t){t.exports=Function.prototype.apply}}),Gv=Q({"node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/reflectApply.js"(e,t){t.exports=typeof Reflect<`u`&&Reflect&&Reflect.apply}}),Kv=Q({"node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/actualApply.js"(e,t){var n=Hv(),r=Wv(),i=Uv();t.exports=Gv()||n.call(i,r)}}),qv=Q({"node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/index.js"(e,t){var n=Hv(),r=wv(),i=Uv(),a=Kv();t.exports=function(e){if(e.length<1||typeof e[0]!=`function`)throw new r(`a function is required`);return a(n,i,e)}}}),Jv=Q({"node_modules/.pnpm/dunder-proto@1.0.1/node_modules/dunder-proto/get.js"(e,t){var n=qv(),r=Fv(),i;try{i=[].__proto__===Array.prototype}catch(e){if(!e||typeof e!=`object`||!(`code`in e)||e.code!==`ERR_PROTO_ACCESS`)throw e}var a=!!i&&r&&r(Object.prototype,`__proto__`),o=Object,s=o.getPrototypeOf;t.exports=a&&typeof a.get==`function`?n([a.get]):typeof s==`function`?(function(e){return s(e==null?e:o(e))}):!1}}),Yv=Q({"node_modules/.pnpm/get-proto@1.0.1/node_modules/get-proto/index.js"(e,t){var n=zv(),r=Bv(),i=Jv();t.exports=n?function(e){return n(e)}:r?function(e){if(!e||typeof e!=`object`&&typeof e!=`function`)throw TypeError(`getProto: not an object`);return r(e)}:i?function(e){return i(e)}:null}}),Xv=Q({"node_modules/.pnpm/hasown@2.0.2/node_modules/hasown/index.js"(e,t){var n=Function.prototype.call,r=Object.prototype.hasOwnProperty;t.exports=Hv().call(n,r)}}),Zv=Q({"node_modules/.pnpm/get-intrinsic@1.3.0/node_modules/get-intrinsic/index.js"(e,t){var n,r=vv(),i=yv(),a=bv(),o=xv(),s=Sv(),c=Cv(),l=wv(),u=Tv(),d=Ev(),f=Dv(),p=Ov(),m=kv(),h=Av(),g=jv(),_=Nv(),v=Function,y=function(e){try{return v(`"use strict"; return (`+e+`).constructor;`)()}catch{}},b=Fv(),x=Iv(),S=function(){throw new l},C=b?(function(){try{return arguments.callee,S}catch{try{return b(arguments,`callee`).get}catch{return S}}})():S,w=Rv()(),T=Yv(),E=Bv(),D=zv(),O=Wv(),k=Uv(),A={},j=typeof Uint8Array>`u`||!T?n:T(Uint8Array),M={__proto__:null,"%AggregateError%":typeof AggregateError>`u`?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>`u`?n:ArrayBuffer,"%ArrayIteratorPrototype%":w&&T?T([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":A,"%AsyncGenerator%":A,"%AsyncGeneratorFunction%":A,"%AsyncIteratorPrototype%":A,"%Atomics%":typeof Atomics>`u`?n:Atomics,"%BigInt%":typeof BigInt>`u`?n:BigInt,"%BigInt64Array%":typeof BigInt64Array>`u`?n:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>`u`?n:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>`u`?n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":i,"%eval%":eval,"%EvalError%":a,"%Float16Array%":typeof Float16Array>`u`?n:Float16Array,"%Float32Array%":typeof Float32Array>`u`?n:Float32Array,"%Float64Array%":typeof Float64Array>`u`?n:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>`u`?n:FinalizationRegistry,"%Function%":v,"%GeneratorFunction%":A,"%Int8Array%":typeof Int8Array>`u`?n:Int8Array,"%Int16Array%":typeof Int16Array>`u`?n:Int16Array,"%Int32Array%":typeof Int32Array>`u`?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":w&&T?T(T([][Symbol.iterator]())):n,"%JSON%":typeof JSON==`object`?JSON:n,"%Map%":typeof Map>`u`?n:Map,"%MapIteratorPrototype%":typeof Map>`u`||!w||!T?n:T(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":r,"%Object.getOwnPropertyDescriptor%":b,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>`u`?n:Promise,"%Proxy%":typeof Proxy>`u`?n:Proxy,"%RangeError%":o,"%ReferenceError%":s,"%Reflect%":typeof Reflect>`u`?n:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>`u`?n:Set,"%SetIteratorPrototype%":typeof Set>`u`||!w||!T?n:T(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>`u`?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":w&&T?T(``[Symbol.iterator]()):n,"%Symbol%":w?Symbol:n,"%SyntaxError%":c,"%ThrowTypeError%":C,"%TypedArray%":j,"%TypeError%":l,"%Uint8Array%":typeof Uint8Array>`u`?n:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>`u`?n:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>`u`?n:Uint16Array,"%Uint32Array%":typeof Uint32Array>`u`?n:Uint32Array,"%URIError%":u,"%WeakMap%":typeof WeakMap>`u`?n:WeakMap,"%WeakRef%":typeof WeakRef>`u`?n:WeakRef,"%WeakSet%":typeof WeakSet>`u`?n:WeakSet,"%Function.prototype.call%":k,"%Function.prototype.apply%":O,"%Object.defineProperty%":x,"%Object.getPrototypeOf%":E,"%Math.abs%":d,"%Math.floor%":f,"%Math.max%":p,"%Math.min%":m,"%Math.pow%":h,"%Math.round%":g,"%Math.sign%":_,"%Reflect.getPrototypeOf%":D};if(T)try{null.error}catch(e){N=T(T(e)),M[`%Error.prototype%`]=N}var N,P=function e(t){var n;if(t===`%AsyncFunction%`)n=y(`async function () {}`);else if(t===`%GeneratorFunction%`)n=y(`function* () {}`);else if(t===`%AsyncGeneratorFunction%`)n=y(`async function* () {}`);else if(t===`%AsyncGenerator%`){var r=e(`%AsyncGeneratorFunction%`);r&&(n=r.prototype)}else if(t===`%AsyncIteratorPrototype%`){var i=e(`%AsyncGenerator%`);i&&T&&(n=T(i.prototype))}return M[t]=n,n},F={__proto__:null,"%ArrayBufferPrototype%":[`ArrayBuffer`,`prototype`],"%ArrayPrototype%":[`Array`,`prototype`],"%ArrayProto_entries%":[`Array`,`prototype`,`entries`],"%ArrayProto_forEach%":[`Array`,`prototype`,`forEach`],"%ArrayProto_keys%":[`Array`,`prototype`,`keys`],"%ArrayProto_values%":[`Array`,`prototype`,`values`],"%AsyncFunctionPrototype%":[`AsyncFunction`,`prototype`],"%AsyncGenerator%":[`AsyncGeneratorFunction`,`prototype`],"%AsyncGeneratorPrototype%":[`AsyncGeneratorFunction`,`prototype`,`prototype`],"%BooleanPrototype%":[`Boolean`,`prototype`],"%DataViewPrototype%":[`DataView`,`prototype`],"%DatePrototype%":[`Date`,`prototype`],"%ErrorPrototype%":[`Error`,`prototype`],"%EvalErrorPrototype%":[`EvalError`,`prototype`],"%Float32ArrayPrototype%":[`Float32Array`,`prototype`],"%Float64ArrayPrototype%":[`Float64Array`,`prototype`],"%FunctionPrototype%":[`Function`,`prototype`],"%Generator%":[`GeneratorFunction`,`prototype`],"%GeneratorPrototype%":[`GeneratorFunction`,`prototype`,`prototype`],"%Int8ArrayPrototype%":[`Int8Array`,`prototype`],"%Int16ArrayPrototype%":[`Int16Array`,`prototype`],"%Int32ArrayPrototype%":[`Int32Array`,`prototype`],"%JSONParse%":[`JSON`,`parse`],"%JSONStringify%":[`JSON`,`stringify`],"%MapPrototype%":[`Map`,`prototype`],"%NumberPrototype%":[`Number`,`prototype`],"%ObjectPrototype%":[`Object`,`prototype`],"%ObjProto_toString%":[`Object`,`prototype`,`toString`],"%ObjProto_valueOf%":[`Object`,`prototype`,`valueOf`],"%PromisePrototype%":[`Promise`,`prototype`],"%PromiseProto_then%":[`Promise`,`prototype`,`then`],"%Promise_all%":[`Promise`,`all`],"%Promise_reject%":[`Promise`,`reject`],"%Promise_resolve%":[`Promise`,`resolve`],"%RangeErrorPrototype%":[`RangeError`,`prototype`],"%ReferenceErrorPrototype%":[`ReferenceError`,`prototype`],"%RegExpPrototype%":[`RegExp`,`prototype`],"%SetPrototype%":[`Set`,`prototype`],"%SharedArrayBufferPrototype%":[`SharedArrayBuffer`,`prototype`],"%StringPrototype%":[`String`,`prototype`],"%SymbolPrototype%":[`Symbol`,`prototype`],"%SyntaxErrorPrototype%":[`SyntaxError`,`prototype`],"%TypedArrayPrototype%":[`TypedArray`,`prototype`],"%TypeErrorPrototype%":[`TypeError`,`prototype`],"%Uint8ArrayPrototype%":[`Uint8Array`,`prototype`],"%Uint8ClampedArrayPrototype%":[`Uint8ClampedArray`,`prototype`],"%Uint16ArrayPrototype%":[`Uint16Array`,`prototype`],"%Uint32ArrayPrototype%":[`Uint32Array`,`prototype`],"%URIErrorPrototype%":[`URIError`,`prototype`],"%WeakMapPrototype%":[`WeakMap`,`prototype`],"%WeakSetPrototype%":[`WeakSet`,`prototype`]},I=Hv(),L=Xv(),R=I.call(k,Array.prototype.concat),z=I.call(O,Array.prototype.splice),B=I.call(k,String.prototype.replace),V=I.call(k,String.prototype.slice),ee=I.call(k,RegExp.prototype.exec),te=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,H=/\\(\\)?/g,ne=function(e){var t=V(e,0,1),n=V(e,-1);if(t===`%`&&n!==`%`)throw new c("invalid intrinsic syntax, expected closing `%`");if(n===`%`&&t!==`%`)throw new c("invalid intrinsic syntax, expected opening `%`");var r=[];return B(e,te,function(e,t,n,i){r[r.length]=n?B(i,H,`$1`):t||e}),r},re=function(e,t){var n=e,r;if(L(F,n)&&(r=F[n],n=`%`+r[0]+`%`),L(M,n)){var i=M[n];if(i===A&&(i=P(n)),i===void 0&&!t)throw new l(`intrinsic `+e+` exists, but is not available. Please file an issue!`);return{alias:r,name:n,value:i}}throw new c(`intrinsic `+e+` does not exist!`)};t.exports=function(e,t){if(typeof e!=`string`||e.length===0)throw new l(`intrinsic name must be a non-empty string`);if(arguments.length>1&&typeof t!=`boolean`)throw new l(`"allowMissing" argument must be a boolean`);if(ee(/^%?[^%]*%?$/,e)===null)throw new c("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=ne(e),r=n.length>0?n[0]:``,i=re(`%`+r+`%`,t),a=i.name,o=i.value,s=!1,u=i.alias;u&&(r=u[0],z(n,R([0,1],u)));for(var d=1,f=!0;d<n.length;d+=1){var p=n[d],m=V(p,0,1),h=V(p,-1);if((m===`"`||m===`'`||m==="`"||h===`"`||h===`'`||h==="`")&&m!==h)throw new c(`property names with quotes must have matching quotes`);if((p===`constructor`||!f)&&(s=!0),r+=`.`+p,a=`%`+r+`%`,L(M,a))o=M[a];else if(o!=null){if(!(p in o)){if(!t)throw new l(`base intrinsic for `+e+` exists, but the property is not available.`);return}if(b&&d+1>=n.length){var g=b(o,p);f=!!g,o=f&&`get`in g&&!(`originalValue`in g.get)?g.get:o[p]}else f=L(o,p),o=o[p];f&&!s&&(M[a]=o)}}return o}}}),Qv=Q({"node_modules/.pnpm/define-data-property@1.1.4/node_modules/define-data-property/index.js"(e,t){var n=Iv(),r=Cv(),i=wv(),a=Fv();t.exports=function(e,t,o){if(!e||typeof e!=`object`&&typeof e!=`function`)throw new i("`obj` must be an object or a function`");if(typeof t!=`string`&&typeof t!=`symbol`)throw new i("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!=`boolean`&&arguments[3]!==null)throw new i("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!=`boolean`&&arguments[4]!==null)throw new i("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!=`boolean`&&arguments[5]!==null)throw new i("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!=`boolean`)throw new i("`loose`, if provided, must be a boolean");var s=arguments.length>3?arguments[3]:null,c=arguments.length>4?arguments[4]:null,l=arguments.length>5?arguments[5]:null,u=arguments.length>6?arguments[6]:!1,d=!!a&&a(e,t);if(n)n(e,t,{configurable:l===null&&d?d.configurable:!l,enumerable:s===null&&d?d.enumerable:!s,value:o,writable:c===null&&d?d.writable:!c});else if(u||!s&&!c&&!l)e[t]=o;else throw new r(`This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.`)}}}),$v=Q({"node_modules/.pnpm/has-property-descriptors@1.0.2/node_modules/has-property-descriptors/index.js"(e,t){var n=Iv(),r=function(){return!!n};r.hasArrayLengthDefineBug=function(){if(!n)return null;try{return n([],`length`,{value:1}).length!==1}catch{return!0}},t.exports=r}}),ey=Q({"node_modules/.pnpm/set-function-length@1.2.2/node_modules/set-function-length/index.js"(e,t){var n=Zv(),r=Qv(),i=$v()(),a=Fv(),o=wv(),s=n(`%Math.floor%`);t.exports=function(e,t){if(typeof e!=`function`)throw new o("`fn` is not a function");if(typeof t!=`number`||t<0||t>4294967295||s(t)!==t)throw new o("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],c=!0,l=!0;if(`length`in e&&a){var u=a(e,`length`);u&&!u.configurable&&(c=!1),u&&!u.writable&&(l=!1)}return(c||l||!n)&&(i?r(e,`length`,t,!0,!0):r(e,`length`,t)),e}}}),ty=Q({"node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/applyBind.js"(e,t){var n=Hv(),r=Wv(),i=Kv();t.exports=function(){return i(n,r,arguments)}}}),ny=Q({"node_modules/.pnpm/call-bind@1.0.8/node_modules/call-bind/index.js"(e,t){var n=ey(),r=Iv(),i=qv(),a=ty();t.exports=function(e){var t=i(arguments),r=e.length-(arguments.length-1);return n(t,1+(r>0?r:0),!0)},r?r(t.exports,`apply`,{value:a}):t.exports.apply=a}}),ry=Q({"node_modules/.pnpm/call-bound@1.0.4/node_modules/call-bound/index.js"(e,t){var n=Zv(),r=qv(),i=r([n(`%String.prototype.indexOf%`)]);t.exports=function(e,t){var a=n(e,!!t);return typeof a==`function`&&i(e,`.prototype.`)>-1?r([a]):a}}}),iy=s_(Q({"node_modules/.pnpm/json-stable-stringify@1.3.0/node_modules/json-stable-stringify/index.js"(e,t){var n=(typeof JSON<`u`?JSON:pv()).stringify,r=mv(),i=_v(),a=ny(),o=ry(),s=o(`Array.prototype.join`),c=o(`Array.prototype.indexOf`),l=o(`Array.prototype.splice`),u=o(`Array.prototype.sort`),d=function(e,t){for(var n=``,r=0;r<e;r+=1)n+=t;return n},f=function(e,t,n){return n};t.exports=function(e){var t=arguments.length>1?arguments[1]:void 0,o=t&&t.space||``;typeof o==`number`&&(o=d(o,` `));var p=!!t&&typeof t.cycles==`boolean`&&t.cycles,m=t&&t.replacer?a(t.replacer):f;if(t&&t.collapseEmpty!==void 0&&typeof t.collapseEmpty!=`boolean`)throw TypeError("`collapseEmpty` must be a boolean, if provided");var h=!!t&&t.collapseEmpty,g=typeof t==`function`?t:t&&t.cmp,_=g&&function(e){var t=g.length>2&&function(t){return e[t]};return function(n,r){return g({key:n,value:e[n]},{key:r,value:e[r]},t?{__proto__:null,get:t}:void 0)}},v=[];return(function e(t,a,f,g){var y=o?`
13
+ `+d(g,o):``,b=o?`: `:`:`;if(f&&f.toJSON&&typeof f.toJSON==`function`&&(f=f.toJSON()),f=m(t,a,f),f!==void 0){if(typeof f!=`object`||!f)return n(f);var x=function(e,t){return h&&e.length===0?t:(t===`[]`?`[`:`{`)+s(e,`,`)+y+(t===`[]`?`]`:`}`)};if(r(f)){for(var S=[],C=0;C<f.length;C++){var w=e(f,C,f[C],g+1)||n(null);S[S.length]=y+o+w}return x(S,`[]`)}if(c(v,f)!==-1){if(p)return n(`__cycle__`);throw TypeError(`Converting circular structure to JSON`)}else v[v.length]=f;for(var T=u(i(f),_&&_(f)),S=[],C=0;C<T.length;C++){var a=T[C],E=e(f,a,f[a],g+1);if(E){var D=n(a)+b+E;S[S.length]=y+o+D}}return l(v,c(v,f),1),x(S,`{}`)}})({"":e},``,e,0)}}})(),1),ay=e=>localStorage.getItem(`kizen-flag-${e}`)===`true`,oy=(e=``)=>e.split(``).reduce((e,t)=>(e<<5)-e+t.charCodeAt(0)|0,0),sy=e=>{try{return oy((0,iy.default)(e))}catch(e){return ay(`script-runner-logging`)&&console.warn(`Failed to stringify object for hashing:`,e),oy(String(Math.random()))}},cy=e=>e.startsWith(`/`),ly=[`microphone`,`speaker-selection`,`autoplay`,`camera`,`display-capture`,`hid`],uy=[`allow-popups`,`allow-scripts`,`allow-same-origin`],dy=3e4,fy=100,py=class{worker;scriptUIRef;onStateChange;done;onError;waitForFrame=!1;plugin;executionPlugin;frameId;onShowToast;onClearToasts;sessionData={};setSessionData;pluginComponentId;onShowModal;onShowCreateRecordModal;onShowCreateRelatedRecordModal;onReleaseBlockingScript;pluginApiName;onNetworkError;onNetworkRequest;invalidateCache;getPendingCacheCount;createFileId;performFileUpload;pushHistory;appPath;constructor(e){this.scriptUIRef=e.scriptUIRef,this.onStateChange=e.onStateChange,this.done=e.done,this.onError=e.onError,this.onReleaseBlockingScript=e.onReleaseBlockingScript,this.worker=e.worker,this.worker.onmessage=this.handleMessage,this.plugin=e.plugin,this.executionPlugin=e.executionPlugin,this.onShowToast=e.onShowToast,this.onClearToasts=e.onClearToasts,this.pluginComponentId=e.pluginComponentId,this.onShowModal=e.onShowModal,this.onShowCreateRecordModal=e.onShowCreateRecordModal,this.onShowCreateRelatedRecordModal=e.onShowCreateRelatedRecordModal,this.onNetworkError=e.onNetworkError,this.onNetworkRequest=e.onNetworkRequest,this.invalidateCache=e.invalidateCache,this.getPendingCacheCount=e.getPendingCacheCount,this.createFileId=e.createFileId,this.performFileUpload=e.performFileUpload,this.pushHistory=e.pushHistory,this.appPath=e.appPath,this.plugin&&(this.frameId=`${Ug}-${this.plugin.plugin_api_name}-${this.plugin.api_name}`),this.pluginApiName=this.executionPlugin?.plugin_api_name??this.plugin?.plugin_api_name??``,this.pluginApiName?(this.sessionData=e.sessionData[this.pluginApiName],this.setSessionData=t=>{e.setSessionData?.(this.pluginApiName,t)}):this.setSessionData=()=>{this.onError?.({message:`Script must be associated with a plugin to use session data`})}}handleMessage=async e=>{let t=JSON.parse(e.data),{action:n}=t;switch(n){case X.QUERY_REQUEST:{let e=t;await this.handleQueryRequest(e.id,e.method,e.url,e.payload,e.options);return}case X.UI_OUTPUT:{let e=t;this.handleUIOutput(e.markup);return}case X.IFRAME_OUTPUT:{let e=t;this.handleIframeOutput(e.url,e.allow,e.sandbox,e.preserve);return}case X.POSTFORMDATA_REQUEST:{let e=t;this.handleFormPostRequest(e.id,e.url,e.payload,e.createNewTab);return}case X.UPLOADFILE_REQUEST:{let e=t;await this.handleUploadFileRequest(e.id,e.payload);return}case X.SETSTATE:{let e=t;this.onStateChange?.(e.state);return}case X.DONE:{let e=t;this.handleDone(e.preserve,e.result);return}case Z.ERROR:{let e=t;this.onError?.({message:e.error});return}case X.OPEN_WINDOW:{let e=t;this.handleOpenWindow(e.url,e.target,e.features);return}case X.COMMUNICATE:{let e=t;this.handleCommunication(e.type,e.recipient,e.args,e.params);return}case X.HIDE:{let{config:e}=t,n=!1;e.hideTrigger&&(n=!0),this.onStateChange?.({hidden:!0,triggerHidden:n});return}case X.SHOW:{let{config:e}=t,n=!1;e.showTrigger===!1&&(n=!0),this.onStateChange?.({hidden:!1,triggerHidden:n});return}case X.EXPAND:this.onStateChange?.({minimized:!1});return;case X.COLLAPSE:this.onStateChange?.({minimized:!0});return;case X.HIDE_HEADER:this.onStateChange?.({hideHeader:!0});return;case X.SHOW_HEADER:this.onStateChange?.({hideHeader:!1});return;case X.COPY_TO_CLIPBOARD:{let e=t;await this.copyToClipboard(e.text);return}case X.OPEN_CREATE_RECORD_MODAL_REQUEST:{let e=t;this.handleCreateRecordRequest(e.id,e.entityId);return}case X.OPEN_CREATE_RELATED_RECORD_MODAL_REQUEST:{let e=t;this.handleCreateRelatedRecordRequest(e.id,e.objectId,e.relatedEntityId);return}case X.SHOW_TOAST:{let e=t;this.showToast(e.message,e.toastOptions);return}case X.CLEAR_TOASTS:this.clearToasts();return;case X.REFRESH_TIMELINE:{let e=t;this.handleRefreshTimeline(e.entityId);return}case X.REFRESH_ENTITY:{let e=t;await this.handleRefreshEntity(e.entityId,e.id);return}case X.UPDATE_SESSION_DATA:{let e=t;this.handleSetSessionData(e.update);return}case X.INSTALL_THIRD_PARTY_SCRIPT_REQUEST:{let e=t;this.handleInstallThirdPartyScriptRequest(e.id,e.url,e.args);return}case X.PROMPT_REQUEST:{let e=t;this.handlePromptRequest(e.id,e.config,!1);return}case X.DYNAMIC_PROMPT_REQUEST:{let e=t;this.handlePromptRequest(e.id,e.config,!0);return}case X.RELEASE_BLOCKING_SCRIPT:this.handleReleaseBlockingScript();return;case X.AUTHORIZE:{let e=t;this.handleAuthorize(e.serviceName,e.config);return}default:return}};handleCommunication=(e,t,n,r)=>{if(e===Bg.SEND_MESSAGE_TO_FRAME){if(this.frameId){let e=document.getElementById(this.frameId);e&&e.contentWindow?.postMessage({...n?.payload??{},__kizen:{recipient:t,frameId:this.frameId}},n?.path??`*`)}}else if(e===Bg.CALL_THIRD_PARTY_SCRIPT)this.handleCallThirdPartyScript(t.type,r);else{let r=this.executionPlugin?.plugin_api_name??this.plugin?.plugin_api_name,i=new CustomEvent(`integration:${e}`,{detail:{recipient:{...t,plugin:r},args:n}});window.dispatchEvent(i)}};handleDone=(e,t)=>{this.waitForFrame||this.done(e,t)};postMessage=(e,t)=>{this.worker.postMessage(JSON.stringify({action:e,...t}))};handleSetSessionData=e=>{this.setSessionData(e)};handleQueryRequest=async(e,t,n,r,i)=>{try{let a=await this.onNetworkRequest?.(t,n,r,i);this.postMessage(Z.QUERY_RESPONSE,{data:a,id:e})}catch(t){this.onNetworkError?.(t),this.postMessage(Z.QUERY_RESPONSE,{error:t,id:e})}};handleUIOutput=e=>{if(this.scriptUIRef?.current){let t=uv.sanitize(e);this.scriptUIRef.current.innerHTML=t}};onLoad=e=>{e.iframe&&(this.waitForFrame=!1,this.handleDone(e.preserve))};handleIframeOutput=(e,t=[],n=[],r=!1)=>{if(this.scriptUIRef?.current){let i=t.filter(e=>ly.includes(e)),a=n.filter(e=>uy.includes(e));this.waitForFrame=!0;let o=document.createElement(`iframe`);o.src=e,o.allow=i.join(`; `),a.forEach(e=>{o.sandbox.add(e)}),o.style.border=`none`,o.style.width=`100%`,o.style.height=`100%`,o.onload=this.onLoad.bind(this,{iframe:o,preserve:r}),this.frameId&&(o.id=this.frameId),this.scriptUIRef.current.replaceChildren(o)}};handleCreateRecordRequest=(e,t)=>{this.onShowCreateRecordModal?.(t,t=>{this.postMessage(Z.CREATE_RECORD_RESPONSE,{id:e,data:t})})};handleCreateRelatedRecordRequest=(e,t,n)=>{this.onShowCreateRelatedRecordModal?.(t,n,t=>{this.postMessage(Z.CREATE_RELATED_RECORD_RESPONSE,{id:e,data:t})})};showToast=(e,t)=>{this.onShowToast?.({message:e,variant:t?.variant??`success`,autohide:t?.autohide??!0})};clearToasts=()=>{this.onClearToasts?.()};copyToClipboard=async e=>{try{await navigator.clipboard.writeText(e)}catch(e){this.onError?.({message:e.message})}};handleRefreshTimeline=e=>{this.invalidateCache?.(`timeline`,e)};waitForIdleState=e=>new Promise(t=>{let n=0,r=setInterval(()=>{(this.getPendingCacheCount?.(e)??0)===0?(clearInterval(r),t(!0)):(n+=1,n>Math.floor(dy/fy)&&(clearInterval(r),t(!1)))},fy)});handleRefreshEntity=async(e,t)=>{this.invalidateCache?.(`entity`,e);let n=await this.waitForIdleState(e);this.postMessage(Z.REFRESH_ENTITY_RESPONSE,{id:t,data:{success:n}})};handleFormPostRequest=(e,t,n,r)=>{let i=document.createElement(`form`);i.method=`POST`,i.action=t,r&&(i.target=`_blank`);for(let e in n){let t=document.createElement(`input`);t.type=`hidden`,t.name=e,t.value=n[e],i.appendChild(t)}document.body.appendChild(i),i.submit(),r&&document.body.removeChild(i),this.postMessage(Z.POSTFORMDATA_RESPONSE,{success:!0,id:e})};handleUploadFileRequest=async(e,t)=>{if(!this.performFileUpload){this.postMessage(Z.UPLOADFILE_RESPONSE,{error:`File upload not supported`,id:e});return}let{file:n,isPublic:r=!1,fileName:i}=t,a=await(await fetch(n)).blob(),o=new File([a],i??`upload-${new Date().toISOString()}`,{type:a.type});o.$id=this.createFileId?.()??Qg();let s=await this.performFileUpload({file:o,id:o.$id,publicFile:r,source:`field_value`,handleProgress:e=>{this.postMessage(Z.UPLOADFILE_PROGRESS,{fileId:e.id,progress:e.progress})},businessId:void 0});this.postMessage(Z.UPLOADFILE_RESPONSE,{data:s,id:e})};waitForReadyState=(e,t,n=0)=>{e||t?.(!0),e?.()?t?.(!0):n<20?setTimeout(()=>{this.waitForReadyState(e,t,n+1)},n*50):t?.(!1)};handleCallThirdPartyScript=(e,t=[])=>{if(e&&Jg[e]){let n=Jg[e],r=window[n];r?.(...t)}};handleReleaseBlockingScript=()=>this.onReleaseBlockingScript?.(this.executionPlugin);handlePromptRequest=(e,t,n=!1)=>{this.onShowModal?this.onShowModal({...t,pluginApiName:this.pluginApiName??``,dynamic:n},(t={})=>{this.postMessage(Z.PROMPT_RESPONSE,{id:e,data:t})}):this.postMessage(Z.PROMPT_RESPONSE,{id:e,data:{canceled:!0}})};handleInstallThirdPartyScriptRequest=(e,t,n={})=>{let r=qg(t);if(!r){this.postMessage(Z.INSTALL_THIRD_PARTY_SCRIPT_RESPONSE,{data:{success:!1,url:t},id:e});return}let i=Yg[r];i(n);let a=document.createElement(`script`);a.onload=()=>{this.waitForReadyState(Xg[r],n=>{this.postMessage(Z.INSTALL_THIRD_PARTY_SCRIPT_RESPONSE,{data:{success:!0,url:t,matched:n},id:e})})},a.onerror=()=>{this.postMessage(Z.INSTALL_THIRD_PARTY_SCRIPT_RESPONSE,{data:{success:!1,url:t},id:e})},a.src=t,a.setAttribute(`data-script-url`,t),document.querySelectorAll(`[data-script-url="`+t+`"]`).length>0?this.waitForReadyState(Xg[r],n=>{this.postMessage(Z.INSTALL_THIRD_PARTY_SCRIPT_RESPONSE,{data:{success:!0,url:t,reused:!0,matched:n},id:e})}):document.documentElement.firstChild?.appendChild(a)};handleOpenWindow=(e,t,n)=>{!cy(e)||t===`_blank`||!this.pushHistory?window.open(e,t,n):this.pushHistory(e)};handleAuthorize=(e,t={})=>{let n=new URLSearchParams;if(t.successRedirectPath&&n.append(`success_redirect_path`,t.successRedirectPath),t.errorRedirectPath&&n.append(`error_redirect_path`,t.errorRedirectPath),!this.appPath){this.onError?.({message:`App path is not defined.`});return}if(!this.pluginApiName){this.onError?.({message:`Plugin API name is not defined.`});return}let r=n.toString();this.handleOpenWindow(`${this.appPath}/external-integrations/business-plugin-apps/${this.pluginApiName}/services/${encodeURIComponent(e)}/authorize${r?`?${r}`:``}`,`_blank`,``)};run=(e,t,n)=>{let r=Zg();this.postMessage(X.RUN,{script:e,setup:t,args:n,sessionData:this.sessionData,pluginComponentId:this.pluginComponentId,pluginApiName:this.pluginApiName,location:r})}},my=async({scriptBody:e,user:t,teamMember:n,business:r,onError:i,onReleaseBlockingScript:a,setLoadingState:o,clientObject:s,scriptUIRef:c,onStateChange:l,workerName:u,context:d,args:f=``,plugin:p,onShowToast:m,onClearToasts:h,terminators:g,executionPlugin:_,sessionData:v,setSessionData:y,onShowModal:b,onShowCreateRecordModal:x,onShowCreateRelatedRecordModal:S,onNetworkError:C,onNetworkRequest:w,appPath:T,pushHistory:E,createFileId:D,performFileUpload:O,getPendingCacheCount:k,invalidateCache:A})=>{let j=ay(`script-runner-logging`),M;return M=u===`recordDetail`?new Worker(new URL(`/assets/recordDetail.worker-BIHPFt8Y.js`,``+import.meta.url),{type:`module`}):u===`genericPlugin`?new Worker(new URL(`/assets/generic.worker-DRXu0-5B.js`,``+import.meta.url),{type:`module`}):u===`floatingFramePlugin`?new Worker(new URL(`/assets/floatingFrame.worker-CWLtchq3.js`,``+import.meta.url),{type:`module`}):new Worker(new URL(`/assets/calendarSource.worker-C9iglnKD.js`,``+import.meta.url),{type:`module`}),new Promise(u=>{let N=oy(e),P=oy(f),F=`${p?.plugin_api_name??``}-${p?.api_name??``}-${String(N)}-${String(P)}`,I=`${p?.plugin_api_name??``}-${p?.api_name??``}`;_?.field_type?(F=`${_.plugin_api_name??``}-${_.field_type}-${String(N)}-${String(P)}`,I=`${_.plugin_api_name??``}-${_.field_type??_.script_id}`):_&&(F=`${_.plugin_api_name??``}-${_.api_name}-${String(N)}-${String(P)}`,I=`${_.plugin_api_name??``}-${_.api_name}`),g.current[F]&&(g.current[F]?.forEach(e=>{e()}),g.current[F]=[]),g.current[F]??=[],g.current[F]?.push(()=>{M.terminate()});let L=new py({worker:M,done:(e,t)=>{o(!1),e||(g.current[F]?.forEach(e=>{e()}),g.current[F]=[]),u(t)},onError:i,onReleaseBlockingScript:a,scriptUIRef:c,onStateChange:l,plugin:p,executionPlugin:_,onShowToast:m,onClearToasts:h,sessionData:v,setSessionData:y,pluginComponentId:I,onShowModal:b,onShowCreateRecordModal:x,onShowCreateRelatedRecordModal:S,onNetworkError:C,pushHistory:E,onNetworkRequest:w,appPath:T,createFileId:D,performFileUpload:O,getPendingCacheCount:k,invalidateCache:A});o(!0),L.run(e,{...d,user:t,teamMember:n,business:r,clientObject:s,appPath:T,isDebug:j},f)})},hy=(e,t)=>{let n=new Worker(new URL(`/assets/expression.worker-Cin-WNVB.js`,``+import.meta.url),{type:`module`});return new Promise(r=>{n.onmessage=e=>{let t=JSON.parse(e.data);n.terminate(),r(t.result)};let i=ay(`script-runner-logging`);n.postMessage(JSON.stringify({expression:e,args:t,isDebug:i}))})},gy=async(e,t)=>await hy(e,t),_y=async(e,t)=>await hy(e,t),vy=async(e,t)=>await hy(e,t),yy=async(e,t)=>await hy(e,t),by=e=>({key:`action__${e.api_name}`,type:`custom_object`,label:e.name,allow_multiple:!0}),xy=(e,t)=>{let n=(e.fields??[]).filter(e=>e.type!==`container`&&e.type!==`description`).map(e=>({...e,when:t?`(${t}) && (${e.when??`true`})`:e.when})),r=(e.fields??[]).filter(e=>e.type===`container`).flatMap(e=>xy(e,e.when)),i=e.actions?.filter(e=>e.hint_object_name)??[];return[...n,...r,...i.map(e=>({...by(e),match_hint:e.hint_object_name??``}))]},Sy=(e,t)=>{let n=xy(e).reduce((e,t)=>({...e,[t.key]:t}),{}),r=Object.keys(t),i={};return r.forEach(e=>{let r=t[e],a=n[e];if(a?.type){switch(a.type){case`boolean`:let t=r;if(!t)return;i[e]=t.value;return;case`custom_object`:{let t=r;if(!t)return;i[e]={objectId:t.value?.id,objectName:t.value?.objectName};return}case`field`:{let t=r;if(!t?.value)return;Array.isArray(t.value)?i[e]=t.value.map(e=>({fieldId:e.value,fieldName:e.label,objectId:t.associatedObject?.id,objectName:t.associatedObject?.name})):typeof t.value==`object`&&typeof t.associatedObject==`object`&&(i[e]={fieldId:t.value.value,fieldName:t.value.label,objectId:t.associatedObject.id,objectName:t.associatedObject.name});return}case`number`:{let t=r;if(!t)return;try{let n=Number(t.value);if(!n&&n!==0)return;i[e]=n}catch{i[e]=NaN}return}case`select`:{let t=r;if(!t)return;i[e]=t.value;return}case`text`:{let t=r?.value;if(t){i[e]=t;return}let n=a.default;n&&(i[e]=n);return}case`description`:case`container`:return}return r?.value}}),i},Cy=`integration:${Bg.RUN_FRAME_SCRIPT}`,wy=(0,G.createContext)(null),Ty=({children:e})=>{let t=(0,G.useRef)({}),n=(0,G.useCallback)(()=>{Object.keys(t.current).forEach(e=>{t.current[e]?.forEach(e=>{e()}),t.current[e]=[]})},[]);return(0,G.useEffect)(()=>()=>{n()},[n]),(0,K.jsx)(wy.Provider,{value:{terminators:t,cleanupWorkers:n},children:e})},Ey=()=>{let e=(0,G.useContext)(wy);if(!e)throw Error(`useTerminators must be used within a TerminatorsWrapper`);return e},Dy=(0,G.createContext)(null),Oy=({children:e})=>{let[t,n]=(0,G.useState)({}),r=(0,G.useCallback)((e,t)=>{n(n=>({...n,[e]:{...n[e],...t}}))},[]);return(0,K.jsx)(Dy.Provider,{value:{sessionData:t,setSessionData:r},children:e})},ky=()=>{let e=(0,G.useContext)(Dy);if(!e)throw Error(`useSessionData must be used within a SessionDataWrapper`);return e},Ay=(0,G.createContext)(null),jy=({children:e,bootstrapPlugins:t=[],userConfigs:n=[],user:r,teamMember:i,business:a,clientObject:o,appPath:s})=>{let[c,l]=(0,G.useState)(!1),[u,d]=(0,G.useState)({}),f=(0,G.useMemo)(()=>Object.values(u).some(e=>e.waitingOnRouteScript),[u]),p=(0,G.useMemo)(()=>t.reduce((e,t)=>({...e,[t.api_name]:t.id}),{}),[t]),m=(0,G.useMemo)(()=>n.reduce((e,t)=>({...e,[t.api_name]:t.config}),{}),[n]),h=(0,G.useCallback)(()=>{l(!0)},[]);return(0,K.jsx)(Ay.Provider,{value:{installedPluginAPINamesToIds:p,userConfigsByApiName:m,user:r,teamMember:i,business:a,clientObject:o,appPath:s,onInitialBootstrap:h,setRouteScriptRunState:d},children:e({waitingOnRouteScript:f,hasFinishedBootstrapping:c})})},My=()=>{let e=(0,G.useContext)(Ay);if(!e)throw Error(`useAppState must be used within an AppStateWrapper`);return e},Ny=(0,G.createContext)(null),Py=({children:e})=>{let[t,n]=(0,G.useState)({}),r=(0,G.useCallback)(e=>t=>{n(n=>({...n,[e]:t(n[e]??{indicator:`none`,hidden:!1,pending:!1})}))},[]),i=(0,G.useCallback)(e=>!e||!t[e]?{indicator:`none`,hidden:!1,pending:!1}:{...t[e]},[t]),a=(0,G.useMemo)(()=>{let e=Object.keys(t);return e.length>0&&e.some(e=>t[e]?.indicator===`block`)},[t]);return(0,K.jsx)(Ny.Provider,{value:{getRunnerStateUpdater:r,getRunnerState:i},children:e(a)})},Fy=()=>{let e=(0,G.useContext)(Ny);if(!e)throw Error(`useRunnerState must be used within a RunnerStateWrapper`);return e},Iy=(0,G.createContext)(null),Ly=({children:e,showing:t,showPrompt:n,show:r,onConfirm:i,onHide:a})=>{let[o,s]=(0,G.useState)([]),[c,l]=(0,G.useState)([]),[u,d]=(0,G.useState)([]),f=(0,G.useRef)(void 0),p=(0,G.useRef)(void 0),m=(0,G.useCallback)((e,t)=>{s(n=>[...n,{config:e,cb:t}])},[]),h=(0,G.useCallback)((e,t)=>{l(n=>[...n,{objectId:e,cb:t}])},[]),g=(0,G.useCallback)((e,t,n)=>{d(r=>[...r,{objectId:e,relatedEntityId:t,cb:n}])},[]),_=(0,G.useCallback)(e=>{c[0]?.cb(e),l(e=>e.slice(1))},[c]),v=(0,G.useCallback)(e=>{u[0]?.cb(e),d(e=>e.slice(1))},[u]);(0,G.useEffect)(()=>{o.length>0&&!t&&(f.current=o[0]?.config,p.current=o[0]?.cb,n())},[o,t,n]);let y=(0,G.useCallback)(()=>{f.current=void 0,p.current=void 0,s(e=>e.slice(1))},[]),b=(0,G.useMemo)(()=>({props:{show:r,onConfirm:e=>{i(),p.current&&p.current({canceled:!1,values:e}),y()},onHide:(e,...t)=>{a(...t),p.current&&p.current({canceled:!0,values:{},eventSource:e}),y()}},config:f.current??{}}),[i,a,r,y]);return(0,K.jsx)(Iy.Provider,{value:{modalState:b,showModal:m,showCreateRecordModal:h,showCreateRelatedRecordModal:g,onCreateRecordComplete:_,onCreateRelatedRecordComplete:v},children:e({showPluginModal:b.props.show,pluginApiName:b.config.pluginApiName??``,handleShowModal:m,handleShowCreateRecordModal:h,handleShowCreateRelatedRecordModal:g,derivedModalState:b,handleCreateRecordComplete:_,handleCreateRelatedRecordComplete:v,showCreateRecordModal:c.length>0,createRecordModalObjectId:c[0]?.objectId??``,showCreateRelatedRecordModal:u.length>0,createRelatedRecordModalObjectId:u[0]?.objectId??``,createRelatedRecordModalRelatedEntityId:u[0]?.relatedEntityId??``})})},Ry=()=>{let e=(0,G.useContext)(Iy);if(!e)throw Error(`useModals must be used within a ModalsWrapper`);return e},zy=(0,G.createContext)(null),By=({children:e,monitoringExceptionHelper:t})=>{let n=(0,G.useCallback)((e,n)=>{t(e,{extra:n})},[t]);return(0,K.jsx)(zy.Provider,{value:{sendException:n},children:e})},Vy=()=>{let e=(0,G.useContext)(zy);if(!e)throw Error(`useMonitoring must be used within an MonitoringWrapper`);return e},Hy=(0,G.createContext)(null),Uy=({children:e,onNavigate:t})=>{let n=(0,G.useCallback)(e=>{t(e,{replace:!1})},[t]),r=(0,G.useCallback)(e=>{t(e,{replace:!0})},[t]);return(0,K.jsx)(Hy.Provider,{value:{push:n,replace:r},children:e})},Wy=()=>{let e=(0,G.useContext)(Hy);if(!e)throw Error(`useHistory must be used within an HistoryWrapper`);return e},Gy=(0,G.createContext)(null),Ky=({children:e,performRequest:t,createFileId:n,performFileUpload:r,getPendingCacheCount:i,invalidateCache:a})=>(0,K.jsx)(Gy.Provider,{value:{performRequest:t,createFileId:n,performFileUpload:r,getPendingCacheCount:i,invalidateCache:a},children:e}),qy=()=>{let e=(0,G.useContext)(Gy);if(!e)throw Error(`useNetwork must be used within a NetworkWrapper`);return e},Jy=e=>e,Yy=(0,G.createContext)({t:Jy}),Xy=e=>{let{children:t,t:n=Jy}=e;return(0,K.jsx)(Yy.Provider,{value:{t:n},children:t})},Zy=()=>(0,G.useContext)(Yy),Qy=(0,G.createContext)(null),$y=({children:e,showToast:t,clearToasts:n})=>(0,K.jsx)(Qy.Provider,{value:{showToast:t,clearToasts:n},children:e}),eb=()=>{let e=(0,G.useContext)(Qy);if(!e)throw Error(`useToast must be used within a ToastWrapper`);return e},tb=({onError:e,scriptUIRef:t,plugin:n,onChangeMinimized:r})=>{let{terminators:i}=Ey(),{sessionData:a,setSessionData:o}=ky(),{installedPluginAPINamesToIds:s,userConfigsByApiName:c,user:l,teamMember:u,business:d,clientObject:f,appPath:p}=My(),{showModal:m,showCreateRecordModal:h,showCreateRelatedRecordModal:g}=Ry(),{sendException:_}=Vy(),{showToast:v,clearToasts:y}=eb(),b=Wy(),{performRequest:x,createFileId:S,performFileUpload:C,getPendingCacheCount:w,invalidateCache:T}=qy(),{t:E}=Zy(),[D,O]=(0,G.useState)(!1),[k,A]=(0,G.useState)({indicator:`none`,hidden:!0,triggerHidden:!1,hideHeader:!1}),j=(0,G.useRef)(!1),[M,N]=(0,G.useState)(!1);D&&!j.current&&(j.current=!0),!D&&j.current&&!M&&N(!0);let P=(0,G.useCallback)(t=>{e?.(t);let r=t?.message??`Unknown plugin error`;_(Error(r),{error:t,workerName:`floatingFrame`,pluginApiName:n.plugin_api_name})},[e,n,_]);return[(0,G.useCallback)((e,_)=>{let D=``;try{let e=s[n.plugin_api_name];D=JSON.stringify({..._,pluginId:e,__kizen_user_config:c[n.plugin_api_name]})}catch{P({message:E(`Arguments passed to the script are invalid`)})}return my({user:l,teamMember:u,business:d,onError:P,setLoadingState:(...e)=>{(0,Tc.flushSync)(()=>{O(...e)})},scriptBody:e,clientObject:f,scriptUIRef:t,onStateChange:e=>{let{minimized:t,...n}=e;typeof t==`boolean`&&r?.(t),A(e=>({...e,...n}))},workerName:`floatingFramePlugin`,args:D,pushHistory:b.push,plugin:n,onShowToast:v,onClearToasts:y,terminators:i,sessionData:a,setSessionData:o,onShowModal:m,onShowCreateRecordModal:h,onShowCreateRelatedRecordModal:g,appPath:p,onNetworkRequest:x,createFileId:S,performFileUpload:C,getPendingCacheCount:w,invalidateCache:T})},[l,u,d,s,f,t,b,n,r,v,y,i,a,o,P,A,c,m,h,g,x,p,S,C,w,T,E]),{...k,pending:M?!1:D}]},nb=({onError:e,scriptUIRef:t,plugin:n})=>{let{terminators:r}=Ey(),{sessionData:i,setSessionData:a}=ky(),{installedPluginAPINamesToIds:o,userConfigsByApiName:s,user:c,teamMember:l,business:u,clientObject:d,appPath:f}=My(),{getRunnerState:p,getRunnerStateUpdater:m}=Fy(),{showModal:h,showCreateRecordModal:g}=Ry(),{sendException:_}=Vy(),{showToast:v,clearToasts:y}=eb(),b=Wy(),{performRequest:x,createFileId:S,performFileUpload:C,getPendingCacheCount:w,invalidateCache:T}=qy(),{t:E}=Zy(),[D,O]=(0,G.useState)(!1),[k,A]=(0,G.useState)(void 0),j=(0,G.useCallback)((t,r)=>{e?.(t);let i=t?.message??`Unknown plugin error`;_(Error(i),{error:t,workerName:`genericPlugin`,pluginApiName:n?.plugin_api_name??r?.plugin_api_name??``})},[e,n,_]);return[(0,G.useCallback)((e,p,_)=>{let D=``,k=$g(_);A(k);try{let e=o[n?.plugin_api_name??_?.plugin_api_name??``];D=JSON.stringify({...p,pluginId:e,__kizen_user_config:s[n?.plugin_api_name??_?.plugin_api_name??``]})}catch{j({message:E(`Arguments passed to the script are invalid`)})}return my({user:c,teamMember:l,business:u,onError:j,setLoadingState:O,scriptBody:e,clientObject:d,scriptUIRef:t,onStateChange:e=>{m(k)(t=>({...t,...e}))},workerName:`genericPlugin`,args:D,pushHistory:b.push,onShowToast:v,onClearToasts:y,terminators:r,plugin:n,executionPlugin:_,sessionData:i,setSessionData:a,onShowModal:h,onShowCreateRecordModal:g,onShowCreateRelatedRecordModal:()=>{},appPath:f,onNetworkRequest:x,createFileId:S,performFileUpload:C,getPendingCacheCount:w,invalidateCache:T})},[c,l,o,u,d,t,b,v,y,r,n,i,a,j,m,s,h,g,x,f,S,C,w,T,E]),{...p(k),pending:D}]},rb=({entityId:e,objectId:t,onError:n,scriptUIRef:r,onReleaseBlockingScript:i})=>{let{terminators:a}=Ey(),{sessionData:o,setSessionData:s}=ky(),{installedPluginAPINamesToIds:c,userConfigsByApiName:l,user:u,teamMember:d,business:f,clientObject:p,appPath:m}=My(),{getRunnerState:h,getRunnerStateUpdater:g}=Fy(),{showModal:_,showCreateRecordModal:v,showCreateRelatedRecordModal:y}=Ry(),{sendException:b}=Vy(),{showToast:x,clearToasts:S}=eb(),C=Wy(),{performRequest:w,createFileId:T,performFileUpload:E,getPendingCacheCount:D,invalidateCache:O}=qy(),{t:k}=Zy(),[A,j]=(0,G.useState)(!1),[M,N]=(0,G.useState)(void 0),P=(0,G.useCallback)((r,i)=>{n?.(r);let a=r?.message??`Unknown plugin error`;b(Error(a),{error:r,workerName:`recordDetail`,pluginApiName:i?.plugin_api_name??``,objectId:t,entityId:e})},[n,t,e,b]);return[(0,G.useCallback)((n,h,b,A)=>{let M=``;try{let e=c[b?.plugin_api_name??``];M=JSON.stringify({...h,pluginId:e,__kizen_user_config:l[b?.plugin_api_name??``]})}catch{P({message:k(`Arguments passed to the script are invalid`)},b)}let F=$g(b);return N(F),my({user:u,teamMember:d,business:f,onReleaseBlockingScript:i,onError:e=>{P(e,b)},setLoadingState:j,scriptBody:n,clientObject:p,scriptUIRef:r,onStateChange:e=>{g(F)(t=>({...t,...e}))},workerName:`recordDetail`,args:M,context:A??{entityId:e,objectId:t},pushHistory:C.push,onShowToast:x,onClearToasts:S,terminators:a,executionPlugin:b,sessionData:o,setSessionData:s,onShowModal:_,onShowCreateRecordModal:v,onShowCreateRelatedRecordModal:y,appPath:m,onNetworkRequest:w,createFileId:T,performFileUpload:E,getPendingCacheCount:D,invalidateCache:O})},[u,d,c,f,e,t,p,r,C,x,S,a,o,s,_,v,y,i,P,g,l,w,m,T,E,D,O,k]),{...h(M),pending:A}]},ib=(e,t)=>{let{showToast:n}=eb(),{t:r}=Zy(),i=(0,G.useRef)(null),a=(0,G.useRef)(null),o=e?.css,s=(0,G.useMemo)(()=>{let t=e?.html;return t?uv.sanitize(t):null},[e]),c=(0,G.useMemo)(()=>e?.event_scripts??{},[e]),[l,{pending:u}]=nb({onError:e=>{n({message:`${r(`Script could not be executed:`)} ${e?.message??`Unknown Error`}`,variant:`failure`})},scriptUIRef:i,plugin:e}),d=(0,G.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),!u){let n=e.target.getAttribute(`data-script`);n&&c[n]&&l(c[n],t)}},[u,l,c,t]);return(0,G.useEffect)(()=>{let e=a.current;return e&&e.addEventListener(`click`,d),()=>{e&&e.removeEventListener(`click`,d)}},[d,e]),{scopedCss:`
14
+ @scope {
15
+ ${o??``}
16
+ }
17
+ `,sanitizedHtml:s,outputUIRef:i,interactableScriptRef:a}},ab=(e,t,n,r,i={})=>{let a=(0,G.useMemo)(()=>t?.event_scripts??{},[t]),o=(0,G.useCallback)(t=>{if(t.preventDefault(),t.stopPropagation(),!r){let n=t.target.getAttribute(`data-script`);n&&a[n]&&e(a[n],{...i})}},[r,e,a,i]);(0,G.useEffect)(()=>{let e=n?.current;return e&&e.addEventListener(`click`,o),()=>{e&&e.removeEventListener(`click`,o)}},[o,t,n])},ob=(e,t,n)=>{let r=e?.iframe_url,i=e?.script,a=e?.callback,o=e?.args,{showToast:s}=eb(),{t:c}=Zy(),l=(0,G.useRef)(null),[u,{pending:d}]=nb({onError:e=>{s({message:`${c(`Plugin error:`)} ${e?.message??``}`,variant:`failure`})},scriptUIRef:l,plugin:e}),f=(0,G.useMemo)(()=>{let e=new URLSearchParams(t);return{...Object.fromEntries(e),...o}},[t,o]),{outputUIRef:p,scopedCss:m,sanitizedHtml:h,interactableScriptRef:g}=ib(e,f);ab(u,e,l,d);let _=(0,G.useRef)(!1);(0,G.useEffect)(()=>{!r&&!_.current&&i&&!n&&(_.current=!0,u(i,f))},[r,u,i,f,n]);let v=(0,G.useCallback)(e=>{let t=e.data;if(t?.type===`kizen:plugin_callback`){let e=t.query;a&&u(a,e)}},[u,a]);return(0,G.useEffect)(()=>(window.addEventListener(`message`,v),()=>{window.removeEventListener(`message`,v)}),[v]),{scriptUIRef:l,outputUIRef:p,scopedCss:m,sanitizedHtml:h,interactableScriptRef:g,iframeURL:r,pending:d}},sb=(0,G.createContext)(null),cb=({children:e})=>{let[t,n]=(0,G.useState)([]),[r,i]=(0,G.useState)(!1),a=(0,G.useCallback)((e,t)=>{n(n=>{let r=[e,...n.filter(t=>t!==e)];return t?.(r),r})},[]),o=(0,G.useMemo)(()=>[...t].reverse().reduce((e,t,n)=>({...e,[t]:n}),{}),[t]);return(0,G.useEffect)(()=>{let e=new MutationObserver(()=>{document.querySelector(`div[role="dialog"]`)?i(!0):i(!1)});return e.observe(document.body,{childList:!0}),()=>{e.disconnect()}},[]),(0,K.jsx)(sb.Provider,{value:{touchFloatingFrame:a,floatingFrameOffset:o},children:e(r)})},lb=()=>{let e=(0,G.useContext)(sb);if(!e)throw Error(`useFloatingFrame must be used within a FloatingFrameWrapper`);return e},ub=[`^/$`,`^/login*`,`/settings/mine$`,`/settings/others$`,`/create-new-business$`,`^/choose-business*`,`^/inactive-business$`,`^/reset$`,`/welcome$`,`/embed/*`,`/create-new-business$`,`/businessbuilder`],db=[`https://js.stripe.com`],fb=(e,t,n,r)=>e<n?t<r?`top-left`:`top-right`:t<r?`bottom-left`:`bottom-right`,pb=e=>{let{currentWindow:t,pathname:n,id:r,frameHeaderSize:i,defaultPositionGap:a=0,viewportHeight:o=window.innerHeight,hiddenByModal:s,updateEmployeeConfig:c}=e,l=(0,G.useRef)(null),u=(0,G.useRef)(!1),{showToast:d}=eb(),{t:f}=Zy(),{installedPluginAPINamesToIds:p,clientObject:m}=My(),{touchFloatingFrame:h,floatingFrameOffset:g}=lb(),_=g[r]??-1,v=t.minimized_style===`none`,y=t.minimized_style===`circle`||v,b=t.default_position===`bottom-right-fixed`,x=t.default_position===`bottom-left-fixed`,S=b||x,C=t.minimized_config?.icon??`action-drag-handle`,w=t.minimized_config?.color??`blue`,T=(0,G.useMemo)(()=>{let e=n.split(`/`),t=e[1],r=e[2];if(t===`client`)return{objectId:m?.id,entityId:r};if(t===`custom-objects`)return{objectId:r,entityId:e[3]}},[m,n]),E=(0,G.useMemo)(()=>{let e=t.match,r=t.ignore;return!!(e?.length&&!e.some(e=>new RegExp(e).test(n))||ub.concat(r??[]).filter(Boolean).some(e=>{try{return new RegExp(e).test(n)}catch{return!1}}))},[t,n]),D=t.plugin_api_name?p[t.plugin_api_name]:``,[O,k]=(0,G.useState)(()=>t.employee_config?.[r]?.minimized??!1),A=t.script,j=t.type,M=t.args,N=t.message_handler,P=t.width??0,[F,I]=(0,G.useState)(()=>{let e=window.innerHeight;return Math.min(t.height??0,e-i)}),[L,R]=(0,G.useState)(null),z=t.default_position,B=(0,G.useCallback)(e=>{let n=t.employee_config?.[r]?.position;if(!n?.quadrant){let t=window.innerWidth-P,r=window.innerHeight-F-i;if(O&&!e&&(r=window.innerHeight-i),n)try{let e=n;return e.left>t&&(e.left=t),e.top>r&&(e.top=r),e.left<0&&(e.left=a),e.top<0&&(e.top=a),e}catch{}let o=t;return z===`bottom-left`&&(o=a),{left:o,top:r-a}}else if(n.quadrant===`top-left`){let e=n.deltas?.left??0,t=n.deltas?.top??0;return{...n,left:e,top:t}}else if(n.quadrant===`top-right`){let e=window.innerWidth-P-(n.deltas?.right??0),t=n.deltas?.top??0;return{...n,left:e,top:t}}else if(n.quadrant===`bottom-left`){let e=n.deltas?.left??0,t=window.innerHeight-(O?0:F)-(n.deltas?.bottom??0)-i;return{...n,left:e,top:t}}else{let e=window.innerWidth-P-(n.deltas?.right??0),t=window.innerHeight-(O?0:F)-(n.deltas?.bottom??0)-i;return{...n,left:e,top:t}}},[t,r,z,O,P,F,i,a]),V=(0,G.useCallback)(e=>{let t=B(e),n=[`bottom-right`,`bottom-left`].includes(t.quadrant??``)&&O?0:F;return t.left<0?t.left=0:t.left>window.innerWidth-P&&(t.left=window.innerWidth-P),t.top<0?t.top=0:t.top>window.innerHeight-n&&(t.top=window.innerHeight-n),t},[B,P,F,O]);(0,G.useEffect)(()=>{let e=t.height??0;if(e>o){I(o-i);let e=B(!0);e.top=0,R(e)}else I(e)},[t.height,B,o,i]);let[ee,te]=(0,G.useState)(O),[H,ne]=(0,G.useState)(O&&y),re=F*5e-4*1e3,ie=e=>{k(e),e&&y?setTimeout(()=>{ne(e)},re):y&&ne(e),s?setTimeout(()=>{te(e)},re):te(e),(L?.quadrant===`bottom-left`||L?.quadrant===`bottom-right`)&&R(e?e=>e?{...e,top:e.top+F}:null:e=>{if(!e)return null;let t=window.innerHeight,n=e.top>=0&&e.top+F<=t;return{...e,top:n?e.top:e.top-F}}),c?.(r,O,L)({minimized:e})},[ae,{pending:oe,hidden:se,indicator:ce,triggerHidden:le,hideHeader:ue}]=tb({onError:e=>{d({message:`${f(`Plugin error:`)} ${e?.message??``}`,variant:`failure`})},scriptUIRef:l,plugin:t,onChangeMinimized:e=>{ie(e)}}),de=(0,G.useMemo)(()=>ue&&S,[ue,S]),U=(0,G.useMemo)(()=>{if(!L)return`top`;let{left:e,top:t}=L;return window.innerWidth-(e+P)<40?`left`:t<40?`bottom`:`top`},[L,P]),fe=(0,G.useCallback)(()=>{let e=x?`left`:`right`,n=`${t.plugin_api_name}-${t.api_name}-trigger-${e}`;return document.getElementById(n)},[x,t]),pe=(0,G.useCallback)(()=>{if(!S)return;let e=fe();if(!e)return;let t=e.getBoundingClientRect(),n=O?0:F,r=de?0:i,o=t.top-(n+r)-a,s=x?t.left:t.right-P,c=n+r,l=Math.max(0,window.innerWidth-P),u=Math.max(0,window.innerHeight-c);s=Math.min(Math.max(0,s),l),o=Math.min(Math.max(0,o),u),R({left:s,top:o,quadrant:x?`bottom-left`:`bottom-right`,deltas:{top:o,left:s,right:window.innerWidth-(s+P),bottom:window.innerHeight-(o+c)}})},[S,x,F,O,P,de,fe,i,a]);(0,G.useEffect)(()=>{S&&pe()},[S,F,O,pe]),(0,G.useEffect)(()=>{if(!S)return;pe();let e=new ResizeObserver(()=>{pe()});return e.observe(document.body),()=>{e.disconnect()}},[S,pe]),(0,G.useEffect)(()=>{!u.current&&A&&j===`script`&&!E&&(u.current=!0,ae(A,{...M}))},[ae,A,j,M,E]),(0,G.useEffect)(()=>{let e=e=>{let n=e;if(n?.detail?.recipient?.frame===t.api_name){let e=n.detail;if(e.recipient?.plugin!==t.plugin_api_name)return;e.recipient.script&&t.event_scripts?.[e.recipient.script]&&ae(t.event_scripts[e.recipient.script]??``,{...e.args,...M,...T})}};return window.addEventListener(Cy,e),()=>{window.removeEventListener(Cy,e)}},[t,ae,M,T]);let[me,he]=(0,G.useState)(!1),ge=(e,t)=>{he(!1),h(r);let n=window.innerWidth,i=window.innerHeight;if(t.node){let e=t.node.getBoundingClientRect(),a=e.left,o=e.top,s=o+e.height,l=a+e.width,u=o,d=i-s,f=a,p=n-l,m={left:a,right:l,top:o,quadrant:fb(u,f,d,p),deltas:{top:u,bottom:d,left:f,right:p}};R(m),c?.(r,O,L)({position:m})}};(0,G.useEffect)(()=>{let e=()=>{S?pe():R(V(!1))};return window.addEventListener(`resize`,e),()=>{window.removeEventListener(`resize`,e)}},[S,pe,V]),ab(ae,t,l,oe,M),(0,G.useEffect)(()=>{let e=e=>{e.source!==window&&N&&!db.includes(e.origin)&&ae(N,{...M,eventData:e.data})};return window.addEventListener(`message`,e),()=>{window.removeEventListener(`message`,e)}},[ae,M,N]);let{outputUIRef:_e,scopedCss:ve,sanitizedHtml:ye,interactableScriptRef:be}=ib(t,{}),xe=ee?se||E||s:se||E,Se=`floating-window-parent--${r}`,Ce=`floating-drag-handle--${r}`,we=`floating-window-content--${r}`,Te=t.employee_config?.[r]?.position?.quadrant?.split(`-`)[1]===`right`?`right`:`left`;x?Te=`left`:b&&(Te=`right`);let Ee=t.minimized_config?.customIcon,De=null;return Ee?.startsWith(`data:image/`)&&(De=({className:e=``})=>(0,K.jsx)(`img`,{src:Ee,alt:t.title||`Open Frame`,className:`object-cover select-none pointer-events-none ${e}`})),L||R(V(!1)),{circleProps:{id:r,side:Te,circleIcon:C,CustomIcon:De,circleColor:w,onClick:()=>{ie(!O)},hidden:!!(xe||E||v||le)},parentProps:{className:Se,dragging:me,hidden:xe||H||E||v},draggableProps:{onStop:ge,onStart:()=>{he(!0)},bounds:`.${Se}`,handle:`.${Ce}`,defaultPosition:{x:L?.left??0,y:L?.top??0},position:{x:L?.left??0,y:L?.top??0},disabled:S},floatProps:{pending:oe,width:P,dragging:me,height:F,isCircle:y&&O},contentProps:{className:we,dragging:me,solid:!0},minimized:O,pending:oe,indicator:ce,hideHeader:de,isFixed:S,isCircle:y,outputUIRef:_e,scopedCss:ve,sanitizedHtml:ye,interactableScriptRef:be,tooltipPosition:U,currentPluginId:D,setMinimized:ie,dragHandleClassName:Ce,height:F,script:A,dragging:me,frameOffset:_,scriptUIRef:l}},mb=()=>{(0,G.useEffect)(()=>{let e=null,t=t=>{if(!t.detail?.location)return;let n=sy(t.detail.location);n!==e&&(e=n,document.querySelectorAll(`iframe[id^=${Ug}-]`).forEach(e=>{let n=null;try{n=new URL(e.src,window.location.href).origin}catch(e){ay(`script-runner-logging`)&&console.warn(`Failed to parse iframe src for location change message target origin:`,e),n=null}n&&e.contentWindow?.postMessage({action:Hg,location:t.detail?.location},n)}))};return window.addEventListener(Vg,t),()=>{window.removeEventListener(Vg,t)}},[])},hb=new pu,gb=({children:e})=>(0,G.useContext)(mu)?(0,K.jsx)(K.Fragment,{children:e}):(0,K.jsx)(gu,{client:hb,children:e}),_b=e=>{let{children:t,bootstrapPlugins:n=[],userConfigs:r=[],user:i,teamMember:a,business:o,clientObject:s,onNavigate:c,modal:l,monitoringExceptionHelper:u,showToast:d,clearToasts:f,performRequest:p,appPath:m,hideFramesOnModal:h=!0,createFileId:g,performFileUpload:_,t:v}=e;return mb(),(0,K.jsx)(gb,{children:(0,K.jsx)(jy,{bootstrapPlugins:n,userConfigs:r,user:i,teamMember:a,business:o,clientObject:s,appPath:m,children:({hasFinishedBootstrapping:e,waitingOnRouteScript:n})=>(0,K.jsx)(Xy,{t:v,children:(0,K.jsx)(Py,{children:r=>(0,K.jsx)(Uy,{onNavigate:c,children:(0,K.jsx)(Ly,{...l,children:i=>(0,K.jsx)(By,{monitoringExceptionHelper:u,children:(0,K.jsx)(Oy,{children:(0,K.jsx)(Ty,{children:(0,K.jsx)($y,{showToast:d,clearToasts:f,children:(0,K.jsx)(cb,{children:a=>(0,K.jsx)(Ky,{performRequest:p,createFileId:g,performFileUpload:_,children:t({...i,showLoadingIndicator:r,hasFinishedBootstrapping:e,waitingOnRouteScript:n,hiddenByModal:h?a:!1})})})})})})})})})})})})})},vb=(0,G.createContext)(null),yb=vb.Provider,bb=(e,t)=>{if(e===`custom_object`)return t?.id},xb=(e,t)=>{if(e.type===`custom_object`)return e.allow_multiple?(t?.value??[]).length>0:!!t?.value?.id;if(e.type===`field`)return e.allow_multiple?(t?.value??[]).length>0:!!t?.value?.value;if(e.type===`text`)return!!(t?.value??``).trim();if(e.type===`number`){let e=Number(t?.value);return!!t?.value&&!isNaN(e)}else if(e.type===`select`)return e.allow_multiple?(t?.value??[]).length>0:!!t?.value?.value;else if(e.type===`boolean`)return!!t?.value;return!1},Sb=e=>{let t=(e.fields??[]).filter(e=>e.type===`custom_object`),n=(e.fields??[]).filter(e=>e.type===`container`).flatMap(e=>Sb(e)),r=e.actions?.filter(e=>e.hint_object_name)??[];return[...t,...n,...r.map(e=>({...by(e),match_hint:e.hint_object_name??``}))]},Cb=e=>{let t=(e.fields??[]).filter(e=>e.type===`field`),n=(e.fields??[]).filter(e=>e.type===`container`).flatMap(e=>Cb(e));return[...t,...n]},wb=({children:e,config:t,value:n,onStateChange:r,disabledKeys:i,templateAssociationsByActionApiName:a,getObjectByAPIName:o,getCustomObjectDetails:s})=>{let[c,l]=(0,G.useState)(n??{}),u=(0,G.useMemo)(()=>xy(t),[t]),d=(0,G.useMemo)(()=>u.reduce((e,t)=>({...e,[t.key]:{type:t.type,value:t.default}}),{}),[u]),f=(0,G.useMemo)(()=>{let e={...Object.entries(a??{}).reduce((e,[t,n])=>{let r=`action__${t}`,i=n.map(e=>({id:e.custom_object.id??``,objectName:e.custom_object.object_name??`Unknown Object`}));return i.length>0&&n.length>0&&n[0]&&(e[r]={type:`custom_object`,value:i,config:by(n[0].browser_js_action_template)}),e},{}),...c};return i?.forEach(t=>{e[t]&&(e[t]=void 0)}),e},[c,a,i]),p=(0,G.useRef)(!!n),m=(0,G.useRef)({}),[h,g]=(0,G.useState)(!n),[_,v]=(0,G.useState)({}),[y,b]=(0,G.useState)({}),[x,S]=(0,G.useState)(!1),C=(0,G.useRef)(null),[w,T]=(0,G.useState)({}),[E,D]=(0,G.useState)(!1),[O,k]=(0,G.useState)(!0),A=(0,G.useRef)({}),j=(0,G.useCallback)((e,t)=>{A.current[e]=t},[]),M=(0,G.useCallback)(e=>{typeof e==`function`?l(t=>{let n=e(t);return m.current=n,r?.(n),n}):(m.current=e,l(e),r?.(e)),T({})},[r]),N=(0,G.useCallback)((e,t)=>{if(e.startsWith(`{{`)&&e.endsWith(`}}`)){let n=e.slice(2,-2).trim();return bb(t[n]?.type,t[n]?.value)}return e},[]),P=(0,G.useCallback)(e=>N(e,f),[f,N]),{clientObject:F}=My(),I=(0,G.useCallback)(async e=>e===`client_client`&&F?[{id:F.id,object_name:F.objectName}]:await o(e),[F,o]),L=(0,G.useCallback)(async()=>{let e=Sb(t);for(let t of e){if(!t.match_hint)continue;let e=await I(t.match_hint);if(e?.[0]){let n={id:e[0].id,objectName:e[0].object_name};M(e=>({...e,[t.key]:{type:`custom_object`,value:t.allow_multiple?[n]:n}}))}}},[t,M,I]),R=(0,G.useCallback)(()=>Cb(t),[t]),z=(0,G.useCallback)(async(e,t)=>{let n=R(),r={};for(let i of n){if(!i.object_id)continue;let n=t??N(i.object_id,m.current);if(e&&!i.object_id.includes(e))continue;if(!r[n]&&n)try{r[n]=await s(n)}catch{}let a=r[n];if(a){let e=a.fields.find(e=>e.name===i.match_hint);e&&M(t=>({...t,[i.key]:{type:`field`,value:{value:e.id,label:e.displayName},associatedObject:{id:n,name:a.objectName}}}))}}},[N,R,M,s]),B=(0,G.useCallback)(async e=>{let n=Sb(t).find(t=>t.key===e);if(n?.match_hint){let t=``,r=(await I(n.match_hint))?.[0];r&&(t=r.id,M(t=>({...t,[e]:{type:`custom_object`,value:{id:r.id,objectName:r.object_name}}})),t&&z(void 0,t))}},[t,M,z,I]),V=(0,G.useCallback)(async()=>{await L(),await z(),g(!1)},[L,z]),ee=(0,G.useCallback)(()=>Cb(t),[t]),te=(0,G.useCallback)(e=>z(e),[z]),H=(0,G.useCallback)(()=>{C.current&&=(clearTimeout(C.current),null),C.current=setTimeout(()=>{S(!0)},500)},[]),ne=(0,G.useCallback)(async(e,t)=>{H(),v(e=>({...e,[t]:!0})),D(!0);let n=await gy(e,{...d,...f});return b(e=>(e[t]===!1&&typeof n==`boolean`&&n&&(f[t]||B(t)),{...e,[t]:n})),v(e=>({...e,[t]:!1})),n},[f,H,B,d]);p.current||(p.current=!0,V());let re=(0,G.useCallback)(e=>y[e]===!1,[y]),ie=(0,G.useCallback)(e=>_[e]===!0,[_]),ae=(0,G.useCallback)(e=>{if(w[e])return{message:w[e],showMessage:!0,error:!0}},[w]),oe=(0,G.useMemo)(()=>{let e=(t.fields??[]).filter(e=>e.type===`container`).map(e=>e.when),n=u.map(e=>e.when);return[...e,...n].filter(Boolean)},[t,u]),se=(0,G.useMemo)(()=>u.reduce((e,t)=>(e[t.key]=t,e),{}),[u]),ce=(0,G.useCallback)((e,t,n)=>{t.add(e);let r=se[e];r?.dependencies?.length&&r.dependencies.forEach(e=>{n.has(e)||(n.add(e),ce(e,t,n))})},[se]),le=(0,G.useMemo)(()=>u.map(e=>{let t=new Set,n=e.dependencies??[],r=new Set;return n.forEach(e=>{ce(e,t,r)}),{...e,dependencies:Array.from(t)}}),[u,ce]),ue=(0,G.useCallback)(e=>{le.filter(t=>t.dependencies.length===0?!1:t.dependencies.includes(e)&&t.key!==e).forEach(e=>{A.current[e.key]?.()})},[le]),de=(0,G.useCallback)(async()=>{let e=(await Promise.all(u.map(async e=>e.when?await gy(e.when,{...d,...f})?e:null:e))).filter(Boolean),t=0;for(let n of e)n&&n.required&&!xb(n,f[n.key])?(T(e=>({...e,[n.key]:`This field is required`})),t++):n?.validation_pattern?new RegExp(n.validation_pattern).test(f[n.key]?.value??n.default??``)||(T(e=>({...e,[n.key]:`Value must match the pattern ${n.validation_pattern??``}`})),t++):n&&T(e=>({...e,[n.key]:void 0}));return{isValid:t===0,includedKeys:e.map(e=>e?.key).filter(e=>!!e)}},[f,u,d]);(0,G.useEffect)(()=>{H()},[H]);let U=Object.values(_).filter(Boolean).length;return!E&&oe.length===0&&D(!0),E&&O&&U===0&&k(!1),(0,K.jsx)(yb,{value:{state:f,setState:M,interpolateValue:P,getNestedFields:ee,reInferFieldsForObject:te,inferencePending:h,evaluateExpression:ne,shouldHideField:re,shouldDisableField:ie,expressionsIdle:x,getFieldErrorState:ae,validateForm:de,waitingExpressionCount:U,initialExpressionsPending:O,flattenedFields:u,flattenedFieldsByKey:se,afterFieldChange:ue,registerFieldResetter:j,disabledKeys:i??[]},children:e})},Tb=()=>{let e=(0,G.useContext)(vb);if(!e)throw Error(`useSetupAssistant must be used within a SetupAssistantController`);return e},Eb=36,Db=20,Ob=9e3,kb=({frameId:e,side:t,color:n,zIndex:r,onClick:i,CustomIcon:a})=>{let o=document.getElementById(`${e}-trigger-${t}`);return o?(0,Tc.createPortal)((0,K.jsx)(`button`,{className:`pointer-events-auto flex h-10 w-10 items-center justify-center rounded-full border border-black/10 shadow-lg`,style:{backgroundColor:n,zIndex:r},onClick:i,onPointerDown:e=>{e.stopPropagation()},title:`Open frame`,children:a?(0,K.jsx)(a,{className:`h-6 w-6 rounded-full object-cover`}):(0,K.jsx)(`span`,{className:`font-mono text-[11px] text-white`,children:`▲`})}),o):null},Ab=({frame:e,framesEnabled:t})=>{let n=`${e.plugin_api_name}-${e.api_name}`,r=id(),[i,a]=(0,G.useState)(window.innerHeight);(0,G.useEffect)(()=>{let e=new ResizeObserver(()=>{a(window.innerHeight)});return e.observe(document.body),()=>{e.disconnect()}},[]);let{circleProps:o,parentProps:s,draggableProps:c,pending:l,indicator:u,outputUIRef:d,scopedCss:f,sanitizedHtml:p,interactableScriptRef:m,hideHeader:h,setMinimized:g,dragHandleClassName:_,isFixed:v,isCircle:y,minimized:b,height:x,dragging:S,frameOffset:C,scriptUIRef:w}=pb({currentWindow:e,pathname:`/sandbox`,id:n,frameHeaderSize:Eb,defaultPositionGap:Db,viewportHeight:i,hiddenByModal:!1}),T=Ob+Math.max(0,C),E=`floating-frame-pos-${n}`,D=(()=>{try{let e=localStorage.getItem(E);return e?JSON.parse(e):null}catch{return null}})(),O=(0,G.useRef)(null),[k,A]=(0,G.useState)(D??c.position),j=(0,G.useRef)(D!==null),M=c.position;(0,G.useEffect)(()=>{j.current||A({x:M.x,y:M.y})},[M.x,M.y]);let N=(0,G.useCallback)(e=>{if(c.disabled||!e.target.closest(`.${_}`))return;e.preventDefault(),c.onStart();let t=e.clientX,n=e.clientY,r=k.x,i=k.y,a=e=>{A({x:r+e.clientX-t,y:i+e.clientY-n})},o=e=>{document.removeEventListener(`pointermove`,a),document.removeEventListener(`pointerup`,o);let s={x:r+e.clientX-t,y:i+e.clientY-n};localStorage.setItem(E,JSON.stringify(s)),j.current=!0,c.onStop(e,{node:O.current})};document.addEventListener(`pointermove`,a),document.addEventListener(`pointerup`,o)},[c,_,k,E]);return(0,K.jsxs)(K.Fragment,{children:[y&&!o.hidden&&(0,K.jsx)(kb,{frameId:n,side:o.side,color:o.circleColor,zIndex:T,onClick:o.onClick,CustomIcon:o.CustomIcon}),(0,K.jsxs)(`div`,{ref:O,className:s.className,style:{position:`fixed`,left:Math.min(k.x,window.innerWidth-r-(e.width??300)),top:k.y,width:e.width??300,zIndex:T,borderRadius:6,overflow:`hidden`,border:`1px solid rgba(0,0,0,0.1)`,boxShadow:`0 4px 20px rgba(0,0,0,0.1)`,backgroundColor:`white`,opacity:s.hidden||!t?0:1,pointerEvents:s.hidden||!t?`none`:`auto`},onPointerDown:N,children:[(l||u===`block`)&&(0,K.jsx)(`div`,{className:`absolute inset-0 z-10 flex items-center justify-center bg-white/80 font-mono text-[11px] text-neutral-400`,children:`loading…`}),!h&&(0,K.jsxs)(`div`,{className:`flex select-none items-center border-b border-black/8`,style:{height:Eb,backgroundColor:e.header_color??`#fafafa`,color:e.header_text_color??`#1a1a1a`},children:[(0,K.jsxs)(`div`,{className:`${_} flex h-full flex-1 items-center gap-2 overflow-hidden px-3 ${v?``:`cursor-grab active:cursor-grabbing`}`,children:[!v&&(0,K.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] opacity-30`,children:`⠿`}),(0,K.jsx)(`span`,{className:`truncate font-mono text-[12px] font-medium`,children:e.title})]}),(0,K.jsx)(`button`,{className:`flex h-full shrink-0 items-center px-3 font-mono text-[11px] transition-colors hover:bg-black/5`,onClick:()=>{g(!b)},onMouseDown:e=>{e.stopPropagation()},onPointerDown:e=>{e.stopPropagation()},title:b?`Expand`:`Collapse`,children:b?`↑`:`↓`})]}),(0,K.jsxs)(`div`,{style:{height:b?0:x,overflow:`hidden`,transition:`height ${String(x*5e-4)}s ease`},children:[e.type===`script`&&(0,K.jsxs)(`div`,{className:`h-full w-full`,style:{pointerEvents:S||s.hidden||!t?`none`:`auto`},children:[(0,K.jsx)(`div`,{className:`h-full w-full`,ref:w}),(0,K.jsx)(`style`,{children:f})]}),e.type===`html`&&p&&(0,K.jsxs)(`div`,{ref:m,className:`overflow-auto bg-white`,style:{height:x,pointerEvents:S||s.hidden||!t?`none`:`auto`},children:[(0,K.jsx)(`div`,{dangerouslySetInnerHTML:{__html:p}}),(0,K.jsx)(`div`,{ref:d}),(0,K.jsx)(`style`,{children:f})]})]})]})]})};function jb(e,t){let n=Object.values(e).find(e=>e.name===t);return typeof n?.value==`string`?n.value:``}function Mb(e,t){if(t){let t=jb(e.fields,`first_name`),n=jb(e.fields,`last_name`),r=jb(e.fields,`email`),i=[t,n].filter(Boolean).join(` `);return i?`${i} (${r})`:r||e.id}let n=Object.values(e.fields).find(e=>e.name===`display_name`);return typeof n?.value==`string`?n.value:e.id}var Nb=({label:e,value:t,onChange:n,onSelect:r,options:i,loading:a,placeholder:o,disabled:s})=>{let[c,l]=(0,G.useState)(!1);return(0,K.jsxs)(`div`,{className:`relative flex flex-col gap-1`,children:[e&&(0,K.jsx)(`label`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-500`,children:e}),(0,K.jsxs)(`div`,{className:`relative`,children:[(0,K.jsx)(C,{icon:x,className:`pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-[10px] text-neutral-400`}),(0,K.jsx)(`input`,{type:`text`,className:`w-full rounded border border-black/10 bg-white py-1.5 pl-7 pr-2.5 font-mono text-[12px] text-neutral-800 focus:border-neutral-400 focus:outline-none disabled:opacity-50`,value:t,placeholder:o,disabled:s,onChange:e=>{n(e.target.value)},onFocus:()=>{l(!0)},onBlur:()=>{l(!1)}})]}),c&&(0,K.jsxs)(`ul`,{className:`absolute left-0 top-full z-10 mt-1 max-h-48 w-full overflow-auto rounded border border-black/10 bg-white shadow-lg`,children:[a&&(0,K.jsx)(`li`,{className:`px-3 py-2 text-[12px] text-neutral-400`,children:`Loading…`}),!a&&i.length===0&&t.length===0&&(0,K.jsx)(`li`,{className:`px-3 py-2 text-[12px] text-neutral-400`,children:`Start typing to search…`}),!a&&i.length===0&&t.length>0&&(0,K.jsx)(`li`,{className:`px-3 py-2 text-[12px] text-neutral-400`,children:`No results`}),!a&&i.map(e=>(0,K.jsx)(`li`,{className:`cursor-pointer px-3 py-2 text-[12px] text-neutral-800 hover:bg-neutral-100`,onMouseDown:e=>{e.preventDefault()},onClick:()=>{r(e.id,e.label),l(!1)},children:e.label},e.id))]})]})},Pb=({action:e,objectId:t,entityId:n,pluginApiName:r,configArgs:i,disabled:a})=>{let[o,{pending:s}]=rb({objectId:t,entityId:n,onError:t=>{console.error(`[js-action] ${e.api_name}:`,t)}}),c={id:e.api_name,api_name:e.api_name,plugin_api_name:r};return(0,K.jsxs)(`button`,{onClick:()=>{o(e.script,i,c)},disabled:a===!0||s,className:`relative flex flex-col items-start rounded border border-black/8 bg-white px-3 py-1.5 text-left transition-colors hover:bg-black/5 disabled:opacity-50`,children:[(0,K.jsx)(`span`,{className:`font-mono text-[12px] text-neutral-800`,children:e.name}),e.hint_object_name&&(0,K.jsxs)(`span`,{className:`font-mono text-[10px] text-neutral-400`,children:[`for: `,e.hint_object_name]}),s&&(0,K.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-center rounded bg-white/70`,children:(0,K.jsx)(C,{icon:d,spin:!0,className:`text-[11px] text-neutral-400`})})]})},Fb=({actions:e,pluginApiName:t,configArgs:n})=>{let r=Ru(),{apiKey:i,businessId:a}=Fu(),o=od(),[s,c]=(0,G.useState)(()=>{try{let e=localStorage.getItem(`kizen-sandbox:${t}:selectedObject`);return e?JSON.parse(e):null}catch{return null}}),[l,u]=(0,G.useState)(()=>s?.name??``),[d,f]=(0,G.useState)(``),[p,m]=(0,G.useState)(()=>{try{let e=localStorage.getItem(`kizen-sandbox:${t}:selectedEntity`);return e?JSON.parse(e):null}catch{return null}}),[h,g]=(0,G.useState)(()=>p?.label??``),[_,v]=(0,G.useState)(``),y=(0,G.useRef)(null);(0,G.useEffect)(()=>(y.current&&clearTimeout(y.current),y.current=setTimeout(()=>{f(l)},300),()=>{y.current&&clearTimeout(y.current)}),[l]);let b=(0,G.useRef)(null);(0,G.useEffect)(()=>(b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{v(h)},300),()=>{b.current&&clearTimeout(b.current)}),[h]),(0,G.useEffect)(()=>{s?localStorage.setItem(`kizen-sandbox:${t}:selectedObject`,JSON.stringify(s)):localStorage.removeItem(`kizen-sandbox:${t}:selectedObject`)},[s,t]),(0,G.useEffect)(()=>{p?localStorage.setItem(`kizen-sandbox:${t}:selectedEntity`,JSON.stringify(p)):localStorage.removeItem(`kizen-sandbox:${t}:selectedEntity`)},[p,t]);let x=Au({queryKey:[`custom-objects`,a,d],queryFn:async()=>{let e=new URLSearchParams({page_size:`20`});return d&&e.set(`search`,d),await(await r(`/custom-objects?${e.toString()}`)).json()},enabled:i!==``&&d.length>=1,staleTime:3e4}),S=Au({queryKey:[`entity-records`,s?.id,_],queryFn:async()=>{let e=new URLSearchParams({page_size:`20`});return _&&e.set(`search`,_),await(await r(`/records/${s?.id??``}/search?${e.toString()}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:`{}`})).json()},enabled:i!==``&&s!==null,staleTime:3e4}),C=(()=>{let e=x.data?.results.map(e=>({id:e.id,label:e.object_name}))??[],t=o?.business?.client_object;return t?.access&&(!d||t.object_name.toLowerCase().includes(d.toLowerCase()))&&e.unshift({id:t.id,label:t.object_name}),e})(),w=s?.id===o?.business?.client_object?.id,T=S.data?.results.map(e=>({id:e.id,label:Mb(e,w??!1)}))??[];if(!i)return(0,K.jsx)(`p`,{className:`mt-1 text-[12px] text-neutral-400`,children:`Configure API credentials in Dev Tools to use JS action templates.`});let E=s!==null&&p!==null;return(0,K.jsxs)(`div`,{className:`flex flex-col gap-3 p-2`,children:[(0,K.jsxs)(`div`,{className:`flex gap-3`,children:[(0,K.jsx)(`div`,{className:`flex-1`,children:(0,K.jsx)(Nb,{label:`Custom Object`,value:l,onChange:e=>{u(e),s&&(c(null),m(null),g(``))},onSelect:(e,t)=>{c({id:e,name:t}),u(t),m(null),g(``)},options:C,loading:x.isFetching,placeholder:`Search custom objects…`})}),(0,K.jsx)(`div`,{className:`flex-1`,children:(0,K.jsx)(Nb,{label:`Entity`,value:h,onChange:e=>{g(e),p&&m(null)},onSelect:(e,t)=>{m({id:e,label:t}),g(t)},options:T,loading:S.isFetching,placeholder:`Search entities…`,disabled:s===null})})]}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.map(e=>(0,K.jsx)(Pb,{action:e,objectId:s?.id??``,entityId:p?.id??``,pluginApiName:t,configArgs:n,disabled:!E},e.api_name))},E?`${s.id}-${p.id}`:`no-selection`)]})},Ib=({adornment:e,objectId:t,entityId:n,pluginApiName:r,fieldValue:i,configArgs:a,disabled:o})=>{let[s,{pending:c}]=rb({objectId:t,entityId:n,onError:t=>{console.error(`[data-adornment] ${e.field_type}:`,t)}}),l={id:e.config.tooltip||e.field_type,api_name:e.field_type,plugin_api_name:r};return(0,K.jsxs)(`button`,{onClick:()=>{let r={value:i,fieldId:``,fieldType:e.field_type,objectId:t,entityId:n,...a};s(e.script,r,l)},disabled:o===!0||c,className:`relative flex flex-col items-start rounded border border-black/8 bg-white px-3 py-1.5 text-left transition-colors hover:bg-black/5 disabled:opacity-50`,children:[(0,K.jsxs)(`span`,{className:`flex items-center gap-1.5 font-mono text-[12px] text-neutral-800`,children:[e.config.color&&(0,K.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full`,style:{backgroundColor:e.config.color}}),e.config.tooltip||e.field_type]}),(0,K.jsx)(`span`,{className:`font-mono text-[10px] text-neutral-400`,children:e.field_type}),c&&(0,K.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-center rounded bg-white/70`,children:(0,K.jsx)(C,{icon:d,spin:!0,className:`text-[11px] text-neutral-400`})})]})},Lb=({adornments:e,pluginApiName:t,configArgs:n})=>{let r=Ru(),{apiKey:i,businessId:a}=Fu(),o=od(),[s,c]=(0,G.useState)(()=>{try{let e=localStorage.getItem(`kizen-sandbox:${t}:selectedObject`);return e?JSON.parse(e):null}catch{return null}}),[l,u]=(0,G.useState)(()=>s?.name??``),[d,f]=(0,G.useState)(``),[p,m]=(0,G.useState)(()=>{try{let e=localStorage.getItem(`kizen-sandbox:${t}:selectedEntity`);return e?JSON.parse(e):null}catch{return null}}),[h,g]=(0,G.useState)(()=>p?.label??``),[_,v]=(0,G.useState)(``),[y,b]=(0,G.useState)({}),x=(0,G.useRef)(null);(0,G.useEffect)(()=>(x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{f(l)},300),()=>{x.current&&clearTimeout(x.current)}),[l]);let S=(0,G.useRef)(null);(0,G.useEffect)(()=>(S.current&&clearTimeout(S.current),S.current=setTimeout(()=>{v(h)},300),()=>{S.current&&clearTimeout(S.current)}),[h]),(0,G.useEffect)(()=>{s?localStorage.setItem(`kizen-sandbox:${t}:selectedObject`,JSON.stringify(s)):localStorage.removeItem(`kizen-sandbox:${t}:selectedObject`)},[s,t]),(0,G.useEffect)(()=>{p?localStorage.setItem(`kizen-sandbox:${t}:selectedEntity`,JSON.stringify(p)):localStorage.removeItem(`kizen-sandbox:${t}:selectedEntity`)},[p,t]);let C=Au({queryKey:[`custom-objects`,a,d],queryFn:async()=>{let e=new URLSearchParams({page_size:`20`});return d&&e.set(`search`,d),await(await r(`/custom-objects?${e.toString()}`)).json()},enabled:i!==``&&d.length>=1,staleTime:3e4}),w=Au({queryKey:[`entity-records`,s?.id,_],queryFn:async()=>{let e=new URLSearchParams({page_size:`20`});return _&&e.set(`search`,_),await(await r(`/records/${s?.id??``}/search?${e.toString()}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:`{}`})).json()},enabled:i!==``&&s!==null,staleTime:3e4}),T=(()=>{let e=C.data?.results.map(e=>({id:e.id,label:e.object_name}))??[],t=o?.business?.client_object;return t?.access&&(!d||t.object_name.toLowerCase().includes(d.toLowerCase()))&&e.unshift({id:t.id,label:t.object_name}),e})(),E=w.data?.results.map(e=>{let t=Object.values(e.fields).find(e=>e.name===`display_name`)?.value,n=typeof t==`string`?t:e.id;return{id:e.id,label:n}})??[];if(!i)return(0,K.jsx)(`p`,{className:`mt-1 text-[12px] text-neutral-400`,children:`Configure API credentials in Dev Tools to use data adornments.`});let D=s!==null&&p!==null,O=e.reduce((e,t)=>{let n=t.field_type;return e[n]??=[],e[n].push(t),e},{});return(0,K.jsxs)(`div`,{className:`flex flex-col gap-3 p-2`,children:[(0,K.jsxs)(`div`,{className:`flex gap-3`,children:[(0,K.jsx)(`div`,{className:`flex-1`,children:(0,K.jsx)(Nb,{label:`Custom Object`,value:l,onChange:e=>{u(e),s&&(c(null),m(null),g(``))},onSelect:(e,t)=>{c({id:e,name:t}),u(t),m(null),g(``)},options:T,loading:C.isFetching,placeholder:`Search custom objects…`})}),(0,K.jsx)(`div`,{className:`flex-1`,children:(0,K.jsx)(Nb,{label:`Entity`,value:h,onChange:e=>{g(e),p&&m(null)},onSelect:(e,t)=>{m({id:e,label:t}),g(t)},options:E,loading:w.isFetching,placeholder:`Search entities…`,disabled:s===null})})]}),(0,K.jsx)(`div`,{className:`flex flex-col gap-3`,children:Object.entries(O).map(([e,r])=>(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:e}),(0,K.jsx)(`input`,{type:`text`,className:`w-full rounded border border-black/10 bg-white px-2.5 py-1.5 font-mono text-[12px] text-neutral-800 focus:border-neutral-400 focus:outline-none`,placeholder:`${e} value…`,value:y[e]??``,onChange:t=>{b(n=>({...n,[e]:t.target.value}))}}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:r.map((r,i)=>(0,K.jsx)(Ib,{adornment:r,objectId:s?.id??``,entityId:p?.id??``,pluginApiName:t,fieldValue:y[e]??``,configArgs:n,disabled:!D},i))})]},e))},D?`${s.id}-${p.id}`:`no-selection`)]})},Rb=({page:e,isActive:t})=>{let{scriptUIRef:n,outputUIRef:r,scopedCss:i,sanitizedHtml:a,interactableScriptRef:o,iframeURL:s,pending:c}=ob(e);return(0,K.jsxs)(`div`,{style:{display:t?`block`:`none`},className:`relative h-full w-full`,children:[c&&(0,K.jsx)(`div`,{className:`absolute inset-0 z-10 flex items-center justify-center bg-white/80 font-mono text-[11px] text-neutral-400`,children:`loading…`}),e.type===`script`&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{ref:n,className:`h-full w-full p-3`}),(0,K.jsx)(`style`,{children:i})]}),e.type===`html`&&(0,K.jsxs)(`div`,{ref:o,className:`overflow-auto p-3`,children:[a&&(0,K.jsx)(`div`,{dangerouslySetInnerHTML:{__html:a}}),(0,K.jsx)(`div`,{ref:r}),(0,K.jsx)(`style`,{children:i})]}),e.type===`iframe`&&s&&(0,K.jsx)(`iframe`,{src:s,className:`h-full w-full border-0`,title:e.name})]})},zb=`integration:route-change`;function Bb(e,t){return e.find(e=>e.api_name===t||t.endsWith(`${e.plugin_api_name}/${e.api_name}`))}function Vb(e){try{let t=new URL(e);return t.hostname===``?t.pathname.split(`/`).filter(Boolean).pop()??e:t.hostname}catch{return e.split(`/`).filter(Boolean).pop()??e}}var Hb=(0,G.forwardRef)(({pages:e},t)=>{let[n,r]=(0,G.useState)(`home`),[i,a]=(0,G.useState)({entries:[``],index:0}),[o,s]=(0,G.useState)([]),[c,l]=(0,G.useState)({}),u=(0,G.useRef)(0),d=i.entries[i.index]??``,f=n===`home`?d:n,p=(0,G.useRef)(!0);(0,G.useEffect)(()=>{if(p.current){p.current=!1;return}let e=`/${f}`;window.dispatchEvent(new CustomEvent(zb,{detail:{location:{host:window.location.host,origin:window.location.origin,port:window.location.port,protocol:window.location.protocol,pathname:e,search:``,hash:``,href:`${window.location.origin}${e}`}}}))},[f]);let m=n===`home`&&i.index>0,h=n===`home`&&i.index<i.entries.length-1,g=(0,G.useCallback)((t,n)=>{let i=t.replace(/^\/+/,``),o=Bb(e,i);o?(r(o.api_name),l(e=>({...e,[o.api_name]:(e[o.api_name]??0)+1}))):(r(`home`),a(e=>{if(!n?.replace&&e.entries[e.index]===i)return e;if(n?.replace){let t=[...e.entries];return t[e.index]=i,{entries:t,index:e.index}}let t=[...e.entries.slice(0,e.index+1),i];return{entries:t,index:t.length-1}}))},[e]),_=(0,G.useCallback)(t=>{let n=Bb(e,t.replace(/^\/+/,``));if(n){r(n.api_name),l(e=>({...e,[n.api_name]:(e[n.api_name]??0)+1}));return}u.current+=1;let i=`__tab_${String(u.current)}`;s(e=>[...e,{id:i,url:t,title:Vb(t)}]),r(i)},[e]),v=(0,G.useCallback)(e=>{s(t=>t.filter(t=>t.id!==e)),n===e&&r(`home`)},[n]);(0,G.useImperativeHandle)(t,()=>({navigate:g,openNewTab:_}),[g,_]);let y=o.find(e=>e.id===n)??null;return(0,K.jsxs)(`div`,{className:`mt-1.5 overflow-hidden rounded border border-black/10 bg-white`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-black/8 bg-neutral-50 px-3 py-1.5`,children:[(0,K.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[(0,K.jsx)(`div`,{className:`h-3 w-3 rounded-full bg-red-400/60`}),(0,K.jsx)(`div`,{className:`h-3 w-3 rounded-full bg-yellow-400/60`}),(0,K.jsx)(`div`,{className:`h-3 w-3 rounded-full bg-green-400/60`})]}),(0,K.jsx)(`button`,{onClick:()=>{a(e=>({...e,index:e.index-1}))},disabled:!m,className:`px-0.5 font-mono text-[15px] leading-none transition-colors ${m?`text-neutral-600 hover:text-neutral-900`:`cursor-default text-neutral-300`}`,children:`‹`}),(0,K.jsx)(`button`,{onClick:()=>{a(e=>({...e,index:e.index+1}))},disabled:!h,className:`px-0.5 font-mono text-[15px] leading-none transition-colors ${h?`text-neutral-600 hover:text-neutral-900`:`cursor-default text-neutral-300`}`,children:`›`}),(0,K.jsx)(`div`,{className:`min-w-0 flex-1 truncate rounded border border-black/8 bg-white px-2 py-0.5 font-mono text-[11px] text-neutral-400`,children:y?y.url:`app://sandbox/${f}`})]}),(0,K.jsxs)(`div`,{className:`flex border-b border-black/8 bg-neutral-50`,children:[(0,K.jsx)(`button`,{onClick:()=>{r(`home`)},className:`border-r border-black/8 px-3 py-1.5 font-mono text-[11px] transition-colors ${n===`home`?`bg-white font-medium text-neutral-900`:`text-neutral-500 hover:bg-black/5`}`,children:`home`}),e.map(e=>(0,K.jsxs)(`button`,{onClick:()=>{r(e.api_name)},className:`border-r border-black/8 px-3 py-1.5 font-mono text-[11px] transition-colors ${n===e.api_name?`bg-white font-medium text-neutral-900`:`text-neutral-500 hover:bg-black/5`}`,children:[e.toolbar_icon&&(Ig[e.toolbar_icon]?(0,K.jsx)(C,{icon:Ig[e.toolbar_icon],className:`mr-1 text-[10px] text-neutral-400`}):(0,K.jsx)(`span`,{className:`mr-1 rounded px-1 font-mono text-[9px] ${Lg.has(e.toolbar_icon)||Fg.has(e.toolbar_icon)?`bg-neutral-100 text-neutral-400`:`bg-amber-100 text-amber-600`}`,children:e.toolbar_icon})),e.name]},e.api_name)),o.map(e=>(0,K.jsxs)(`div`,{className:`flex items-center border-r border-black/8 ${n===e.id?`bg-white`:`hover:bg-black/5`}`,children:[(0,K.jsx)(`button`,{onClick:()=>{r(e.id)},className:`py-1.5 pl-3 pr-1 font-mono text-[11px] transition-colors ${n===e.id?`font-medium text-neutral-900`:`text-neutral-500`}`,children:e.title}),(0,K.jsx)(`button`,{onClick:()=>{v(e.id)},className:`px-1.5 py-1.5 font-mono text-[11px] text-neutral-300 transition-colors hover:text-neutral-600`,children:`×`})]},e.id))]}),(0,K.jsxs)(`div`,{className:`min-h-[600px]`,children:[n===`home`&&d===``&&(0,K.jsxs)(`div`,{className:`flex flex-col gap-2 p-6 font-mono text-[11px]`,children:[(0,K.jsx)(`div`,{className:`text-neutral-400`,children:`app://sandbox/`}),(0,K.jsx)(`div`,{className:`mt-1 text-[13px] font-medium text-neutral-700`,children:`App Homepage`}),(0,K.jsx)(`div`,{className:`text-neutral-400`,children:`This is the index page of your app. Navigate to a routable page using the tabs above.`})]}),n===`home`&&d!==``&&(0,K.jsxs)(`div`,{className:`flex flex-col gap-2 p-6 font-mono text-[11px]`,children:[(0,K.jsxs)(`div`,{className:`text-neutral-400`,children:[`app://sandbox/`,d]}),(0,K.jsx)(`div`,{className:`mt-1 text-[13px] font-medium text-neutral-500`,children:`Page not found`}),(0,K.jsxs)(`div`,{className:`text-neutral-400`,children:[`No routable page with api_name`,` `,(0,K.jsx)(`code`,{className:`rounded bg-neutral-100 px-1`,children:d}),` is defined in this plugin.`]})]}),e.map(e=>(0,K.jsx)(Rb,{page:e,isActive:n===e.api_name},`${e.api_name}-${String(c[e.api_name]??0)}`)),o.map(e=>(0,K.jsx)(`div`,{style:{display:n===e.id?`block`:`none`},className:`h-full w-full`,children:/^https?:\/\//i.test(e.url)?(0,K.jsx)(`iframe`,{src:e.url,className:`h-full w-full border-0`,title:e.title}):(0,K.jsxs)(`div`,{className:`flex flex-col gap-2 p-6 font-mono text-[11px]`,children:[(0,K.jsx)(`div`,{className:`text-neutral-400`,children:e.url}),(0,K.jsx)(`div`,{className:`mt-1 text-[13px] font-medium text-neutral-500`,children:`Page not found`}),(0,K.jsxs)(`div`,{className:`text-neutral-400`,children:[`No routable page with path`,` `,(0,K.jsx)(`code`,{className:`rounded bg-neutral-100 px-1`,children:e.url}),` is defined in this plugin.`]})]})},e.id))]})]})});Hb.displayName=`RoutablePageBrowser`;var Ub=({item:e})=>{let[t,{pending:n}]=nb({onError:t=>{console.error(`[toolbar] ${e.api_name}:`,t)},plugin:e});return(0,K.jsxs)(`button`,{onClick:()=>void t(e.script,e.args),disabled:n,className:`relative flex items-center gap-1.5 rounded border border-black/8 bg-white px-3 py-1.5 font-mono text-[12px] text-neutral-800 transition-colors hover:bg-black/5 disabled:opacity-50`,children:[e.color&&(0,K.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full`,style:{backgroundColor:e.color}}),e.icon&&(Ig[e.icon]?(0,K.jsx)(C,{icon:Ig[e.icon],className:`text-[12px] text-neutral-500`}):(0,K.jsx)(`span`,{className:`rounded px-1 font-mono text-[10px] ${Lg.has(e.icon)||Fg.has(e.icon)?`bg-neutral-100 text-neutral-400`:`bg-amber-100 text-amber-600`}`,children:e.icon})),(0,K.jsx)(`span`,{children:e.label}),n&&(0,K.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-center rounded bg-white/70`,children:(0,K.jsx)(C,{icon:d,spin:!0,className:`text-[11px] text-neutral-400`})})]})},Wb=({item:e,objectId:t,pluginApiName:n,configArgs:r,disabled:i})=>{let[a,{pending:o}]=rb({objectId:t,entityId:``,onError:t=>{console.error(`[object-settings] ${e.api_name}:`,t)}}),s={id:e.api_name,api_name:e.api_name,plugin_api_name:n};return(0,K.jsxs)(`button`,{onClick:()=>{a(e.script,r,s)},disabled:i===!0||o,className:`relative flex flex-col items-start rounded border border-black/8 bg-white px-3 py-1.5 text-left transition-colors hover:bg-black/5 disabled:opacity-50`,children:[(0,K.jsx)(`span`,{className:`font-mono text-[12px] text-neutral-800`,children:e.label}),e.when&&(0,K.jsxs)(`span`,{className:`font-mono text-[10px] text-neutral-400`,children:[`when: `,e.when]}),o&&(0,K.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-center rounded bg-white/70`,children:(0,K.jsx)(C,{icon:d,spin:!0,className:`text-[11px] text-neutral-400`})})]})},Gb=({items:e,pluginApiName:t,configArgs:n})=>{let r=Ru(),{apiKey:i,businessId:a}=Fu(),o=od(),s=`kizen-sandbox:${t}:objectSettings:selectedObject`,[c,l]=(0,G.useState)(()=>{try{let e=localStorage.getItem(s);return e?JSON.parse(e):null}catch{return null}}),[u,d]=(0,G.useState)(()=>c?.name??``),[f,p]=(0,G.useState)(``),m=(0,G.useRef)(null);(0,G.useEffect)(()=>(m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{p(u)},300),()=>{m.current&&clearTimeout(m.current)}),[u]),(0,G.useEffect)(()=>{c?localStorage.setItem(s,JSON.stringify(c)):localStorage.removeItem(s)},[c,s]);let h=Au({queryKey:[`custom-objects`,a,f],queryFn:async()=>{let e=new URLSearchParams({page_size:`20`});return f&&e.set(`search`,f),await(await r(`/custom-objects?${e.toString()}`)).json()},enabled:i!==``&&f.length>=1,staleTime:3e4}),g=(()=>{let e=h.data?.results.map(e=>({id:e.id,label:e.object_name}))??[],t=o?.business?.client_object;return t?.access&&(!f||t.object_name.toLowerCase().includes(f.toLowerCase()))&&e.unshift({id:t.id,label:t.object_name}),e})();return i?(0,K.jsxs)(`div`,{className:`flex flex-col gap-3 p-2`,children:[(0,K.jsx)(`div`,{className:`w-64`,children:(0,K.jsx)(Nb,{label:`Custom Object`,value:u,onChange:e=>{d(e),c&&l(null)},onSelect:(e,t)=>{l({id:e,name:t}),d(t)},options:g,loading:h.isFetching,placeholder:`Search custom objects…`})}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.map(e=>(0,K.jsx)(Wb,{item:e,objectId:c?.id??``,pluginApiName:t,configArgs:n,disabled:c===null},e.api_name))},c?.id??`no-selection`)]}):(0,K.jsx)(`p`,{className:`mt-1 text-[12px] text-neutral-400`,children:`Configure API credentials in Dev Tools to use object settings menu items.`})},Kb=`h-8 rounded border border-black/10 bg-white px-2.5 font-mono text-[12px] text-neutral-800 focus:border-neutral-400 focus:outline-none w-full`,qb=`block text-[11px] font-semibold uppercase tracking-widest text-neutral-500 mb-1`,Jb=e=>e===`GET`?`bg-green-50 text-green-700`:e===`DELETE`?`bg-red-50 text-red-700`:e===`POST`?`bg-blue-50 text-blue-700`:`bg-amber-50 text-amber-700`;function Yb(e,t){try{let n=localStorage.getItem(`kizen-sandbox:${e}:service:${t}:requestHistory`);return n?JSON.parse(n):[]}catch{return[]}}function Xb(e,t,n,r){let i=n.path===``||n.path.startsWith(`/`)?n.path:`/${n.path}`,a=`${n.method}:${i}`,o=r.filter(e=>`${e.method}:${e.path}`!==a),s=[{...n,path:i,id:String(Date.now())},...o].slice(0,10);try{localStorage.setItem(`kizen-sandbox:${e}:service:${t}:requestHistory`,JSON.stringify(s))}catch{}return s}var Zb=({response:e})=>{let{status:t,elapsedMs:n,contentType:r,body:i}=e,a=t===0?`bg-neutral-100 text-neutral-500`:t<300?`bg-green-50 text-green-700`:t<400?`bg-yellow-50 text-yellow-700`:`bg-red-50 text-red-700`,o=i;if(r.includes(`application/json`))try{o=JSON.stringify(JSON.parse(i),null,2)}catch{}return(0,K.jsxs)(`div`,{className:`mt-3 flex flex-col gap-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`rounded px-2 py-0.5 text-[11px] font-semibold ${a}`,children:t===0?`Error`:t}),n>0&&(0,K.jsxs)(`span`,{className:`rounded bg-neutral-100 px-2 py-0.5 text-[11px] text-neutral-500`,children:[n,`ms`]})]}),(0,K.jsx)(`pre`,{className:`max-h-72 overflow-auto rounded border border-black/5 bg-neutral-50 p-3 font-mono text-[11px] leading-relaxed text-neutral-700 whitespace-pre-wrap break-all`,children:o||`(empty response)`})]})},Qb=({headers:e,onChange:t})=>{let n=()=>{t([...e,{id:String(Date.now()),key:``,value:``}])},r=n=>{t(e.filter(e=>e.id!==n))},i=(n,r,i)=>{t(e.map(e=>e.id===n?{...e,[r]:i}:e))};return(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(`label`,{className:qb,children:`Custom Headers`}),e.length>0&&(0,K.jsx)(`div`,{className:`grid grid-cols-[1fr_1fr_auto] gap-1 mb-1`,children:e.map(e=>(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`input`,{className:Kb,placeholder:`Header name`,value:e.key,onChange:t=>{i(e.id,`key`,t.target.value)}},`${e.id}-key`),(0,K.jsx)(`input`,{className:Kb,placeholder:`Value`,value:e.value,onChange:t=>{i(e.id,`value`,t.target.value)}},`${e.id}-val`),(0,K.jsx)(`button`,{type:`button`,className:`px-1.5 text-neutral-400 hover:text-red-500`,onClick:()=>{r(e.id)},children:(0,K.jsx)(C,{icon:o,className:`text-[11px]`})},`${e.id}-rm`)]}))}),(0,K.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1 text-[11px] text-neutral-400 hover:text-neutral-700 self-start`,onClick:n,children:[(0,K.jsx)(C,{icon:l,className:`text-[10px]`}),`Add header`]})]})},$b=({service:e,pluginApiName:t})=>{let n=Ru(),{environment:r}=Fu(),i=Iu[r],[a,o]=(0,G.useState)(`GET`),[s,l]=(0,G.useState)(``),[u,p]=(0,G.useState)([]),[m,h]=(0,G.useState)(``),[g,_]=(0,G.useState)(!1),[v,y]=(0,G.useState)(null),[b,x]=(0,G.useState)(()=>Yb(t,e.service_name)),[S,w]=(0,G.useState)(!1),T=(0,G.useRef)(null);(0,G.useEffect)(()=>{if(!S)return;let e=e=>{T.current&&!T.current.contains(e.target)&&w(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[S]);let E=[`POST`,`PUT`,`PATCH`].includes(a),D=s===``||s.startsWith(`/`)?s:`/${s}`,O=`/external-integrations/proxy/${t}/${e.service_name}${D||`/`}`,k=`${i}${O}`,A=e=>{o(e.method),l(e.path),p(e.headers),h(e.body),w(!1)},j=()=>{localStorage.removeItem(`kizen-sandbox:${t}:service:${e.service_name}:requestHistory`),x([]),w(!1)},M=async()=>{if(!g){x(Xb(t,e.service_name,{method:a,path:s,headers:u,body:m},b)),_(!0),y(null);try{let e=Object.fromEntries(u.filter(e=>e.key.trim()).map(e=>[e.key.trim(),e.value])),t=performance.now(),r=await n(O,{method:a,headers:{...E&&m.trim()?{"Content-Type":`application/json`}:{},...e},...E&&m.trim()?{body:m}:{}}),i=Math.round(performance.now()-t),o=r.headers.get(`content-type`)??``,s=await r.text();y({status:r.status,elapsedMs:i,contentType:o,body:s})}catch(e){y({status:0,elapsedMs:0,contentType:``,body:String(e)})}finally{_(!1)}}};return(0,K.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-1 shrink-0`,children:[(0,K.jsx)(`label`,{className:qb,children:`Method`}),(0,K.jsx)(`select`,{className:`h-8 w-28 rounded border border-black/10 bg-white px-2 font-mono text-[12px] text-neutral-800 focus:border-neutral-400 focus:outline-none`,value:a,onChange:e=>{o(e.target.value)},children:[`GET`,`POST`,`PUT`,`PATCH`,`DELETE`].map(e=>(0,K.jsx)(`option`,{value:e,children:e},e))})]}),(0,K.jsxs)(`div`,{className:`relative flex flex-col gap-1 flex-1 min-w-0`,ref:T,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsx)(`label`,{className:qb,children:`Path`}),b.length>0&&(0,K.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1 text-[11px] text-neutral-400 hover:text-neutral-700`,onClick:()=>{w(e=>!e)},title:`Request history`,children:[(0,K.jsx)(C,{icon:f,className:`text-[10px]`}),(0,K.jsx)(`span`,{children:b.length})]})]}),(0,K.jsx)(`input`,{className:Kb,placeholder:`/path/to/endpoint`,value:s,onChange:e=>{l(e.target.value)},onKeyDown:e=>{e.key===`Enter`&&M()}}),(0,K.jsx)(`span`,{className:`font-mono text-[10px] text-neutral-400 truncate`,children:k}),S&&b.length>0&&(0,K.jsxs)(`div`,{className:`absolute left-0 top-full z-10 mt-1 w-full rounded border border-black/10 bg-white shadow-lg`,children:[(0,K.jsx)(`ul`,{className:`max-h-48 overflow-auto`,children:b.map(e=>(0,K.jsx)(`li`,{children:(0,K.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 px-3 py-1.5 text-left hover:bg-neutral-50`,onMouseDown:e=>{e.preventDefault()},onClick:()=>{A(e)},children:[(0,K.jsx)(`span`,{className:`shrink-0 rounded px-1.5 py-0.5 font-mono text-[10px] font-semibold ${Jb(e.method)}`,children:e.method}),(0,K.jsx)(`span`,{className:`flex-1 truncate font-mono text-[11px] text-neutral-700`,children:e.path||`/`}),e.headers.filter(e=>e.key.trim()).length>0&&(0,K.jsxs)(`span`,{className:`shrink-0 text-[10px] text-neutral-400`,children:[e.headers.filter(e=>e.key.trim()).length,`h`]}),e.body.trim()&&(0,K.jsx)(`span`,{className:`shrink-0 text-[10px] text-neutral-400`,children:`body`})]})},e.id))}),(0,K.jsx)(`div`,{className:`border-t border-black/5 px-3 py-1.5 text-right`,children:(0,K.jsx)(`button`,{type:`button`,className:`text-[11px] text-neutral-400 hover:text-neutral-700`,onClick:j,children:`clear history`})})]})]}),(0,K.jsxs)(`div`,{className:`flex flex-col gap-1 shrink-0`,children:[(0,K.jsx)(`span`,{className:`invisible ${qb}`,children:`\xA0`}),(0,K.jsxs)(`button`,{type:`button`,disabled:g,className:`h-8 flex items-center gap-1.5 rounded bg-neutral-800 px-3 text-[12px] font-medium text-white hover:bg-neutral-700 disabled:opacity-50`,onClick:()=>{M()},children:[g?(0,K.jsx)(C,{icon:d,className:`animate-spin text-[11px]`}):(0,K.jsx)(C,{icon:c,className:`text-[11px]`}),`Send`]})]})]}),(0,K.jsx)(Qb,{headers:u,onChange:p}),E&&(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(`label`,{className:qb,children:`Request Body`}),(0,K.jsx)(`textarea`,{className:`rounded border border-black/10 bg-white px-2.5 py-1.5 font-mono text-[12px] text-neutral-800 focus:border-neutral-400 focus:outline-none w-full resize-y`,rows:5,placeholder:`{"key": "value"}`,value:m,onChange:e=>{h(e.target.value)}})]}),v!==null&&(0,K.jsx)(Zb,{response:v})]})},ex=e=>e===`oauth`?`rounded bg-blue-50 px-1.5 py-0.5 text-[11px] font-mono text-blue-700`:e===`no_auth`?`rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-mono text-neutral-500`:`rounded bg-amber-50 px-1.5 py-0.5 text-[11px] font-mono text-amber-700`,tx=({label:e,children:t})=>(0,K.jsxs)(`div`,{className:`flex items-baseline gap-2 text-[12px]`,children:[(0,K.jsx)(`span`,{className:`w-28 shrink-0 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:e}),t]}),nx=({service:e})=>(0,K.jsxs)(`div`,{className:`flex flex-col gap-1.5 pb-4 mb-4 border-b border-black/5`,children:[(0,K.jsxs)(tx,{label:`Name`,children:[(0,K.jsx)(`span`,{className:`text-neutral-800 font-medium`,children:e.display_name}),(0,K.jsx)(`span`,{className:`rounded bg-neutral-100 px-1.5 py-0.5 font-mono text-[11px] text-neutral-500`,children:e.service_name})]}),(0,K.jsxs)(tx,{label:`Auth`,children:[(0,K.jsx)(`span`,{className:ex(e.auth_type),children:e.auth_type}),e.auth_level&&(0,K.jsx)(`span`,{className:`text-[11px] text-neutral-400`,children:e.auth_level})]}),(0,K.jsx)(tx,{label:`Base URL`,children:(0,K.jsx)(`span`,{className:`font-mono text-[11px] text-neutral-600 break-all`,children:e.base_service_url||(0,K.jsx)(`em`,{className:`text-neutral-400`,children:`none`})})}),e.auth_credentials?.scopes&&(0,K.jsx)(tx,{label:`Scopes`,children:(0,K.jsx)(`span`,{className:`font-mono text-[11px] text-neutral-600 break-all leading-relaxed`,children:e.auth_credentials.scopes})}),e.auth_credentials?.authorize_url&&(0,K.jsx)(tx,{label:`Auth URL`,children:(0,K.jsx)(`span`,{className:`font-mono text-[11px] text-neutral-600 break-all`,children:e.auth_credentials.authorize_url})}),e.required_entitlement?(0,K.jsx)(tx,{label:`Entitlement`,children:(0,K.jsx)(`span`,{className:`font-mono text-[11px] text-neutral-500`,children:e.required_entitlement})}):null]}),rx=({services:e,pluginApiName:t})=>{let n=e.map(e=>e),[r,i]=(0,G.useState)(0),a=n[r]??n[0];return a?(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`strong`,{className:`text-xs`,children:`Services`}),(0,K.jsxs)(Y,{className:`mt-2 !p-0 overflow-hidden`,children:[(0,K.jsx)(`div`,{className:`flex border-b border-black/10 overflow-x-auto`,children:n.map((e,t)=>(0,K.jsx)(`button`,{type:`button`,onClick:()=>{i(t)},className:`shrink-0 px-4 py-2.5 text-[12px] font-medium border-b-2 transition-colors ${t===r?`border-neutral-800 text-neutral-900`:`border-transparent text-neutral-400 hover:text-neutral-700`}`,children:e.display_name},e.service_name))}),(0,K.jsxs)(`div`,{className:`p-5 flex flex-col gap-4`,children:[(0,K.jsx)(nx,{service:a}),(0,K.jsx)($b,{service:a,pluginApiName:t},a.service_name)]})]})]}):null},ix=e=>e.id??e.key??``,ax=(e,t)=>{let n={},r=e=>{let i=ix(e);if(i)if(e.type===`text`)n[i]={value:t[i]??e.defaultValue??``};else if(e.type===`number`){let r=t[i];n[i]={value:r!==void 0&&r!==``?Number(r):e.default??null}}else if(e.type===`boolean`){let r=t[i];n[i]={value:r===void 0?!!e.default:!!r}}else if(e.type===`select`){let r=t[i]??``;n[i]={value:e.options?.find(e=>e.value===r)??(r?{value:r,label:r}:null)}}else if(e.type===`dropdown`){let r=t[i]??e.defaultValue??``;n[i]={value:e.options?.find(e=>e.value===r)??(r?{value:r,label:r}:null)}}else e.type===`container`&&e.fields?.forEach(r)};return e.forEach(r),n},ox=({label:e,required:t,tooltip:n})=>(0,K.jsxs)(`span`,{className:`flex items-center gap-1 text-[11px] font-medium text-neutral-500`,children:[e,t&&(0,K.jsx)(`span`,{className:`text-red-500`,children:`*`}),n&&(0,K.jsx)(`span`,{className:`cursor-help rounded-full border border-neutral-300 px-1 text-[10px] text-neutral-400`,title:n,children:`i`})]}),sx=({block:e,values:t,onChange:n})=>{let r=ix(e);return e.type===`description`?(0,K.jsx)(`p`,{className:`m-0 text-[13px] text-neutral-700`,children:e.content}):e.type===`spacer`?(0,K.jsx)(`div`,{style:{height:e.height??8}}):e.type===`text`?(0,K.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(ox,{label:e.label,required:e.required,tooltip:e.tooltip}),(0,K.jsx)(`input`,{type:`text`,value:t[r]??e.defaultValue??``,placeholder:e.placeholder,onChange:e=>{n(r,e.target.value)},className:`rounded border border-black/10 px-2 py-1.5 font-mono text-[12px] focus:outline-none focus:ring-1 focus:ring-neutral-400`})]}):e.type===`number`?(0,K.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(ox,{label:e.label,required:e.required,tooltip:e.tooltip}),(0,K.jsx)(`input`,{type:`number`,value:t[r]??``,placeholder:e.placeholder,onChange:e=>{n(r,e.target.value)},className:`rounded border border-black/10 px-2 py-1.5 font-mono text-[12px] focus:outline-none focus:ring-1 focus:ring-neutral-400`})]}):e.type===`boolean`?(0,K.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:t[r]===void 0?!!e.default:!!t[r],onChange:e=>{n(r,e.target.checked)},className:`h-3.5 w-3.5 rounded border-black/20 accent-neutral-800`}),(0,K.jsxs)(`span`,{className:`flex items-center gap-1 text-[12px] text-neutral-700`,children:[e.label,e.required&&(0,K.jsx)(`span`,{className:`text-red-500`,children:`*`}),e.tooltip&&(0,K.jsx)(`span`,{className:`cursor-help rounded-full border border-neutral-300 px-1 text-[10px] text-neutral-400`,title:e.tooltip,children:`i`})]})]}):e.type===`select`||e.type===`dropdown`?(0,K.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(ox,{label:e.label,required:e.required,tooltip:e.tooltip}),(0,K.jsxs)(`select`,{value:t[r]??e.defaultValue??``,onChange:e=>{n(r,e.target.value)},className:`rounded border border-black/10 bg-white px-2 py-1.5 font-mono text-[12px] focus:outline-none`,children:[(e.placeholder!=null||!e.required)&&(0,K.jsx)(`option`,{value:``,children:e.placeholder??`—`}),(e.options??[]).map(e=>(0,K.jsx)(`option`,{value:e.value,children:e.label},e.value))]})]}):e.type===`container`?(0,K.jsx)(`div`,{className:`flex flex-wrap gap-3`,children:(e.fields??[]).map(e=>(0,K.jsx)(`div`,{style:{width:e.widthPercent===50?`calc(50% - 6px)`:`100%`},children:(0,K.jsx)(sx,{block:e,values:t,onChange:n})},ix(e)||e.type))}):null},cx={small:`max-w-sm`,medium:`max-w-md`,large:`max-w-2xl`},lx=({show:e,config:t,onConfirm:n,onHide:r})=>{let i=t,a=i.content??[],[o,s]=(0,G.useState)({}),c=(0,G.useCallback)((e,t)=>{s(n=>({...n,[e]:t}))},[]),l=()=>{let e=ax(a,o);s({}),n(e)},u=e=>{s({}),r(e)};if(!e)return null;let d=t.confirmButton?.label??`Confirm`,f=t.cancelButton?.label??`Cancel`;return(0,K.jsx)(`div`,{role:`dialog`,className:`fixed inset-0 z-[99999] flex items-start justify-center overflow-y-auto bg-black/30 px-4 py-12`,onClick:()=>{u(`close`)},children:(0,K.jsxs)(`div`,{className:`w-full ${cx[i.size??`medium`]??cx.medium??``} rounded-lg border border-black/10 bg-white font-mono shadow-xl`,onClick:e=>{e.stopPropagation()},children:[t.title&&(0,K.jsx)(`div`,{className:`border-b border-black/8 px-5 py-3`,children:(0,K.jsx)(`span`,{className:`text-[13px] font-semibold text-neutral-900`,children:t.title})}),a.length>0&&(0,K.jsx)(`div`,{className:`max-h-[60vh] space-y-3 overflow-y-auto px-5 py-4`,children:a.map((e,t)=>(0,K.jsx)(sx,{block:e,values:o,onChange:c},ix(e)||`${e.type}-${String(t)}`))}),(0,K.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-black/8 px-5 py-3`,children:[(0,K.jsx)(`button`,{onClick:()=>{u(`button`)},className:`rounded border border-black/10 px-3 py-1.5 text-[12px] text-neutral-600 transition-colors hover:bg-black/5`,children:f}),(0,K.jsx)(`button`,{onClick:l,className:`rounded bg-neutral-900 px-3 py-1.5 text-[12px] text-white transition-colors hover:bg-neutral-700`,children:d})]})]})})},ux=`kizen-plugin-config:`;function dx(e){return`${ux}${e}`}function fx(e){try{let t=localStorage.getItem(dx(e));return t?JSON.parse(t):null}catch{return null}}function px(e,t,n){let r={__kizen_setup_assistant_values:t,__kizen_clean_config:Sy(n,t)};localStorage.setItem(dx(e),JSON.stringify(r))}function mx(e,t){let n={__kizen_setup_assistant_values:{},__kizen_clean_config:t};localStorage.setItem(dx(e),JSON.stringify(n))}function hx(e){localStorage.removeItem(dx(e))}var gx=56,_x=({showingToast:e,browserRef:t})=>{let{apiName:n}=xc({strict:!1}),r=id(),[i,a]=(0,G.useState)(()=>localStorage.getItem(`frames-enabled`)===`true`),o=e=>{a(e),localStorage.setItem(`frames-enabled`,String(e))},{data:s,isLoading:c,isError:l}=Au(Mu),u=(0,G.useMemo)(()=>fx(n??``),[n]);if(c)return(0,K.jsx)(Y,{children:(0,K.jsx)(`p`,{className:`m-0 text-[13px] text-neutral-400`,children:`Fetching bundle.json…`})});if(l)return(0,K.jsx)(Y,{children:(0,K.jsx)(`p`,{className:`m-0 text-[13px] text-red-700`,children:`Could not load bundle.json.`})});let d=s?.find(e=>e.api_name===n);if(!d)return(0,K.jsx)(Y,{children:(0,K.jsxs)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:[`No app found with api_name`,` `,(0,K.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 py-0.5`,children:n}),`.`]})});let f=u?.__kizen_clean_config?{__kizen_clean_config:u.__kizen_clean_config}:{},p=d.artifacts.floating_frames.map(e=>({...e,plugin_api_name:d.api_name,args:f})),m=d.artifacts.toolbar_items.map(e=>({...e,plugin_api_name:d.api_name,args:f})),h=d.artifacts.js_action_templates.map(e=>({...e,plugin_api_name:d.api_name,args:f})),g=d.artifacts.object_settings_menu_items.map(e=>({...e,plugin_api_name:d.api_name,args:f})),_=d.artifacts.data_adornments.map(e=>({...e,plugin_api_name:d.api_name,args:f})),v=d.artifacts.routable_pages.map(e=>({...e,plugin_api_name:d.api_name,args:f})),y=m.length>0||h.length>0||g.length>0||_.length>0;return(0,K.jsxs)(K.Fragment,{children:[e&&(0,K.jsx)(`div`,{className:`fixed top-4 left-1/2 -translate-x-1/2 z-20 rounded px-4 py-2 text-sm font-medium ${{success:`bg-green-100 text-green-700`,error:`bg-red-100 text-red-700`,failure:`bg-red-100 text-red-700`,alert:`bg-amber-100 text-amber-700`}[e.variant??`success`]??`bg-green-100 text-green-700`}`,children:e.message}),(0,K.jsxs)(`div`,{style:{paddingRight:p.length>0?gx:0},children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-6 xl:flex-row xl:items-start`,children:[y&&(0,K.jsxs)(`div`,{className:`flex flex-col gap-4 xl:flex-1 xl:min-w-0`,children:[m.length>0&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`strong`,{className:`text-xs`,children:`Toolbar Items`}),(0,K.jsx)(`div`,{children:(0,K.jsx)(`div`,{className:`flex flex-wrap gap-2 p-2`,children:m.map(e=>(0,K.jsx)(Ub,{item:e},e.api_name))})})]}),h.length>0&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`strong`,{className:`text-xs`,children:`JS Action Templates`}),(0,K.jsx)(Fb,{actions:h,pluginApiName:d.api_name,configArgs:f})]}),g.length>0&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`strong`,{className:`text-xs`,children:`Object Settings Menu Items`}),(0,K.jsx)(Gb,{items:g,pluginApiName:d.api_name,configArgs:f})]}),_.length>0&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`strong`,{className:`text-xs`,children:`Data Adornments`}),(0,K.jsx)(Lb,{adornments:_,pluginApiName:d.api_name,configArgs:f})]})]}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`strong`,{className:`text-xs`,children:`Routable Pages`}),(0,K.jsx)(Hb,{ref:t,pages:v})]})]}),(d.services?.length??0)>0&&(0,K.jsx)(rx,{services:d.services??[],pluginApiName:d.api_name})]}),p.length>0&&(0,K.jsxs)(`div`,{className:`pointer-events-none fixed inset-0`,children:[(0,K.jsxs)(`div`,{className:`absolute inset-y-0 flex w-14 flex-col-reverse items-center gap-2 border-l border-black/8 bg-white/60 pb-4 backdrop-blur-sm`,style:{right:r},children:[p.map(e=>(0,K.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,K.jsx)(`div`,{id:`${e.plugin_api_name}-${e.api_name}-trigger-left`}),(0,K.jsx)(`div`,{id:`${e.plugin_api_name}-${e.api_name}-trigger-right`})]},e.api_name)),(0,K.jsx)(`strong`,{className:`text-[9px] uppercase tracking-widest text-neutral-400`,children:`Frames`}),(0,K.jsxs)(`label`,{className:`flex flex-col items-center gap-0.5 cursor-pointer pointer-events-auto`,children:[(0,K.jsx)(`input`,{type:`checkbox`,className:`h-3 w-3 cursor-pointer accent-neutral-600`,checked:i,onChange:e=>{o(e.target.checked)}}),(0,K.jsxs)(`span`,{className:`text-[8px] uppercase tracking-widest text-neutral-400 text-center leading-tight`,children:[`enable`,(0,K.jsx)(`br`,{}),`frames`]})]})]}),p.map(e=>(0,K.jsx)(Ab,{frame:e,framesEnabled:i},e.api_name))]})]})},vx=()=>{let[e,t]=(0,G.useState)(null),[n,r]=(0,G.useState)(!1),[i,a]=(0,G.useState)(!1),o=(0,G.useRef)(null);(0,G.useEffect)(()=>{let e=window.open;return window.open=e=>(o.current?.openNewTab(String(e??``)),null),()=>{window.open=e}},[]),(0,G.useEffect)(()=>{if(!e)return;let n=setTimeout(()=>{t(null)},5e3);return()=>{clearTimeout(n)}},[e]);let s=od(),c=Ru(),{environment:l}=Fu(),u=Iu[l];return s?(0,K.jsx)(_b,{appPath:u,user:{id:s.team.user,crm_client_id:``},business:s.business,clientObject:s.business.client_object?{id:s.business.client_object.id,objectName:s.business.client_object.object_name}:void 0,teamMember:s.team,onNavigate:(e,t)=>{o.current?.navigate(e,t)},performFileUpload:({file:e,id:t,source:n,businessId:r,publicFile:i})=>(console.log(`File upload requested`,{file:e,id:t,source:n,businessId:r,publicFile:i}),new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{t({url:r.result})},r.onerror=n,r.readAsDataURL(e)})),monitoringExceptionHelper:()=>{},performRequest:async(e,t,n,r)=>{let i=n?.headers,a=r instanceof FormData||r instanceof Blob,o=r!=null&&!a?{"Content-Type":`application/json`,...i}:i,s=await c(t,{method:e.toUpperCase(),...r!=null&&{body:a?r:JSON.stringify(r)},...o!=null&&{headers:o}});return s.status===204||s.headers.get(`content-length`)===`0`?{data:{}}:{data:await s.json()}},modal:{showing:n,show:i,showPrompt:()=>{r(!0),a(!0)},onConfirm:()=>{r(!1),a(!1)},onHide:()=>{r(!1),a(!1)}},showToast:({message:e,variant:n})=>{t({message:e,variant:n??`success`})},clearToasts:()=>{t(null)},children:({showPluginModal:t,derivedModalState:n})=>(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(_x,{showingToast:e,browserRef:o}),(0,K.jsx)(lx,{show:t,config:n.config,onConfirm:n.props.onConfirm,onHide:n.props.onHide})]})}):(0,K.jsx)(C,{icon:d,className:`animate-spin text-neutral-400`,size:`2x`})},yx=({field:e,disabled:t=!1})=>{let{state:n,setState:r,evaluateExpression:i,shouldHideField:a,getFieldErrorState:o,registerFieldResetter:s,afterFieldChange:c,disabledKeys:l}=Tb(),u=n[e.key]?.value??e.default??!1,d=u===!0||u===`true`,f=l.includes(e.key)||t,p=(0,G.useCallback)(t=>{r(n=>({...n,[e.key]:{type:`boolean`,value:t}})),c(e.key)},[e.key,r,c]);if((0,G.useEffect)(()=>{s(e.key,()=>{p(void 0)})},[e.key,s,p]),(0,G.useEffect)(()=>{e.when&&i(e.when,e.key)},[e.when,i,e.key]),a(e.key))return null;let m=o(e.key);return(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:d,onChange:e=>{p(e.target.checked)},disabled:f,className:`h-3.5 w-3.5 cursor-pointer accent-blue-600`}),(0,K.jsxs)(`span`,{className:`text-[13px] ${f?`text-neutral-400`:`text-neutral-700`}`,children:[e.label,e.required&&(0,K.jsx)(`span`,{className:`text-red-500 ml-0.5`,children:`*`})]}),e.tooltip&&(0,K.jsx)(`span`,{className:`text-[11px] text-neutral-400`,title:e.tooltip,children:`?`})]}),m?.showMessage&&m.message&&(0,K.jsx)(`span`,{className:`text-[11px] text-red-500`,children:m.message})]})},bx=({field:e,pluginApiName:t,disabled:n=!1})=>{let{evaluateExpression:r,shouldHideField:i}=Tb(),a=e.columns??1;return(0,G.useEffect)(()=>{e.when&&r(e.when,e.key)},[e.when,r,e.key]),i(e.key)?null:(0,K.jsxs)(`div`,{children:[e.label&&(0,K.jsx)(`h3`,{className:`text-[14px] font-semibold text-neutral-800 mb-3 mt-4`,children:e.label}),(0,K.jsx)(`div`,{className:`gap-4`,style:{display:`grid`,gridTemplateColumns:`repeat(${String(a)}, 1fr)`},children:e.fields?.map(e=>(0,K.jsx)(Cx,{field:e,pluginApiName:t,disabled:n},e.key))})]})},xx=({field:e})=>e.label?(0,K.jsxs)(`label`,{className:`text-[12px] font-medium text-neutral-600`,children:[e.label,e.required&&(0,K.jsx)(`span`,{className:`text-red-500 ml-0.5`,children:`*`}),e.tooltip&&(0,K.jsx)(`span`,{className:`ml-1 text-neutral-400 cursor-help`,title:e.tooltip,children:`?`})]}):null,Sx={container:bx,custom_object:({field:e,disabled:t=!1})=>{let{state:n,setState:r,getNestedFields:i,reInferFieldsForObject:a,evaluateExpression:o,shouldHideField:s,shouldDisableField:c,getFieldErrorState:l,registerFieldResetter:u,afterFieldChange:d,disabledKeys:f}=Tb(),p=n[e.key]?.value,m=f.includes(e.key)||t,h=c(e.key)||m,[g,_]=(0,G.useState)(p?.objectName??``),[v,y]=(0,G.useState)([]),[b,x]=(0,G.useState)(!1),S=(0,G.useRef)(null),C=Ru(),w=od(),T=(0,G.useCallback)(async e=>{x(!0);try{let t=new URLSearchParams({page_size:`20`});e&&t.set(`search`,e);let n=await(await C(`/custom-objects?${t.toString()}`)).json(),r=(Array.isArray(n)?n:n.results??[]).map(e=>({id:e.id,label:e.object_name})),i=w?.business?.client_object;i?.access&&(!e||i.object_name.toLowerCase().includes(e.toLowerCase()))&&r.unshift({id:i.id,label:i.object_name}),y(r)}catch{y([])}finally{x(!1)}},[C,w]),E=(0,G.useCallback)(t=>{_(t),p&&(r(t=>Object.fromEntries(Object.entries(t).filter(([t])=>t!==e.key))),d(e.key)),S.current&&clearTimeout(S.current),S.current=setTimeout(()=>{T(t)},300)},[p,e.key,r,d,T]),D=(0,G.useCallback)((t,n)=>{_(n),r(r=>({...r,[e.key]:{type:`custom_object`,value:{id:t,objectName:n}}}));let o=i().filter(t=>t.object_id?.includes(e.key));for(let e of o)r(t=>Object.fromEntries(Object.entries(t).filter(([t])=>t!==e.key)));a(e.key),d(e.key)},[e.key,r,i,a,d]);if((0,G.useEffect)(()=>{u(e.key,()=>{r(t=>Object.fromEntries(Object.entries(t).filter(([t])=>t!==e.key))),_(``)})},[e.key,u,r]),(0,G.useEffect)(()=>{e.when&&o(e.when,e.key)},[e.when,o,e.key]),s(e.key))return null;let O=l(e.key);return(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(xx,{field:e}),(0,K.jsxs)(`div`,{className:`relative`,children:[(0,K.jsx)(Nb,{value:g,onChange:E,onSelect:D,options:v,loading:b,placeholder:e.placeholder??`Search for an object...`,disabled:h}),p&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>{r(t=>Object.fromEntries(Object.entries(t).filter(([t])=>t!==e.key))),_(``),d(e.key)},disabled:h,className:`absolute right-2 top-1/2 -translate-y-1/2 text-[11px] text-neutral-400 hover:text-neutral-600`,"aria-label":`Clear selection`,children:`×`})]}),O?.showMessage&&O.message&&(0,K.jsx)(`span`,{className:`text-[11px] text-red-500`,children:O.message})]})},field:({field:e,disabled:t=!1})=>{let{interpolateValue:n,state:r,setState:i,evaluateExpression:a,shouldHideField:o,getFieldErrorState:s,registerFieldResetter:c,afterFieldChange:l,disabledKeys:u}=Tb(),d=u.includes(e.key)||t,f=n(e.object_id??``),[p,m]=(0,G.useState)([]),[h,g]=(0,G.useState)(``),[_,v]=(0,G.useState)(!1),[y,b]=(0,G.useState)(null),x=Ru();(0,G.useEffect)(()=>{!f||f===y||o(e.key)||(async()=>{v(!0);try{g((await(await x(`/custom-objects/${f}`)).json()).object_name??``);let e=await(await x(`/custom-objects/${f}/fields`)).json();m((Array.isArray(e)?e:e.results??[]).map(e=>({label:e.display_name,value:e.id}))),b(f)}catch{m([])}finally{v(!1)}})()},[f,y,x,e.key,o]);let S=r[e.key]?.value,C=(0,G.useCallback)(t=>{i(n=>({...n,[e.key]:{type:`field`,value:t,associatedObject:{id:f,name:h}}})),l(e.key)},[e.key,i,f,h,l]);if((0,G.useEffect)(()=>{c(e.key,()=>{i(t=>Object.fromEntries(Object.entries(t).filter(([t])=>t!==e.key)))})},[e.key,c,i]),(0,G.useEffect)(()=>{e.when&&a(e.when,e.key)},[e.when,a,e.key]),o(e.key))return null;let w=s(e.key),T=!f||d;if(e.allow_multiple){let t=Array.isArray(S)?S:[];return(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(xx,{field:e}),(0,K.jsx)(`div`,{className:`rounded border p-2 text-[13px] ${w?.error?`border-red-300`:`border-black/10`} ${T?`bg-neutral-50`:`bg-white`}`,children:_?(0,K.jsx)(`span`,{className:`text-neutral-400 text-[12px]`,children:`Loading fields...`}):f?p.length===0?(0,K.jsx)(`span`,{className:`text-neutral-400 text-[12px]`,children:`No fields available`}):(0,K.jsx)(`div`,{className:`flex flex-col gap-1 max-h-48 overflow-y-auto`,children:p.map(e=>{let n=t.some(t=>t.value===e.value);return(0,K.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:n,disabled:T,onChange:()=>{C(n?t.filter(t=>t.value!==e.value):[...t,e])},className:`h-3 w-3 accent-blue-600`}),(0,K.jsx)(`span`,{className:`text-[12px]`,children:e.label})]},e.value)})}):(0,K.jsx)(`span`,{className:`text-neutral-400 text-[12px]`,children:`Select an object first`})}),w?.showMessage&&w.message&&(0,K.jsx)(`span`,{className:`text-[11px] text-red-500`,children:w.message})]})}let E=S&&!Array.isArray(S)?S.value:``;return(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(xx,{field:e}),_?(0,K.jsx)(`div`,{className:`rounded border border-black/10 px-2 py-1.5 text-[12px] text-neutral-400 bg-neutral-50`,children:`Loading fields...`}):(0,K.jsxs)(`select`,{value:E,onChange:e=>{let t=p.find(t=>t.value===e.target.value);t&&C(t)},disabled:T,className:`rounded border px-2 py-1.5 text-[13px] font-mono focus:outline-none focus:ring-1 ${w?.error?`border-red-300 focus:ring-red-400`:`border-black/10 focus:ring-blue-400`} ${T?`bg-neutral-50 text-neutral-400`:`bg-white`}`,children:[(0,K.jsx)(`option`,{value:``,children:f?`Choose a field`:`Select an object first`}),p.map(e=>(0,K.jsx)(`option`,{value:e.value,children:e.label},e.value))]}),w?.showMessage&&w.message&&(0,K.jsx)(`span`,{className:`text-[11px] text-red-500`,children:w.message})]})},text:({field:e,disabled:t=!1})=>{let{state:n,setState:r,evaluateExpression:i,shouldHideField:a,getFieldErrorState:o,registerFieldResetter:s,afterFieldChange:c,disabledKeys:l}=Tb(),[u,d]=(0,G.useState)(n[e.key]?.value??e.default??``),f=l.includes(e.key)||t,p=(0,G.useCallback)(t=>{r(n=>({...n,[e.key]:{type:`text`,value:t}})),c(e.key)},[e.key,r,c]);if((0,G.useEffect)(()=>{s(e.key,()=>{d(``),p(``)})},[e.key,s,p]),(0,G.useEffect)(()=>{let e=setTimeout(()=>{p(u)},300);return()=>{clearTimeout(e)}},[u,p]),(0,G.useEffect)(()=>{e.when&&i(e.when,e.key)},[e.when,i,e.key]),a(e.key))return null;let m=o(e.key);return(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(xx,{field:e}),(0,K.jsx)(`input`,{type:`text`,value:u,onChange:e=>{d(e.target.value)},placeholder:e.placeholder??e.default??`Enter text`,disabled:f,className:`rounded border px-2 py-1.5 text-[13px] font-mono focus:outline-none focus:ring-1 ${m?.error?`border-red-300 focus:ring-red-400`:`border-black/10 focus:ring-blue-400`} ${f?`bg-neutral-50 text-neutral-400`:`bg-white`}`}),m?.showMessage&&m.message&&(0,K.jsx)(`span`,{className:`text-[11px] text-red-500`,children:m.message})]})},description:({field:e})=>{let{evaluateExpression:t,shouldHideField:n}=Tb();return(0,G.useEffect)(()=>{e.when&&t(e.when,e.key)},[e.when,t,e.key]),n(e.key)?null:(0,K.jsx)(`div`,{className:`text-[13px] text-neutral-500 leading-relaxed`,children:e.content})},number:({field:e,disabled:t=!1})=>{let{state:n,setState:r,evaluateExpression:i,shouldHideField:a,getFieldErrorState:o,registerFieldResetter:s,afterFieldChange:c,disabledKeys:l}=Tb(),u=n[e.key]?.value??e.default??``,[d,f]=(0,G.useState)(String(u)),p=l.includes(e.key)||t,m=(0,G.useCallback)(t=>{r(n=>({...n,[e.key]:{type:`number`,value:t}})),c(e.key)},[e.key,r,c]);if((0,G.useEffect)(()=>{s(e.key,()=>{f(``),m(``)})},[e.key,s,m]),(0,G.useEffect)(()=>{let e=setTimeout(()=>{m(d)},300);return()=>{clearTimeout(e)}},[d,m]),(0,G.useEffect)(()=>{e.when&&i(e.when,e.key)},[e.when,i,e.key]),a(e.key))return null;let h=o(e.key);return(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(xx,{field:e}),(0,K.jsx)(`input`,{type:`number`,value:d,onChange:e=>{f(e.target.value)},placeholder:e.placeholder??e.default??`Enter a number`,disabled:p,className:`rounded border px-2 py-1.5 text-[13px] font-mono focus:outline-none focus:ring-1 ${h?.error?`border-red-300 focus:ring-red-400`:`border-black/10 focus:ring-blue-400`} ${p?`bg-neutral-50 text-neutral-400`:`bg-white`}`}),h?.showMessage&&h.message&&(0,K.jsx)(`span`,{className:`text-[11px] text-red-500`,children:h.message})]})},select:({field:e,pluginApiName:t,disabled:n=!1})=>{let{state:r,setState:i,evaluateExpression:a,shouldHideField:o,getFieldErrorState:s,inferencePending:c,initialExpressionsPending:l,expressionsIdle:u,afterFieldChange:d,registerFieldResetter:f,disabledKeys:p}=Tb(),m=!c&&!l&&u,[h,g]=(0,G.useState)([]),[_,v]=(0,G.useState)(!1),y=(0,G.useRef)(null),b=!!(e.getFetchUrl??e.optionMapper),x=r[e.key]?.value,S=p.includes(e.key)||n,C=Ru(),w=(0,G.useCallback)(t=>{i(n=>({...n,[e.key]:{type:`select`,value:t}})),d(e.key)},[d,e.key,i]);(0,G.useEffect)(()=>{f(e.key,()=>{i(t=>Object.fromEntries(Object.entries(t).filter(([t])=>t!==e.key)))})},[e.key,f,i]),(0,G.useEffect)(()=>{e.when&&a(e.when,e.key)},[e.when,a,e.key]);let T=(0,G.useMemo)(()=>JSON.stringify(r),[r]);if((0,G.useEffect)(()=>{!b||!m||o(e.key)||y.current===T||(async()=>{v(!0),y.current=T;try{let n={__kizen_state:{value:{...r,pluginApiName:t}}},i;if(e.getFetchUrl){let t=await _y(e.getFetchUrl,n);if(t){let r=e.fetchMethod??`GET`,a={"Content-Type":`application/json`},o=null;if(e.getHeaders&&(a=await yy(e.getHeaders,n)),r===`POST`&&e.getBody){let t=await yy(e.getBody,n);o=JSON.stringify(t)}if(t.startsWith(`/`))i={data:await(await C(t,{method:r,headers:a,...o!=null&&{body:o}})).json()};else{let e=await fetch(t,{method:r,headers:a,...o!=null&&{body:o}});e.ok&&(i=await e.json())}}}if(e.optionMapper){let n=await vy(e.optionMapper,{__kizen_state:{value:{...r,result:i,pluginApiName:t}}});g(structuredClone(n))}else Array.isArray(i)&&g(i)}catch{g([])}finally{v(!1)}})()},[b,m,T,r,e,t,C,o]),o(e.key))return null;let E=s(e.key),D=b?h:e.options??[];if(e.allow_multiple){let t=Array.isArray(x)?x:[];return(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(xx,{field:e}),(0,K.jsx)(`div`,{className:`rounded border p-2 text-[13px] ${E?.error?`border-red-300`:`border-black/10`} ${S?`bg-neutral-50`:`bg-white`}`,children:_?(0,K.jsx)(`span`,{className:`text-neutral-400 text-[12px]`,children:`Loading options...`}):D.length===0?(0,K.jsx)(`span`,{className:`text-neutral-400 text-[12px]`,children:`No options available`}):(0,K.jsx)(`div`,{className:`flex flex-col gap-1 max-h-48 overflow-y-auto`,children:D.map(e=>{let n=t.some(t=>t.value===e.value);return(0,K.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:n,disabled:S,onChange:()=>{w(n?t.filter(t=>t.value!==e.value):[...t,e])},className:`h-3 w-3 accent-blue-600`}),(0,K.jsx)(`span`,{className:`text-[12px]`,children:e.label})]},e.value)})})}),E?.showMessage&&E.message&&(0,K.jsx)(`span`,{className:`text-[11px] text-red-500`,children:E.message})]})}let O=x&&!Array.isArray(x)?x.value:``;return(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(xx,{field:e}),_?(0,K.jsx)(`div`,{className:`rounded border border-black/10 px-2 py-1.5 text-[12px] text-neutral-400 bg-neutral-50`,children:`Loading options...`}):(0,K.jsxs)(`select`,{value:O,onChange:e=>{let t=D.find(t=>t.value===e.target.value);t&&w(t)},disabled:S,className:`rounded border px-2 py-1.5 text-[13px] font-mono focus:outline-none focus:ring-1 ${E?.error?`border-red-300 focus:ring-red-400`:`border-black/10 focus:ring-blue-400`} ${S?`bg-neutral-50 text-neutral-400`:`bg-white`}`,children:[(0,K.jsx)(`option`,{value:``,children:e.placeholder??`Choose an option`}),D.map(e=>(0,K.jsx)(`option`,{value:e.value,children:e.label},e.value))]}),E?.showMessage&&E.message&&(0,K.jsx)(`span`,{className:`text-[11px] text-red-500`,children:E.message})]})},boolean:yx},Cx=({field:e,pluginApiName:t,disabled:n=!1})=>{let r=Sx[e.type];return(0,K.jsx)(r,{field:e,pluginApiName:t,disabled:n})},wx=({apiName:e})=>{let t=fx(e),[n,r]=(0,G.useState)(t?.__kizen_clean_config?JSON.stringify(t.__kizen_clean_config,null,2):`{}`),[i,a]=(0,G.useState)(null),[o,s]=(0,G.useState)(!1);return(0,K.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,K.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,K.jsx)(`p`,{className:`text-[13px] text-neutral-500 m-0`,children:`No setup assistant defined. Enter configuration as JSON.`})}),(0,K.jsx)(`textarea`,{value:n,onChange:e=>{r(e.target.value),a(null),s(!1)},spellCheck:!1,className:`w-full min-h-[300px] rounded border p-3 text-[13px] font-mono leading-relaxed focus:outline-none focus:ring-1 ${i?`border-red-300 focus:ring-red-400`:`border-black/10 focus:ring-blue-400`}`}),i&&(0,K.jsxs)(`span`,{className:`text-[12px] text-red-500`,children:[`Parse error: `,i]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`button`,{onClick:()=>{try{mx(e,JSON.parse(n)),a(null),s(!0),setTimeout(()=>{s(!1)},2e3)}catch(e){a(e instanceof Error?e.message:`Invalid JSON`),s(!1)}},className:`rounded bg-blue-600 px-4 py-1.5 text-[13px] font-medium text-white hover:bg-blue-700 active:bg-blue-800`,children:`Save Configuration`}),(0,K.jsx)(`button`,{onClick:()=>{hx(e),r(`{}`),a(null),s(!1)},className:`rounded border border-black/10 px-4 py-1.5 text-[13px] font-medium text-neutral-600 hover:bg-neutral-50 active:bg-neutral-100`,children:`Reset`}),o&&(0,K.jsx)(`span`,{className:`text-[12px] text-green-600 font-medium`,children:`Saved`})]})]})},Tx=({config:e,apiName:t})=>{let n=fx(t)?.__kizen_setup_assistant_values,r=(0,G.useRef)({}),[i,a]=(0,G.useState)(!1),o=Ru(),s=od(),c=(0,G.useCallback)(async e=>{try{let t=await(await o(`/api/custom-objects?filters=${encodeURIComponent(JSON.stringify({api_name:e}))}`)).json(),n=Array.isArray(t)?t:t.results;if(n&&n.length>0)return n}catch{}let t=s?.business?.client_object;if(t?.access&&t.name===e)return[{id:t.id,object_name:t.object_name}]},[o,s]),l=(0,G.useCallback)(async e=>{try{let[t,n]=await Promise.all([o(`/api/custom-objects/${e}`),o(`/api/custom-objects/${e}/fields`)]),r=await t.json(),i=await n.json(),a=Array.isArray(i)?i:i.results??[];return{id:e,objectName:r.object_name??``,fields:a.map(e=>({id:e.id,name:e.name,displayName:e.display_name}))}}catch{return{id:e,objectName:``,fields:[]}}},[o]),u=(0,G.useCallback)(e=>{r.current=e},[]);return(0,K.jsx)(wb,{config:e,value:n,onStateChange:u,disabledKeys:[],getObjectByAPIName:c,getCustomObjectDetails:l,children:(0,K.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[e.fields?.map(e=>(0,K.jsx)(Cx,{field:e,pluginApiName:t},e.key)),(0,K.jsxs)(`div`,{className:`flex items-center gap-2 mt-2`,children:[(0,K.jsx)(`button`,{onClick:()=>{let n=r.current;px(t,n,e),a(!0),setTimeout(()=>{a(!1)},2e3)},className:`rounded bg-blue-600 px-4 py-1.5 text-[13px] font-medium text-white hover:bg-blue-700 active:bg-blue-800`,children:`Save Configuration`}),(0,K.jsx)(`button`,{onClick:()=>{hx(t),window.location.reload()},className:`rounded border border-black/10 px-4 py-1.5 text-[13px] font-medium text-neutral-600 hover:bg-neutral-50 active:bg-neutral-100`,children:`Reset`}),i&&(0,K.jsx)(`span`,{className:`text-[12px] text-green-600 font-medium`,children:`Saved`})]})]})})},Ex=({config:e,apiName:t})=>{let n=od(),r=Ru(),{environment:i}=Fu(),a=Iu[i],[o,s]=(0,G.useState)(!1),[c,l]=(0,G.useState)(!1);return n?(0,K.jsx)(_b,{appPath:a,user:{id:n.team.user,crm_client_id:``},business:n.business,clientObject:n.business.client_object?{id:n.business.client_object.id,objectName:n.business.client_object.object_name}:void 0,teamMember:n.team,onNavigate:()=>{},performFileUpload:()=>Promise.resolve({url:``}),monitoringExceptionHelper:()=>{},performRequest:async(e,t,n,i)=>{let a=n?.headers,o=i instanceof FormData||i instanceof Blob,s=i!=null&&!o?{"Content-Type":`application/json`,...a}:a,c=await r(t,{method:e.toUpperCase(),...i!=null&&{body:o?i:JSON.stringify(i)},...s!=null&&{headers:s}});return c.status===204||c.headers.get(`content-length`)===`0`?{data:{}}:{data:await c.json()}},modal:{showing:o,show:c,showPrompt:()=>{s(!0),l(!0)},onConfirm:()=>{s(!1),l(!1)},onHide:()=>{s(!1),l(!1)}},showToast:()=>{},clearToasts:()=>{},children:()=>(0,K.jsx)(Tx,{config:e,apiName:t})}):(0,K.jsx)(C,{icon:d,className:`animate-spin text-neutral-400`})},Dx=()=>{let{apiName:e}=xc({strict:!1}),{data:t,isLoading:n,isError:r}=Au(Mu);if(n)return(0,K.jsx)(Y,{children:(0,K.jsx)(`p`,{className:`m-0 text-[13px] text-neutral-400`,children:`Fetching bundle.json…`})});if(r)return(0,K.jsx)(Y,{children:(0,K.jsx)(`p`,{className:`m-0 text-[13px] text-red-700`,children:`Could not load bundle.json.`})});let i=t?.find(t=>t.api_name===e);if(!i)return(0,K.jsx)(Y,{children:(0,K.jsxs)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:[`No app found with api_name`,` `,(0,K.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 py-0.5`,children:e}),`.`]})});let a=i.base_config?.setup_assistant,o=(a?.fields?.length??0)>0;return(0,K.jsx)(Y,{children:(0,K.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h2`,{className:`text-[15px] font-bold text-neutral-900 m-0`,children:`Configuration`}),(0,K.jsx)(`p`,{className:`text-[12px] text-neutral-400 m-0 mt-1`,children:o?`Configure the setup assistant fields for this plugin app.`:`Enter plugin configuration as JSON.`})]}),o&&a?(0,K.jsx)(Ex,{config:a,apiName:e??``}):(0,K.jsx)(wx,{apiName:e??``})]})})},Ox=()=>{let{apiName:e}=xc({from:`/$apiName/versions`}),{data:t,isLoading:n,isError:r}=Au(Mu);if(n)return(0,K.jsx)(Y,{children:(0,K.jsx)(`p`,{className:`text-[13px] text-neutral-400`,children:`Loading...`})});if(r||!t)return(0,K.jsx)(Y,{children:(0,K.jsx)(`p`,{className:`text-[13px] text-red-500`,children:`Error loading bundle.`})});let i=t.find(t=>t.api_name===e),a=i?.version??``,o=Array.isArray(i?.allReleaseNotes)?i.allReleaseNotes:[];return o.length===0?(0,K.jsx)(Y,{children:(0,K.jsx)(`p`,{className:`text-[13px] text-neutral-400`,children:`No release notes found.`})}):(0,K.jsx)(`div`,{className:`flex flex-col gap-4`,children:o.map(({version:e,notes:t})=>(0,K.jsxs)(Y,{children:[(0,K.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,K.jsxs)(`span`,{className:`rounded bg-neutral-100 px-2 py-0.5 text-[11px] font-semibold tracking-wide text-neutral-600`,children:[`v`,e]}),e===a&&(0,K.jsx)(`span`,{className:`rounded bg-green-100 px-2 py-0.5 text-[11px] font-semibold tracking-wide text-green-700`,children:`current`})]}),(0,K.jsx)(`div`,{className:`mb-3 border-t border-black/5`}),(0,K.jsx)(`pre`,{className:`whitespace-pre-wrap font-mono text-[12px] leading-relaxed text-neutral-700`,children:t})]},e))})},kx=Hc({component:ud}),Ax=Bc({getParentRoute:()=>kx,path:`/`,component:dd}),jx=Bc({getParentRoute:()=>kx,path:`/$apiName/summary`,component:zg}),Mx=Bc({getParentRoute:()=>kx,path:`/$apiName/sandbox`,component:vx}),Nx=Bc({getParentRoute:()=>kx,path:`/$apiName/configuration`,component:Dx}),Px=Bc({getParentRoute:()=>kx,path:`/$apiName/versions`,component:Ox}),Fx=nl({routeTree:kx.addChildren([Ax,jx,Mx,Nx,Px])}),Ix=document.getElementById(`root`),Lx=new pu;if(Ix===null)throw Error(`Root element not found`);(0,ju.createRoot)(Ix).render((0,K.jsx)(G.StrictMode,{children:(0,K.jsx)(gu,{client:Lx,children:(0,K.jsx)(al,{router:Fx})})}));