@kizenapps/cli 1.6.3 → 1.7.0-3667650

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 (51) hide show
  1. package/dist/index.js +30 -23
  2. package/dist/index.js.map +1 -1
  3. package/dist/viewer/assets/AppDetailPage-C0sXm8BK.js +1 -0
  4. package/dist/viewer/assets/{BootstrapContext-Caqxm0pS.js → BootstrapContext-CS2e3X9Y.js} +1 -1
  5. package/dist/viewer/assets/Card-Sa52PGkn.js +1 -0
  6. package/dist/viewer/assets/CodeStepsPage-C6gfmJey.js +1 -0
  7. package/dist/viewer/assets/{CodeViewer-BdEsrhvR.js → CodeViewer-270Os8MC.js} +2 -2
  8. package/dist/viewer/assets/ConfigurationPage-BPe2YfgC.js +1 -0
  9. package/dist/viewer/assets/CredentialsContext-Cwl_xyt_.js +1 -0
  10. package/dist/viewer/assets/DevSidebar-BRP2rhyU.js +1 -0
  11. package/dist/viewer/assets/{Dialog-D6sZ1i69.js → Dialog-C3QoiHOt.js} +1 -1
  12. package/dist/viewer/assets/{IconReferencePage-B4ayBaGk.js → IconReferencePage-DhoHxEaW.js} +1 -1
  13. package/dist/viewer/assets/SandboxPage-C1g2AVsQ.js +1 -0
  14. package/dist/viewer/assets/SecretsPage-B74hR1Yn.js +1 -0
  15. package/dist/viewer/assets/SidebarContext-q5sbcZXM.js +1 -0
  16. package/dist/viewer/assets/{SourceBrowserPage-H2pFRVF1.js → SourceBrowserPage-BM7YULjl.js} +1 -1
  17. package/dist/viewer/assets/{Tooltip-4dV1-FIG.js → Tooltip-JYkgiL8J.js} +1 -1
  18. package/dist/viewer/assets/VersionsPage-RisNLZx3.js +1 -0
  19. package/dist/viewer/assets/{WhenBadge-BTCs-6JK.js → WhenBadge-2kXXp2JS.js} +1 -1
  20. package/dist/viewer/assets/{api-LYugLsE_.js → api-Z7hihohh.js} +1 -1
  21. package/dist/viewer/assets/bootstrapQuery-qFpHSWE9.js +1 -0
  22. package/dist/viewer/assets/bundleQuery-BE1Gb8Ii.js +1 -0
  23. package/dist/viewer/assets/configStorage-Bmswf3bC.js +1 -0
  24. package/dist/viewer/assets/{fa-core-DteucspK.js → fa-core-BSqLAjHu.js} +1 -1
  25. package/dist/viewer/assets/{iconMap-BotklELY.js → iconMap-B-cS2yrx.js} +1 -1
  26. package/dist/viewer/assets/index-CjFi83Rf.js +5 -0
  27. package/dist/viewer/assets/index-Ty4403F6.css +2 -0
  28. package/dist/viewer/assets/{react-CGXpNBH3.js → react-C5hrIo29.js} +1 -1
  29. package/dist/viewer/assets/storageKeys-IkM_u7nJ.js +1 -0
  30. package/dist/viewer/assets/{useCriticalExceptionDialog-DNmzdRI0.js → useCriticalExceptionDialog-C60A18a6.js} +1 -1
  31. package/dist/viewer/assets/{useLocalStorage-gLSTo_Vv.js → useLocalStorage-CeqPEGCc.js} +1 -1
  32. package/dist/viewer/assets/useNavigate-BL0GTcH4.js +1 -0
  33. package/dist/viewer/assets/{bundleQuery-DnoDprqO.js → useParams-D3awshYI.js} +1 -1
  34. package/dist/viewer/assets/{useQuery-DLOWDn8s.js → useQuery-JKMI40WO.js} +1 -1
  35. package/dist/viewer/index.html +16 -13
  36. package/package.json +2 -2
  37. package/dist/viewer/assets/AppDetailPage-BTSBtvJb.js +0 -1
  38. package/dist/viewer/assets/Card-CKKHGdG4.js +0 -1
  39. package/dist/viewer/assets/CodeStepsPage-Krgx1XWT.js +0 -1
  40. package/dist/viewer/assets/ConfigurationPage-BNA5KrGT.js +0 -1
  41. package/dist/viewer/assets/DevSidebar-BBRPcthT.js +0 -1
  42. package/dist/viewer/assets/SandboxPage-CYnP7ZzD.js +0 -1
  43. package/dist/viewer/assets/SidebarContext-g2Wqf-42.js +0 -1
  44. package/dist/viewer/assets/VersionsPage-l_9K0iyg.js +0 -1
  45. package/dist/viewer/assets/configStorage-Db8RcPNR.js +0 -1
  46. package/dist/viewer/assets/index-BCe-a4I_.css +0 -2
  47. package/dist/viewer/assets/index-BN2If3Zu.js +0 -5
  48. package/dist/viewer/assets/storageKeys-Dv0AbTSJ.js +0 -1
  49. package/dist/viewer/assets/useNavigate-EsATq4C7.js +0 -1
  50. /package/dist/viewer/assets/{fa-pro-icons-CmhlYbxQ.js → fa-pro-icons-B6J9phvt.js} +0 -0
  51. /package/dist/viewer/assets/{formatBytes-BCP0hIUu.js → formatBytes-CrFJUAnr.js} +0 -0
@@ -1,4 +1,4 @@
1
- import{n as e,r as t,t as n}from"./rolldown-runtime-Dw2cE7zH.js";import{M as r,N as i,j as a,x as o}from"./fa-core-DteucspK.js";import{n as s}from"./react-CGXpNBH3.js";import{A as c,I as l,M as u,O as d,a as f,c as p,d as m,f as h,i as g,l as _,n as v,o as y,p as b,r as x,s as S,u as C,v as w}from"./useQuery-DLOWDn8s.js";import{i as T,n as E,r as D}from"./BootstrapContext-Caqxm0pS.js";import{f as O}from"./storageKeys-Dv0AbTSJ.js";import{C as k,D as A,E as j,O as M,S as N,T as P,_ as F,b as I,c as L,f as R,g as ee,h as z,i as te,k as ne,l as re,m as ie,o as ae,p as oe,r as se,s as ce,u as le,w as ue,x as de,y as fe}from"./api-LYugLsE_.js";import{n as pe,t as me}from"./Dialog-D6sZ1i69.js";function he(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function ge(e,t,n){let r=e.slice(0);return r[t]=n,r}var _e=class extends l{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#p(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,w.batch(()=>{let e=this.#i,t=this.#f(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!u(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(he(e,n).forEach(e=>{e.destroy()}),he(n,e).forEach(e=>{e.subscribe(t=>{this.#p(e,t)})})),this.#m()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#f(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=c(this.#a,t(e))),this.#a}return e}#f(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new b(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#p(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=ge(this.#t,n,t),this.#m())}#m(){if(this.hasListeners()){let e=this.#a,t=this.#u(this.#t,this.#l);e!==this.#d(t,this.#r?.combine)&&w.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},B=t(i(),1);function ve({queries:e,...t},n){let r=h(n),i=_(),a=p(),o=B.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{v(e),f(e,a,r.getQueryCache().get(e.queryHash))}),S(a);let[s]=B.useState(()=>new _e(r,o,t)),[c,l,u]=s.getOptimisticResult(o,t.combine),m=!i&&t.subscribed!==!1;B.useSyncExternalStore(B.useCallback(e=>m?s.subscribe(w.batchCalls(e)):d,[s,m]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),B.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let C=c.some((e,t)=>g(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&g(n,e)?x(n,new b(r,n),a):[]}):[];if(C.length>0)throw Promise.all(C);let T=c.find((e,t)=>{let n=o[t];return n&&y({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(T?.error)throw T.error;return l(u())}var ye=`integration:${ue.RUN_FRAME_SCRIPT}`,be={lessThanXSeconds:{one:`less than a second`,other:`less than {{count}} seconds`},xSeconds:{one:`1 second`,other:`{{count}} seconds`},halfAMinute:`half a minute`,lessThanXMinutes:{one:`less than a minute`,other:`less than {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`about 1 hour`,other:`about {{count}} hours`},xHours:{one:`1 hour`,other:`{{count}} hours`},xDays:{one:`1 day`,other:`{{count}} days`},aboutXWeeks:{one:`about 1 week`,other:`about {{count}} weeks`},xWeeks:{one:`1 week`,other:`{{count}} weeks`},aboutXMonths:{one:`about 1 month`,other:`about {{count}} months`},xMonths:{one:`1 month`,other:`{{count}} months`},aboutXYears:{one:`about 1 year`,other:`about {{count}} years`},xYears:{one:`1 year`,other:`{{count}} years`},overXYears:{one:`over 1 year`,other:`over {{count}} years`},almostXYears:{one:`almost 1 year`,other:`almost {{count}} years`}},xe=(e,t,n)=>{let r,i=be[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r};function Se(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var Ce={date:Se({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:Se({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:Se({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},we={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},Te=(e,t,n,r)=>we[e];function Ee(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}var De={ordinalNumber:(e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},era:Ee({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:Ee({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:Ee({values:{narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},defaultWidth:`wide`}),day:Ee({values:{narrow:[`S`,`M`,`T`,`W`,`T`,`F`,`S`],short:[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],abbreviated:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],wide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},defaultWidth:`wide`}),dayPeriod:Ee({values:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`}},defaultFormattingWidth:`wide`})};function Oe(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?Ae(s,e=>e.test(o)):ke(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}function ke(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function Ae(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function je(e){return(t,n={})=>{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}var Me={code:`en-US`,formatDistance:xe,formatLong:Ce,formatRelative:Te,localize:De,match:{ordinalNumber:je({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:Oe({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:Oe({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:Oe({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:Oe({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:Oe({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}},Ne={};function Pe(){return Ne}var Fe=365.2425,Ie=6048e5,Le=864e5,Re=3600*24;Re*7,Re*Fe/12*3;var ze=Symbol.for(`constructDateFrom`);function Be(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&ze in e?e[ze](t):e instanceof Date?new e.constructor(t):new Date(t)}function Ve(e,t){return Be(t||e,e)}function He(e){let t=Ve(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),e-+n}function Ue(e,...t){let n=Be.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function We(e,t){let n=Ve(e,t?.in);return n.setHours(0,0,0,0),n}function Ge(e,t,n){let[r,i]=Ue(n?.in,e,t),a=We(r),o=We(i),s=+a-He(a),c=+o-He(o);return Math.round((s-c)/Le)}function Ke(e,t){let n=Ve(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function qe(e,t){let n=Ve(e,t?.in);return Ge(n,Ke(n))+1}function Je(e,t){let n=Pe(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=Ve(e,t?.in),a=i.getDay(),o=(a<r?7:0)+a-r;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function Ye(e,t){return Je(e,{...t,weekStartsOn:1})}function Xe(e,t){let n=Ve(e,t?.in),r=n.getFullYear(),i=Be(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);let a=Ye(i),o=Be(n,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);let s=Ye(o);return n.getTime()>=a.getTime()?r+1:n.getTime()>=s.getTime()?r:r-1}function Ze(e,t){let n=Xe(e,t),r=Be(t?.in||e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),Ye(r)}function Qe(e,t){let n=Ve(e,t?.in),r=Ye(n)-+Ze(n);return Math.round(r/Ie)+1}function $e(e,t){let n=Ve(e,t?.in),r=n.getFullYear(),i=Pe(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=Be(t?.in||e,0);o.setFullYear(r+1,0,a),o.setHours(0,0,0,0);let s=Je(o,t),c=Be(t?.in||e,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);let l=Je(c,t);return+n>=+s?r+1:+n>=+l?r:r-1}function et(e,t){let n=Pe(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=$e(e,t),a=Be(t?.in||e,0);return a.setFullYear(i,0,r),a.setHours(0,0,0,0),Je(a,t)}function tt(e,t){let n=Ve(e,t?.in),r=Je(n,t)-+et(n,t);return Math.round(r/Ie)+1}function V(e,t){return(e<0?`-`:``)+Math.abs(e).toString().padStart(t,`0`)}var nt={y(e,t){let n=e.getFullYear(),r=n>0?n:1-n;return V(t===`yy`?r%100:r,t.length)},M(e,t){let n=e.getMonth();return t===`M`?String(n+1):V(n+1,2)},d(e,t){return V(e.getDate(),t.length)},a(e,t){let n=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.toUpperCase();case`aaa`:return n;case`aaaaa`:return n[0];default:return n===`am`?`a.m.`:`p.m.`}},h(e,t){return V(e.getHours()%12||12,t.length)},H(e,t){return V(e.getHours(),t.length)},m(e,t){return V(e.getMinutes(),t.length)},s(e,t){return V(e.getSeconds(),t.length)},S(e,t){let n=t.length,r=e.getMilliseconds();return V(Math.trunc(r*10**(n-3)),t.length)}},rt={am:`am`,pm:`pm`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},it={G:function(e,t,n){let r=+(e.getFullYear()>0);switch(t){case`G`:case`GG`:case`GGG`:return n.era(r,{width:`abbreviated`});case`GGGGG`:return n.era(r,{width:`narrow`});default:return n.era(r,{width:`wide`})}},y:function(e,t,n){if(t===`yo`){let t=e.getFullYear(),r=t>0?t:1-t;return n.ordinalNumber(r,{unit:`year`})}return nt.y(e,t)},Y:function(e,t,n,r){let i=$e(e,r),a=i>0?i:1-i;return t===`YY`?V(a%100,2):t===`Yo`?n.ordinalNumber(a,{unit:`year`}):V(a,t.length)},R:function(e,t){return V(Xe(e),t.length)},u:function(e,t){return V(e.getFullYear(),t.length)},Q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`Q`:return String(r);case`QQ`:return V(r,2);case`Qo`:return n.ordinalNumber(r,{unit:`quarter`});case`QQQ`:return n.quarter(r,{width:`abbreviated`,context:`formatting`});case`QQQQQ`:return n.quarter(r,{width:`narrow`,context:`formatting`});default:return n.quarter(r,{width:`wide`,context:`formatting`})}},q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`q`:return String(r);case`qq`:return V(r,2);case`qo`:return n.ordinalNumber(r,{unit:`quarter`});case`qqq`:return n.quarter(r,{width:`abbreviated`,context:`standalone`});case`qqqqq`:return n.quarter(r,{width:`narrow`,context:`standalone`});default:return n.quarter(r,{width:`wide`,context:`standalone`})}},M:function(e,t,n){let r=e.getMonth();switch(t){case`M`:case`MM`:return nt.M(e,t);case`Mo`:return n.ordinalNumber(r+1,{unit:`month`});case`MMM`:return n.month(r,{width:`abbreviated`,context:`formatting`});case`MMMMM`:return n.month(r,{width:`narrow`,context:`formatting`});default:return n.month(r,{width:`wide`,context:`formatting`})}},L:function(e,t,n){let r=e.getMonth();switch(t){case`L`:return String(r+1);case`LL`:return V(r+1,2);case`Lo`:return n.ordinalNumber(r+1,{unit:`month`});case`LLL`:return n.month(r,{width:`abbreviated`,context:`standalone`});case`LLLLL`:return n.month(r,{width:`narrow`,context:`standalone`});default:return n.month(r,{width:`wide`,context:`standalone`})}},w:function(e,t,n,r){let i=tt(e,r);return t===`wo`?n.ordinalNumber(i,{unit:`week`}):V(i,t.length)},I:function(e,t,n){let r=Qe(e);return t===`Io`?n.ordinalNumber(r,{unit:`week`}):V(r,t.length)},d:function(e,t,n){return t===`do`?n.ordinalNumber(e.getDate(),{unit:`date`}):nt.d(e,t)},D:function(e,t,n){let r=qe(e);return t===`Do`?n.ordinalNumber(r,{unit:`dayOfYear`}):V(r,t.length)},E:function(e,t,n){let r=e.getDay();switch(t){case`E`:case`EE`:case`EEE`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`EEEEE`:return n.day(r,{width:`narrow`,context:`formatting`});case`EEEEEE`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},e:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`e`:return String(a);case`ee`:return V(a,2);case`eo`:return n.ordinalNumber(a,{unit:`day`});case`eee`:return n.day(i,{width:`abbreviated`,context:`formatting`});case`eeeee`:return n.day(i,{width:`narrow`,context:`formatting`});case`eeeeee`:return n.day(i,{width:`short`,context:`formatting`});default:return n.day(i,{width:`wide`,context:`formatting`})}},c:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`c`:return String(a);case`cc`:return V(a,t.length);case`co`:return n.ordinalNumber(a,{unit:`day`});case`ccc`:return n.day(i,{width:`abbreviated`,context:`standalone`});case`ccccc`:return n.day(i,{width:`narrow`,context:`standalone`});case`cccccc`:return n.day(i,{width:`short`,context:`standalone`});default:return n.day(i,{width:`wide`,context:`standalone`})}},i:function(e,t,n){let r=e.getDay(),i=r===0?7:r;switch(t){case`i`:return String(i);case`ii`:return V(i,t.length);case`io`:return n.ordinalNumber(i,{unit:`day`});case`iii`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`iiiii`:return n.day(r,{width:`narrow`,context:`formatting`});case`iiiiii`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},a:function(e,t,n){let r=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`});case`aaa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`aaaaa`:return n.dayPeriod(r,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(r,{width:`wide`,context:`formatting`})}},b:function(e,t,n){let r=e.getHours(),i;switch(i=r===12?rt.noon:r===0?rt.midnight:r/12>=1?`pm`:`am`,t){case`b`:case`bb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`bbb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`bbbbb`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},B:function(e,t,n){let r=e.getHours(),i;switch(i=r>=17?rt.evening:r>=12?rt.afternoon:r>=4?rt.morning:rt.night,t){case`B`:case`BB`:case`BBB`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`BBBBB`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},h:function(e,t,n){if(t===`ho`){let t=e.getHours()%12;return t===0&&(t=12),n.ordinalNumber(t,{unit:`hour`})}return nt.h(e,t)},H:function(e,t,n){return t===`Ho`?n.ordinalNumber(e.getHours(),{unit:`hour`}):nt.H(e,t)},K:function(e,t,n){let r=e.getHours()%12;return t===`Ko`?n.ordinalNumber(r,{unit:`hour`}):V(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t===`ko`?n.ordinalNumber(r,{unit:`hour`}):V(r,t.length)},m:function(e,t,n){return t===`mo`?n.ordinalNumber(e.getMinutes(),{unit:`minute`}):nt.m(e,t)},s:function(e,t,n){return t===`so`?n.ordinalNumber(e.getSeconds(),{unit:`second`}):nt.s(e,t)},S:function(e,t){return nt.S(e,t)},X:function(e,t,n){let r=e.getTimezoneOffset();if(r===0)return`Z`;switch(t){case`X`:return ot(r);case`XXXX`:case`XX`:return st(r);default:return st(r,`:`)}},x:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`x`:return ot(r);case`xxxx`:case`xx`:return st(r);default:return st(r,`:`)}},O:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+at(r,`:`);default:return`GMT`+st(r,`:`)}},z:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`z`:case`zz`:case`zzz`:return`GMT`+at(r,`:`);default:return`GMT`+st(r,`:`)}},t:function(e,t,n){return V(Math.trunc(e/1e3),t.length)},T:function(e,t,n){return V(+e,t.length)}};function at(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Math.trunc(r/60),a=r%60;return a===0?n+String(i):n+String(i)+t+V(a,2)}function ot(e,t){return e%60==0?(e>0?`-`:`+`)+V(Math.abs(e)/60,2):st(e,t)}function st(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=V(Math.trunc(r/60),2),a=V(r%60,2);return n+i+t+a}var ct=(e,t)=>{switch(e){case`P`:return t.date({width:`short`});case`PP`:return t.date({width:`medium`});case`PPP`:return t.date({width:`long`});default:return t.date({width:`full`})}},lt=(e,t)=>{switch(e){case`p`:return t.time({width:`short`});case`pp`:return t.time({width:`medium`});case`ppp`:return t.time({width:`long`});default:return t.time({width:`full`})}},ut={p:lt,P:(e,t)=>{let n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return ct(e,t);let a;switch(r){case`P`:a=t.dateTime({width:`short`});break;case`PP`:a=t.dateTime({width:`medium`});break;case`PPP`:a=t.dateTime({width:`long`});break;default:a=t.dateTime({width:`full`});break}return a.replace(`{{date}}`,ct(r,t)).replace(`{{time}}`,lt(i,t))}},dt=/^D+$/,ft=/^Y+$/,pt=[`D`,`DD`,`YY`,`YYYY`];function mt(e){return dt.test(e)}function ht(e){return ft.test(e)}function gt(e,t,n){let r=_t(e,t,n);if(console.warn(r),pt.includes(e))throw RangeError(r)}function _t(e,t,n){let r=e[0]===`Y`?`years`:`days of the month`;return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}function vt(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function yt(e){return!(!vt(e)&&typeof e!=`number`||isNaN(+Ve(e)))}var bt=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,xt=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,St=/^'([^]*?)'?$/,Ct=/''/g,wt=/[a-zA-Z]/;function Tt(e,t,n){let r=Pe(),i=n?.locale??r.locale??Me,a=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,s=Ve(e,n?.in);if(!yt(s))throw RangeError(`Invalid time value`);let c=t.match(xt).map(e=>{let t=e[0];if(t===`p`||t===`P`){let n=ut[t];return n(e,i.formatLong)}return e}).join(``).match(bt).map(e=>{if(e===`''`)return{isToken:!1,value:`'`};let t=e[0];if(t===`'`)return{isToken:!1,value:Et(e)};if(it[t])return{isToken:!0,value:e};if(t.match(wt))throw RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));let l={firstWeekContainsDate:a,weekStartsOn:o,locale:i};return c.map(r=>{if(!r.isToken)return r.value;let a=r.value;(!n?.useAdditionalWeekYearTokens&&ht(a)||!n?.useAdditionalDayOfYearTokens&&mt(a))&&gt(a,t,String(e));let o=it[a[0]];return o(s,a,i.localize,l)}).join(``)}function Et(e){let t=e.match(St);return t?t[1].replace(Ct,`'`):e}function Dt(e,t){let n=Ve(e,t?.in);return n.setHours(23,59,59,999),n}function Ot(){return Object.assign({},Pe())}function kt(e,t,n){let r=Ot(),i=Mt(e,n.timeZone,n.locale??r.locale);return`formatToParts`in i?At(i,t):jt(i,t)}function At(e,t){let n=e.formatToParts(t);for(let e=n.length-1;e>=0;--e)if(n[e].type===`timeZoneName`)return n[e].value}function jt(e,t){let n=e.format(t).replace(/\u200E/g,``),r=/ [\w-+ ]+$/.exec(n);return r?r[0].substr(1):``}function Mt(e,t,n){return new Intl.DateTimeFormat(n?[n.code,`en-US`]:void 0,{timeZone:t,timeZoneName:e})}function Nt(e,t){let n=Bt(t);return`formatToParts`in n?Ft(n,e):It(n,e)}var Pt={year:0,month:1,day:2,hour:3,minute:4,second:5};function Ft(e,t){try{let n=e.formatToParts(t),r=[];for(let e=0;e<n.length;e++){let t=Pt[n[e].type];t!==void 0&&(r[t]=parseInt(n[e].value,10))}return r}catch(e){if(e instanceof RangeError)return[NaN];throw e}}function It(e,t){let n=e.format(t),r=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(n);return[parseInt(r[3],10),parseInt(r[1],10),parseInt(r[2],10),parseInt(r[4],10),parseInt(r[5],10),parseInt(r[6],10)]}var Lt={},Rt=new Intl.DateTimeFormat(`en-US`,{hourCycle:`h23`,timeZone:`America/New_York`,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}).format(new Date(`2014-06-25T04:00:00.123Z`)),zt=Rt===`06/25/2014, 00:00:00`||Rt===`‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00`;function Bt(e){return Lt[e]||(Lt[e]=zt?new Intl.DateTimeFormat(`en-US`,{hourCycle:`h23`,timeZone:e,year:`numeric`,month:`numeric`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}):new Intl.DateTimeFormat(`en-US`,{hour12:!1,timeZone:e,year:`numeric`,month:`numeric`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`})),Lt[e]}function Vt(e,t,n,r,i,a,o){let s=new Date(0);return s.setUTCFullYear(e,t,n),s.setUTCHours(r,i,a,o),s}var Ht=36e5,Ut=6e4,Wt={timezone:/([Z+-].*)$/,timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function Gt(e,t,n){if(!e)return 0;let r=Wt.timezoneZ.exec(e);if(r)return 0;let i,a;if(r=Wt.timezoneHH.exec(e),r)return i=parseInt(r[1],10),Yt(i)?-(i*Ht):NaN;if(r=Wt.timezoneHHMM.exec(e),r){i=parseInt(r[2],10);let e=parseInt(r[3],10);return Yt(i,e)?(a=Math.abs(i)*Ht+e*Ut,r[1]===`+`?-a:a):NaN}if(Zt(e)){t=new Date(t||Date.now());let r=qt(n?t:Kt(t),e);return-(n?r:Jt(t,r,e))}return NaN}function Kt(e){return Vt(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}function qt(e,t){let n=Nt(e,t),r=Vt(n[0],n[1]-1,n[2],n[3]%24,n[4],n[5],0).getTime(),i=e.getTime(),a=i%1e3;return i-=a>=0?a:1e3+a,r-i}function Jt(e,t,n){let r=e.getTime()-t,i=qt(new Date(r),n);if(t===i)return t;r-=i-t;let a=qt(new Date(r),n);return i===a?i:Math.max(i,a)}function Yt(e,t){return-23<=e&&e<=23&&(t==null||0<=t&&t<=59)}var Xt={};function Zt(e){if(Xt[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),Xt[e]=!0,!0}catch{return!1}}var Qt=60*1e3,$t={X:function(e,t,n){let r=en(n.timeZone,e);if(r===0)return`Z`;switch(t){case`X`:return rn(r);case`XXXX`:case`XX`:return nn(r);default:return nn(r,`:`)}},x:function(e,t,n){let r=en(n.timeZone,e);switch(t){case`x`:return rn(r);case`xxxx`:case`xx`:return nn(r);default:return nn(r,`:`)}},O:function(e,t,n){let r=en(n.timeZone,e);switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+an(r,`:`);default:return`GMT`+nn(r,`:`)}},z:function(e,t,n){switch(t){case`z`:case`zz`:case`zzz`:return kt(`short`,e,n);default:return kt(`long`,e,n)}}};function en(e,t){let n=e?Gt(e,t,!0)/Qt:t?.getTimezoneOffset()??0;if(Number.isNaN(n))throw RangeError(`Invalid time zone specified: `+e);return n}function tn(e,t){let n=e<0?`-`:``,r=Math.abs(e).toString();for(;r.length<t;)r=`0`+r;return n+r}function nn(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=tn(Math.floor(r/60),2),a=tn(Math.floor(r%60),2);return n+i+t+a}function rn(e,t){return e%60==0?(e>0?`-`:`+`)+tn(Math.abs(e)/60,2):nn(e,t)}function an(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Math.floor(r/60),a=r%60;return a===0?n+String(i):n+String(i)+t+tn(a,2)}function on(e){let t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e-+t}var sn=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/,cn=36e5,ln=6e4,un=2,H={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,plainTime:/:/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:sn};function dn(e,t={}){if(arguments.length<1)throw TypeError(`1 argument required, but only `+arguments.length+` present`);if(e===null)return new Date(NaN);let n=t.additionalDigits==null?un:Number(t.additionalDigits);if(n!==2&&n!==1&&n!==0)throw RangeError(`additionalDigits must be 0, 1 or 2`);if(e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`)return new Date(e.getTime());if(typeof e==`number`||Object.prototype.toString.call(e)===`[object Number]`)return new Date(e);if(Object.prototype.toString.call(e)!==`[object String]`)return new Date(NaN);let r=fn(e),{year:i,restDateString:a}=pn(r.date,n),o=mn(a,i);if(o===null||isNaN(o.getTime()))return new Date(NaN);if(o){let e=o.getTime(),n=0,i;if(r.time&&(n=hn(r.time),n===null||isNaN(n)))return new Date(NaN);if(r.timeZone||t.timeZone){if(i=Gt(r.timeZone||t.timeZone,new Date(e+n)),isNaN(i))return new Date(NaN)}else i=on(new Date(e+n)),i=on(new Date(e+n+i));return new Date(e+n+i)}else return new Date(NaN)}function fn(e){let t={},n=H.dateTimePattern.exec(e),r;if(n?(t.date=n[1],r=n[3]):(n=H.datePattern.exec(e),n?(t.date=n[1],r=n[2]):(t.date=null,r=e)),r){let e=H.timeZone.exec(r);e?(t.time=r.replace(e[1],``),t.timeZone=e[1].trim()):t.time=r}return t}function pn(e,t){if(e){let n=H.YYY[t],r=H.YYYYY[t],i=H.YYYY.exec(e)||r.exec(e);if(i){let t=i[1];return{year:parseInt(t,10),restDateString:e.slice(t.length)}}if(i=H.YY.exec(e)||n.exec(e),i){let t=i[1];return{year:parseInt(t,10)*100,restDateString:e.slice(t.length)}}}return{year:null}}function mn(e,t){if(t===null)return null;let n,r,i;if(!e||!e.length)return n=new Date(0),n.setUTCFullYear(t),n;let a=H.MM.exec(e);if(a)return n=new Date(0),r=parseInt(a[1],10)-1,bn(t,r)?(n.setUTCFullYear(t,r),n):new Date(NaN);if(a=H.DDD.exec(e),a){n=new Date(0);let e=parseInt(a[1],10);return xn(t,e)?(n.setUTCFullYear(t,0,e),n):new Date(NaN)}if(a=H.MMDD.exec(e),a){n=new Date(0),r=parseInt(a[1],10)-1;let e=parseInt(a[2],10);return bn(t,r,e)?(n.setUTCFullYear(t,r,e),n):new Date(NaN)}if(a=H.Www.exec(e),a)return i=parseInt(a[1],10)-1,Sn(i)?gn(t,i):new Date(NaN);if(a=H.WwwD.exec(e),a){i=parseInt(a[1],10)-1;let e=parseInt(a[2],10)-1;return Sn(i,e)?gn(t,i,e):new Date(NaN)}return null}function hn(e){let t,n,r=H.HH.exec(e);if(r)return t=parseFloat(r[1].replace(`,`,`.`)),Cn(t)?t%24*cn:NaN;if(r=H.HHMM.exec(e),r)return t=parseInt(r[1],10),n=parseFloat(r[2].replace(`,`,`.`)),Cn(t,n)?t%24*cn+n*ln:NaN;if(r=H.HHMMSS.exec(e),r){t=parseInt(r[1],10),n=parseInt(r[2],10);let e=parseFloat(r[3].replace(`,`,`.`));return Cn(t,n,e)?t%24*cn+n*ln+e*1e3:NaN}return null}function gn(e,t,n){t||=0,n||=0;let r=new Date(0);r.setUTCFullYear(e,0,4);let i=r.getUTCDay()||7,a=t*7+n+1-i;return r.setUTCDate(r.getUTCDate()+a),r}var _n=[31,28,31,30,31,30,31,31,30,31,30,31],vn=[31,29,31,30,31,30,31,31,30,31,30,31];function yn(e){return e%400==0||e%4==0&&e%100!=0}function bn(e,t,n){if(t<0||t>11)return!1;if(n!=null){if(n<1)return!1;let r=yn(e);if(r&&n>vn[t]||!r&&n>_n[t])return!1}return!0}function xn(e,t){if(t<1)return!1;let n=yn(e);return!(n&&t>366||!n&&t>365)}function Sn(e,t){return!(e<0||e>52||t!=null&&(t<0||t>6))}function Cn(e,t,n){return!(e<0||e>=25||t!=null&&(t<0||t>=60)||n!=null&&(n<0||n>=60))}var wn=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function Tn(e,t,n={}){t=String(t);let r=t.match(wn);if(r){let i=dn(n.originalDate||e,n);t=r.reduce(function(e,t){if(t[0]===`'`)return e;let r=e.indexOf(t),a=e[r-1]===`'`,o=e.replace(t,`'`+$t[t[0]](i,t,n)+`'`);return a?o.substring(0,r-1)+o.substring(r+1):o},t)}return Tt(e,t,n)}function En(e,t,n){e=dn(e,n);let r=Gt(t,e,!0),i=new Date(e.getTime()-r),a=new Date(0);return a.setFullYear(i.getUTCFullYear(),i.getUTCMonth(),i.getUTCDate()),a.setHours(i.getUTCHours(),i.getUTCMinutes(),i.getUTCSeconds(),i.getUTCMilliseconds()),a}function Dn(e,t,n,r){return r={...r,timeZone:t,originalDate:e},Tn(En(e,t,{timeZone:r.timeZone}),n,r)}var U=r(),On=s(),kn=(0,B.createContext)(null),An=({children:e})=>{let t=(0,B.useRef)({}),n=(0,B.useCallback)(()=>{Object.keys(t.current).forEach(e=>{t.current[e]?.forEach(e=>{e()}),t.current[e]=[]})},[]);return(0,B.useEffect)(()=>()=>{n()},[n]),(0,U.jsx)(kn.Provider,{value:{terminators:t,cleanupWorkers:n},children:e})},jn=()=>{let e=(0,B.useContext)(kn);if(!e)throw Error(`useTerminators must be used within a TerminatorsWrapper`);return e},Mn=(0,B.createContext)(null),Nn=({children:e})=>{let[t,n]=(0,B.useState)({}),r=(0,B.useCallback)((e,t)=>{n(n=>({...n,[e]:{...n[e],...t}}))},[]);return(0,U.jsx)(Mn.Provider,{value:{sessionData:t,setSessionData:r},children:e})},Pn=()=>{let e=(0,B.useContext)(Mn);if(!e)throw Error(`useSessionData must be used within a SessionDataWrapper`);return e},Fn=(0,B.createContext)(null),In=({children:e,bootstrapPlugins:t=[],userConfigs:n=[],user:r,teamMember:i,business:a,clientObject:o,appPath:s})=>{let[c,l]=(0,B.useState)(!1),[u,d]=(0,B.useState)({}),f=(0,B.useMemo)(()=>Object.values(u).some(e=>e.waitingOnRouteScript),[u]),p=(0,B.useMemo)(()=>t.reduce((e,t)=>({...e,[t.api_name]:t.id}),{}),[t]),m=(0,B.useMemo)(()=>n.reduce((e,t)=>({...e,[t.api_name]:t.config}),{}),[n]),h=(0,B.useCallback)(()=>{l(!0)},[]);return(0,U.jsx)(Fn.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})})},Ln=()=>{let e=(0,B.useContext)(Fn);if(!e)throw Error(`useAppState must be used within an AppStateWrapper`);return e},Rn=(0,B.createContext)(null),zn=({children:e})=>{let[t,n]=(0,B.useState)({}),r=(0,B.useCallback)(e=>t=>{n(n=>({...n,[e]:t(n[e]??{indicator:`none`,hidden:!1,pending:!1})}))},[]),i=(0,B.useCallback)(e=>!e||!t[e]?{indicator:`none`,hidden:!1,pending:!1}:{...t[e]},[t]),a=(0,B.useMemo)(()=>{let e=Object.keys(t);return e.length>0&&e.some(e=>t[e]?.indicator===`block`)},[t]);return(0,U.jsx)(Rn.Provider,{value:{getRunnerStateUpdater:r,getRunnerState:i},children:e(a)})},Bn=()=>{let e=(0,B.useContext)(Rn);if(!e)throw Error(`useRunnerState must be used within a RunnerStateWrapper`);return e},Vn=(0,B.createContext)(null),Hn=({children:e,showing:t,showPrompt:n,show:r,onConfirm:i,onHide:a})=>{let[o,s]=(0,B.useState)([]),[c,l]=(0,B.useState)([]),[u,d]=(0,B.useState)([]),f=(0,B.useRef)(void 0),p=(0,B.useRef)(void 0),m=(0,B.useCallback)((e,t)=>{s(n=>[...n,{config:e,cb:t}])},[]),h=(0,B.useCallback)((e,t)=>{l(n=>[...n,{objectId:e,cb:t}])},[]),g=(0,B.useCallback)((e,t,n)=>{d(r=>[...r,{objectId:e,relatedEntityId:t,cb:n}])},[]),_=(0,B.useCallback)(e=>{c[0]?.cb(e),l(e=>e.slice(1))},[c]),v=(0,B.useCallback)(e=>{u[0]?.cb(e),d(e=>e.slice(1))},[u]);(0,B.useEffect)(()=>{o.length>0&&!t&&(f.current=o[0]?.config,p.current=o[0]?.cb,n())},[o,t,n]);let y=(0,B.useCallback)(()=>{f.current=void 0,p.current=void 0,s(e=>e.slice(1))},[]),b=(0,B.useCallback)((e,t)=>{p.current&&(p.current({canceled:t??!1,values:e??{},eventSource:`script`}),t?a(`script`):i(),y())},[y,i,a]),x=(0,B.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,U.jsx)(Vn.Provider,{value:{modalState:x,showModal:m,showCreateRecordModal:h,showCreateRelatedRecordModal:g,onCreateRecordComplete:_,onCreateRelatedRecordComplete:v,closeCurrentModal:b},children:e({showPluginModal:x.props.show,pluginApiName:x.config.pluginApiName??``,handleShowModal:m,handleShowCreateRecordModal:h,handleShowCreateRelatedRecordModal:g,derivedModalState:x,handleCreateRecordComplete:_,handleCreateRelatedRecordComplete:v,closeCurrentModal:b,showCreateRecordModal:c.length>0,createRecordModalObjectId:c[0]?.objectId??``,showCreateRelatedRecordModal:u.length>0,createRelatedRecordModalObjectId:u[0]?.objectId??``,createRelatedRecordModalRelatedEntityId:u[0]?.relatedEntityId??``})})},Un=()=>{let e=(0,B.useContext)(Vn);if(!e)throw Error(`useModals must be used within a ModalsWrapper`);return e},Wn=(0,B.createContext)(null),Gn=({children:e,monitoringExceptionHelper:t})=>{let n=(0,B.useCallback)((e,n)=>{t(e,{extra:n})},[t]);return(0,U.jsx)(Wn.Provider,{value:{sendException:n},children:e})},Kn=()=>{let e=(0,B.useContext)(Wn);if(!e)throw Error(`useMonitoring must be used within an MonitoringWrapper`);return e},qn=(0,B.createContext)(null),Jn=({children:e,onNavigate:t})=>{let n=(0,B.useCallback)(e=>{t(e,{replace:!1})},[t]),r=(0,B.useCallback)(e=>{t(e,{replace:!0})},[t]);return(0,U.jsx)(qn.Provider,{value:{push:n,replace:r},children:e})},Yn=()=>{let e=(0,B.useContext)(qn);if(!e)throw Error(`useHistory must be used within an HistoryWrapper`);return e},Xn=(0,B.createContext)(null),Zn=({children:e,performRequest:t,createFileId:n,performFileUpload:r,getPendingCacheCount:i,invalidateCache:a})=>(0,U.jsx)(Xn.Provider,{value:{performRequest:t,createFileId:n,performFileUpload:r,getPendingCacheCount:i,invalidateCache:a},children:e}),Qn=()=>{let e=(0,B.useContext)(Xn);if(!e)throw Error(`useNetwork must be used within a NetworkWrapper`);return e},$n=e=>e,er=(0,B.createContext)({t:$n}),tr=e=>{let{children:t,t:n=$n}=e;return(0,U.jsx)(er.Provider,{value:{t:n},children:t})},nr=()=>(0,B.useContext)(er),rr=(e,t)=>{if(!Array.isArray(e))throw Error(`Return value must be an array`);t.required.forEach(t=>{e.forEach((e,n)=>{if(!(t.key in e))throw Error(`Missing required field: ${t.key} in result row ${String(n)}`);let r=typeof e[t.key];if(r!==t.type)throw Error(`Invalid type for field: ${t.key} in result row ${String(n)}. Expected ${t.type}, got ${r}`)})}),t.optional.forEach(t=>{e.forEach((e,n)=>{if(t.key in e){let r=typeof e[t.key];if(r!==t.type)throw Error(`Invalid type for field: ${t.key} in result row ${String(n)}. Expected ${t.type}, got ${r}`)}})})},ir=({onError:e,showToast:t,clearToasts:n})=>{let{t:r}=nr(),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(void 0),{terminators:c}=jn(),{sessionData:l,setSessionData:u}=Pn(),{installedPluginAPINamesToIds:d,userConfigsByApiName:f,user:p,teamMember:m,business:h,clientObject:g,appPath:_}=Ln(),{getRunnerState:v,getRunnerStateUpdater:y}=Bn(),{showModal:b,showCreateRecordModal:x,closeCurrentModal:S}=Un(),{sendException:C}=Kn(),w=Yn(),{performRequest:T,createFileId:E,performFileUpload:D,getPendingCacheCount:O,invalidateCache:A}=Qn(),j=(0,B.useCallback)(t=>n=>{e?.(n);let r=n?.message??`Unknown plugin error`;C(Error(r),{error:n,workerName:`calendarSource`,pluginApiName:t?.plugin_api_name??``})},[e,C]);return[(0,B.useCallback)(async(i,o,v,C)=>{let M=``,N=k(o);s(N);try{let e=d[o.plugin_api_name];M=JSON.stringify({...v,pluginId:e,__kizen_user_config:f[o.plugin_api_name]})}catch{j(o)({message:r(`Arguments passed to the script are invalid`)})}let P=!1,F=await z({user:p,teamMember:m,business:h,onError:j(o),setLoadingState:a,scriptBody:i,clientObject:g,onStateChange:e=>{y(N)(t=>({...t,...e}))},workerName:`calendarSource`,args:M,pushHistory:w.push,onShowToast:t,onClearToasts:n,terminators:c,plugin:o,sessionData:l,setSessionData:u,onShowModal:b,onCloseModal:S,onShowCreateRecordModal:x,onShowCreateRelatedRecordModal:()=>{},onNetworkError:e=>{e?.status===503&&(P=!0)},appPath:_,onNetworkRequest:T,createFileId:E,performFileUpload:D,getPendingCacheCount:O,invalidateCache:A});try{C&&rr(F,C)}catch(t){e?.(t)}return{result:F,authError:P}},[p,m,d,h,g,w,t,n,c,l,u,b,x,j,y,f,e,T,E,_,D,O,A,r,S]),{...v(o),pending:i}]},ar=(0,B.createContext)(null),or=({children:e,showToast:t,clearToasts:n})=>(0,U.jsx)(ar.Provider,{value:{showToast:t,clearToasts:n},children:e}),sr=()=>{let e=(0,B.useContext)(ar);if(!e)throw Error(`useToast must be used within a ToastWrapper`);return e},cr=async(e,t,n,r)=>{let{result:i,authError:a}=await n(e,t,r,{required:[{key:`id`,type:`string`},{key:`name`,type:`string`}],optional:[{key:`description`,type:`string`}]});return Array.isArray(i)?{result:i,authError:a}:(console.warn(`Expected calendar source script to return an array, but got:`,i),{result:[],authError:a})},lr=async(e,t,n,r)=>{let{result:i,authError:a}=await n(e,t,r,{required:[{key:`id`,type:`string`},{key:`calendar_id`,type:`string`},{key:`title`,type:`string`},{key:`start_time`,type:`number`},{key:`end_time`,type:`number`}],optional:[{key:`description`,type:`string`},{key:`url`,type:`string`},{key:`activity_id`,type:`string`},{key:`all_day`,type:`boolean`},{key:`busy`,type:`boolean`}]});return Array.isArray(i)?{result:i,authError:a}:(console.warn(`Expected calendar event script to return an array, but got:`,i),{result:[],authError:a})},ur=(e,t,n={})=>{let{showToast:r,clearToasts:i}=sr(),{t:a}=nr(),[o]=ir({onError:e=>{r({message:`${a(`Error fetching calendar options.`)} ${e?.message??``}`,variant:`failure`})},showToast:r,clearToasts:i}),s=ve({queries:t.map(t=>({queryKey:j.CALENDAR_SOURCE_CALENDAR_LIST(t.plugin_api_name,t.api_name),queryFn:async()=>{let e=n[t.plugin_api_name]?.business_config??{},{result:r,authError:i}=await cr(t.calendars_script,t,o,e);return{source:t,calendars:r,authError:i}},enabled:e&&!!t.calendars_script}))}),c=s.some(e=>e.isLoading);return{calendars:(0,B.useMemo)(()=>c||!e?{}:s.reduce((e,t)=>{if(!t.data?.source.plugin_api_name||typeof t.data.source.plugin_api_name!=`string`)return e;let n=t.data.source.plugin_api_name;return e[n]??=[],e[n].push(...t.data.calendars.map(e=>({calendar:e,source:t.data.source}))),e},{}),[s,c,e]),errorServices:(0,B.useMemo)(()=>s.filter(e=>e.data?.authError).map(e=>e.data?.source.plugin_api_name),[s]),isLoading:c}},dr=`yyyy-MM-dd'T'HH:mm:ssXXX`,fr=e=>{if(!/^\d{4}-\d{2}-\d{2}$/.test(e))throw Error(`Invalid date string: ${e}. Expected format: YYYY-MM-DD`);let[t,n,r]=e.split(`-`).map(Number);return new Date(t,n-1,r)},pr=(e,t)=>Dn(e,t,dr),mr=(e,t,n={})=>{let r=Intl.DateTimeFormat().resolvedOptions().timeZone,i=pr(We(fr(t.rangeStart)),r),a=pr(Dt(fr(t.rangeEnd)),r),{showToast:o,clearToasts:s}=sr(),{t:c}=nr(),[l]=ir({onError:e=>{o({message:`${c(`Error fetching calendar events.`)} ${e?.message??``}`,variant:`failure`})},showToast:o,clearToasts:s}),u=ve({queries:e.map(({calendar:e,source:r})=>({queryKey:j.CALENDAR_SOURCE_EVENTS(r.plugin_api_name,r.api_name,e.id,t),queryFn:async()=>{let t=n[r.plugin_api_name]?.business_config??{},{result:o,authError:s}=await lr(r.events_script,r,l,{...t,calendar:{calendar_id:e.id,range_start:i,range_end:a}});return{calendarId:e.id,events:o,authError:s}}}))}),d=u.some(e=>e.isLoading),f=(0,B.useMemo)(()=>e.reduce((e,{calendar:t,source:n})=>(e[t.id]={source:n,calendar:t},e),{}),[e]);return{events:(0,B.useMemo)(()=>d?{}:u.reduce((e,t)=>(t.data?.calendarId&&(e[t.data.calendarId]=t.data.events),e),{}),[u,d]),sources:f,isLoading:d}},hr=({onError:e,scriptUIRef:t,plugin:n,onChangeMinimized:r})=>{let{terminators:i}=jn(),{sessionData:a,setSessionData:o}=Pn(),{installedPluginAPINamesToIds:s,userConfigsByApiName:c,user:l,teamMember:u,business:d,clientObject:f,appPath:p}=Ln(),{showModal:m,showCreateRecordModal:h,showCreateRelatedRecordModal:g,closeCurrentModal:_}=Un(),{sendException:v}=Kn(),{showToast:y,clearToasts:b}=sr(),x=Yn(),{performRequest:S,createFileId:C,performFileUpload:w,getPendingCacheCount:T,invalidateCache:E}=Qn(),{t:D}=nr(),[O,k]=(0,B.useState)(!1),[A,j]=(0,B.useState)({indicator:`none`,hidden:!0,triggerHidden:!1,hideHeader:!1}),M=(0,B.useRef)(!1),[N,P]=(0,B.useState)(!1);O&&!M.current&&(M.current=!0),!O&&M.current&&!N&&P(!0);let F=(0,B.useCallback)(t=>{e?.(t);let r=t?.message??`Unknown plugin error`;v(Error(r),{error:t,workerName:`floatingFrame`,pluginApiName:n.plugin_api_name})},[e,n,v]),I=(0,B.useCallback)((e,v)=>{let O=``;try{let e=s[n.plugin_api_name];O=JSON.stringify({...v,pluginId:e,__kizen_user_config:c[n.plugin_api_name]})}catch{F({message:D(`Arguments passed to the script are invalid`)})}return z({user:l,teamMember:u,business:d,onError:F,setLoadingState:(...e)=>{(0,On.flushSync)(()=>{k(...e)})},scriptBody:e,clientObject:f,scriptUIRef:t,onStateChange:e=>{let{minimized:t,...n}=e;typeof t==`boolean`&&r?.(t),j(e=>({...e,...n}))},workerName:`floatingFramePlugin`,args:O,pushHistory:x.push,plugin:n,onShowToast:y,onClearToasts:b,terminators:i,sessionData:a,setSessionData:o,onShowModal:m,onCloseModal:_,onShowCreateRecordModal:h,onShowCreateRelatedRecordModal:g,appPath:p,onNetworkRequest:S,createFileId:C,performFileUpload:w,getPendingCacheCount:T,invalidateCache:E,onRunEventScript:(e,t)=>{let r=n.event_scripts?.[e];if(!r){F({message:`${D(`Event script not found:`)} ${e}`});return}I(r,t)}})},[l,u,d,s,f,t,x,n,r,y,b,i,a,o,F,j,c,m,h,g,S,p,C,w,T,E,D,_]);return[I,{...A,pending:N?!1:O}]},gr=({onError:e,scriptUIRef:t,plugin:n})=>{let{terminators:r}=jn(),{sessionData:i,setSessionData:a}=Pn(),{installedPluginAPINamesToIds:o,userConfigsByApiName:s,user:c,teamMember:l,business:u,clientObject:d,appPath:f}=Ln(),{getRunnerState:p,getRunnerStateUpdater:m}=Bn(),{showModal:h,showCreateRecordModal:g,closeCurrentModal:_}=Un(),{sendException:v}=Kn(),{showToast:y,clearToasts:b}=sr(),x=Yn(),{performRequest:S,createFileId:C,performFileUpload:w,getPendingCacheCount:T,invalidateCache:E}=Qn(),{t:D}=nr(),[O,A]=(0,B.useState)(!1),[j,M]=(0,B.useState)(void 0),N=(0,B.useCallback)((t,r)=>{e?.(t);let i=t?.message??`Unknown plugin error`;v(Error(i),{error:t,workerName:`genericPlugin`,pluginApiName:n?.plugin_api_name??r?.plugin_api_name??``})},[e,n,v]),P=(0,B.useCallback)((e,p,v)=>{let O=``,j=k(v);M(j);try{let e=o[n?.plugin_api_name??v?.plugin_api_name??``];O=JSON.stringify({...p,pluginId:e,__kizen_user_config:s[n?.plugin_api_name??v?.plugin_api_name??``]})}catch{N({message:D(`Arguments passed to the script are invalid`)})}return z({user:c,teamMember:l,business:u,onError:N,setLoadingState:A,scriptBody:e,clientObject:d,scriptUIRef:t,onStateChange:e=>{m(j)(t=>({...t,...e}))},workerName:`genericPlugin`,args:O,pushHistory:x.push,onShowToast:y,onClearToasts:b,terminators:r,plugin:n,executionPlugin:v,sessionData:i,setSessionData:a,onShowModal:h,onCloseModal:_,onShowCreateRecordModal:g,onShowCreateRelatedRecordModal:()=>{},appPath:f,onNetworkRequest:S,createFileId:C,performFileUpload:w,getPendingCacheCount:T,invalidateCache:E,onRunEventScript:(e,t)=>{let r=n?.event_scripts?.[e];if(!r){N({message:`${D(`Event script not found:`)} ${e}`});return}P(r,t,v)}})},[c,l,o,u,d,t,x,y,b,r,n,i,a,N,m,s,h,g,S,f,C,w,T,E,D,_]);return[P,{...p(j),pending:O}]},_r=({entityId:e,objectId:t,onError:n,scriptUIRef:r,onReleaseBlockingScript:i})=>{let{terminators:a}=jn(),{sessionData:o,setSessionData:s}=Pn(),{installedPluginAPINamesToIds:c,userConfigsByApiName:l,user:u,teamMember:d,business:f,clientObject:p,appPath:m}=Ln(),{getRunnerState:h,getRunnerStateUpdater:g}=Bn(),{showModal:_,showCreateRecordModal:v,showCreateRelatedRecordModal:y,closeCurrentModal:b}=Un(),{sendException:x}=Kn(),{showToast:S,clearToasts:C}=sr(),w=Yn(),{performRequest:T,createFileId:E,performFileUpload:D,getPendingCacheCount:O,invalidateCache:A}=Qn(),{t:j}=nr(),[M,N]=(0,B.useState)(!1),[P,F]=(0,B.useState)(void 0),I=(0,B.useCallback)((r,i)=>{n?.(r);let a=r?.message??`Unknown plugin error`;x(Error(a),{error:r,workerName:`recordDetail`,pluginApiName:i?.plugin_api_name??``,objectId:t,entityId:e})},[n,t,e,x]);return[(0,B.useCallback)((n,h,x,M)=>{let P=``;try{let e=c[x?.plugin_api_name??``];P=JSON.stringify({...h,pluginId:e,__kizen_user_config:l[x?.plugin_api_name??``]})}catch{I({message:j(`Arguments passed to the script are invalid`)},x)}let L=k(x);return F(L),z({user:u,teamMember:d,business:f,onReleaseBlockingScript:i,onError:e=>{I(e,x)},setLoadingState:N,scriptBody:n,clientObject:p,scriptUIRef:r,onStateChange:e=>{g(L)(t=>({...t,...e}))},workerName:`recordDetail`,args:P,context:M??{entityId:e,objectId:t},pushHistory:w.push,onShowToast:S,onClearToasts:C,terminators:a,executionPlugin:x,sessionData:o,setSessionData:s,onShowModal:_,onCloseModal:b,onShowCreateRecordModal:v,onShowCreateRelatedRecordModal:y,appPath:m,onNetworkRequest:T,createFileId:E,performFileUpload:D,getPendingCacheCount:O,invalidateCache:A})},[u,d,c,f,e,t,p,r,w,S,C,a,o,s,_,v,y,i,I,g,l,T,m,E,D,O,A,j,b]),{...h(P),pending:M}]},vr=(e,t,n,r,i={})=>{let a=(0,B.useMemo)(()=>t?.event_scripts??{},[t]),o=(0,B.useCallback)(t=>{if(!r){let n=t.target.getAttribute(`data-script`);n&&a[n]&&(t.preventDefault(),t.stopPropagation(),e(a[n],{...i}))}},[r,e,a,i]),s=(0,B.useCallback)(t=>{if(t.preventDefault(),t.stopPropagation(),!r){let n=t.target,r=n.getAttribute(`data-script`);if(r&&a[r]){let t=new FormData(n),o=Object.fromEntries([...new Set(t.keys())].map(e=>[e,t.getAll(e)]));e(a[r],{...i,formData:o})}}},[r,e,a,i]);(0,B.useEffect)(()=>{let e=n?.current;return e&&(e.addEventListener(`click`,o),e.addEventListener(`submit`,s)),()=>{e&&(e.removeEventListener(`click`,o),e.removeEventListener(`submit`,s))}},[o,s,t,n])},yr=(e,t,n)=>(0,B.useMemo)(()=>ce(e,t,n),[e,t,n]),br=(e,t,n)=>{let{showToast:r}=sr(),{t:i}=nr(),a=(0,B.useRef)(null),o=(0,B.useRef)(null),s=e?.css,{html:c}=yr(e?.html,e?.plugin_api_name,n),[l,{pending:u}]=gr({onError:e=>{r({message:`${i(`Script could not be executed:`)} ${e?.message??`Unknown Error`}`,variant:`failure`})},scriptUIRef:a,plugin:e});return vr(l,e,o,u,t),{scopedCss:`
1
+ import{n as e,r as t,t as n}from"./rolldown-runtime-Dw2cE7zH.js";import{F as r,I as i,P as a,w as o}from"./fa-core-BSqLAjHu.js";import{n as s}from"./react-C5hrIo29.js";import{A as c,I as l,M as u,O as d,a as f,c as p,d as m,f as h,i as g,l as _,n as v,o as y,p as b,r as x,s as S,u as C,v as w}from"./useQuery-JKMI40WO.js";import{i as T,n as E,r as D}from"./BootstrapContext-CS2e3X9Y.js";import{n as O}from"./CredentialsContext-Cwl_xyt_.js";import{C as k,D as A,E as j,O as M,S as N,T as P,_ as F,b as I,c as L,f as R,g as ee,h as z,i as te,k as ne,l as re,m as ie,o as ae,p as oe,r as se,s as ce,u as le,w as ue,x as de,y as fe}from"./api-Z7hihohh.js";import{n as pe,t as me}from"./Dialog-C3QoiHOt.js";function he(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function ge(e,t,n){let r=e.slice(0);return r[t]=n,r}var _e=class extends l{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#p(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,w.batch(()=>{let e=this.#i,t=this.#f(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!u(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(he(e,n).forEach(e=>{e.destroy()}),he(n,e).forEach(e=>{e.subscribe(t=>{this.#p(e,t)})})),this.#m()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#f(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=c(this.#a,t(e))),this.#a}return e}#f(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new b(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#p(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=ge(this.#t,n,t),this.#m())}#m(){if(this.hasListeners()){let e=this.#a,t=this.#u(this.#t,this.#l);e!==this.#d(t,this.#r?.combine)&&w.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},B=t(i(),1);function ve({queries:e,...t},n){let r=h(n),i=_(),a=p(),o=B.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{v(e),f(e,a,r.getQueryCache().get(e.queryHash))}),S(a);let[s]=B.useState(()=>new _e(r,o,t)),[c,l,u]=s.getOptimisticResult(o,t.combine),m=!i&&t.subscribed!==!1;B.useSyncExternalStore(B.useCallback(e=>m?s.subscribe(w.batchCalls(e)):d,[s,m]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),B.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let C=c.some((e,t)=>g(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&g(n,e)?x(n,new b(r,n),a):[]}):[];if(C.length>0)throw Promise.all(C);let T=c.find((e,t)=>{let n=o[t];return n&&y({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(T?.error)throw T.error;return l(u())}var ye=`integration:${ue.RUN_FRAME_SCRIPT}`,be={lessThanXSeconds:{one:`less than a second`,other:`less than {{count}} seconds`},xSeconds:{one:`1 second`,other:`{{count}} seconds`},halfAMinute:`half a minute`,lessThanXMinutes:{one:`less than a minute`,other:`less than {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`about 1 hour`,other:`about {{count}} hours`},xHours:{one:`1 hour`,other:`{{count}} hours`},xDays:{one:`1 day`,other:`{{count}} days`},aboutXWeeks:{one:`about 1 week`,other:`about {{count}} weeks`},xWeeks:{one:`1 week`,other:`{{count}} weeks`},aboutXMonths:{one:`about 1 month`,other:`about {{count}} months`},xMonths:{one:`1 month`,other:`{{count}} months`},aboutXYears:{one:`about 1 year`,other:`about {{count}} years`},xYears:{one:`1 year`,other:`{{count}} years`},overXYears:{one:`over 1 year`,other:`over {{count}} years`},almostXYears:{one:`almost 1 year`,other:`almost {{count}} years`}},xe=(e,t,n)=>{let r,i=be[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r};function Se(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var Ce={date:Se({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:Se({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:Se({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},we={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},Te=(e,t,n,r)=>we[e];function Ee(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}var De={ordinalNumber:(e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},era:Ee({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:Ee({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:Ee({values:{narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},defaultWidth:`wide`}),day:Ee({values:{narrow:[`S`,`M`,`T`,`W`,`T`,`F`,`S`],short:[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],abbreviated:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],wide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},defaultWidth:`wide`}),dayPeriod:Ee({values:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`}},defaultFormattingWidth:`wide`})};function Oe(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?Ae(s,e=>e.test(o)):ke(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}function ke(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function Ae(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function je(e){return(t,n={})=>{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}var Me={code:`en-US`,formatDistance:xe,formatLong:Ce,formatRelative:Te,localize:De,match:{ordinalNumber:je({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:Oe({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:Oe({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:Oe({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:Oe({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:Oe({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}},Ne={};function Pe(){return Ne}var Fe=365.2425,Ie=6048e5,Le=864e5,Re=3600*24;Re*7,Re*Fe/12*3;var ze=Symbol.for(`constructDateFrom`);function Be(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&ze in e?e[ze](t):e instanceof Date?new e.constructor(t):new Date(t)}function Ve(e,t){return Be(t||e,e)}function He(e){let t=Ve(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),e-+n}function Ue(e,...t){let n=Be.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function We(e,t){let n=Ve(e,t?.in);return n.setHours(0,0,0,0),n}function Ge(e,t,n){let[r,i]=Ue(n?.in,e,t),a=We(r),o=We(i),s=+a-He(a),c=+o-He(o);return Math.round((s-c)/Le)}function Ke(e,t){let n=Ve(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function qe(e,t){let n=Ve(e,t?.in);return Ge(n,Ke(n))+1}function Je(e,t){let n=Pe(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=Ve(e,t?.in),a=i.getDay(),o=(a<r?7:0)+a-r;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function Ye(e,t){return Je(e,{...t,weekStartsOn:1})}function Xe(e,t){let n=Ve(e,t?.in),r=n.getFullYear(),i=Be(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);let a=Ye(i),o=Be(n,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);let s=Ye(o);return n.getTime()>=a.getTime()?r+1:n.getTime()>=s.getTime()?r:r-1}function Ze(e,t){let n=Xe(e,t),r=Be(t?.in||e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),Ye(r)}function Qe(e,t){let n=Ve(e,t?.in),r=Ye(n)-+Ze(n);return Math.round(r/Ie)+1}function $e(e,t){let n=Ve(e,t?.in),r=n.getFullYear(),i=Pe(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=Be(t?.in||e,0);o.setFullYear(r+1,0,a),o.setHours(0,0,0,0);let s=Je(o,t),c=Be(t?.in||e,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);let l=Je(c,t);return+n>=+s?r+1:+n>=+l?r:r-1}function et(e,t){let n=Pe(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=$e(e,t),a=Be(t?.in||e,0);return a.setFullYear(i,0,r),a.setHours(0,0,0,0),Je(a,t)}function tt(e,t){let n=Ve(e,t?.in),r=Je(n,t)-+et(n,t);return Math.round(r/Ie)+1}function V(e,t){return(e<0?`-`:``)+Math.abs(e).toString().padStart(t,`0`)}var nt={y(e,t){let n=e.getFullYear(),r=n>0?n:1-n;return V(t===`yy`?r%100:r,t.length)},M(e,t){let n=e.getMonth();return t===`M`?String(n+1):V(n+1,2)},d(e,t){return V(e.getDate(),t.length)},a(e,t){let n=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.toUpperCase();case`aaa`:return n;case`aaaaa`:return n[0];default:return n===`am`?`a.m.`:`p.m.`}},h(e,t){return V(e.getHours()%12||12,t.length)},H(e,t){return V(e.getHours(),t.length)},m(e,t){return V(e.getMinutes(),t.length)},s(e,t){return V(e.getSeconds(),t.length)},S(e,t){let n=t.length,r=e.getMilliseconds();return V(Math.trunc(r*10**(n-3)),t.length)}},rt={am:`am`,pm:`pm`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},it={G:function(e,t,n){let r=+(e.getFullYear()>0);switch(t){case`G`:case`GG`:case`GGG`:return n.era(r,{width:`abbreviated`});case`GGGGG`:return n.era(r,{width:`narrow`});default:return n.era(r,{width:`wide`})}},y:function(e,t,n){if(t===`yo`){let t=e.getFullYear(),r=t>0?t:1-t;return n.ordinalNumber(r,{unit:`year`})}return nt.y(e,t)},Y:function(e,t,n,r){let i=$e(e,r),a=i>0?i:1-i;return t===`YY`?V(a%100,2):t===`Yo`?n.ordinalNumber(a,{unit:`year`}):V(a,t.length)},R:function(e,t){return V(Xe(e),t.length)},u:function(e,t){return V(e.getFullYear(),t.length)},Q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`Q`:return String(r);case`QQ`:return V(r,2);case`Qo`:return n.ordinalNumber(r,{unit:`quarter`});case`QQQ`:return n.quarter(r,{width:`abbreviated`,context:`formatting`});case`QQQQQ`:return n.quarter(r,{width:`narrow`,context:`formatting`});default:return n.quarter(r,{width:`wide`,context:`formatting`})}},q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`q`:return String(r);case`qq`:return V(r,2);case`qo`:return n.ordinalNumber(r,{unit:`quarter`});case`qqq`:return n.quarter(r,{width:`abbreviated`,context:`standalone`});case`qqqqq`:return n.quarter(r,{width:`narrow`,context:`standalone`});default:return n.quarter(r,{width:`wide`,context:`standalone`})}},M:function(e,t,n){let r=e.getMonth();switch(t){case`M`:case`MM`:return nt.M(e,t);case`Mo`:return n.ordinalNumber(r+1,{unit:`month`});case`MMM`:return n.month(r,{width:`abbreviated`,context:`formatting`});case`MMMMM`:return n.month(r,{width:`narrow`,context:`formatting`});default:return n.month(r,{width:`wide`,context:`formatting`})}},L:function(e,t,n){let r=e.getMonth();switch(t){case`L`:return String(r+1);case`LL`:return V(r+1,2);case`Lo`:return n.ordinalNumber(r+1,{unit:`month`});case`LLL`:return n.month(r,{width:`abbreviated`,context:`standalone`});case`LLLLL`:return n.month(r,{width:`narrow`,context:`standalone`});default:return n.month(r,{width:`wide`,context:`standalone`})}},w:function(e,t,n,r){let i=tt(e,r);return t===`wo`?n.ordinalNumber(i,{unit:`week`}):V(i,t.length)},I:function(e,t,n){let r=Qe(e);return t===`Io`?n.ordinalNumber(r,{unit:`week`}):V(r,t.length)},d:function(e,t,n){return t===`do`?n.ordinalNumber(e.getDate(),{unit:`date`}):nt.d(e,t)},D:function(e,t,n){let r=qe(e);return t===`Do`?n.ordinalNumber(r,{unit:`dayOfYear`}):V(r,t.length)},E:function(e,t,n){let r=e.getDay();switch(t){case`E`:case`EE`:case`EEE`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`EEEEE`:return n.day(r,{width:`narrow`,context:`formatting`});case`EEEEEE`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},e:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`e`:return String(a);case`ee`:return V(a,2);case`eo`:return n.ordinalNumber(a,{unit:`day`});case`eee`:return n.day(i,{width:`abbreviated`,context:`formatting`});case`eeeee`:return n.day(i,{width:`narrow`,context:`formatting`});case`eeeeee`:return n.day(i,{width:`short`,context:`formatting`});default:return n.day(i,{width:`wide`,context:`formatting`})}},c:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`c`:return String(a);case`cc`:return V(a,t.length);case`co`:return n.ordinalNumber(a,{unit:`day`});case`ccc`:return n.day(i,{width:`abbreviated`,context:`standalone`});case`ccccc`:return n.day(i,{width:`narrow`,context:`standalone`});case`cccccc`:return n.day(i,{width:`short`,context:`standalone`});default:return n.day(i,{width:`wide`,context:`standalone`})}},i:function(e,t,n){let r=e.getDay(),i=r===0?7:r;switch(t){case`i`:return String(i);case`ii`:return V(i,t.length);case`io`:return n.ordinalNumber(i,{unit:`day`});case`iii`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`iiiii`:return n.day(r,{width:`narrow`,context:`formatting`});case`iiiiii`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},a:function(e,t,n){let r=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`});case`aaa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`aaaaa`:return n.dayPeriod(r,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(r,{width:`wide`,context:`formatting`})}},b:function(e,t,n){let r=e.getHours(),i;switch(i=r===12?rt.noon:r===0?rt.midnight:r/12>=1?`pm`:`am`,t){case`b`:case`bb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`bbb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`bbbbb`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},B:function(e,t,n){let r=e.getHours(),i;switch(i=r>=17?rt.evening:r>=12?rt.afternoon:r>=4?rt.morning:rt.night,t){case`B`:case`BB`:case`BBB`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`BBBBB`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},h:function(e,t,n){if(t===`ho`){let t=e.getHours()%12;return t===0&&(t=12),n.ordinalNumber(t,{unit:`hour`})}return nt.h(e,t)},H:function(e,t,n){return t===`Ho`?n.ordinalNumber(e.getHours(),{unit:`hour`}):nt.H(e,t)},K:function(e,t,n){let r=e.getHours()%12;return t===`Ko`?n.ordinalNumber(r,{unit:`hour`}):V(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t===`ko`?n.ordinalNumber(r,{unit:`hour`}):V(r,t.length)},m:function(e,t,n){return t===`mo`?n.ordinalNumber(e.getMinutes(),{unit:`minute`}):nt.m(e,t)},s:function(e,t,n){return t===`so`?n.ordinalNumber(e.getSeconds(),{unit:`second`}):nt.s(e,t)},S:function(e,t){return nt.S(e,t)},X:function(e,t,n){let r=e.getTimezoneOffset();if(r===0)return`Z`;switch(t){case`X`:return ot(r);case`XXXX`:case`XX`:return st(r);default:return st(r,`:`)}},x:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`x`:return ot(r);case`xxxx`:case`xx`:return st(r);default:return st(r,`:`)}},O:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+at(r,`:`);default:return`GMT`+st(r,`:`)}},z:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`z`:case`zz`:case`zzz`:return`GMT`+at(r,`:`);default:return`GMT`+st(r,`:`)}},t:function(e,t,n){return V(Math.trunc(e/1e3),t.length)},T:function(e,t,n){return V(+e,t.length)}};function at(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Math.trunc(r/60),a=r%60;return a===0?n+String(i):n+String(i)+t+V(a,2)}function ot(e,t){return e%60==0?(e>0?`-`:`+`)+V(Math.abs(e)/60,2):st(e,t)}function st(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=V(Math.trunc(r/60),2),a=V(r%60,2);return n+i+t+a}var ct=(e,t)=>{switch(e){case`P`:return t.date({width:`short`});case`PP`:return t.date({width:`medium`});case`PPP`:return t.date({width:`long`});default:return t.date({width:`full`})}},lt=(e,t)=>{switch(e){case`p`:return t.time({width:`short`});case`pp`:return t.time({width:`medium`});case`ppp`:return t.time({width:`long`});default:return t.time({width:`full`})}},ut={p:lt,P:(e,t)=>{let n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return ct(e,t);let a;switch(r){case`P`:a=t.dateTime({width:`short`});break;case`PP`:a=t.dateTime({width:`medium`});break;case`PPP`:a=t.dateTime({width:`long`});break;default:a=t.dateTime({width:`full`});break}return a.replace(`{{date}}`,ct(r,t)).replace(`{{time}}`,lt(i,t))}},dt=/^D+$/,ft=/^Y+$/,pt=[`D`,`DD`,`YY`,`YYYY`];function mt(e){return dt.test(e)}function ht(e){return ft.test(e)}function gt(e,t,n){let r=_t(e,t,n);if(console.warn(r),pt.includes(e))throw RangeError(r)}function _t(e,t,n){let r=e[0]===`Y`?`years`:`days of the month`;return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}function vt(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function yt(e){return!(!vt(e)&&typeof e!=`number`||isNaN(+Ve(e)))}var bt=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,xt=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,St=/^'([^]*?)'?$/,Ct=/''/g,wt=/[a-zA-Z]/;function Tt(e,t,n){let r=Pe(),i=n?.locale??r.locale??Me,a=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,s=Ve(e,n?.in);if(!yt(s))throw RangeError(`Invalid time value`);let c=t.match(xt).map(e=>{let t=e[0];if(t===`p`||t===`P`){let n=ut[t];return n(e,i.formatLong)}return e}).join(``).match(bt).map(e=>{if(e===`''`)return{isToken:!1,value:`'`};let t=e[0];if(t===`'`)return{isToken:!1,value:Et(e)};if(it[t])return{isToken:!0,value:e};if(t.match(wt))throw RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));let l={firstWeekContainsDate:a,weekStartsOn:o,locale:i};return c.map(r=>{if(!r.isToken)return r.value;let a=r.value;(!n?.useAdditionalWeekYearTokens&&ht(a)||!n?.useAdditionalDayOfYearTokens&&mt(a))&&gt(a,t,String(e));let o=it[a[0]];return o(s,a,i.localize,l)}).join(``)}function Et(e){let t=e.match(St);return t?t[1].replace(Ct,`'`):e}function Dt(e,t){let n=Ve(e,t?.in);return n.setHours(23,59,59,999),n}function Ot(){return Object.assign({},Pe())}function kt(e,t,n){let r=Ot(),i=Mt(e,n.timeZone,n.locale??r.locale);return`formatToParts`in i?At(i,t):jt(i,t)}function At(e,t){let n=e.formatToParts(t);for(let e=n.length-1;e>=0;--e)if(n[e].type===`timeZoneName`)return n[e].value}function jt(e,t){let n=e.format(t).replace(/\u200E/g,``),r=/ [\w-+ ]+$/.exec(n);return r?r[0].substr(1):``}function Mt(e,t,n){return new Intl.DateTimeFormat(n?[n.code,`en-US`]:void 0,{timeZone:t,timeZoneName:e})}function Nt(e,t){let n=Bt(t);return`formatToParts`in n?Ft(n,e):It(n,e)}var Pt={year:0,month:1,day:2,hour:3,minute:4,second:5};function Ft(e,t){try{let n=e.formatToParts(t),r=[];for(let e=0;e<n.length;e++){let t=Pt[n[e].type];t!==void 0&&(r[t]=parseInt(n[e].value,10))}return r}catch(e){if(e instanceof RangeError)return[NaN];throw e}}function It(e,t){let n=e.format(t),r=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(n);return[parseInt(r[3],10),parseInt(r[1],10),parseInt(r[2],10),parseInt(r[4],10),parseInt(r[5],10),parseInt(r[6],10)]}var Lt={},Rt=new Intl.DateTimeFormat(`en-US`,{hourCycle:`h23`,timeZone:`America/New_York`,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}).format(new Date(`2014-06-25T04:00:00.123Z`)),zt=Rt===`06/25/2014, 00:00:00`||Rt===`‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00`;function Bt(e){return Lt[e]||(Lt[e]=zt?new Intl.DateTimeFormat(`en-US`,{hourCycle:`h23`,timeZone:e,year:`numeric`,month:`numeric`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}):new Intl.DateTimeFormat(`en-US`,{hour12:!1,timeZone:e,year:`numeric`,month:`numeric`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`})),Lt[e]}function Vt(e,t,n,r,i,a,o){let s=new Date(0);return s.setUTCFullYear(e,t,n),s.setUTCHours(r,i,a,o),s}var Ht=36e5,Ut=6e4,Wt={timezone:/([Z+-].*)$/,timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function Gt(e,t,n){if(!e)return 0;let r=Wt.timezoneZ.exec(e);if(r)return 0;let i,a;if(r=Wt.timezoneHH.exec(e),r)return i=parseInt(r[1],10),Yt(i)?-(i*Ht):NaN;if(r=Wt.timezoneHHMM.exec(e),r){i=parseInt(r[2],10);let e=parseInt(r[3],10);return Yt(i,e)?(a=Math.abs(i)*Ht+e*Ut,r[1]===`+`?-a:a):NaN}if(Zt(e)){t=new Date(t||Date.now());let r=qt(n?t:Kt(t),e);return-(n?r:Jt(t,r,e))}return NaN}function Kt(e){return Vt(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}function qt(e,t){let n=Nt(e,t),r=Vt(n[0],n[1]-1,n[2],n[3]%24,n[4],n[5],0).getTime(),i=e.getTime(),a=i%1e3;return i-=a>=0?a:1e3+a,r-i}function Jt(e,t,n){let r=e.getTime()-t,i=qt(new Date(r),n);if(t===i)return t;r-=i-t;let a=qt(new Date(r),n);return i===a?i:Math.max(i,a)}function Yt(e,t){return-23<=e&&e<=23&&(t==null||0<=t&&t<=59)}var Xt={};function Zt(e){if(Xt[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),Xt[e]=!0,!0}catch{return!1}}var Qt=60*1e3,$t={X:function(e,t,n){let r=en(n.timeZone,e);if(r===0)return`Z`;switch(t){case`X`:return rn(r);case`XXXX`:case`XX`:return nn(r);default:return nn(r,`:`)}},x:function(e,t,n){let r=en(n.timeZone,e);switch(t){case`x`:return rn(r);case`xxxx`:case`xx`:return nn(r);default:return nn(r,`:`)}},O:function(e,t,n){let r=en(n.timeZone,e);switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+an(r,`:`);default:return`GMT`+nn(r,`:`)}},z:function(e,t,n){switch(t){case`z`:case`zz`:case`zzz`:return kt(`short`,e,n);default:return kt(`long`,e,n)}}};function en(e,t){let n=e?Gt(e,t,!0)/Qt:t?.getTimezoneOffset()??0;if(Number.isNaN(n))throw RangeError(`Invalid time zone specified: `+e);return n}function tn(e,t){let n=e<0?`-`:``,r=Math.abs(e).toString();for(;r.length<t;)r=`0`+r;return n+r}function nn(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=tn(Math.floor(r/60),2),a=tn(Math.floor(r%60),2);return n+i+t+a}function rn(e,t){return e%60==0?(e>0?`-`:`+`)+tn(Math.abs(e)/60,2):nn(e,t)}function an(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Math.floor(r/60),a=r%60;return a===0?n+String(i):n+String(i)+t+tn(a,2)}function on(e){let t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e-+t}var sn=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/,cn=36e5,ln=6e4,un=2,H={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,plainTime:/:/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:sn};function dn(e,t={}){if(arguments.length<1)throw TypeError(`1 argument required, but only `+arguments.length+` present`);if(e===null)return new Date(NaN);let n=t.additionalDigits==null?un:Number(t.additionalDigits);if(n!==2&&n!==1&&n!==0)throw RangeError(`additionalDigits must be 0, 1 or 2`);if(e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`)return new Date(e.getTime());if(typeof e==`number`||Object.prototype.toString.call(e)===`[object Number]`)return new Date(e);if(Object.prototype.toString.call(e)!==`[object String]`)return new Date(NaN);let r=fn(e),{year:i,restDateString:a}=pn(r.date,n),o=mn(a,i);if(o===null||isNaN(o.getTime()))return new Date(NaN);if(o){let e=o.getTime(),n=0,i;if(r.time&&(n=hn(r.time),n===null||isNaN(n)))return new Date(NaN);if(r.timeZone||t.timeZone){if(i=Gt(r.timeZone||t.timeZone,new Date(e+n)),isNaN(i))return new Date(NaN)}else i=on(new Date(e+n)),i=on(new Date(e+n+i));return new Date(e+n+i)}else return new Date(NaN)}function fn(e){let t={},n=H.dateTimePattern.exec(e),r;if(n?(t.date=n[1],r=n[3]):(n=H.datePattern.exec(e),n?(t.date=n[1],r=n[2]):(t.date=null,r=e)),r){let e=H.timeZone.exec(r);e?(t.time=r.replace(e[1],``),t.timeZone=e[1].trim()):t.time=r}return t}function pn(e,t){if(e){let n=H.YYY[t],r=H.YYYYY[t],i=H.YYYY.exec(e)||r.exec(e);if(i){let t=i[1];return{year:parseInt(t,10),restDateString:e.slice(t.length)}}if(i=H.YY.exec(e)||n.exec(e),i){let t=i[1];return{year:parseInt(t,10)*100,restDateString:e.slice(t.length)}}}return{year:null}}function mn(e,t){if(t===null)return null;let n,r,i;if(!e||!e.length)return n=new Date(0),n.setUTCFullYear(t),n;let a=H.MM.exec(e);if(a)return n=new Date(0),r=parseInt(a[1],10)-1,bn(t,r)?(n.setUTCFullYear(t,r),n):new Date(NaN);if(a=H.DDD.exec(e),a){n=new Date(0);let e=parseInt(a[1],10);return xn(t,e)?(n.setUTCFullYear(t,0,e),n):new Date(NaN)}if(a=H.MMDD.exec(e),a){n=new Date(0),r=parseInt(a[1],10)-1;let e=parseInt(a[2],10);return bn(t,r,e)?(n.setUTCFullYear(t,r,e),n):new Date(NaN)}if(a=H.Www.exec(e),a)return i=parseInt(a[1],10)-1,Sn(i)?gn(t,i):new Date(NaN);if(a=H.WwwD.exec(e),a){i=parseInt(a[1],10)-1;let e=parseInt(a[2],10)-1;return Sn(i,e)?gn(t,i,e):new Date(NaN)}return null}function hn(e){let t,n,r=H.HH.exec(e);if(r)return t=parseFloat(r[1].replace(`,`,`.`)),Cn(t)?t%24*cn:NaN;if(r=H.HHMM.exec(e),r)return t=parseInt(r[1],10),n=parseFloat(r[2].replace(`,`,`.`)),Cn(t,n)?t%24*cn+n*ln:NaN;if(r=H.HHMMSS.exec(e),r){t=parseInt(r[1],10),n=parseInt(r[2],10);let e=parseFloat(r[3].replace(`,`,`.`));return Cn(t,n,e)?t%24*cn+n*ln+e*1e3:NaN}return null}function gn(e,t,n){t||=0,n||=0;let r=new Date(0);r.setUTCFullYear(e,0,4);let i=r.getUTCDay()||7,a=t*7+n+1-i;return r.setUTCDate(r.getUTCDate()+a),r}var _n=[31,28,31,30,31,30,31,31,30,31,30,31],vn=[31,29,31,30,31,30,31,31,30,31,30,31];function yn(e){return e%400==0||e%4==0&&e%100!=0}function bn(e,t,n){if(t<0||t>11)return!1;if(n!=null){if(n<1)return!1;let r=yn(e);if(r&&n>vn[t]||!r&&n>_n[t])return!1}return!0}function xn(e,t){if(t<1)return!1;let n=yn(e);return!(n&&t>366||!n&&t>365)}function Sn(e,t){return!(e<0||e>52||t!=null&&(t<0||t>6))}function Cn(e,t,n){return!(e<0||e>=25||t!=null&&(t<0||t>=60)||n!=null&&(n<0||n>=60))}var wn=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function Tn(e,t,n={}){t=String(t);let r=t.match(wn);if(r){let i=dn(n.originalDate||e,n);t=r.reduce(function(e,t){if(t[0]===`'`)return e;let r=e.indexOf(t),a=e[r-1]===`'`,o=e.replace(t,`'`+$t[t[0]](i,t,n)+`'`);return a?o.substring(0,r-1)+o.substring(r+1):o},t)}return Tt(e,t,n)}function En(e,t,n){e=dn(e,n);let r=Gt(t,e,!0),i=new Date(e.getTime()-r),a=new Date(0);return a.setFullYear(i.getUTCFullYear(),i.getUTCMonth(),i.getUTCDate()),a.setHours(i.getUTCHours(),i.getUTCMinutes(),i.getUTCSeconds(),i.getUTCMilliseconds()),a}function Dn(e,t,n,r){return r={...r,timeZone:t,originalDate:e},Tn(En(e,t,{timeZone:r.timeZone}),n,r)}var U=r(),On=s(),kn=(0,B.createContext)(null),An=({children:e})=>{let t=(0,B.useRef)({}),n=(0,B.useCallback)(()=>{Object.keys(t.current).forEach(e=>{t.current[e]?.forEach(e=>{e()}),t.current[e]=[]})},[]);return(0,B.useEffect)(()=>()=>{n()},[n]),(0,U.jsx)(kn.Provider,{value:{terminators:t,cleanupWorkers:n},children:e})},jn=()=>{let e=(0,B.useContext)(kn);if(!e)throw Error(`useTerminators must be used within a TerminatorsWrapper`);return e},Mn=(0,B.createContext)(null),Nn=({children:e})=>{let[t,n]=(0,B.useState)({}),r=(0,B.useCallback)((e,t)=>{n(n=>({...n,[e]:{...n[e],...t}}))},[]);return(0,U.jsx)(Mn.Provider,{value:{sessionData:t,setSessionData:r},children:e})},Pn=()=>{let e=(0,B.useContext)(Mn);if(!e)throw Error(`useSessionData must be used within a SessionDataWrapper`);return e},Fn=(0,B.createContext)(null),In=({children:e,bootstrapPlugins:t=[],userConfigs:n=[],user:r,teamMember:i,business:a,clientObject:o,appPath:s})=>{let[c,l]=(0,B.useState)(!1),[u,d]=(0,B.useState)({}),f=(0,B.useMemo)(()=>Object.values(u).some(e=>e.waitingOnRouteScript),[u]),p=(0,B.useMemo)(()=>t.reduce((e,t)=>({...e,[t.api_name]:t.id}),{}),[t]),m=(0,B.useMemo)(()=>n.reduce((e,t)=>({...e,[t.api_name]:t.config}),{}),[n]),h=(0,B.useCallback)(()=>{l(!0)},[]);return(0,U.jsx)(Fn.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})})},Ln=()=>{let e=(0,B.useContext)(Fn);if(!e)throw Error(`useAppState must be used within an AppStateWrapper`);return e},Rn=(0,B.createContext)(null),zn=({children:e})=>{let[t,n]=(0,B.useState)({}),r=(0,B.useCallback)(e=>t=>{n(n=>({...n,[e]:t(n[e]??{indicator:`none`,hidden:!1,pending:!1})}))},[]),i=(0,B.useCallback)(e=>!e||!t[e]?{indicator:`none`,hidden:!1,pending:!1}:{...t[e]},[t]),a=(0,B.useMemo)(()=>{let e=Object.keys(t);return e.length>0&&e.some(e=>t[e]?.indicator===`block`)},[t]);return(0,U.jsx)(Rn.Provider,{value:{getRunnerStateUpdater:r,getRunnerState:i},children:e(a)})},Bn=()=>{let e=(0,B.useContext)(Rn);if(!e)throw Error(`useRunnerState must be used within a RunnerStateWrapper`);return e},Vn=(0,B.createContext)(null),Hn=({children:e,showing:t,showPrompt:n,show:r,onConfirm:i,onHide:a})=>{let[o,s]=(0,B.useState)([]),[c,l]=(0,B.useState)([]),[u,d]=(0,B.useState)([]),f=(0,B.useRef)(void 0),p=(0,B.useRef)(void 0),m=(0,B.useCallback)((e,t)=>{s(n=>[...n,{config:e,cb:t}])},[]),h=(0,B.useCallback)((e,t)=>{l(n=>[...n,{objectId:e,cb:t}])},[]),g=(0,B.useCallback)((e,t,n)=>{d(r=>[...r,{objectId:e,relatedEntityId:t,cb:n}])},[]),_=(0,B.useCallback)(e=>{c[0]?.cb(e),l(e=>e.slice(1))},[c]),v=(0,B.useCallback)(e=>{u[0]?.cb(e),d(e=>e.slice(1))},[u]);(0,B.useEffect)(()=>{o.length>0&&!t&&(f.current=o[0]?.config,p.current=o[0]?.cb,n())},[o,t,n]);let y=(0,B.useCallback)(()=>{f.current=void 0,p.current=void 0,s(e=>e.slice(1))},[]),b=(0,B.useCallback)((e,t)=>{p.current&&(p.current({canceled:t??!1,values:e??{},eventSource:`script`}),t?a(`script`):i(),y())},[y,i,a]),x=(0,B.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,U.jsx)(Vn.Provider,{value:{modalState:x,showModal:m,showCreateRecordModal:h,showCreateRelatedRecordModal:g,onCreateRecordComplete:_,onCreateRelatedRecordComplete:v,closeCurrentModal:b},children:e({showPluginModal:x.props.show,pluginApiName:x.config.pluginApiName??``,handleShowModal:m,handleShowCreateRecordModal:h,handleShowCreateRelatedRecordModal:g,derivedModalState:x,handleCreateRecordComplete:_,handleCreateRelatedRecordComplete:v,closeCurrentModal:b,showCreateRecordModal:c.length>0,createRecordModalObjectId:c[0]?.objectId??``,showCreateRelatedRecordModal:u.length>0,createRelatedRecordModalObjectId:u[0]?.objectId??``,createRelatedRecordModalRelatedEntityId:u[0]?.relatedEntityId??``})})},Un=()=>{let e=(0,B.useContext)(Vn);if(!e)throw Error(`useModals must be used within a ModalsWrapper`);return e},Wn=(0,B.createContext)(null),Gn=({children:e,monitoringExceptionHelper:t})=>{let n=(0,B.useCallback)((e,n)=>{t(e,{extra:n})},[t]);return(0,U.jsx)(Wn.Provider,{value:{sendException:n},children:e})},Kn=()=>{let e=(0,B.useContext)(Wn);if(!e)throw Error(`useMonitoring must be used within an MonitoringWrapper`);return e},qn=(0,B.createContext)(null),Jn=({children:e,onNavigate:t})=>{let n=(0,B.useCallback)(e=>{t(e,{replace:!1})},[t]),r=(0,B.useCallback)(e=>{t(e,{replace:!0})},[t]);return(0,U.jsx)(qn.Provider,{value:{push:n,replace:r},children:e})},Yn=()=>{let e=(0,B.useContext)(qn);if(!e)throw Error(`useHistory must be used within an HistoryWrapper`);return e},Xn=(0,B.createContext)(null),Zn=({children:e,performRequest:t,createFileId:n,performFileUpload:r,getPendingCacheCount:i,invalidateCache:a})=>(0,U.jsx)(Xn.Provider,{value:{performRequest:t,createFileId:n,performFileUpload:r,getPendingCacheCount:i,invalidateCache:a},children:e}),Qn=()=>{let e=(0,B.useContext)(Xn);if(!e)throw Error(`useNetwork must be used within a NetworkWrapper`);return e},$n=e=>e,er=(0,B.createContext)({t:$n}),tr=e=>{let{children:t,t:n=$n}=e;return(0,U.jsx)(er.Provider,{value:{t:n},children:t})},nr=()=>(0,B.useContext)(er),rr=(e,t)=>{if(!Array.isArray(e))throw Error(`Return value must be an array`);t.required.forEach(t=>{e.forEach((e,n)=>{if(!(t.key in e))throw Error(`Missing required field: ${t.key} in result row ${String(n)}`);let r=typeof e[t.key];if(r!==t.type)throw Error(`Invalid type for field: ${t.key} in result row ${String(n)}. Expected ${t.type}, got ${r}`)})}),t.optional.forEach(t=>{e.forEach((e,n)=>{if(t.key in e){let r=typeof e[t.key];if(r!==t.type)throw Error(`Invalid type for field: ${t.key} in result row ${String(n)}. Expected ${t.type}, got ${r}`)}})})},ir=({onError:e,showToast:t,clearToasts:n})=>{let{t:r}=nr(),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(void 0),{terminators:c}=jn(),{sessionData:l,setSessionData:u}=Pn(),{installedPluginAPINamesToIds:d,userConfigsByApiName:f,user:p,teamMember:m,business:h,clientObject:g,appPath:_}=Ln(),{getRunnerState:v,getRunnerStateUpdater:y}=Bn(),{showModal:b,showCreateRecordModal:x,closeCurrentModal:S}=Un(),{sendException:C}=Kn(),w=Yn(),{performRequest:T,createFileId:E,performFileUpload:D,getPendingCacheCount:O,invalidateCache:A}=Qn(),j=(0,B.useCallback)(t=>n=>{e?.(n);let r=n?.message??`Unknown plugin error`;C(Error(r),{error:n,workerName:`calendarSource`,pluginApiName:t?.plugin_api_name??``})},[e,C]);return[(0,B.useCallback)(async(i,o,v,C)=>{let M=``,N=k(o);s(N);try{let e=d[o.plugin_api_name];M=JSON.stringify({...v,pluginId:e,__kizen_user_config:f[o.plugin_api_name]})}catch{j(o)({message:r(`Arguments passed to the script are invalid`)})}let P=!1,F=await z({user:p,teamMember:m,business:h,onError:j(o),setLoadingState:a,scriptBody:i,clientObject:g,onStateChange:e=>{y(N)(t=>({...t,...e}))},workerName:`calendarSource`,args:M,pushHistory:w.push,onShowToast:t,onClearToasts:n,terminators:c,plugin:o,sessionData:l,setSessionData:u,onShowModal:b,onCloseModal:S,onShowCreateRecordModal:x,onShowCreateRelatedRecordModal:()=>{},onNetworkError:e=>{e?.status===503&&(P=!0)},appPath:_,onNetworkRequest:T,createFileId:E,performFileUpload:D,getPendingCacheCount:O,invalidateCache:A});try{C&&rr(F,C)}catch(t){e?.(t)}return{result:F,authError:P}},[p,m,d,h,g,w,t,n,c,l,u,b,x,j,y,f,e,T,E,_,D,O,A,r,S]),{...v(o),pending:i}]},ar=(0,B.createContext)(null),or=({children:e,showToast:t,clearToasts:n})=>(0,U.jsx)(ar.Provider,{value:{showToast:t,clearToasts:n},children:e}),sr=()=>{let e=(0,B.useContext)(ar);if(!e)throw Error(`useToast must be used within a ToastWrapper`);return e},cr=async(e,t,n,r)=>{let{result:i,authError:a}=await n(e,t,r,{required:[{key:`id`,type:`string`},{key:`name`,type:`string`}],optional:[{key:`description`,type:`string`}]});return Array.isArray(i)?{result:i,authError:a}:(console.warn(`Expected calendar source script to return an array, but got:`,i),{result:[],authError:a})},lr=async(e,t,n,r)=>{let{result:i,authError:a}=await n(e,t,r,{required:[{key:`id`,type:`string`},{key:`calendar_id`,type:`string`},{key:`title`,type:`string`},{key:`start_time`,type:`number`},{key:`end_time`,type:`number`}],optional:[{key:`description`,type:`string`},{key:`url`,type:`string`},{key:`activity_id`,type:`string`},{key:`all_day`,type:`boolean`},{key:`busy`,type:`boolean`}]});return Array.isArray(i)?{result:i,authError:a}:(console.warn(`Expected calendar event script to return an array, but got:`,i),{result:[],authError:a})},ur=(e,t,n={})=>{let{showToast:r,clearToasts:i}=sr(),{t:a}=nr(),[o]=ir({onError:e=>{r({message:`${a(`Error fetching calendar options.`)} ${e?.message??``}`,variant:`failure`})},showToast:r,clearToasts:i}),s=ve({queries:t.map(t=>({queryKey:j.CALENDAR_SOURCE_CALENDAR_LIST(t.plugin_api_name,t.api_name),queryFn:async()=>{let e=n[t.plugin_api_name]?.business_config??{},{result:r,authError:i}=await cr(t.calendars_script,t,o,e);return{source:t,calendars:r,authError:i}},enabled:e&&!!t.calendars_script}))}),c=s.some(e=>e.isLoading);return{calendars:(0,B.useMemo)(()=>c||!e?{}:s.reduce((e,t)=>{if(!t.data?.source.plugin_api_name||typeof t.data.source.plugin_api_name!=`string`)return e;let n=t.data.source.plugin_api_name;return e[n]??=[],e[n].push(...t.data.calendars.map(e=>({calendar:e,source:t.data.source}))),e},{}),[s,c,e]),errorServices:(0,B.useMemo)(()=>s.filter(e=>e.data?.authError).map(e=>e.data?.source.plugin_api_name),[s]),isLoading:c}},dr=`yyyy-MM-dd'T'HH:mm:ssXXX`,fr=e=>{if(!/^\d{4}-\d{2}-\d{2}$/.test(e))throw Error(`Invalid date string: ${e}. Expected format: YYYY-MM-DD`);let[t,n,r]=e.split(`-`).map(Number);return new Date(t,n-1,r)},pr=(e,t)=>Dn(e,t,dr),mr=(e,t,n={})=>{let r=Intl.DateTimeFormat().resolvedOptions().timeZone,i=pr(We(fr(t.rangeStart)),r),a=pr(Dt(fr(t.rangeEnd)),r),{showToast:o,clearToasts:s}=sr(),{t:c}=nr(),[l]=ir({onError:e=>{o({message:`${c(`Error fetching calendar events.`)} ${e?.message??``}`,variant:`failure`})},showToast:o,clearToasts:s}),u=ve({queries:e.map(({calendar:e,source:r})=>({queryKey:j.CALENDAR_SOURCE_EVENTS(r.plugin_api_name,r.api_name,e.id,t),queryFn:async()=>{let t=n[r.plugin_api_name]?.business_config??{},{result:o,authError:s}=await lr(r.events_script,r,l,{...t,calendar:{calendar_id:e.id,range_start:i,range_end:a}});return{calendarId:e.id,events:o,authError:s}}}))}),d=u.some(e=>e.isLoading),f=(0,B.useMemo)(()=>e.reduce((e,{calendar:t,source:n})=>(e[t.id]={source:n,calendar:t},e),{}),[e]);return{events:(0,B.useMemo)(()=>d?{}:u.reduce((e,t)=>(t.data?.calendarId&&(e[t.data.calendarId]=t.data.events),e),{}),[u,d]),sources:f,isLoading:d}},hr=({onError:e,scriptUIRef:t,plugin:n,onChangeMinimized:r})=>{let{terminators:i}=jn(),{sessionData:a,setSessionData:o}=Pn(),{installedPluginAPINamesToIds:s,userConfigsByApiName:c,user:l,teamMember:u,business:d,clientObject:f,appPath:p}=Ln(),{showModal:m,showCreateRecordModal:h,showCreateRelatedRecordModal:g,closeCurrentModal:_}=Un(),{sendException:v}=Kn(),{showToast:y,clearToasts:b}=sr(),x=Yn(),{performRequest:S,createFileId:C,performFileUpload:w,getPendingCacheCount:T,invalidateCache:E}=Qn(),{t:D}=nr(),[O,k]=(0,B.useState)(!1),[A,j]=(0,B.useState)({indicator:`none`,hidden:!0,triggerHidden:!1,hideHeader:!1}),M=(0,B.useRef)(!1),[N,P]=(0,B.useState)(!1);O&&!M.current&&(M.current=!0),!O&&M.current&&!N&&P(!0);let F=(0,B.useCallback)(t=>{e?.(t);let r=t?.message??`Unknown plugin error`;v(Error(r),{error:t,workerName:`floatingFrame`,pluginApiName:n.plugin_api_name})},[e,n,v]),I=(0,B.useCallback)((e,v)=>{let O=``;try{let e=s[n.plugin_api_name];O=JSON.stringify({...v,pluginId:e,__kizen_user_config:c[n.plugin_api_name]})}catch{F({message:D(`Arguments passed to the script are invalid`)})}return z({user:l,teamMember:u,business:d,onError:F,setLoadingState:(...e)=>{(0,On.flushSync)(()=>{k(...e)})},scriptBody:e,clientObject:f,scriptUIRef:t,onStateChange:e=>{let{minimized:t,...n}=e;typeof t==`boolean`&&r?.(t),j(e=>({...e,...n}))},workerName:`floatingFramePlugin`,args:O,pushHistory:x.push,plugin:n,onShowToast:y,onClearToasts:b,terminators:i,sessionData:a,setSessionData:o,onShowModal:m,onCloseModal:_,onShowCreateRecordModal:h,onShowCreateRelatedRecordModal:g,appPath:p,onNetworkRequest:S,createFileId:C,performFileUpload:w,getPendingCacheCount:T,invalidateCache:E,onRunEventScript:(e,t)=>{let r=n.event_scripts?.[e];if(!r){F({message:`${D(`Event script not found:`)} ${e}`});return}I(r,t)}})},[l,u,d,s,f,t,x,n,r,y,b,i,a,o,F,j,c,m,h,g,S,p,C,w,T,E,D,_]);return[I,{...A,pending:N?!1:O}]},gr=({onError:e,scriptUIRef:t,plugin:n})=>{let{terminators:r}=jn(),{sessionData:i,setSessionData:a}=Pn(),{installedPluginAPINamesToIds:o,userConfigsByApiName:s,user:c,teamMember:l,business:u,clientObject:d,appPath:f}=Ln(),{getRunnerState:p,getRunnerStateUpdater:m}=Bn(),{showModal:h,showCreateRecordModal:g,closeCurrentModal:_}=Un(),{sendException:v}=Kn(),{showToast:y,clearToasts:b}=sr(),x=Yn(),{performRequest:S,createFileId:C,performFileUpload:w,getPendingCacheCount:T,invalidateCache:E}=Qn(),{t:D}=nr(),[O,A]=(0,B.useState)(!1),[j,M]=(0,B.useState)(void 0),N=(0,B.useCallback)((t,r)=>{e?.(t);let i=t?.message??`Unknown plugin error`;v(Error(i),{error:t,workerName:`genericPlugin`,pluginApiName:n?.plugin_api_name??r?.plugin_api_name??``})},[e,n,v]),P=(0,B.useCallback)((e,p,v)=>{let O=``,j=k(v);M(j);try{let e=o[n?.plugin_api_name??v?.plugin_api_name??``];O=JSON.stringify({...p,pluginId:e,__kizen_user_config:s[n?.plugin_api_name??v?.plugin_api_name??``]})}catch{N({message:D(`Arguments passed to the script are invalid`)})}return z({user:c,teamMember:l,business:u,onError:N,setLoadingState:A,scriptBody:e,clientObject:d,scriptUIRef:t,onStateChange:e=>{m(j)(t=>({...t,...e}))},workerName:`genericPlugin`,args:O,pushHistory:x.push,onShowToast:y,onClearToasts:b,terminators:r,plugin:n,executionPlugin:v,sessionData:i,setSessionData:a,onShowModal:h,onCloseModal:_,onShowCreateRecordModal:g,onShowCreateRelatedRecordModal:()=>{},appPath:f,onNetworkRequest:S,createFileId:C,performFileUpload:w,getPendingCacheCount:T,invalidateCache:E,onRunEventScript:(e,t)=>{let r=n?.event_scripts?.[e];if(!r){N({message:`${D(`Event script not found:`)} ${e}`});return}P(r,t,v)}})},[c,l,o,u,d,t,x,y,b,r,n,i,a,N,m,s,h,g,S,f,C,w,T,E,D,_]);return[P,{...p(j),pending:O}]},_r=({entityId:e,objectId:t,onError:n,scriptUIRef:r,onReleaseBlockingScript:i})=>{let{terminators:a}=jn(),{sessionData:o,setSessionData:s}=Pn(),{installedPluginAPINamesToIds:c,userConfigsByApiName:l,user:u,teamMember:d,business:f,clientObject:p,appPath:m}=Ln(),{getRunnerState:h,getRunnerStateUpdater:g}=Bn(),{showModal:_,showCreateRecordModal:v,showCreateRelatedRecordModal:y,closeCurrentModal:b}=Un(),{sendException:x}=Kn(),{showToast:S,clearToasts:C}=sr(),w=Yn(),{performRequest:T,createFileId:E,performFileUpload:D,getPendingCacheCount:O,invalidateCache:A}=Qn(),{t:j}=nr(),[M,N]=(0,B.useState)(!1),[P,F]=(0,B.useState)(void 0),I=(0,B.useCallback)((r,i)=>{n?.(r);let a=r?.message??`Unknown plugin error`;x(Error(a),{error:r,workerName:`recordDetail`,pluginApiName:i?.plugin_api_name??``,objectId:t,entityId:e})},[n,t,e,x]);return[(0,B.useCallback)((n,h,x,M)=>{let P=``;try{let e=c[x?.plugin_api_name??``];P=JSON.stringify({...h,pluginId:e,__kizen_user_config:l[x?.plugin_api_name??``]})}catch{I({message:j(`Arguments passed to the script are invalid`)},x)}let L=k(x);return F(L),z({user:u,teamMember:d,business:f,onReleaseBlockingScript:i,onError:e=>{I(e,x)},setLoadingState:N,scriptBody:n,clientObject:p,scriptUIRef:r,onStateChange:e=>{g(L)(t=>({...t,...e}))},workerName:`recordDetail`,args:P,context:M??{entityId:e,objectId:t},pushHistory:w.push,onShowToast:S,onClearToasts:C,terminators:a,executionPlugin:x,sessionData:o,setSessionData:s,onShowModal:_,onCloseModal:b,onShowCreateRecordModal:v,onShowCreateRelatedRecordModal:y,appPath:m,onNetworkRequest:T,createFileId:E,performFileUpload:D,getPendingCacheCount:O,invalidateCache:A})},[u,d,c,f,e,t,p,r,w,S,C,a,o,s,_,v,y,i,I,g,l,T,m,E,D,O,A,j,b]),{...h(P),pending:M}]},vr=(e,t,n,r,i={})=>{let a=(0,B.useMemo)(()=>t?.event_scripts??{},[t]),o=(0,B.useCallback)(t=>{if(!r){let n=t.target.getAttribute(`data-script`);n&&a[n]&&(t.preventDefault(),t.stopPropagation(),e(a[n],{...i}))}},[r,e,a,i]),s=(0,B.useCallback)(t=>{if(t.preventDefault(),t.stopPropagation(),!r){let n=t.target,r=n.getAttribute(`data-script`);if(r&&a[r]){let t=new FormData(n),o=Object.fromEntries([...new Set(t.keys())].map(e=>[e,t.getAll(e)]));e(a[r],{...i,formData:o})}}},[r,e,a,i]);(0,B.useEffect)(()=>{let e=n?.current;return e&&(e.addEventListener(`click`,o),e.addEventListener(`submit`,s)),()=>{e&&(e.removeEventListener(`click`,o),e.removeEventListener(`submit`,s))}},[o,s,t,n])},yr=(e,t,n)=>(0,B.useMemo)(()=>ce(e,t,n),[e,t,n]),br=(e,t,n)=>{let{showToast:r}=sr(),{t:i}=nr(),a=(0,B.useRef)(null),o=(0,B.useRef)(null),s=e?.css,{html:c}=yr(e?.html,e?.plugin_api_name,n),[l,{pending:u}]=gr({onError:e=>{r({message:`${i(`Script could not be executed:`)} ${e?.message??`Unknown Error`}`,variant:`failure`})},scriptUIRef:a,plugin:e});return vr(l,e,o,u,t),{scopedCss:`
2
2
  @scope {
3
3
  ${s??``}
4
4
  }
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{N as t}from"./fa-core-DteucspK.js";var n=e(t(),1);function r(e,t){let[r,i]=(0,n.useState)(()=>{try{let n=localStorage.getItem(e);return n===null?t:JSON.parse(n)}catch{return t}});return[r,(0,n.useCallback)(t=>{i(t),t==null?localStorage.removeItem(e):localStorage.setItem(e,JSON.stringify(t))},[e])]}export{r as t};
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{I as t}from"./fa-core-BSqLAjHu.js";var n=e(t(),1);function r(e,t){let[r,i]=(0,n.useState)(()=>{try{let n=localStorage.getItem(e);return n===null?t:JSON.parse(n)}catch{return t}});return[r,(0,n.useCallback)(t=>{i(t),t==null?localStorage.removeItem(e):localStorage.setItem(e,JSON.stringify(t))},[e])]}export{r as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{I as t}from"./fa-core-BSqLAjHu.js";import{a as n}from"./useParams-D3awshYI.js";var r=e(t(),1);r.use;var i=typeof window<`u`?r.useLayoutEffect:r.useEffect;function a(e){let t=r.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function o(e,t,n={},i={}){r.useEffect(()=>{if(!e.current||i.disabled||typeof IntersectionObserver!=`function`)return;let r=new IntersectionObserver(([e])=>{t(e)},n);return r.observe(e.current),()=>{r.disconnect()}},[t,n,i.disabled,e])}function s(e){let t=r.useRef(null);return r.useImperativeHandle(e,()=>t.current,[]),t}function c(e){let t=n();return r.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}export{a,i,s as n,o as r,c as t};
@@ -1 +1 @@
1
- import{r as e,t}from"./rolldown-runtime-Dw2cE7zH.js";import{N as n}from"./fa-core-DteucspK.js";function r(e){return e[e.length-1]}function i(e){return typeof e==`function`}function a(e,t){return i(e)?e(t):e}var o=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable,c=()=>Object.create(null),l=(e,t)=>u(e,t,c);function u(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=m(e)&&m(i);if(!a&&!(f(e)&&f(i)))return i;let s=a?e:d(e);if(!s)return i;let c=a?i:d(i);if(!c)return i;let l=s.length,p=c.length,h=a?Array(p):n(),g=0;for(let t=0;t<p;t++){let s=a?t:c[t],d=e[s],f=i[s];if(d===f){h[s]=d,(a?t<l:o.call(e,s))&&g++;continue}if(d===null||f===null||typeof d!=`object`||typeof f!=`object`){h[s]=f;continue}let p=u(d,f,n,r+1);h[s]=p,p===d&&g++}return l===p&&g===l?e:h}function d(e){let t=Object.getOwnPropertyNames(e);for(let n of t)if(!s.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(!s.call(e,t))return!1;r.push(t)}return r}function f(e){if(!p(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!p(n)||!n.hasOwnProperty(`isPrototypeOf`))}function p(e){return Object.prototype.toString.call(e)===`[object Object]`}function m(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function h(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(!h(e[r],t[r],n))return!1;return!0}if(f(e)&&f(t)){let r=n?.ignoreUndefined??!0;if(n?.partial){for(let i in t)if((!r||t[i]!==void 0)&&!h(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||!h(e[o],t[o],n)))return!1;return i===a}return!1}function g(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 _(e){return!!(e&&typeof e==`object`&&typeof e.then==`function`)}function v(e){return e.replace(/[\x00-\x1f\x7f]/g,``)}function y(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 v(t)}var b=[`http:`,`https:`,`mailto:`,`tel:`];function x(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function S(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+=y(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=y(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function C(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function w(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 T(){throw Error(`Invariant failed`)}var E=e(n(),1),D=E.createContext(null);function O(e){return E.useContext(D)}var k=E.createContext(void 0),A=E.createContext(void 0),j=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})),M=t(((e,t)=>{t.exports=j()})),N=t((e=>{var t=n(),r=M();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}})),P=t(((e,t)=>{t.exports=N()}))();function F(e,t){return e===t}function I(e,t,n=F){let r=(0,E.useCallback)(t=>{if(!e)return()=>{};let{unsubscribe:n}=e.subscribe(t);return n},[e]),i=(0,E.useCallback)(()=>e?.get(),[e]);return(0,P.useSyncExternalStoreWithSelector)(r,i,i,t,n)}var L={get:()=>void 0,subscribe:()=>({unsubscribe:()=>{}})};function R(e){let t=O(),n=E.useContext(e.from?A:k),r=e.from??n,i=r?e.from?t.stores.getRouteMatchStore(r):t.stores.matchStores.get(r):void 0,a=E.useRef(void 0);return I(i??L,n=>{if((e.shouldThrow??!0)&&!n&&T(),n===void 0)return;let r=e.select?e.select(n):n;if(e.structuralSharing??t.options.defaultStructuralSharing){let e=u(a.current,r);return a.current=e,e}return r})}function z(e){return R({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}})}var B={queryKey:[`bundle`],queryFn:async()=>{let e=await fetch(`/api/bundle`);if(!e.ok)throw Error(`Failed to fetch bundle.json`);return e.json()}};export{f as _,k as a,l as b,T as c,g as d,S as f,x as g,a as h,I as i,b as l,C as m,z as n,O as o,h as p,R as r,D as s,B as t,w as u,_ as v,u as x,r as y};
1
+ import{r as e,t}from"./rolldown-runtime-Dw2cE7zH.js";import{I as n}from"./fa-core-BSqLAjHu.js";function r(e){return e[e.length-1]}function i(e){return typeof e==`function`}function a(e,t){return i(e)?e(t):e}var o=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable,c=()=>Object.create(null),l=(e,t)=>u(e,t,c);function u(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=m(e)&&m(i);if(!a&&!(f(e)&&f(i)))return i;let s=a?e:d(e);if(!s)return i;let c=a?i:d(i);if(!c)return i;let l=s.length,p=c.length,h=a?Array(p):n(),g=0;for(let t=0;t<p;t++){let s=a?t:c[t],d=e[s],f=i[s];if(d===f){h[s]=d,(a?t<l:o.call(e,s))&&g++;continue}if(d===null||f===null||typeof d!=`object`||typeof f!=`object`){h[s]=f;continue}let p=u(d,f,n,r+1);h[s]=p,p===d&&g++}return l===p&&g===l?e:h}function d(e){let t=Object.getOwnPropertyNames(e);for(let n of t)if(!s.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(!s.call(e,t))return!1;r.push(t)}return r}function f(e){if(!p(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!p(n)||!n.hasOwnProperty(`isPrototypeOf`))}function p(e){return Object.prototype.toString.call(e)===`[object Object]`}function m(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function h(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(!h(e[r],t[r],n))return!1;return!0}if(f(e)&&f(t)){let r=n?.ignoreUndefined??!0;if(n?.partial){for(let i in t)if((!r||t[i]!==void 0)&&!h(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||!h(e[o],t[o],n)))return!1;return i===a}return!1}function g(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 _(e){return!!(e&&typeof e==`object`&&typeof e.then==`function`)}function v(e){return e.replace(/[\x00-\x1f\x7f]/g,``)}function y(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 v(t)}var b=[`http:`,`https:`,`mailto:`,`tel:`];function x(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function S(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+=y(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=y(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function C(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function w(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 T(){throw Error(`Invariant failed`)}var E=e(n(),1),D=E.createContext(null);function O(e){return E.useContext(D)}var k=E.createContext(void 0),A=E.createContext(void 0),j=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})),M=t(((e,t)=>{t.exports=j()})),N=t((e=>{var t=n(),r=M();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}})),P=t(((e,t)=>{t.exports=N()}))();function F(e,t){return e===t}function I(e,t,n=F){let r=(0,E.useCallback)(t=>{if(!e)return()=>{};let{unsubscribe:n}=e.subscribe(t);return n},[e]),i=(0,E.useCallback)(()=>e?.get(),[e]);return(0,P.useSyncExternalStoreWithSelector)(r,i,i,t,n)}var L={get:()=>void 0,subscribe:()=>({unsubscribe:()=>{}})};function R(e){let t=O(),n=E.useContext(e.from?A:k),r=e.from??n,i=r?e.from?t.stores.getRouteMatchStore(r):t.stores.matchStores.get(r):void 0,a=E.useRef(void 0);return I(i??L,n=>{if((e.shouldThrow??!0)&&!n&&T(),n===void 0)return;let r=e.select?e.select(n):n;if(e.structuralSharing??t.options.defaultStructuralSharing){let e=u(a.current,r);return a.current=e,e}return r})}function z(e){return R({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}})}export{_,O as a,u as b,b as c,S as d,h as f,f as g,x as h,k as i,w as l,a as m,R as n,D as o,C as p,I as r,T as s,z as t,g as u,r as v,l as y};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{M as t,N as n}from"./fa-core-DteucspK.js";var r=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(){}},i=new class extends r{#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`}},a={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},o=new class{#e=a;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 s(e){setTimeout(e,0)}var c=typeof window>`u`||`Deno`in globalThis;function l(){}function u(e,t){return typeof e==`function`?e(t):e}function d(e){return typeof e==`number`&&e>=0&&e!==1/0}function f(e,t){return Math.max(e+(t||0)-Date.now(),0)}function p(e,t){return typeof e==`function`?e(t):e}function m(e,t){return typeof e==`function`?e(t):e}function h(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==_(o,t.options))return!1}else if(!y(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 g(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(v(t.options.mutationKey)!==v(a))return!1}else if(!y(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function _(e,t){return(t?.queryKeyHashFn||v)(e)}function v(e){return JSON.stringify(e,(e,t)=>w(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function y(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>y(e[n],t[n])):!1}var b=Object.prototype.hasOwnProperty;function x(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=C(e)&&C(t);if(!r&&!(w(e)&&w(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:b.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=x(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function S(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 C(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function w(e){if(!ee(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!ee(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function ee(e){return Object.prototype.toString.call(e)===`[object Object]`}function te(e){return new Promise(t=>{o.setTimeout(t,e)})}function T(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:x(e,t)}function ne(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function re(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var E=Symbol();function D(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===E?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function O(e,t){return typeof e==`function`?e(...t):!!e}function ie(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 k=(()=>{let e=()=>c;return{isServer(){return e()},setIsServer(t){e=t}}})();function A(){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 ae=s;function oe(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=ae,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=oe(),M=new class extends r{#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 se(e){return Math.min(1e3*2**e,3e4)}function N(e){return(e??`online`)===`online`?M.isOnline():!0}var P=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function F(e){let t=!1,n=0,r,a=A(),o=()=>a.status!==`pending`,s=t=>{if(!o()){let n=new P(t);p(n),e.onCancel?.(n)}},c=()=>{t=!0},l=()=>{t=!1},u=()=>i.isFocused()&&(e.networkMode===`always`||M.isOnline())&&e.canRun(),d=()=>N(e.networkMode)&&e.canRun(),f=e=>{o()||(r?.(),a.resolve(e))},p=e=>{o()||(r?.(),a.reject(e))},m=()=>new Promise(t=>{r=e=>{(o()||u())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,o()||e.onContinue?.()}),h=()=>{if(o())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(f).catch(r=>{if(o())return;let i=e.retry??(k.isServer()?0:3),a=e.retryDelay??se,s=typeof a==`function`?a(n,r):a,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){p(r);return}n++,e.onFail?.(n,r),te(s).then(()=>u()?void 0:m()).then(()=>{t?p(r):h()})})};return{promise:a,status:()=>a.status,cancel:s,continue:()=>(r?.(),a),cancelRetry:c,continueRetry:l,canStart:d,start:()=>(d()?h():m().then(h),a)}}var I=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),d(this.gcTime)&&(this.#e=o.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(k.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(o.clearTimeout(this.#e),this.#e=void 0)}},ce=class extends I{#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=R(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=R(this.options);e.data!==void 0&&(this.setState(L(e.data,e.dataUpdatedAt)),this.#e=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#n.remove(this)}setData(e,t){let n=T(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(l).catch(l):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=>m(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===E||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>p(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:!f(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=D(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=F({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof P&&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 P){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,...le(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...L(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 le(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:N(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function L(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function R(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 z=class extends r{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=A(),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),B(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return V(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return V(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 m(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&&!S(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&H(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||m(this.options.enabled,this.#t)!==m(t.enabled,this.#t)||p(this.options.staleTime,this.#t)!==p(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||m(this.options.enabled,this.#t)!==m(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 de(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(l)),t}#g(){this.#b();let e=p(this.options.staleTime,this.#t);if(k.isServer()||this.#r.isStale||!d(e))return;let t=f(this.#r.dataUpdatedAt,e)+1;this.#d=o.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,!(k.isServer()||m(this.options.enabled,this.#t)===!1||!d(this.#p)||this.#p===0)&&(this.#f=o.setInterval(()=>{(this.options.refetchIntervalInBackground||i.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(o.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(o.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&&B(e,t),o=i&&H(e,n,t,r);(a||o)&&(l={...l,...le(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:h}=l;d=l.data;let g=!1;if(t.placeholderData!==void 0&&d===void 0&&h===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,g=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(h=`success`,d=T(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!g)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=T(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(),h=`error`);let _=l.fetchStatus===`fetching`,v=h===`pending`,y=h===`error`,b=v&&_,x=d!==void 0,S={status:h,fetchStatus:l.fetchStatus,isPending:v,isSuccess:h===`success`,isError:y,isInitialLoading:b,isLoading:b,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:_,isRefetching:_&&!v,isLoadingError:y&&!x,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:y&&x,isStale:U(e,t),refetch:this.refetch,promise:this.#o,isEnabled:m(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=S.data!==void 0,r=S.status===`error`&&!t,i=e=>{r?e.reject(S.error):t&&e.resolve(S.data)},a=()=>{i(this.#o=S.promise=A())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||S.data!==o.value)&&a();break;case`rejected`:(!r||S.error!==o.reason)&&a();break}}return S}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),!S(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 ue(e,t){return m(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&t.retryOnMount===!1)}function B(e,t){return ue(e,t)||e.state.data!==void 0&&V(e,t,t.refetchOnMount)}function V(e,t,n){if(m(t.enabled,e)!==!1&&p(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&U(e,t)}return!1}function H(e,t,n,r){return(e!==t||m(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&U(e,n)}function U(e,t){return m(t.enabled,e)!==!1&&e.isStaleByTime(p(t.staleTime,e))}function de(e,t){return!S(e.getCurrentResult(),t)}var W=e(n(),1),fe=t(),G=W.createContext(void 0),K=e=>{let t=W.useContext(G);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},pe=({client:e,children:t})=>(W.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,fe.jsx)(G.Provider,{value:e,children:t})),q=W.createContext(!1),J=()=>W.useContext(q);q.Provider;function me(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var he=W.createContext(me()),Y=()=>W.useContext(he),X=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?O(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},Z=e=>{W.useEffect(()=>{e.clearReset()},[e])},Q=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||O(n,[e.error,r])),ge=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))}},_e=(e,t)=>e.isLoading&&e.isFetching&&!t,ve=(e,t)=>e?.suspense&&t.isPending,$=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function ye(e,t,n){let r=J(),i=Y(),a=K(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash);o._optimisticResults=r?`isRestoring`:`optimistic`,ge(o),X(o,i,s),Z(i);let c=!a.getQueryCache().get(o.queryHash),[u]=W.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),f=!r&&e.subscribed!==!1;if(W.useSyncExternalStore(W.useCallback(e=>{let t=f?u.subscribe(j.batchCalls(e)):l;return u.updateResult(),t},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),W.useEffect(()=>{u.setOptions(o)},[o,u]),ve(o,d))throw $(o,u,i);if(Q({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!k.isServer()&&_e(d,r)&&(c?$(o,u,i):s?.promise)?.catch(l).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}function be(e,t){return ye(e,z,t)}export{x as A,u as C,h as D,g as E,i as F,r as I,S as M,O as N,l as O,E as P,D as S,_ as T,M as _,X as a,ne as b,Y as c,pe as d,K as f,F as g,I as h,ve as i,p as j,y as k,J as l,ce as m,ge as n,Q as o,z as p,$ as r,Z as s,be as t,G as u,j as v,v as w,re as x,ie as y};
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{F as t,I as n}from"./fa-core-BSqLAjHu.js";var r=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(){}},i=new class extends r{#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`}},a={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},o=new class{#e=a;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 s(e){setTimeout(e,0)}var c=typeof window>`u`||`Deno`in globalThis;function l(){}function u(e,t){return typeof e==`function`?e(t):e}function d(e){return typeof e==`number`&&e>=0&&e!==1/0}function f(e,t){return Math.max(e+(t||0)-Date.now(),0)}function p(e,t){return typeof e==`function`?e(t):e}function m(e,t){return typeof e==`function`?e(t):e}function h(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==_(o,t.options))return!1}else if(!y(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 g(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(v(t.options.mutationKey)!==v(a))return!1}else if(!y(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function _(e,t){return(t?.queryKeyHashFn||v)(e)}function v(e){return JSON.stringify(e,(e,t)=>w(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function y(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>y(e[n],t[n])):!1}var b=Object.prototype.hasOwnProperty;function x(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=C(e)&&C(t);if(!r&&!(w(e)&&w(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:b.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=x(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function S(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 C(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function w(e){if(!ee(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!ee(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function ee(e){return Object.prototype.toString.call(e)===`[object Object]`}function te(e){return new Promise(t=>{o.setTimeout(t,e)})}function T(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:x(e,t)}function ne(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function re(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var E=Symbol();function D(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===E?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function O(e,t){return typeof e==`function`?e(...t):!!e}function ie(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 k=(()=>{let e=()=>c;return{isServer(){return e()},setIsServer(t){e=t}}})();function A(){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 ae=s;function oe(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=ae,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=oe(),M=new class extends r{#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 se(e){return Math.min(1e3*2**e,3e4)}function N(e){return(e??`online`)===`online`?M.isOnline():!0}var P=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function F(e){let t=!1,n=0,r,a=A(),o=()=>a.status!==`pending`,s=t=>{if(!o()){let n=new P(t);p(n),e.onCancel?.(n)}},c=()=>{t=!0},l=()=>{t=!1},u=()=>i.isFocused()&&(e.networkMode===`always`||M.isOnline())&&e.canRun(),d=()=>N(e.networkMode)&&e.canRun(),f=e=>{o()||(r?.(),a.resolve(e))},p=e=>{o()||(r?.(),a.reject(e))},m=()=>new Promise(t=>{r=e=>{(o()||u())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,o()||e.onContinue?.()}),h=()=>{if(o())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(f).catch(r=>{if(o())return;let i=e.retry??(k.isServer()?0:3),a=e.retryDelay??se,s=typeof a==`function`?a(n,r):a,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){p(r);return}n++,e.onFail?.(n,r),te(s).then(()=>u()?void 0:m()).then(()=>{t?p(r):h()})})};return{promise:a,status:()=>a.status,cancel:s,continue:()=>(r?.(),a),cancelRetry:c,continueRetry:l,canStart:d,start:()=>(d()?h():m().then(h),a)}}var I=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),d(this.gcTime)&&(this.#e=o.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(k.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(o.clearTimeout(this.#e),this.#e=void 0)}},ce=class extends I{#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=R(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=R(this.options);e.data!==void 0&&(this.setState(L(e.data,e.dataUpdatedAt)),this.#e=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#n.remove(this)}setData(e,t){let n=T(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(l).catch(l):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=>m(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===E||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>p(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:!f(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=D(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=F({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof P&&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 P){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,...le(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...L(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 le(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:N(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function L(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function R(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 z=class extends r{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=A(),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),B(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return V(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return V(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 m(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&&!S(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&H(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||m(this.options.enabled,this.#t)!==m(t.enabled,this.#t)||p(this.options.staleTime,this.#t)!==p(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||m(this.options.enabled,this.#t)!==m(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 de(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(l)),t}#g(){this.#b();let e=p(this.options.staleTime,this.#t);if(k.isServer()||this.#r.isStale||!d(e))return;let t=f(this.#r.dataUpdatedAt,e)+1;this.#d=o.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,!(k.isServer()||m(this.options.enabled,this.#t)===!1||!d(this.#p)||this.#p===0)&&(this.#f=o.setInterval(()=>{(this.options.refetchIntervalInBackground||i.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(o.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(o.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&&B(e,t),o=i&&H(e,n,t,r);(a||o)&&(l={...l,...le(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:h}=l;d=l.data;let g=!1;if(t.placeholderData!==void 0&&d===void 0&&h===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,g=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(h=`success`,d=T(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!g)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=T(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(),h=`error`);let _=l.fetchStatus===`fetching`,v=h===`pending`,y=h===`error`,b=v&&_,x=d!==void 0,S={status:h,fetchStatus:l.fetchStatus,isPending:v,isSuccess:h===`success`,isError:y,isInitialLoading:b,isLoading:b,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:_,isRefetching:_&&!v,isLoadingError:y&&!x,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:y&&x,isStale:U(e,t),refetch:this.refetch,promise:this.#o,isEnabled:m(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=S.data!==void 0,r=S.status===`error`&&!t,i=e=>{r?e.reject(S.error):t&&e.resolve(S.data)},a=()=>{i(this.#o=S.promise=A())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||S.data!==o.value)&&a();break;case`rejected`:(!r||S.error!==o.reason)&&a();break}}return S}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),!S(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 ue(e,t){return m(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&t.retryOnMount===!1)}function B(e,t){return ue(e,t)||e.state.data!==void 0&&V(e,t,t.refetchOnMount)}function V(e,t,n){if(m(t.enabled,e)!==!1&&p(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&U(e,t)}return!1}function H(e,t,n,r){return(e!==t||m(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&U(e,n)}function U(e,t){return m(t.enabled,e)!==!1&&e.isStaleByTime(p(t.staleTime,e))}function de(e,t){return!S(e.getCurrentResult(),t)}var W=e(n(),1),fe=t(),G=W.createContext(void 0),K=e=>{let t=W.useContext(G);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},pe=({client:e,children:t})=>(W.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,fe.jsx)(G.Provider,{value:e,children:t})),q=W.createContext(!1),J=()=>W.useContext(q);q.Provider;function me(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var he=W.createContext(me()),Y=()=>W.useContext(he),X=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?O(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},Z=e=>{W.useEffect(()=>{e.clearReset()},[e])},Q=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||O(n,[e.error,r])),ge=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))}},_e=(e,t)=>e.isLoading&&e.isFetching&&!t,ve=(e,t)=>e?.suspense&&t.isPending,$=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function ye(e,t,n){let r=J(),i=Y(),a=K(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash);o._optimisticResults=r?`isRestoring`:`optimistic`,ge(o),X(o,i,s),Z(i);let c=!a.getQueryCache().get(o.queryHash),[u]=W.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),f=!r&&e.subscribed!==!1;if(W.useSyncExternalStore(W.useCallback(e=>{let t=f?u.subscribe(j.batchCalls(e)):l;return u.updateResult(),t},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),W.useEffect(()=>{u.setOptions(o)},[o,u]),ve(o,d))throw $(o,u,i);if(Q({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!k.isServer()&&_e(d,r)&&(c?$(o,u,i):s?.promise)?.catch(l).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}function be(e,t){return ye(e,z,t)}export{x as A,u as C,h as D,g as E,i as F,r as I,S as M,O as N,l as O,E as P,D as S,_ as T,M as _,X as a,ne as b,Y as c,pe as d,K as f,F as g,I as h,ve as i,p as j,y as k,J as l,ce as m,ge as n,Q as o,z as p,$ as r,Z as s,be as t,G as u,j as v,v as w,re as x,ie as y};
@@ -4,20 +4,23 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>Kizen App Development Toolkit</title>
7
- <script type="module" crossorigin src="/assets/index-BN2If3Zu.js"></script>
7
+ <script type="module" crossorigin src="/assets/index-CjFi83Rf.js"></script>
8
8
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-Dw2cE7zH.js">
9
- <link rel="modulepreload" crossorigin href="/assets/fa-core-DteucspK.js">
10
- <link rel="modulepreload" crossorigin href="/assets/storageKeys-Dv0AbTSJ.js">
11
- <link rel="modulepreload" crossorigin href="/assets/api-LYugLsE_.js">
12
- <link rel="modulepreload" crossorigin href="/assets/useQuery-DLOWDn8s.js">
13
- <link rel="modulepreload" crossorigin href="/assets/react-CGXpNBH3.js">
14
- <link rel="modulepreload" crossorigin href="/assets/BootstrapContext-Caqxm0pS.js">
15
- <link rel="modulepreload" crossorigin href="/assets/bundleQuery-DnoDprqO.js">
16
- <link rel="modulepreload" crossorigin href="/assets/useNavigate-EsATq4C7.js">
17
- <link rel="modulepreload" crossorigin href="/assets/SidebarContext-g2Wqf-42.js">
18
- <link rel="modulepreload" crossorigin href="/assets/Card-CKKHGdG4.js">
19
- <link rel="modulepreload" crossorigin href="/assets/Dialog-D6sZ1i69.js">
20
- <link rel="stylesheet" crossorigin href="/assets/index-BCe-a4I_.css">
9
+ <link rel="modulepreload" crossorigin href="/assets/fa-core-BSqLAjHu.js">
10
+ <link rel="modulepreload" crossorigin href="/assets/CredentialsContext-Cwl_xyt_.js">
11
+ <link rel="modulepreload" crossorigin href="/assets/api-Z7hihohh.js">
12
+ <link rel="modulepreload" crossorigin href="/assets/useQuery-JKMI40WO.js">
13
+ <link rel="modulepreload" crossorigin href="/assets/react-C5hrIo29.js">
14
+ <link rel="modulepreload" crossorigin href="/assets/BootstrapContext-CS2e3X9Y.js">
15
+ <link rel="modulepreload" crossorigin href="/assets/useParams-D3awshYI.js">
16
+ <link rel="modulepreload" crossorigin href="/assets/useNavigate-BL0GTcH4.js">
17
+ <link rel="modulepreload" crossorigin href="/assets/SidebarContext-q5sbcZXM.js">
18
+ <link rel="modulepreload" crossorigin href="/assets/bootstrapQuery-qFpHSWE9.js">
19
+ <link rel="modulepreload" crossorigin href="/assets/bundleQuery-BE1Gb8Ii.js">
20
+ <link rel="modulepreload" crossorigin href="/assets/Card-Sa52PGkn.js">
21
+ <link rel="modulepreload" crossorigin href="/assets/Dialog-C3QoiHOt.js">
22
+ <link rel="modulepreload" crossorigin href="/assets/storageKeys-IkM_u7nJ.js">
23
+ <link rel="stylesheet" crossorigin href="/assets/index-Ty4403F6.css">
21
24
  </head>
22
25
  <body>
23
26
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kizenapps/cli",
3
- "version": "1.6.3",
3
+ "version": "1.7.0-3667650",
4
4
  "description": "CLI tool for running Kizen plugin apps locally",
5
5
  "license": "GPL-3.0",
6
6
  "type": "module",
@@ -15,7 +15,7 @@
15
15
  ],
16
16
  "dependencies": {
17
17
  "@kizenapps/engine": "^1.7.0",
18
- "@kizenapps/packager": "0.2.0",
18
+ "@kizenapps/packager": "^0.3.0",
19
19
  "chrome-launcher": "^1.2.1",
20
20
  "chrome-remote-interface": "^0.34.0",
21
21
  "commander": "^14.0.3",
@@ -1 +0,0 @@
1
- import{M as e,j as t}from"./fa-core-DteucspK.js";import{n,t as r}from"./bundleQuery-DnoDprqO.js";import{t as i}from"./useQuery-DLOWDn8s.js";import{t as a}from"./Card-CKKHGdG4.js";import{n as o,r as s,t as c}from"./iconMap-BotklELY.js";import{t as l}from"./formatBytes-BCP0hIUu.js";var u=e(),d=()=>{let{apiName:e}=n({strict:!1}),{data:d,isLoading:f,isError:p}=i(r);if(f)return(0,u.jsx)(a,{children:(0,u.jsx)(`p`,{className:`m-0 text-[13px] text-neutral-400`,children:`Fetching bundle.json…`})});if(p)return(0,u.jsx)(a,{children:(0,u.jsx)(`p`,{className:`m-0 text-[13px] text-red-700`,children:`Could not load bundle.json.`})});let m=d?.find(t=>t.api_name===e);if(!m)return(0,u.jsx)(a,{children:(0,u.jsxs)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:[`No app found with api_name`,` `,(0,u.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 py-0.5`,children:e}),`.`]})});let{floating_frames:h,data_adornments:g,routable_pages:_,toolbar_items:v,js_action_templates:y,route_scripts:b,object_settings_menu_items:x,automation_action_configs:S,calendar_sources:C}=m.artifacts,w=h.length>0||g.length>0||_.length>0||v.length>0||y.length>0||b.length>0||x.length>0||S.length>0||C.length>0,T=d?new TextEncoder().encode(JSON.stringify(d,null,2)).length:null,E=m.base_config,D=E?.setup_assistant?.fields??[],O=E?.user_setup_assistant?.fields??[];return(0,u.jsxs)(`div`,{className:`space-y-4 text-[13px]`,children:[(0,u.jsx)(a,{children:(0,u.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`h1`,{className:`text-lg font-bold leading-tight text-neutral-900`,children:m.name}),(0,u.jsx)(`p`,{className:`mt-0.5 font-mono text-[11px] text-neutral-400`,children:m.api_name})]}),m.description&&(0,u.jsx)(`p`,{className:`text-[13px] leading-relaxed text-neutral-600`,children:m.description}),(0,u.jsxs)(`div`,{className:`divide-y divide-black/5`,children:[m.version&&(0,u.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,u.jsxs)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-2 py-0.5 text-[11px] font-semibold tracking-wide text-neutral-600`,children:[`v`,m.version]}),(0,u.jsx)(`span`,{className:`text-[12px] text-neutral-500`,children:`App version`})]}),m.engine&&(0,u.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,u.jsxs)(`span`,{className:`shrink-0 rounded bg-blue-50 px-2 py-0.5 text-[11px] font-semibold tracking-wide text-blue-600`,children:[`engine: `,m.engine]}),(0,u.jsx)(`span`,{className:`text-[12px] text-neutral-500`,children:`Plugin engine version`})]}),(0,u.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,u.jsx)(`span`,{className:`shrink-0 rounded px-2 py-0.5 text-[11px] font-semibold tracking-wide ${m.published?`bg-green-100 text-green-700`:`bg-neutral-100 text-neutral-500`}`,children:m.published?`published`:`unpublished`}),(0,u.jsx)(`span`,{className:`text-[12px] text-neutral-500`,children:`Whether this app is publicly available`})]}),m.release_environments?.map(e=>(0,u.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,u.jsx)(`span`,{className:`shrink-0 rounded bg-violet-50 px-2 py-0.5 text-[11px] font-semibold tracking-wide text-violet-600`,children:e}),(0,u.jsx)(`span`,{className:`text-[12px] text-neutral-500`,children:`Release environment`})]},e)),m.block_loading_for_setup&&(0,u.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,u.jsx)(`span`,{className:`shrink-0 rounded bg-amber-100 px-2 py-0.5 text-[11px] font-semibold tracking-wide text-amber-700`,children:`blocks app loading`}),(0,u.jsx)(`span`,{className:`text-[12px] text-neutral-500`,children:`Whether this app blocks loading of Kizen UI until resources are fetched and processed`})]}),m.developer_business_id&&(typeof m.developer_business_id==`string`?(0,u.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,u.jsxs)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-2 py-0.5 font-mono text-[11px] tracking-wide text-neutral-500`,children:[`biz: `,m.developer_business_id]}),(0,u.jsx)(`span`,{className:`text-[12px] text-neutral-500`,children:`Developer business ID`})]}):Object.entries(m.developer_business_id).map(([e,t])=>(0,u.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,u.jsxs)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-2 py-0.5 font-mono text-[11px] tracking-wide text-neutral-500`,children:[`biz (`,e,`): `,t]}),(0,u.jsxs)(`span`,{className:`text-[12px] text-neutral-500`,children:[`Developer business ID (`,e,`)`]})]},e))),T!==null&&(0,u.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,u.jsxs)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-2 py-0.5 text-[11px] font-semibold tracking-wide text-neutral-600`,children:[`bundle: `,l(T)]}),(0,u.jsx)(`span`,{className:`text-[12px] text-neutral-500`,children:`Total size of bundle.json`})]})]})]})}),w||D.length>0||O.length>0||m.releaseNotes?(0,u.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3`,children:[h.length>0&&(0,u.jsxs)(a,{children:[(0,u.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,u.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Floating Frames`}),(0,u.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,u.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,u.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Name`}),(0,u.jsx)(`span`,{className:`shrink-0`,children:`Position`})]}),(0,u.jsx)(`div`,{className:`divide-y divide-black/5`,children:h.map((e,t)=>(0,u.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,u.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,u.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.name}),(0,u.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]}),e.default_position&&(0,u.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))})]}),g.length>0&&(0,u.jsxs)(a,{children:[(0,u.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,u.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Data Adornments`}),(0,u.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:g.length})]}),(0,u.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,u.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Field`}),(0,u.jsx)(`span`,{className:`shrink-0`,children:`Type`})]}),(0,u.jsx)(`div`,{className:`divide-y divide-black/5`,children:g.map((e,n)=>(0,u.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[e.config.color&&(0,u.jsx)(`span`,{className:`h-3 w-4 shrink-0 rounded-sm border border-black/10`,style:{backgroundColor:e.config.color}}),e.config.icon&&(c[e.config.icon]?(0,u.jsx)(t,{icon:c[e.config.icon],className:`shrink-0 text-[12px] text-neutral-500`}):(0,u.jsx)(`span`,{className:`shrink-0 rounded px-1 font-mono text-[10px] ${s.has(e.config.icon)||o.has(e.config.icon)?`bg-neutral-100 text-neutral-400`:`bg-amber-100 text-amber-600`}`,children:e.config.icon})),(0,u.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-neutral-900`,children:e.config.tooltip||e.field_type}),(0,u.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})]},n))})]}),_.length>0&&(0,u.jsxs)(a,{children:[(0,u.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,u.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Routable Pages`}),(0,u.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:_.length})]}),(0,u.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,u.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Page`}),(0,u.jsx)(`span`,{className:`shrink-0`,children:`Type`})]}),(0,u.jsx)(`div`,{className:`divide-y divide-black/5`,children:_.map((e,t)=>(0,u.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,u.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,u.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.name}),(0,u.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]}),e.iframe_url&&(0,u.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))})]}),v.length>0&&(0,u.jsxs)(a,{children:[(0,u.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,u.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Toolbar Items`}),(0,u.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,u.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,u.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Label`}),(0,u.jsx)(`span`,{className:`shrink-0`,children:`Icon`})]}),(0,u.jsx)(`div`,{className:`divide-y divide-black/5`,children:v.map((e,n)=>(0,u.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[e.color&&(0,u.jsx)(`span`,{className:`h-3 w-4 shrink-0 rounded-sm border border-black/10`,style:{backgroundColor:e.color}}),(0,u.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,u.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.label}),(0,u.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]}),e.icon&&(c[e.icon]?(0,u.jsx)(t,{icon:c[e.icon],className:`shrink-0 text-[12px] text-neutral-400`}):(0,u.jsx)(`span`,{className:`shrink-0 rounded px-1 font-mono text-[10px] ${s.has(e.icon)||o.has(e.icon)?`bg-neutral-100 text-neutral-400`:`bg-amber-100 text-amber-600`}`,children:e.icon}))]},n))})]}),y.length>0&&(0,u.jsxs)(a,{children:[(0,u.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,u.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`JS Action Templates`}),(0,u.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:y.length})]}),(0,u.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,u.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Name`}),(0,u.jsx)(`span`,{className:`shrink-0`,children:`Object`})]}),(0,u.jsx)(`div`,{className:`divide-y divide-black/5`,children:y.map((e,t)=>(0,u.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,u.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,u.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.name}),(0,u.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]}),e.hint_object_name&&(0,u.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))})]}),b.length>0&&(0,u.jsxs)(a,{children:[(0,u.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,u.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Route Scripts`}),(0,u.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:b.length})]}),(0,u.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,u.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Name`}),(0,u.jsx)(`span`,{className:`shrink-0`,children:`Routes`})]}),(0,u.jsx)(`div`,{className:`divide-y divide-black/5`,children:b.map((e,t)=>(0,u.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,u.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,u.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.name||e.api_name}),e.name&&(0,u.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]}),e.routes.length>0&&(0,u.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))})]}),x.length>0&&(0,u.jsxs)(a,{children:[(0,u.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,u.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Object Settings`}),(0,u.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:x.length})]}),(0,u.jsx)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:(0,u.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Label`})}),(0,u.jsx)(`div`,{className:`divide-y divide-black/5`,children:x.map((e,t)=>(0,u.jsx)(`div`,{className:`flex items-center gap-2 py-1.5`,children:(0,u.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,u.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.label}),(0,u.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]})},t))})]}),S.length>0&&(0,u.jsxs)(a,{children:[(0,u.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,u.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Automation Actions`}),(0,u.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:S.length})]}),(0,u.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,u.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Name`}),(0,u.jsx)(`span`,{className:`shrink-0`,children:`Type`})]}),(0,u.jsx)(`div`,{className:`divide-y divide-black/5`,children:S.map((e,t)=>(0,u.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,u.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,u.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.name}),(0,u.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.action_step_api_name})]}),e.action_type&&(0,u.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))})]}),C.length>0&&(0,u.jsxs)(a,{children:[(0,u.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,u.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Calendar Sources`}),(0,u.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,u.jsx)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:(0,u.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Name`})}),(0,u.jsx)(`div`,{className:`divide-y divide-black/5`,children:C.map((e,t)=>(0,u.jsx)(`div`,{className:`flex items-center gap-2 py-1.5`,children:(0,u.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,u.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.name}),(0,u.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]})},t))})]}),D.length>0&&(0,u.jsxs)(a,{children:[(0,u.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,u.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Setup Assistant`}),(0,u.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,u.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,u.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Field`}),(0,u.jsx)(`span`,{className:`shrink-0`,children:`Type`})]}),(0,u.jsx)(`div`,{className:`divide-y divide-black/5`,children:D.map((e,t)=>(0,u.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,u.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-neutral-900`,children:`label`in e?e.label??e.key:e.type}),(0,u.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))})]}),O.length>0&&(0,u.jsxs)(a,{children:[(0,u.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,u.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`User Setup Assistant`}),(0,u.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,u.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,u.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Field`}),(0,u.jsx)(`span`,{className:`shrink-0`,children:`Type`})]}),(0,u.jsx)(`div`,{className:`divide-y divide-black/5`,children:O.map((e,t)=>(0,u.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,u.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-neutral-900`,children:`label`in e?e.label??e.key:e.type}),(0,u.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))})]}),m.releaseNotes&&(0,u.jsxs)(a,{children:[(0,u.jsx)(`div`,{className:`mb-3 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Release Notes`}),(0,u.jsx)(`pre`,{className:`whitespace-pre-wrap font-mono text-[12px] leading-relaxed text-neutral-700`,children:m.releaseNotes})]})]}):(0,u.jsx)(a,{children:(0,u.jsx)(`p`,{className:`text-[13px] text-neutral-400`,children:`No plugin assets defined.`})})]})};export{d as AppDetailPage};
@@ -1 +0,0 @@
1
- import{M as e}from"./fa-core-DteucspK.js";var t=e(),n=({children:e,className:n=``})=>(0,t.jsx)(`div`,{className:`rounded-xl bg-white p-5 shadow-sm ${n}`,children:e});export{n as t};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{C as t,D as n,M as r,N as i,a,j as o,s}from"./fa-core-DteucspK.js";import{t as c}from"./useNavigate-EsATq4C7.js";import{n as l,t as u}from"./bundleQuery-DnoDprqO.js";import{t as d}from"./useQuery-DLOWDn8s.js";import{d as f,i as p}from"./api-LYugLsE_.js";import{t as m}from"./Card-CKKHGdG4.js";import{t as h}from"./CodeViewer-BdEsrhvR.js";import{t as g}from"./useLocalStorage-gLSTo_Vv.js";import{i as _,r as v}from"./configStorage-Db8RcPNR.js";import{t as y}from"./WhenBadge-BTCs-6JK.js";var b=e(i(),1),x=r(),S=({title:e,defaultOpen:t=!1,children:n})=>{let[r,i]=(0,b.useState)(t);return(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`button`,{onClick:()=>{i(e=>!e)},className:`flex w-full items-center gap-1.5 py-1 text-[11px] font-semibold uppercase tracking-widest text-neutral-400 hover:text-neutral-600`,children:[(0,x.jsx)(o,{icon:r?a:s,className:`w-2.5`}),e]}),r&&(0,x.jsx)(`div`,{className:`pb-2`,children:n})]})},C=({result:e})=>{let t=Object.entries(e.outputValues);return(0,x.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-black/10 bg-white p-4`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(`span`,{className:`rounded px-2 py-0.5 text-[11px] font-semibold ${e.success?`bg-green-100 text-green-700`:`bg-red-100 text-red-700`}`,children:e.success?`Success`:`Error`}),(0,x.jsxs)(`span`,{className:`text-[11px] text-neutral-400`,children:[String(e.durationMs),`ms`]}),e.exitCode!==0&&(0,x.jsxs)(`span`,{className:`text-[11px] text-neutral-400`,children:[`exit code `,String(e.exitCode)]}),(0,x.jsx)(`button`,{onClick:e=>{let t=e.currentTarget;for(;t;){if(t.scrollHeight>t.clientHeight){t.scrollTo({top:0,behavior:`smooth`});return}t=t.parentElement}},className:`ml-auto text-[11px] text-neutral-400 hover:text-neutral-600`,children:`↑ top`})]}),e.error&&(0,x.jsx)(`pre`,{className:`overflow-auto rounded bg-red-50 p-3 font-mono text-[12px] text-red-800`,children:e.error}),t.length>0&&(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`div`,{className:`mb-1 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Outputs`}),(0,x.jsx)(`div`,{className:`divide-y divide-black/5`,children:t.map(([e,t])=>(0,x.jsxs)(`div`,{className:`flex items-start gap-2 py-1.5`,children:[(0,x.jsx)(`span`,{className:`shrink-0 font-mono text-[12px] text-neutral-600`,children:e}),(0,x.jsx)(`span`,{className:`text-[11px] text-neutral-300`,children:`=`}),(0,x.jsx)(`pre`,{className:`min-w-0 flex-1 overflow-auto font-mono text-[12px] text-neutral-800`,children:typeof t==`string`?t:JSON.stringify(t,null,2)})]},e))})]}),e.logs.length>0&&(0,x.jsx)(S,{title:`Logs (${String(e.logs.length)})`,children:(0,x.jsx)(`div`,{className:`space-y-0.5`,children:e.logs.map((e,t)=>(0,x.jsx)(`div`,{className:`font-mono text-[12px] text-neutral-600`,children:e},t))})}),e.stdout&&(0,x.jsx)(S,{title:`Stdout`,children:(0,x.jsx)(`pre`,{className:`overflow-auto rounded bg-neutral-50 p-3 font-mono text-[12px] text-neutral-700`,children:e.stdout})}),e.stderr&&(0,x.jsx)(S,{title:`Stderr`,children:(0,x.jsx)(`pre`,{className:`overflow-auto rounded bg-neutral-50 p-3 font-mono text-[12px] text-neutral-700`,children:e.stderr})}),e.httpRequests&&e.httpRequests.count>0&&(0,x.jsx)(S,{title:`Network (${String(e.httpRequests.count)}${e.httpRequests.notLogged>0?`, ${String(e.httpRequests.notLogged)} not logged`:``})`,children:(0,x.jsx)(`div`,{className:`space-y-1.5`,children:e.httpRequests.requests.map((e,t)=>(0,x.jsx)(E,{request:e},t))})})]})},w=e=>{switch(e.toUpperCase()){case`GET`:return`bg-blue-100 text-blue-700`;case`POST`:return`bg-green-100 text-green-700`;case`PUT`:case`PATCH`:return`bg-amber-100 text-amber-700`;case`DELETE`:return`bg-red-100 text-red-700`;default:return`bg-neutral-100 text-neutral-700`}},T=(e,t)=>t||e>=500?`text-red-700`:e>=400?`text-amber-700`:e>=200?`text-green-700`:`text-neutral-600`,E=({request:e})=>{let[t,n]=(0,b.useState)(!1),r=e.requestErrorType!==null;return(0,x.jsxs)(`div`,{className:`rounded border border-black/5 bg-neutral-50`,children:[(0,x.jsxs)(`button`,{onClick:()=>{n(e=>!e)},className:`flex w-full items-center gap-2 px-2.5 py-1.5 text-left hover:bg-neutral-100`,children:[(0,x.jsx)(o,{icon:t?a:s,className:`w-2.5 text-neutral-400`}),(0,x.jsx)(`span`,{className:`rounded px-1.5 py-0.5 font-mono text-[10px] font-semibold ${w(e.method)}`,children:e.method}),(0,x.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[12px] text-neutral-700`,children:e.url}),(0,x.jsx)(`span`,{className:`font-mono text-[11px] font-semibold ${T(e.responseStatusCode,r)}`,children:r?e.requestErrorType:e.responseStatusCode}),(0,x.jsxs)(`span`,{className:`font-mono text-[10px] text-neutral-400`,children:[(e.duration*1e3).toFixed(0),`ms`]})]}),t&&(0,x.jsxs)(`div`,{className:`space-y-2 border-t border-black/5 p-2.5`,children:[(0,x.jsx)(D,{title:`Request Headers`,data:e.headers}),e.body&&(0,x.jsx)(O,{title:`Request Body`,body:e.body}),(0,x.jsx)(D,{title:`Response Headers`,data:e.responseHeaders}),e.responseBody&&(0,x.jsx)(O,{title:`Response Body`,body:e.responseBody})]})]})},D=({title:e,data:t})=>{let n=Object.entries(t);return n.length===0?null:(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-widest text-neutral-400`,children:e}),(0,x.jsx)(`div`,{className:`divide-y divide-black/5 rounded border border-black/5 bg-white`,children:n.map(([e,t])=>(0,x.jsxs)(`div`,{className:`flex gap-2 px-2 py-1 font-mono text-[11px]`,children:[(0,x.jsxs)(`span`,{className:`shrink-0 text-neutral-500`,children:[e,`:`]}),(0,x.jsx)(`span`,{className:`min-w-0 flex-1 break-all text-neutral-800`,children:t})]},e))})]})},O=({title:e,body:t})=>(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-widest text-neutral-400`,children:e}),(0,x.jsx)(`pre`,{className:`overflow-auto rounded border border-black/5 bg-white p-2 font-mono text-[11px] text-neutral-800`,children:t})]}),k=[`python-3-12`,`python-3-13`],A=`python-3-13`,j={text:`s`,string:`s`,number:`n`,integer:`n`,boolean:`b`,date:`d`,datetime:`dt`,phone:`p`,phonenumber:`p`,uuid:`u`,file:`f`,list:`l`};function M(e){return j[e.toLowerCase()]??`s`}function N(e){return k.includes(e)}function P(e,t){let n=Object.keys(e);if(n.length===0)return null;let r={};for(let i of n)r[i]={t:M(t[i]??`string`),v:e[i]};return r}function F(e){let t=Object.keys(e);if(t.length===0)return null;let n={};for(let r of t)n[r]=M(e[r]??`string`);return n}function I(e){if(!e)return{};let t={};for(let[n,r]of Object.entries(e))t[n]=r.v;return t}function L(e){if(!e)return;let t=e.requests.map(e=>({method:e.method,url:e.url,headers:e.headers,body:e.body,requestSubmittedAt:e.requestSubmittedAt,session:e.session,responseStatusCode:e.responseStatusCode,responseHeaders:e.responseHeaders,responseBody:e.responseBody,requestErrorType:e.requestErrorType,duration:e.duration}));return{count:e.count,notLogged:e.not_logged,requests:t}}async function R(e,t){let n=Date.now(),r=t.scriptRuntime||A;if(!N(r))return{success:!1,outputValues:{},logs:[],stdout:``,stderr:``,error:`Unsupported runtime "${r}". Supported runtimes: ${k.join(`, `)}. Update the step's config.json "runtime" field (e.g. "python 3.13").`,exitCode:1,durationMs:Date.now()-n};let i={user_script:t.script,runtime:r,secrets:t.secretNames.length>0?t.secretNames:void 0,inputs:P(t.inputs,t.inputTypes),output_types:F(t.outputTypes)};try{let t=await e(`/coderunner/run`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(i)}),r=Date.now()-n;if(!t.ok){let e=await t.text();return{success:!1,outputValues:{},logs:[],stdout:``,stderr:``,error:`Remote runner returned ${String(t.status)}: ${e}`,exitCode:1,durationMs:r}}let a=await t.json(),o=a.error!==null,s=L(a.http_requests),c={success:!o,outputValues:I(a.values),logs:a.logs??[],stdout:``,stderr:``,exitCode:+!!o,durationMs:a.duration_ms??r,...s&&{httpRequests:s}};return o&&a.error&&(c.error=a.error.detail?`${a.error.error}\n${a.error.detail}`:a.error.error),c}catch(e){return{success:!1,outputValues:{},logs:[],stdout:``,stderr:``,error:`Remote execution failed: ${e instanceof Error?e.message:String(e)}`,exitCode:1,durationMs:Date.now()-n}}}var z=()=>{let{apiName:e,stepApiName:r}=l({strict:!1}),i=c(),{data:a,isLoading:s,isError:S}=d(u),w=p(),[T,E]=(0,b.useState)(!1),[D,O]=(0,b.useState)(null),[k,A]=g(`kizen-step-inputs:${e??``}:${r??``}`,{}),[j,M]=g(`kizen-step-secrets:${e??``}:${r??``}`,{}),[N,P]=g(`kizen-code-runner-mode`,`local`),F=a?.find(t=>t.api_name===e),I=(0,b.useMemo)(()=>F?.artifacts.automation_action_configs??[],[F]),L=I.find(e=>e.action_step_api_name===r)??I[0],z=(0,b.useMemo)(()=>{if(!e||!F)return{};let t=F.base_config,n=v(e),r=_(e),i=f(n?.__kizen_clean_config??{},[],n?.__kizen_setup_assistant_values??{},t?.setup_assistant?.fields),a=f(r?.__kizen_clean_config??{},[],r?.__kizen_setup_assistant_values??{},t?.user_setup_assistant?.fields),o={};for(let[e,t]of Object.entries(i))o[`config__${e}`]=t;for(let[e,t]of Object.entries(a))o[`userConfig__${e}`]=t;return o},[e,F]);if((0,b.useEffect)(()=>{if(!r&&I.length>0&&e){let t=I[0];t&&i({to:`/$apiName/code-steps/$stepApiName`,params:{apiName:e,stepApiName:t.action_step_api_name},replace:!0})}},[r,I,e,i]),(0,b.useEffect)(()=>{O(null)},[r]),s)return(0,x.jsx)(m,{children:(0,x.jsx)(`p`,{className:`m-0 text-[13px] text-neutral-400`,children:`Fetching bundle.json…`})});if(S)return(0,x.jsx)(m,{children:(0,x.jsx)(`p`,{className:`m-0 text-[13px] text-red-700`,children:`Could not load bundle.json.`})});if(!F)return(0,x.jsx)(m,{children:(0,x.jsxs)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:[`No app found with api_name`,` `,(0,x.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 py-0.5`,children:e}),`.`]})});if(I.length===0)return(0,x.jsx)(m,{children:(0,x.jsx)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:`This app has no automation code steps.`})});if(!L)return(0,x.jsx)(m,{children:(0,x.jsxs)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:[`Step not found: `,(0,x.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 py-0.5`,children:r}),`.`]})});let B=async()=>{E(!0),O(null);try{let t=Object.fromEntries(L.inputs.map(e=>[e.name,k[e.name]??``])),n;n=N===`remote`?await R(w,{script:L.script,scriptRuntime:L.script_runtime,inputs:t,inputTypes:Object.fromEntries(L.inputs.map(e=>[e.name,e.data_type])),outputTypes:Object.fromEntries(L.outputs.map(e=>[e.name,e.data_type])),secretNames:L.secrets.map(t=>`${e??``}__${t}`)}):await(await fetch(`/api/execute-step`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({script:L.script,scriptRuntime:L.script_runtime,inputs:t,secrets:Object.fromEntries(L.secrets.map(t=>[`${e??``}__${t}`,j[t]??``]))})})).json(),O(n)}catch(e){O({success:!1,outputValues:{},logs:[],stdout:``,stderr:``,error:e instanceof Error?e.message:String(e),exitCode:1,durationMs:0})}finally{E(!1)}};return(0,x.jsxs)(`div`,{className:`space-y-4`,children:[(0,x.jsxs)(m,{children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,x.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Code Step`}),(0,x.jsx)(`select`,{value:L.action_step_api_name,onChange:t=>{e&&i({to:`/$apiName/code-steps/$stepApiName`,params:{apiName:e,stepApiName:t.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:I.map(e=>(0,x.jsx)(`option`,{value:e.action_step_api_name,children:e.name},e.action_step_api_name))}),(0,x.jsx)(`div`,{className:`flex-1`}),(0,x.jsx)(`span`,{className:`rounded bg-blue-50 px-1.5 py-0.5 text-[10px] font-semibold text-blue-600`,children:L.script_runtime})]}),L.overall_description&&(0,x.jsx)(`p`,{className:`mt-2 text-[12px] text-neutral-500`,children:L.overall_description}),L.when&&(0,x.jsx)(`div`,{className:`mt-2`,children:(0,x.jsx)(y,{when:L.when,whenState:z})})]}),(0,x.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-3`,children:[(0,x.jsxs)(m,{children:[(0,x.jsx)(`div`,{className:`mb-3 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Inputs`}),L.inputs.length>0?(0,x.jsx)(`div`,{className:`space-y-3`,children:L.inputs.map(e=>(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`label`,{className:`mb-1 block text-[12px] text-neutral-700`,children:[e.label,e.required&&(0,x.jsx)(`span`,{className:`ml-0.5 text-red-500`,children:`*`})]}),(0,x.jsx)(`input`,{type:`text`,value:k[e.name]??``,onChange:t=>{A({...k,[e.name]:t.target.value})},placeholder:e.name,className:`w-full rounded border border-black/10 bg-white px-2.5 py-1.5 font-mono text-[13px] text-neutral-800 placeholder:text-neutral-300 focus:border-blue-300 focus:outline-none`}),(0,x.jsx)(`div`,{className:`mt-0.5 font-mono text-[10px] text-neutral-400`,children:e.name})]},e.name))}):(0,x.jsx)(`p`,{className:`m-0 text-[12px] text-neutral-400`,children:`None defined.`})]}),(0,x.jsxs)(m,{children:[(0,x.jsx)(`div`,{className:`mb-3 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Outputs`}),L.outputs.length>0?(0,x.jsx)(`div`,{className:`space-y-2`,children:L.outputs.map(e=>(0,x.jsxs)(`div`,{className:`flex items-baseline gap-2 rounded border border-black/5 bg-neutral-50 px-2.5 py-1.5`,children:[(0,x.jsx)(`span`,{className:`text-[13px] text-neutral-700`,children:e.label}),(0,x.jsx)(`span`,{className:`font-mono text-[10px] text-neutral-400`,children:e.name}),(0,x.jsx)(`span`,{className:`ml-auto rounded bg-white px-1.5 py-0.5 font-mono text-[10px] text-neutral-500`,children:e.data_type})]},e.name))}):(0,x.jsx)(`p`,{className:`m-0 text-[12px] text-neutral-400`,children:`None defined.`})]}),(0,x.jsxs)(m,{children:[(0,x.jsx)(`div`,{className:`mb-3 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Secrets`}),N===`remote`&&(0,x.jsx)(`p`,{className:`mb-3 rounded border border-blue-100 bg-blue-50 px-2.5 py-1.5 text-[12px] text-blue-700`,children:`Remote runner uses secrets from your business context.`}),L.secrets.length>0?(0,x.jsx)(`div`,{className:`space-y-3`,children:L.secrets.map(e=>(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`label`,{className:`mb-1 block text-[12px] text-neutral-700`,children:e}),(0,x.jsx)(`input`,{type:`password`,value:j[e]??``,onChange:t=>{M({...j,[e]:t.target.value})},placeholder:e,disabled:N===`remote`,className:`w-full rounded border border-black/10 bg-white px-2.5 py-1.5 font-mono text-[13px] text-neutral-800 placeholder:text-neutral-300 focus:border-blue-300 focus:outline-none disabled:cursor-not-allowed disabled:bg-neutral-50 disabled:text-neutral-400`})]},e))}):(0,x.jsx)(`p`,{className:`m-0 text-[12px] text-neutral-400`,children:`None defined.`})]})]}),(0,x.jsx)(h,{code:L.script,language:`python`,onRun:()=>void B(),isRunning:T,executionMode:N,onModeChange:P}),(0,x.jsx)(`div`,{className:`sticky bottom-0 z-10 max-h-[60vh] overflow-y-auto rounded-lg shadow-[0_-8px_24px_-12px_rgba(0,0,0,0.18)]`,children:D?(0,x.jsx)(C,{result:D}):(0,x.jsx)(`div`,{className:`flex items-center gap-2 rounded-lg border border-dashed border-black/10 bg-white px-4 py-3`,children:T?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(o,{icon:n,className:`animate-spin text-neutral-400`}),(0,x.jsx)(`span`,{className:`text-[12px] text-neutral-500`,children:`Running step…`})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(o,{icon:t,className:`text-neutral-300`}),(0,x.jsx)(`span`,{className:`text-[12px] text-neutral-400`,children:`Run the step to see output, logs, and network activity here.`})]})})})]})};export{z as CodeStepsPage};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{D as t,M as n,N as r,j as i}from"./fa-core-DteucspK.js";import{n as a,t as o}from"./bundleQuery-DnoDprqO.js";import{t as s}from"./useQuery-DLOWDn8s.js";import{n as c}from"./BootstrapContext-Caqxm0pS.js";import{c as l,n as u,r as d,s as f,t as p}from"./useCriticalExceptionDialog-DNmzdRI0.js";import{f as m}from"./storageKeys-Dv0AbTSJ.js";import{i as h,k as g,n as _,r as v}from"./api-LYugLsE_.js";import{n as y,t as b}from"./Dialog-D6sZ1i69.js";import{t as x}from"./Card-CKKHGdG4.js";import{t as S}from"./CodeViewer-BdEsrhvR.js";import{c as C,i as w,n as T,o as E,r as D,s as O,t as k}from"./configStorage-Db8RcPNR.js";var A=e(r(),1),j=n(),M=e=>e?JSON.stringify(e,null,2):`{}`,N=({apiName:e,configTemplate:t})=>{let n=D(e),r=M(t),[i,a]=(0,A.useState)(n?.__kizen_clean_config?JSON.stringify(n.__kizen_clean_config,null,2):r),[o,s]=(0,A.useState)(null),[c,l]=(0,A.useState)(!1);return(0,j.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,j.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,j.jsxs)(`p`,{className:`text-[13px] text-neutral-500 m-0`,children:[`No setup assistant defined. Enter configuration as JSON.`,t?` Pre-populated from config_template.`:``]})}),(0,j.jsx)(`textarea`,{value:i,onChange:e=>{a(e.target.value),s(null),l(!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 ${o?`border-red-300 focus:ring-red-400`:`border-black/10 focus:ring-blue-400`}`}),o&&(0,j.jsxs)(`span`,{className:`text-[12px] text-red-500`,children:[`Parse error: `,o]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`button`,{onClick:()=>{try{O(e,JSON.parse(i)),s(null),l(!0),setTimeout(()=>{l(!1)},2e3)}catch(e){s(e instanceof Error?e.message:`Invalid JSON`),l(!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,j.jsx)(`button`,{onClick:()=>{k(e),a(r),s(null),l(!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`}),c&&(0,j.jsx)(`span`,{className:`text-[12px] text-green-600 font-medium`,children:`Saved`})]})]})},P=({open:e,onClose:t,apiName:n,loadFn:r,label:i})=>{let a=(0,A.useMemo)(()=>e?r(n)?.__kizen_clean_config??null:null,[e,n,r]),o=(0,A.useMemo)(()=>a?JSON.stringify(a,null,2):``,[a]),[s,c]=(0,A.useState)(!1);return(0,A.useEffect)(()=>{e||c(!1)},[e]),(0,j.jsx)(b,{open:e,size:`xl`,ariaModal:!0,onBackdropClick:t,header:(0,j.jsx)(y,{title:`Stored JSON — ${i}`,onClose:t}),footer:a?(0,j.jsx)(`button`,{onClick:()=>{navigator.clipboard.writeText(o).then(()=>{c(!0),setTimeout(()=>{c(!1)},1200)})},className:`rounded border border-black/10 px-3 py-1 text-[12px] font-medium text-neutral-600 hover:bg-neutral-50 active:bg-neutral-100`,children:s?`Copied`:`Copy`}):void 0,children:(0,j.jsxs)(`div`,{className:`px-5 py-4`,children:[(0,j.jsxs)(`p`,{className:`m-0 mb-3 text-[12px] text-neutral-500`,children:[`This is the saved JSON the plugin runtime will see as`,` `,(0,j.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 font-mono text-[11px]`,children:i}),`. Save the form to refresh.`]}),a?(0,j.jsx)(S,{code:o,language:`json`}):(0,j.jsx)(`div`,{className:`rounded border border-dashed border-black/10 px-4 py-6 text-center text-[12px] text-neutral-400`,children:`No saved configuration yet. Save the form to populate this view.`})]})})},F=({config:e,apiName:t,loadFn:n,saveFn:r,clearFn:i})=>{let a=n(t)?.__kizen_setup_assistant_values,o=(0,A.useRef)({}),[s,c]=(0,A.useState)(!1),{getObjectByAPIName:f,getCustomObjectDetails:p}=u(),m=(0,A.useCallback)(e=>{o.current=e},[]);return(0,j.jsx)(l,{config:e,value:a,onStateChange:m,disabledKeys:[],getObjectByAPIName:f,getCustomObjectDetails:p,children:(0,j.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[e.fields?.map(e=>(0,j.jsx)(d,{field:e,pluginApiName:t},e.key)),(0,j.jsxs)(`div`,{className:`flex items-center gap-2 mt-2`,children:[(0,j.jsx)(`button`,{onClick:()=>{let n=o.current;r(t,n,e),c(!0),setTimeout(()=>{c(!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,j.jsx)(`button`,{onClick:()=>{i(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`}),s&&(0,j.jsx)(`span`,{className:`text-[12px] text-green-600 font-medium`,children:`Saved`})]})]})})},I=({config:e,apiName:n,loadFn:r,saveFn:a,clearFn:o})=>{let s=c(),l=h(),u=(0,A.useMemo)(()=>g(l),[l]),{environment:d}=m(),y=_[d],[b,x]=(0,A.useState)(!1),[S,C]=(0,A.useState)(!1),{onMonitoringException:w,dialog:T}=p();return s?(0,j.jsx)(f,{appPath:y,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:()=>{},performFileUpload:()=>Promise.resolve({url:``}),monitoringExceptionHelper:w,performRequest:v(u),modal:{showing:b,show:S,showPrompt:()=>{x(!0),C(!0)},onConfirm:()=>{x(!1),C(!1)},onHide:()=>{x(!1),C(!1)}},showToast:()=>{},clearToasts:()=>{},children:()=>(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(F,{config:e,apiName:n,loadFn:r,saveFn:a,clearFn:o}),T]})}):(0,j.jsx)(i,{icon:t,className:`animate-spin text-neutral-400`})},L=()=>{let{apiName:e}=a({strict:!1}),{data:t,isLoading:n,isError:r}=s(o),[i,c]=(0,A.useState)(null);if(n)return(0,j.jsx)(x,{children:(0,j.jsx)(`p`,{className:`m-0 text-[13px] text-neutral-400`,children:`Fetching bundle.json…`})});if(r)return(0,j.jsx)(x,{children:(0,j.jsx)(`p`,{className:`m-0 text-[13px] text-red-700`,children:`Could not load bundle.json.`})});let l=t?.find(t=>t.api_name===e);if(!l)return(0,j.jsx)(x,{children:(0,j.jsxs)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:[`No app found with api_name`,` `,(0,j.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 py-0.5`,children:e}),`.`]})});let u=l.base_config,d=u?.setup_assistant,f=u?.user_setup_assistant,p=(d?.fields?.length??0)>0,m=(f?.fields?.length??0)>0;return!p&&!m?(0,j.jsx)(x,{children:(0,j.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h2`,{className:`text-[15px] font-bold text-neutral-900 m-0`,children:`Configuration`}),(0,j.jsx)(`p`,{className:`text-[12px] text-neutral-400 m-0 mt-1`,children:`Enter plugin configuration as JSON.`})]}),(0,j.jsx)(N,{apiName:e??``,configTemplate:l.config_template})]})}):(0,j.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-start`,children:[p&&d&&(0,j.jsx)(x,{className:`lg:flex-1 lg:min-w-0`,children:(0,j.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,j.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`h2`,{className:`text-[15px] font-bold text-neutral-900 m-0`,children:`Business Configuration`}),(0,j.jsxs)(`p`,{className:`text-[12px] text-neutral-400 m-0 mt-1`,children:[`Configure the business-level setup assistant fields. These values are shared across the whole business and exposed to plugin scripts at`,` `,(0,j.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 font-mono text-[11px]`,children:`this.config`}),`.`]})]}),(0,j.jsx)(`button`,{onClick:()=>{c(`business`)},className:`shrink-0 rounded border border-black/10 px-3 py-1.5 text-[12px] font-medium text-neutral-600 hover:bg-neutral-50 active:bg-neutral-100`,children:`View JSON`})]}),(0,j.jsx)(I,{config:d,apiName:e??``,loadFn:D,saveFn:E,clearFn:k})]})}),m&&f&&(0,j.jsx)(x,{className:`lg:flex-1 lg:min-w-0`,children:(0,j.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,j.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`h2`,{className:`text-[15px] font-bold text-neutral-900 m-0`,children:`User Configuration`}),(0,j.jsxs)(`p`,{className:`text-[12px] text-neutral-400 m-0 mt-1`,children:[`Configure the per-user setup assistant fields. These values are scoped to the logged-in user and exposed to plugin scripts at`,` `,(0,j.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 font-mono text-[11px]`,children:`this.userConfig`}),`.`]})]}),(0,j.jsx)(`button`,{onClick:()=>{c(`user`)},className:`shrink-0 rounded border border-black/10 px-3 py-1.5 text-[12px] font-medium text-neutral-600 hover:bg-neutral-50 active:bg-neutral-100`,children:`View JSON`})]}),(0,j.jsx)(I,{config:f,apiName:e??``,loadFn:w,saveFn:C,clearFn:T})]})}),(0,j.jsx)(P,{open:i===`business`,onClose:()=>{c(null)},apiName:e??``,loadFn:D,label:`this.config`}),(0,j.jsx)(P,{open:i===`user`,onClose:()=>{c(null)},apiName:e??``,loadFn:w,label:`this.userConfig`})]})};export{L as ConfigurationPage};