@objectstack/studio 5.1.0 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/index-81ZhtCq-.js +159 -0
- package/dist/assets/index-CSlaSCb_.css +2 -0
- package/dist/assets/rolldown-runtime-aKtaBQYM.js +1 -0
- package/dist/assets/vendor-charts-CMWbKNvz.js +34 -0
- package/dist/assets/vendor-icons-C-VDCqO9.js +1 -0
- package/dist/assets/vendor-kzrx2K5g.css +1 -0
- package/dist/assets/vendor-object-ui-core-C_SRaIe4.js +59 -0
- package/dist/assets/vendor-object-ui-form-DRRdiS9F.js +1 -0
- package/dist/assets/vendor-object-ui-grid-BvNa3IUR.js +6 -0
- package/dist/assets/vendor-object-ui-views-CyaLQwFl.js +0 -0
- package/dist/assets/vendor-rQmwIIxi.js +152 -0
- package/dist/assets/vendor-radix-DlDjksHy.js +1 -0
- package/dist/assets/vendor-react-CfxtBSJn.js +9 -0
- package/dist/assets/vendor-tanstack-D6oxbowc.js +1 -0
- package/dist/index.html +30 -2
- package/package.json +30 -24
- package/dist/assets/dist-DiOJyKuv.js +0 -1
- package/dist/assets/index-BiwiL-EB.css +0 -2
- package/dist/assets/index-DYSVcooZ.js +0 -230
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{bn as t,gn as n,vn as r,yn as i}from"./vendor-rQmwIIxi.js";var a=e(t(),1),o=typeof window<`u`?a.useLayoutEffect:a.useEffect;function s(e){let t=a.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function c(e,t,n={},r={}){a.useEffect(()=>{if(!e.current||r.disabled||typeof IntersectionObserver!=`function`)return;let i=new IntersectionObserver(([e])=>{t(e)},n);return i.observe(e.current),()=>{i.disconnect()}},[t,n,r.disabled,e])}function l(e){let t=a.useRef(null);return a.useImperativeHandle(e,()=>t.current,[]),t}function u(e){return e[e.length-1]}function d(e){return typeof e==`function`}function f(e,t){return d(e)?e(t):e}var p=Object.prototype.hasOwnProperty,m=Object.prototype.propertyIsEnumerable;function h(e){for(let t in e)if(p.call(e,t))return!0;return!1}var g=()=>Object.create(null),_=(e,t)=>v(e,t,g);function v(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=S(e)&&S(i);if(!a&&!(b(e)&&b(i)))return i;let o=a?e:y(e);if(!o)return i;let s=a?i:y(i);if(!s)return i;let c=o.length,l=s.length,u=a?Array(l):n(),d=0;for(let t=0;t<l;t++){let o=a?t:s[t],l=e[o],f=i[o];if(l===f){u[o]=l,(a?t<c:p.call(e,o))&&d++;continue}if(l===null||f===null||typeof l!=`object`||typeof f!=`object`){u[o]=f;continue}let m=v(l,f,n,r+1);u[o]=m,m===l&&d++}return c===l&&d===c?e:u}function y(e){let t=Object.getOwnPropertyNames(e);for(let n of t)if(!m.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(!m.call(e,t))return!1;r.push(t)}return r}function b(e){if(!x(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!x(n)||!n.hasOwnProperty(`isPrototypeOf`))}function x(e){return Object.prototype.toString.call(e)===`[object Object]`}function S(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function C(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(!C(e[r],t[r],n))return!1;return!0}if(b(e)&&b(t)){let r=n?.ignoreUndefined??!0;if(n?.partial){for(let i in t)if((!r||t[i]!==void 0)&&!C(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||!C(e[o],t[o],n)))return!1;return i===a}return!1}function w(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 T(e){return!!(e&&typeof e==`object`&&typeof e.then==`function`)}function E(e){return e.replace(/[\x00-\x1f\x7f]/g,``)}function D(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 E(t)}var ee=[`http:`,`https:`,`mailto:`,`tel:`];function te(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function O(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+=D(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=D(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function ne(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function re(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 k(){throw Error(`Invariant failed`)}function ie(e){let t=new Map,n,r,i=e=>{e.next&&(e.prev?(e.prev.next=e.next,e.next.prev=e.prev,e.next=void 0,r&&(r.next=e,e.prev=r)):(e.next.prev=void 0,n=e.next,e.next=void 0,r&&(e.prev=r,r.next=e)),r=e)};return{get(e){let n=t.get(e);if(n)return i(n),n.value},set(a,o){if(t.size>=e&&n){let e=n;t.delete(e.key),e.next&&(n=e.next,e.next.prev=void 0),e===r&&(r=void 0)}let s=t.get(a);if(s)s.value=o,i(s);else{let e={key:a,value:o,prev:r};r&&(r.next=e),r=e,n||=e,t.set(a,e)}},clear(){t.clear(),n=void 0,r=void 0}}}var A=4,ae=5;function oe(e){let t=e.indexOf(`{`);if(t===-1)return null;let n=e.indexOf(`}`,t);return n===-1||t+1>=e.length?null:[t,n]}function se(e,t,n=new Uint16Array(6)){let r=e.indexOf(`/`,t),i=r===-1?e.length:r,a=e.substring(t,i);if(!a||!a.includes(`$`))return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n;if(a===`$`){let r=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=r,n[4]=r,n[5]=r,n}if(a.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=i,n[4]=i,n[5]=i,n;let o=oe(a);if(o){let[r,s]=o,c=a.charCodeAt(r+1);if(c===45){if(r+2<a.length&&a.charCodeAt(r+2)===36){let e=r+3,a=s;if(e<a)return n[0]=3,n[1]=t+r,n[2]=t+e,n[3]=t+a,n[4]=t+s+1,n[5]=i,n}}else if(c===36){let a=r+1,o=r+2;return o===s?(n[0]=2,n[1]=t+r,n[2]=t+a,n[3]=t+o,n[4]=t+s+1,n[5]=e.length,n):(n[0]=1,n[1]=t+r,n[2]=t+o,n[3]=t+s,n[4]=t+s+1,n[5]=i,n)}}return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n}function ce(e,t,n,r,i,a,o){o?.(n);let s=r;{let r=n.fullPath??n.from,o=r.length,c=n.options?.caseSensitive??e,l=n.options?.params?.parse??n.options?.parseParams;for(;s<o;){let e=se(r,s,t),o,u=s,d=e[5];switch(s=d+1,a++,e[0]){case 0:{let t=r.substring(e[2],e[3]);if(c){let e=i.static?.get(t);if(e)o=e;else{i.static??=new Map;let e=M(n.fullPath??n.from);e.parent=i,e.depth=a,o=e,i.static.set(t,e)}}else{let e=t.toLowerCase(),r=i.staticInsensitive?.get(e);if(r)o=r;else{i.staticInsensitive??=new Map;let t=M(n.fullPath??n.from);t.parent=i,t.depth=a,o=t,i.staticInsensitive.set(e,t)}}break}case 1:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),f=c&&!!(t||s),p=t?f?t:t.toLowerCase():void 0,m=s?f?s:s.toLowerCase():void 0,h=!l&&i.dynamic?.find(e=>!e.parse&&e.caseSensitive===f&&e.prefix===p&&e.suffix===m);if(h)o=h;else{let e=ue(1,n.fullPath??n.from,f,p,m);o=e,e.depth=a,e.parent=i,i.dynamic??=[],i.dynamic.push(e)}break}case 3:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),f=c&&!!(t||s),p=t?f?t:t.toLowerCase():void 0,m=s?f?s:s.toLowerCase():void 0,h=!l&&i.optional?.find(e=>!e.parse&&e.caseSensitive===f&&e.prefix===p&&e.suffix===m);if(h)o=h;else{let e=ue(3,n.fullPath??n.from,f,p,m);o=e,e.parent=i,e.depth=a,i.optional??=[],i.optional.push(e)}break}case 2:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),l=c&&!!(t||s),f=t?l?t:t.toLowerCase():void 0,p=s?l?s:s.toLowerCase():void 0,m=ue(2,n.fullPath??n.from,l,f,p);o=m,m.parent=i,m.depth=a,i.wildcard??=[],i.wildcard.push(m)}}i=o}if(l&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf(`/`)+1)===95){let e=M(n.fullPath??n.from);e.kind=ae,e.parent=i,a++,e.depth=a,i.pathless??=[],i.pathless.push(e),i=e}let u=(n.path||!n.children)&&!n.isRoot;if(u&&r.endsWith(`/`)){let e=M(n.fullPath??n.from);e.kind=A,e.parent=i,a++,e.depth=a,i.index=e,i=e}i.parse=l??null,i.priority=n.options?.params?.priority??0,u&&!i.route&&(i.route=n,i.fullPath=n.fullPath??n.from)}if(n.children)for(let r of n.children)ce(e,t,r,s,i,a,o)}function le(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function j(e){if(e.pathless)for(let t of e.pathless)j(t);if(e.static)for(let t of e.static.values())j(t);if(e.staticInsensitive)for(let t of e.staticInsensitive.values())j(t);if(e.dynamic?.length){e.dynamic.sort(le);for(let t of e.dynamic)j(t)}if(e.optional?.length){e.optional.sort(le);for(let t of e.optional)j(t)}if(e.wildcard?.length){e.wildcard.sort(le);for(let t of e.wildcard)j(t)}}function M(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,priority:0}}function ue(e,t,n,r,i){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:i}}function de(e,t){let n=M(`/`),r=new Uint16Array(6);for(let t of e)ce(!1,r,t,1,n,0);j(n),t.masksTree=n,t.flatCache=ie(1e3)}function fe(e,t){e||=`/`;let n=t.flatCache.get(e);if(n)return n;let r=F(e,t.masksTree);return t.flatCache.set(e,r),r}function N(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=M(`/`),ce(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),F(r,o,n)}function P(e,t,n=!1){let r=n?e:`nofuzz\0${e}`,i=t.matchCache.get(r);if(i!==void 0)return i;e||=`/`;let a;try{a=F(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=he(a.route)),t.matchCache.set(r,a),a}function pe(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function me(e,t=!1,n){let r=M(e.fullPath),i=new Uint16Array(6),a={},o={},s=0;return ce(t,i,e,1,r,0,e=>{if(n?.(e,s),e.id in a&&k(),a[e.id]=e,s!==0&&e.path){let t=pe(e.fullPath);(!o[t]||e.fullPath.endsWith(`/`))&&(o[t]=e)}s++}),j(r),{processedTree:{segmentTree:r,singleCache:ie(1e3),matchCache:ie(1e3),flatCache:null,masksTree:null},routesById:a,routesByPath:o}}function F(e,t,n=!1){let r=e.split(`/`),i=_e(e,r,t,n);if(!i)return null;let[a]=I(e,r,i);return{route:i.node.route,rawParams:a}}function I(e,t,n){let r=ge(n.node),i=null,a=Object.create(null),o=n.extract?.part??0,s=n.extract?.node??0,c=n.extract?.path??0,l=n.extract?.segment??0;for(;s<r.length;o++,s++,c++,l++){let u=r[s];if(u.kind===A)break;if(u.kind===ae){l--,o--,c--;continue}let d=t[o],f=c;if(d&&(c+=d.length),u.kind===1){i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0;if(e.charCodeAt(t)===123){let n=u.suffix?.length??0,r=e.substring(t+2,e.length-n-1),i=d.substring(t,d.length-n);a[r]=decodeURIComponent(i)}else{let t=e.substring(1);a[t]=decodeURIComponent(d)}}else if(u.kind===3){if(n.skipped&1<<s){o--,c=f-1;continue}i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0,r=u.suffix?.length??0,p=e.substring(t+3,e.length-r-1),m=u.suffix||u.prefix?d.substring(t,d.length-r):d;m&&(a[p]=decodeURIComponent(m))}else if(u.kind===2){let t=u,n=e.substring(f+(t.prefix?.length??0),e.length-(t.suffix?.length??0)),r=decodeURIComponent(n);a[`*`]=r,a._splat=r;break}}return n.rawParams&&Object.assign(a,n.rawParams),[a,{part:o,node:s,path:c,segment:l}]}function he(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function ge(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function _e(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!u(t),a=i&&e!==`/`,o=t.length-+!!i,s=[{node:n,index:1,skipped:0,depth:1,statics:0,dynamics:0,optionals:0}],c=null,l=null;for(;s.length;){let n=s.pop(),{node:i,index:u,skipped:d,depth:f,statics:p,dynamics:m,optionals:h}=n,{extract:g,rawParams:_}=n;if(i.kind===2&&i.route&&!R(l,n))continue;if(i.parse){if(!ye(e,t,n))continue;_=n.rawParams,g=n.extract}r&&i.route&&i.kind!==A&&R(c,n)&&(c=n);let v=u===o;if(v&&(i.route&&(!a||i.kind===A||i.kind===2)&&R(l,n)&&(l=n),!i.optional&&!i.wildcard&&!i.index&&!i.pathless))continue;let y=v?void 0:t[u],b;if(v&&i.index){let n={node:i.index,index:u,skipped:d,depth:f+1,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_},r=!0;if(i.index.parse&&(ye(e,t,n)||(r=!1)),r){if(!m&&!h&&!d&&ve(p,o))return n;R(l,n)&&(l=n)}}if(i.wildcard)for(let e=i.wildcard.length-1;e>=0;e--){let n=i.wildcard[e],{prefix:r,suffix:a}=n;if(!(r&&(v||!(n.caseSensitive?y:b??=y.toLowerCase()).startsWith(r)))){if(a){if(v)continue;let e=t.slice(u).join(`/`).slice(-a.length);if((n.caseSensitive?e:e.toLowerCase())!==a)continue}s.push({node:n,index:o,skipped:d,depth:f+1,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}}if(i.optional){let e=d|1<<f,t=f+1;for(let n=i.optional.length-1;n>=0;n--){let r=i.optional[n];s.push({node:r,index:u,skipped:e,depth:t,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}if(!v)for(let e=i.optional.length-1;e>=0;e--){let n=i.optional[e],{prefix:r,suffix:a}=n;if(r||a){let e=n.caseSensitive?y:b??=y.toLowerCase();if(r&&!e.startsWith(r)||a&&!e.endsWith(a))continue}s.push({node:n,index:u+1,skipped:d,depth:t,statics:p,dynamics:m,optionals:h+L(o,u),extract:g,rawParams:_})}}if(!v&&i.dynamic&&y)for(let e=i.dynamic.length-1;e>=0;e--){let t=i.dynamic[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?y:b??=y.toLowerCase();if(n&&!e.startsWith(n)||r&&!e.endsWith(r))continue}s.push({node:t,index:u+1,skipped:d,depth:f+1,statics:p,dynamics:m+L(o,u),optionals:h,extract:g,rawParams:_})}if(!v&&i.staticInsensitive){let e=i.staticInsensitive.get(b??=y.toLowerCase());e&&s.push({node:e,index:u+1,skipped:d,depth:f+1,statics:p+L(o,u),dynamics:m,optionals:h,extract:g,rawParams:_})}if(!v&&i.static){let e=i.static.get(y);e&&s.push({node:e,index:u+1,skipped:d,depth:f+1,statics:p+L(o,u),dynamics:m,optionals:h,extract:g,rawParams:_})}if(i.pathless){let e=f+1;for(let t=i.pathless.length-1;t>=0;t--){let n=i.pathless[t];s.push({node:n,index:u,skipped:d,depth:e,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}}}if(l)return l;if(r&&c){let n=c.index;for(let e=0;e<c.index;e++)n+=t[e].length;let r=n===e.length?`/`:e.slice(n);return c.rawParams??=Object.create(null),c.rawParams[`**`]=decodeURIComponent(r),c}return null}function L(e,t){return 2**(e-t-1)}function ve(e,t){return e===2**(t-1)-1}function ye(e,t,n){let r,i;try{[r,i]=I(e,t,n)}catch{return null}if(n.rawParams=r,n.extract=i,!n.node.parse)return!0;try{if(n.node.parse(r)===!1)return null}catch{}return!0}function R(e,t){return e?t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===A)>(e.node.kind===A)||t.node.kind===A==(e.node.kind===A)&&t.depth>e.depth))):!0}function z(e){return B(e.filter(e=>e!==void 0).join(`/`))}function B(e){return e.replace(/\/{2,}/g,`/`)}function be(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function V(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/{1,}$/,``):e}function xe(e){return V(be(e))}function Se(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function Ce(e,t,n){return Se(e,n)===Se(t,n)}function we({base:e,to:t,trailingSlash:n=`never`,cache:r}){let i=t.startsWith(`/`),a=!i&&t===`.`,o;if(r){o=i?t:a?e:e+`\0`+t;let n=r.get(o);if(n)return n}let s;if(a)s=e.split(`/`);else if(i)s=t.split(`/`);else{for(s=e.split(`/`);s.length>1&&u(s)===``;)s.pop();let n=t.split(`/`);for(let e=0,t=n.length;e<t;e++){let r=n[e];r===``?e?e===t-1&&s.push(r):s=[r]:r===`..`?s.pop():r===`.`||s.push(r)}}s.length>1&&(u(s)===``?n===`never`&&s.pop():n===`always`&&s.push(``));let c=B(s.join(`/`))||`/`;return o&&r&&r.set(o,c),c}function Te(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=Array.from(t.keys()).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),r=new RegExp(n,`g`);return e=>e.replace(r,e=>t.get(e)??e)}function Ee(e,t,n){let r=t[e];return typeof r==`string`?e===`_splat`?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split(`/`).map(e=>Oe(e,n)).join(`/`):Oe(r,n):r}function De({path:e,params:t,decoder:n,...r}){let i=!1,a=Object.create(null);if(!e||e===`/`)return{interpolatedPath:`/`,usedParams:a,isMissingParams:i};if(!e.includes(`$`))return{interpolatedPath:e,usedParams:a,isMissingParams:i};let o=e.length,s=0,c,l=``;for(;s<o;){let r=s;c=se(e,r,c);let o=c[5];if(s=o+1,r===o)continue;let u=c[0];if(u===0){l+=`/`+e.substring(r,o);continue}if(u===2){let s=t._splat;a._splat=s,a[`*`]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o);if(!s){i=!0,(u||d)&&(l+=`/`+u+d);continue}let f=Ee(`_splat`,t,n);l+=`/`+u+f+d;continue}if(u===1){let s=e.substring(c[2],c[3]);!i&&!(s in t)&&(i=!0),a[s]=t[s];let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=Ee(s,t,n)??`undefined`;l+=`/`+u+f+d;continue}if(u===3){let i=e.substring(c[2],c[3]),s=t[i];if(s==null)continue;a[i]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=Ee(i,t,n)??``;l+=`/`+u+f+d;continue}}return e.endsWith(`/`)&&(l+=`/`),{usedParams:a,interpolatedPath:l||`/`,isMissingParams:i}}function Oe(e,t){let n=encodeURIComponent(e);return t?.(n)??n}function H(e){return e?.isNotFound===!0}function ke(e,t=String){let n=new URLSearchParams;for(let r in e){let i=e[r];i!==void 0&&n.set(r,t(i))}return n.toString()}function Ae(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function je(e){let t=new URLSearchParams(e),n=Object.create(null);for(let[e,r]of t.entries()){let t=n[e];t==null?n[e]=Ae(r):Array.isArray(t)?t.push(Ae(r)):n[e]=[t,Ae(r)]}return n}var Me=Pe(JSON.parse),Ne=Fe(JSON.stringify,JSON.parse);function Pe(e){return t=>{t[0]===`?`&&(t=t.substring(1));let n=je(t);for(let t in n){let r=n[t];if(typeof r==`string`)try{n[t]=e(r)}catch{}}return n}}function Fe(e,t){let n=typeof t==`function`;function r(r){if(typeof r==`object`&&r)try{return e(r)}catch{}else if(n&&typeof r==`string`)try{return t(r),e(r)}catch{}return r}return e=>{let t=ke(e,r);return t?`?${t}`:``}}var Ie=`__root__`;function Le(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&!e.reloadDocument&&typeof e.href==`string`)try{new URL(e.href),e.reloadDocument=!0}catch{}let t=new Headers(e.headers);e.href&&t.get(`Location`)===null&&t.set(`Location`,e.href);let n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function U(e){return e instanceof Response&&!!e.options}var Re=e=>{if(!e.rendered)return e.rendered=!0,e.onReady?.()},ze=e=>e.stores.matchesId.get().some(t=>e.stores.matchStores.get(t)?.get()._forcePending),Be=(e,t)=>!!(e.preload&&!e.router.stores.matchStores.has(t)),W=(e,t,n=!0)=>{let r={...e.router.options.context??{}},i=n?t:t-1;for(let t=0;t<=i;t++){let n=e.matches[t];if(!n)continue;let i=e.router.getMatch(n.id);i&&Object.assign(r,i.__routeContext,i.__beforeLoadContext)}return r},Ve=(e,t)=>{if(!e.matches.length)return;let n=t.routeId,r=e.matches.findIndex(t=>t.routeId===e.router.routeTree.id),i=r>=0?r:0,a=n?e.matches.findIndex(e=>e.routeId===n):e.firstBadMatchIndex??e.matches.length-1;a<0&&(a=i);for(let t=a;t>=0;t--){let n=e.matches[t];if(e.router.looseRoutesById[n.routeId].options.notFoundComponent)return t}return n?a:i},G=(e,t,n)=>{if(!(!U(n)&&!H(n)))throw U(n)&&n.redirectHandled&&!n.options.reloadDocument?n:(t&&(t._nonReactive.beforeLoadPromise?.resolve(),t._nonReactive.loaderPromise?.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0,t._nonReactive.error=n,e.updateMatch(t.id,r=>({...r,status:U(n)?`redirected`:H(n)?`notFound`:r.status===`pending`?`success`:r.status,context:W(e,t.index),isFetching:!1,error:n})),H(n)&&!n.routeId&&(n.routeId=t.routeId),t._nonReactive.loadPromise?.resolve()),U(n)&&(e.rendered=!0,n.options._fromLocation=e.location,n.redirectHandled=!0,n=e.router.resolveRedirect(n)),n)},He=(e,t)=>{let n=e.router.getMatch(t);return!!(!n||n._nonReactive.dehydrated)},Ue=(e,t,n)=>{let r=W(e,n);e.updateMatch(t,e=>({...e,context:r}))},We=(e,t,n,r)=>{let{id:i,routeId:a}=e.matches[t],o=e.router.looseRoutesById[a];if(n instanceof Promise)throw n;n.routerCode=r,e.firstBadMatchIndex??=t,G(e,e.router.getMatch(i),n);try{o.options.onError?.(n)}catch(t){n=t,G(e,e.router.getMatch(i),n)}e.updateMatch(i,e=>(e._nonReactive.beforeLoadPromise?.resolve(),e._nonReactive.beforeLoadPromise=void 0,e._nonReactive.loadPromise?.resolve(),{...e,error:n,status:`error`,isFetching:!1,updatedAt:Date.now(),abortController:new AbortController})),!e.preload&&!U(n)&&!H(n)&&(e.serialError??=n)},Ge=(e,t,n,r)=>{if(r._nonReactive.pendingTimeout!==void 0)return;let i=n.options.pendingMs??e.router.options.defaultPendingMs;if(e.onReady&&!Be(e,t)&&(n.options.loader||n.options.beforeLoad||nt(n))&&typeof i==`number`&&i!==1/0&&(n.options.pendingComponent??e.router.options?.defaultPendingComponent)){let t=setTimeout(()=>{Re(e)},i);r._nonReactive.pendingTimeout=t}},Ke=(e,t,n)=>{let r=e.router.getMatch(t);if(!r._nonReactive.beforeLoadPromise&&!r._nonReactive.loaderPromise)return;Ge(e,t,n,r);let i=()=>{let n=e.router.getMatch(t);n.preload&&(n.status===`redirected`||n.status===`notFound`)&&G(e,n,n.error)};return r._nonReactive.beforeLoadPromise?r._nonReactive.beforeLoadPromise.then(i):i()},qe=(e,t,n,r)=>{let i=e.router.getMatch(t),a=i._nonReactive.loadPromise;i._nonReactive.loadPromise=w(()=>{a?.resolve(),a=void 0});let{paramsError:o,searchError:s}=i;o&&We(e,n,o,`PARSE_PARAMS`),s&&We(e,n,s,`VALIDATE_SEARCH`),Ge(e,t,r,i);let c=new AbortController,l=!1,u=()=>{l||(l=!0,e.updateMatch(t,e=>({...e,isFetching:`beforeLoad`,fetchCount:e.fetchCount+1,abortController:c})))},d=()=>{i._nonReactive.beforeLoadPromise?.resolve(),i._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,e=>({...e,isFetching:!1}))};if(!r.options.beforeLoad){e.router.batch(()=>{u(),d()});return}i._nonReactive.beforeLoadPromise=w();let f={...W(e,n,!1),...i.__routeContext},{search:p,params:m,cause:h}=i,g=Be(e,t),_={search:p,abortController:c,params:m,preload:g,context:f,location:e.location,navigate:t=>e.router.navigate({...t,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:g?`preload`:h,matches:e.matches,routeId:r.id,...e.router.options.additionalContext},v=r=>{if(r===void 0){e.router.batch(()=>{u(),d()});return}(U(r)||H(r))&&(u(),We(e,n,r,`BEFORE_LOAD`)),e.router.batch(()=>{u(),e.updateMatch(t,e=>({...e,__beforeLoadContext:r})),d()})},y;try{if(y=r.options.beforeLoad(_),T(y))return u(),y.catch(t=>{We(e,n,t,`BEFORE_LOAD`)}).then(v)}catch(t){u(),We(e,n,t,`BEFORE_LOAD`)}v(y)},Je=(e,t)=>{let{id:n,routeId:r}=e.matches[t],i=e.router.looseRoutesById[r],a=()=>s(),o=()=>qe(e,n,t,i),s=()=>{if(He(e,n))return;let t=Ke(e,n,i);return T(t)?t.then(o):o()};return a()},Ye=(e,t,n)=>{let r=e.router.getMatch(t);if(!r||!n.options.head&&!n.options.scripts&&!n.options.headers)return;let i={ssr:e.router.options.ssr,matches:e.matches,match:r,params:r.params,loaderData:r.loaderData};return Promise.all([n.options.head?.(i),n.options.scripts?.(i),n.options.headers?.(i)]).then(([e,t,n])=>({meta:e?.meta,links:e?.links,headScripts:e?.scripts,headers:n,scripts:t,styles:e?.styles}))},Xe=(e,t,n,r,i)=>{let a=t[r-1],{params:o,loaderDeps:s,abortController:c,cause:l}=e.router.getMatch(n),u=W(e,r),d=Be(e,n);return{params:o,deps:s,preload:!!d,parentMatchPromise:a,abortController:c,context:u,location:e.location,navigate:t=>e.router.navigate({...t,_fromLocation:e.location}),cause:d?`preload`:l,route:i,...e.router.options.additionalContext}},Ze=async(e,t,n,r,i)=>{try{let a=e.router.getMatch(n);try{tt(i);let o=i.options.loader,s=typeof o==`function`?o:o?.handler,c=s?.(Xe(e,t,n,r,i)),l=!!s&&T(c);if((l||i._lazyPromise||i._componentsPromise||i.options.head||i.options.scripts||i.options.headers||a._nonReactive.minPendingPromise)&&e.updateMatch(n,e=>({...e,isFetching:`loader`})),s){let t=l?await c:c;G(e,e.router.getMatch(n),t),t!==void 0&&e.updateMatch(n,e=>({...e,loaderData:t}))}i._lazyPromise&&await i._lazyPromise;let u=a._nonReactive.minPendingPromise;u&&await u,i._componentsPromise&&await i._componentsPromise,e.updateMatch(n,t=>({...t,error:void 0,context:W(e,r),status:`success`,isFetching:!1,updatedAt:Date.now()}))}catch(t){let o=t;if(o?.name===`AbortError`){if(a.abortController.signal.aborted){a._nonReactive.loaderPromise?.resolve(),a._nonReactive.loaderPromise=void 0;return}e.updateMatch(n,t=>({...t,status:t.status===`pending`?`success`:t.status,isFetching:!1,context:W(e,r)}));return}let s=a._nonReactive.minPendingPromise;s&&await s,H(t)&&await i.options.notFoundComponent?.preload?.(),G(e,e.router.getMatch(n),t);try{i.options.onError?.(t)}catch(t){o=t,G(e,e.router.getMatch(n),t)}!U(o)&&!H(o)&&await tt(i,[`errorComponent`]),e.updateMatch(n,t=>({...t,error:o,context:W(e,r),status:`error`,isFetching:!1}))}}catch(t){let r=e.router.getMatch(n);r&&(r._nonReactive.loaderPromise=void 0),G(e,r,t)}},Qe=async(e,t,n)=>{async function r(r,a,c,l,d){let f=Date.now()-a.updatedAt,p=r?d.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:d.options.staleTime??e.router.options.defaultStaleTime??0,m=d.options.shouldReload,h=typeof m==`function`?m(Xe(e,t,i,n,d)):m,{status:g,invalid:_}=l,v=f>=p&&(!!e.forceStaleReload||l.cause===`enter`||c!==void 0&&c!==l.id);o=g===`success`&&(_||(h??v)),r&&d.options.preload===!1||(o&&!e.sync&&u?(s=!0,(async()=>{try{await Ze(e,t,i,n,d);let r=e.router.getMatch(i);r._nonReactive.loaderPromise?.resolve(),r._nonReactive.loadPromise?.resolve(),r._nonReactive.loaderPromise=void 0,r._nonReactive.loadPromise=void 0}catch(t){U(t)&&await e.router.navigate(t.options)}})()):g!==`success`||o?await Ze(e,t,i,n,d):Ue(e,i,n))}let{id:i,routeId:a}=e.matches[n],o=!1,s=!1,c=e.router.looseRoutesById[a],l=c.options.loader,u=((typeof l==`function`?void 0:l?.staleReloadMode)??e.router.options.defaultStaleReloadMode)!==`blocking`;if(He(e,i)){if(!e.router.getMatch(i))return e.matches[n];Ue(e,i,n)}else{let t=e.router.getMatch(i),o=e.router.stores.matchesId.get()[n],s=(o&&e.router.stores.matchStores.get(o)||null)?.routeId===a?o:e.router.stores.matches.get().find(e=>e.routeId===a)?.id,l=Be(e,i);if(t._nonReactive.loaderPromise){if(t.status===`success`&&!e.sync&&!t.preload&&u)return t;await t._nonReactive.loaderPromise;let n=e.router.getMatch(i),a=n._nonReactive.error||n.error;a&&G(e,n,a),n.status===`pending`&&await r(l,t,s,n,c)}else{let n=l&&!e.router.stores.matchStores.has(i),a=e.router.getMatch(i);a._nonReactive.loaderPromise=w(),n!==a.preload&&e.updateMatch(i,e=>({...e,preload:n})),await r(l,t,s,a,c)}}let d=e.router.getMatch(i);s||(d._nonReactive.loaderPromise?.resolve(),d._nonReactive.loadPromise?.resolve(),d._nonReactive.loadPromise=void 0),clearTimeout(d._nonReactive.pendingTimeout),d._nonReactive.pendingTimeout=void 0,s||(d._nonReactive.loaderPromise=void 0),d._nonReactive.dehydrated=void 0;let f=s?d.isFetching:!1;return f!==d.isFetching||d.invalid!==!1?(e.updateMatch(i,e=>({...e,isFetching:f,invalid:!1})),e.router.getMatch(i)):d};async function $e(e){let t=e,n=[];ze(t.router)&&Re(t);let r;for(let e=0;e<t.matches.length;e++){try{let n=Je(t,e);T(n)&&await n}catch(e){if(U(e))throw e;if(H(e))r=e;else if(!t.preload)throw e;break}if(t.serialError||t.firstBadMatchIndex!=null)break}let i=t.firstBadMatchIndex??t.matches.length,a=r&&!t.preload?Ve(t,r):void 0,o=r&&t.preload?0:a===void 0?i:Math.min(a+1,i),s,c;for(let e=0;e<o;e++)n.push(Qe(t,n,e));try{await Promise.all(n)}catch{let e=await Promise.allSettled(n);for(let t of e){if(t.status!==`rejected`)continue;let e=t.reason;if(U(e))throw e;H(e)?s??=e:c??=e}if(c!==void 0)throw c}let l=s??(r&&!t.preload?r:void 0),u=t.firstBadMatchIndex===void 0?t.matches.length-1:t.firstBadMatchIndex;if(!l&&r&&t.preload)return t.matches;if(l){let e=Ve(t,l);e===void 0&&k();let n=t.matches[e],r=t.router.looseRoutesById[n.routeId],i=t.router.options?.defaultNotFoundComponent;!r.options.notFoundComponent&&i&&(r.options.notFoundComponent=i),l.routeId=n.routeId;let a=n.routeId===t.router.routeTree.id;t.updateMatch(n.id,e=>({...e,...a?{status:`success`,globalNotFound:!0,error:void 0}:{status:`notFound`,error:l},isFetching:!1})),u=e,await tt(r,[`notFoundComponent`])}else if(!t.preload){let e=t.matches[0];e.globalNotFound||t.router.getMatch(e.id)?.globalNotFound&&t.updateMatch(e.id,e=>({...e,globalNotFound:!1,error:void 0}))}if(t.serialError&&t.firstBadMatchIndex!==void 0){let e=t.router.looseRoutesById[t.matches[t.firstBadMatchIndex].routeId];await tt(e,[`errorComponent`])}for(let e=0;e<=u;e++){let{id:n,routeId:r}=t.matches[e],i=t.router.looseRoutesById[r];try{let e=Ye(t,n,i);if(e){let r=await e;t.updateMatch(n,e=>({...e,...r}))}}catch(e){console.error(`Error executing head for route ${r}:`,e)}}let d=Re(t);if(T(d)&&await d,l)throw l;if(t.serialError&&!t.preload&&!t.onReady)throw t.serialError;return t.matches}function et(e,t){let n=t.map(t=>e.options[t]?.preload?.()).filter(Boolean);if(n.length!==0)return Promise.all(n)}function tt(e,t=rt){!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(t=>{let{id:n,...r}=t.options;Object.assign(e.options,r),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0);let n=()=>e._componentsLoaded?void 0:t===rt?(()=>{if(e._componentsPromise===void 0){let t=et(e,rt);t?e._componentsPromise=t.then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0}):e._componentsLoaded=!0}return e._componentsPromise})():et(e,t);return e._lazyPromise?e._lazyPromise.then(n):n()}function nt(e){for(let t of rt)if(e.options[t]?.preload)return!0;return!1}var rt=[`component`,`errorComponent`,`pendingComponent`,`notFoundComponent`];function it(e){return{input:({url:t})=>{for(let n of e)t=ot(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=st(e[n],t);return t}}}function at(e){let t=xe(e.basepath),n=`/${t}`,r=e.caseSensitive?n:n.toLowerCase(),i=`${r}/`;return{input:({url:t})=>{let a=e.caseSensitive?t.pathname:t.pathname.toLowerCase();return a===r?t.pathname=`/`:a.startsWith(i)&&(t.pathname=t.pathname.slice(n.length)),t},output:({url:e})=>(e.pathname=z([`/`,t,e.pathname]),e)}}function ot(e,t){let n=e?.input?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function st(e,t){let n=e?.output?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function ct(e,t){let{createMutableStore:n,createReadonlyStore:r,batch:i,init:a}=t,o=new Map,s=new Map,c=new Map,l=n(e.status),u=n(e.loadedAt),d=n(e.isLoading),f=n(e.isTransitioning),p=n(e.location),m=n(e.resolvedLocation),h=n(e.statusCode),g=n(e.redirect),_=n([]),v=n([]),y=n([]),b=r(()=>lt(o,_.get())),x=r(()=>lt(s,v.get())),S=r(()=>lt(c,y.get())),C=r(()=>_.get()[0]),w=r(()=>_.get().some(e=>o.get(e)?.get().status===`pending`)),T=r(()=>({locationHref:p.get().href,resolvedLocationHref:m.get()?.href,status:l.get()})),E=r(()=>({status:l.get(),loadedAt:u.get(),isLoading:d.get(),isTransitioning:f.get(),matches:b.get(),location:p.get(),resolvedLocation:m.get(),statusCode:h.get(),redirect:g.get()})),D=ie(64);function ee(e){let t=D.get(e);return t||(t=r(()=>{let t=_.get();for(let n of t){let t=o.get(n);if(t&&t.routeId===e)return t.get()}}),D.set(e,t)),t}let te={status:l,loadedAt:u,isLoading:d,isTransitioning:f,location:p,resolvedLocation:m,statusCode:h,redirect:g,matchesId:_,pendingIds:v,cachedIds:y,matches:b,pendingMatches:x,cachedMatches:S,firstId:C,hasPending:w,matchRouteDeps:T,matchStores:o,pendingMatchStores:s,cachedMatchStores:c,__store:E,getRouteMatchStore:ee,setMatches:O,setPending:ne,setCached:re};O(e.matches),a?.(te);function O(e){ut(e,o,_,n,i)}function ne(e){ut(e,s,v,n,i)}function re(e){ut(e,c,y,n,i)}return te}function lt(e,t){let n=[];for(let r of t){let t=e.get(r);t&&n.push(t.get())}return n}function ut(e,t,n,r,i){let a=e.map(e=>e.id),o=new Set(a);i(()=>{for(let e of t.keys())o.has(e)||t.delete(e);for(let n of e){let e=t.get(n.id);if(!e){let e=r(n);e.routeId=n.routeId,t.set(n.id,e);continue}e.routeId=n.routeId,e.get()!==n&&e.set(n)}re(n.get(),a)||n.set(a)})}var K=`__TSR_index`,dt=`popstate`,ft=`beforeunload`;function pt(e){let t=e.getLocation(),n=new Set,r=r=>{t=e.getLocation(),n.forEach(e=>e({location:t,action:r}))},i=n=>{e.notifyOnIndexChange??!0?r(n):t=e.getLocation()},a=async({task:n,navigateOpts:r,...i})=>{if(r?.ignoreBlocker??!1){n();return}let a=e.getBlockers?.()??[],o=i.type===`PUSH`||i.type===`REPLACE`;if(typeof document<`u`&&a.length&&o)for(let n of a){let r=_t(i.path,i.state);if(await n.blockerFn({currentLocation:t,nextLocation:r,action:i.type})){e.onBlocked?.();return}}n()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:e=>(n.add(e),()=>{n.delete(e)}),push:(n,i,o)=>{let s=t.state[K];i=mt(s+1,i),a({task:()=>{e.pushState(n,i),r({type:`PUSH`})},navigateOpts:o,type:`PUSH`,path:n,state:i})},replace:(n,i,o)=>{let s=t.state[K];i=mt(s,i),a({task:()=>{e.replaceState(n,i),r({type:`REPLACE`})},navigateOpts:o,type:`REPLACE`,path:n,state:i})},go:(t,n)=>{a({task:()=>{e.go(t),i({type:`GO`,index:t})},navigateOpts:n,type:`GO`})},back:t=>{a({task:()=>{e.back(t?.ignoreBlocker??!1),i({type:`BACK`})},navigateOpts:t,type:`BACK`})},forward:t=>{a({task:()=>{e.forward(t?.ignoreBlocker??!1),i({type:`FORWARD`})},navigateOpts:t,type:`FORWARD`})},canGoBack:()=>t.state[K]!==0,createHref:t=>e.createHref(t),block:t=>{if(!e.setBlockers)return()=>{};let n=e.getBlockers?.()??[];return e.setBlockers([...n,t]),()=>{let n=e.getBlockers?.()??[];e.setBlockers?.(n.filter(e=>e!==t))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r}}function mt(e,t){t||={};let n=vt();return{...t,key:n,__TSR_key:n,[K]:e}}function ht(e){let t=e?.window??(typeof document<`u`?window:void 0),n=t.history.pushState,r=t.history.replaceState,i=[],a=()=>i,o=e=>i=e,s=e?.createHref??(e=>e),c=e?.parseLocation??(()=>_t(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=vt();t.history.replaceState({[K]:0,key:e,__TSR_key:e},``)}let l=c(),u,d=!1,f=!1,p=!1,m=!1,h=()=>l,g,_,v=()=>{g&&(C._ignoreSubscribers=!0,(g.isPush?t.history.pushState:t.history.replaceState)(g.state,``,g.href),C._ignoreSubscribers=!1,g=void 0,_=void 0,u=void 0)},y=(e,t,n)=>{let r=s(t);_||(u=l),l=_t(t,n),g={href:r,state:n,isPush:g?.isPush||e===`push`},_||=Promise.resolve().then(()=>v())},b=e=>{l=c(),C.notify({type:e})},x=async()=>{if(f){f=!1;return}let e=c(),n=e.state[K]-l.state[K],r=n===1,i=n===-1,o=!r&&!i||d;d=!1;let s=o?`GO`:i?`BACK`:`FORWARD`,u=o?{type:`GO`,index:n}:{type:i?`BACK`:`FORWARD`};if(p)p=!1;else{let n=a();if(typeof document<`u`&&n.length){for(let r of n)if(await r.blockerFn({currentLocation:l,nextLocation:e,action:s})){f=!0,t.history.go(1),C.notify(u);return}}}l=c(),C.notify(u)},S=e=>{if(m){m=!1;return}let t=!1,n=a();if(typeof document<`u`&&n.length)for(let e of n){let n=e.enableBeforeUnload??!0;if(n===!0){t=!0;break}if(typeof n==`function`&&n()===!0){t=!0;break}}if(t)return e.preventDefault(),e.returnValue=``},C=pt({getLocation:h,getLength:()=>t.history.length,pushState:(e,t)=>y(`push`,e,t),replaceState:(e,t)=>y(`replace`,e,t),back:e=>(e&&(p=!0),m=!0,t.history.back()),forward:e=>{e&&(p=!0),m=!0,t.history.forward()},go:e=>{d=!0,t.history.go(e)},createHref:e=>s(e),flush:v,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(ft,S,{capture:!0}),t.removeEventListener(dt,x)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return t.addEventListener(ft,S,{capture:!0}),t.addEventListener(dt,x),t.history.pushState=function(...e){let r=n.apply(t.history,e);return C._ignoreSubscribers||b(`PUSH`),r},t.history.replaceState=function(...e){let n=r.apply(t.history,e);return C._ignoreSubscribers||b(`REPLACE`),n},C}function gt(e){let t=e.replace(/[\x00-\x1f\x7f]/g,``);return t.startsWith(`//`)&&(t=`/`+t.replace(/^\/+/,``)),t}function _t(e,t){let n=gt(e),r=n.indexOf(`#`),i=n.indexOf(`?`),a=vt();return{href:n,pathname:n.substring(0,r>0?i>0?Math.min(r,i):r:i>0?i:n.length),hash:r>-1?n.substring(r):``,search:i>-1?n.slice(i,r===-1?void 0:r):``,state:t||{[K]:0,key:a,__TSR_key:a}}}function vt(){return(Math.random()+1).toString(36).substring(7)}function q(e,t){let n=t,r=e;return{fromLocation:n,toLocation:r,pathChanged:n?.pathname!==r.pathname,hrefChanged:n?.href!==r.href,hashChanged:n?.hash!==r.hash}}var yt=new WeakMap,bt=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.isScrollRestoring=!1,this.isScrollRestorationSetup=!1,this.routeBranchCache=new WeakMap,this.startTransition=e=>e(),this.update=e=>{let t=this.options,n=this.basepath??t?.basepath??`/`,r=this.basepath===void 0,i=t?.rewrite;if(this.options={...t,...e},this.isServer=this.options.isServer??typeof document>`u`,this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=Te(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=ht()),this.origin=this.options.origin,this.origin||(window?.origin&&window.origin!==`null`?this.origin=window.origin:this.origin=`http://localhost`),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let e;this.resolvePathCache=ie(1e3),e=this.buildRouteTree(),this.setRoutes(e)}if(!this.stores&&this.latestLocation){let e=this.getStoreConfig(this);this.batch=e.batch,this.stores=ct(Ct(this.latestLocation),e),Ut(this)}let a=!1,o=this.options.basepath??`/`,s=this.options.rewrite;if(r||n!==o||i!==s){this.basepath=o;let e=[],t=xe(o);t&&t!==`/`&&e.push(at({basepath:o})),s&&e.push(s),this.rewrite=e.length===0?void 0:e.length===1?e[0]:it(e),this.history&&this.updateLatestLocation(),a=!0}a&&this.stores&&this.stores.location.set(this.latestLocation),typeof window<`u`&&`CSS`in window&&typeof window.CSS?.supports==`function`&&(this.isViewTransitionTypesSupported=window.CSS.supports(`selector(:active-view-transition-type(a))`))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=me(this.routeTree,this.options.caseSensitive,(e,t)=>{e.init({originalIndex:t})});return this.options.routeMasks&&de(this.options.routeMasks,e.processedTree),e},this.subscribe=(e,t)=>{let n={eventType:e,fn:t};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=e=>{this.subscribers.forEach(t=>{t.eventType===e.type&&t.fn(e)})},this.parseLocation=(e,t)=>{let n=({pathname:e,search:n,hash:r,href:i,state:a})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(e)){let i=this.options.parseSearch(n),o=this.options.stringifySearch(i);return{href:e+o+r,publicHref:e+o+r,pathname:O(e).path,external:!1,searchStr:o,search:_(t?.search,i),hash:O(r.slice(1)).path,state:v(t?.state,a)}}let o=new URL(i,this.origin),s=ot(this.rewrite,o),c=this.options.parseSearch(s.search),l=this.options.stringifySearch(c);return s.search=l,{href:s.href.replace(s.origin,``),publicHref:i,pathname:O(s.pathname).path,external:!!this.rewrite&&s.origin!==this.origin,searchStr:l,search:_(t?.search,c),hash:O(s.hash.slice(1)).path,state:v(t?.state,a)}},r=n(e),{__tempLocation:i,__tempKey:a}=r.state;if(i&&(!a||a===this.tempLocationKey)){let e=n(i);return e.state.key=r.state.key,e.state.__TSR_key=r.state.__TSR_key,delete e.state.__tempLocation,{...e,maskedLocation:r}}return r},this.resolvePathWithBase=(e,t)=>we({base:e,to:t.includes(`//`)?B(t):t,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(e,t,n)=>typeof e==`string`?this.matchRoutesInternal({pathname:e,search:t},n):this.matchRoutesInternal(e,t),this.getMatchedRoutes=e=>Tt({pathname:e,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=e=>{let t=this.getMatch(e);t&&(t.abortController.abort(),clearTimeout(t._nonReactive.pendingTimeout),t._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{this.stores.pendingIds.get().forEach(e=>{this.cancelMatch(e)}),this.stores.matchesId.get().forEach(e=>{if(this.stores.pendingMatchStores.has(e))return;let t=this.stores.matchStores.get(e)?.get();t&&(t.status===`pending`||t.isFetching===`loader`)&&this.cancelMatch(e)})},this.buildLocation=e=>{let t=(t={})=>{let n=t._fromLocation||this.pendingBuiltLocation||this.latestLocation,r=this.matchRoutesLightweight(n);t.from;let i=t.unsafeRelative===`path`?n.pathname:t.from??r.fullPath,a=t.to?`${t.to}`:void 0,o=r.search,s=Object.assign(Object.create(null),r.params),c=a?.charCodeAt(0)===47?`/`:this.resolvePathWithBase(i,`.`),l=a?this.resolvePathWithBase(c,a):c,u=t.params===!1||t.params===null?Object.create(null):(t.params??!0)===!0?s:Object.assign(s,f(t.params,s)),d=this.routesByPath[V(l)],p;if(d)p=this.getRouteBranch(d);else if(l.includes(`$`))p=[];else{let e=this.getMatchedRoutes(l);p=e.matchedRoutes,this.options.notFoundRoute&&(!e.foundRoute||e.foundRoute.path!==`/`&&e.routeParams[`**`])&&(p=[...p,this.options.notFoundRoute])}if(p.length&&h(u))for(let e of p){let t=e.options.params?.stringify??e.options.stringifyParams;if(t)try{Object.assign(u,t(u))}catch{}}let m=e.leaveParams?l:O(De({path:l,params:u,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path,g=o;if(e._includeValidateSearch&&this.options.search?.strict){let e={};p.forEach(t=>{if(t.options.validateSearch)try{Object.assign(e,wt(t.options.validateSearch,{...e,...g}))}catch{}}),g=e}g=Et({search:g,dest:t,destRoutes:p,_includeValidateSearch:e._includeValidateSearch}),g=_(o,g);let y=this.options.stringifySearch(g),b=t.hash===!0?n.hash:t.hash?f(t.hash,n.hash):void 0,x=b?`#${b}`:``,S=t.state===!0?n.state:t.state?f(t.state,n.state):{};S=v(n.state,S);let C=`${m}${y}${x}`,w,T,E=!1;if(this.rewrite){let e=new URL(C,this.origin),t=st(this.rewrite,e);w=e.href.replace(e.origin,``),t.origin===this.origin?T=t.pathname+t.search+t.hash:(T=t.href,E=!0)}else w=ne(C),T=w;return{publicHref:T,href:w,pathname:m,search:g,searchStr:y,state:S,hash:b??``,external:E,unmaskOnReload:t.unmaskOnReload}},n=(n={},r)=>{let i=t(n),a=r?t(r):void 0;if(!a){let n=Object.create(null);if(this.options.routeMasks){let o=fe(i.pathname,this.processedTree);if(o){Object.assign(n,o.rawParams);let{from:i,params:s,...c}=o.route,l=s===!1||s===null?Object.create(null):(s??!0)===!0?n:Object.assign(n,f(s,n));r={from:e.from,...c,params:l},a=t(r)}}}return a&&(i.maskedLocation=a),i};return e.mask?n(e,{from:e.from,...e.mask}):n(e)},this.commitLocation=async({viewTransition:e,ignoreBlocker:t,...n})=>{let r,i=()=>{let e=[`key`,`__TSR_key`,`__TSR_index`,`__hashScrollIntoViewOptions`];e.forEach(e=>{n.state[e]=this.latestLocation.state[e]});let t=C(n.state,this.latestLocation.state);return e.forEach(e=>{delete n.state[e]}),t},a=V(this.latestLocation.href)===V(n.href),o=this.commitLocationPromise;if(this.commitLocationPromise=w(()=>{o?.resolve(),o=void 0}),a&&i())this.load();else{let{maskedLocation:i,hashScrollIntoView:a,...o}=n;i&&(o={...i,state:{...i.state,__tempKey:void 0,__tempLocation:{...o,search:o.searchStr,state:{...o.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(o.unmaskOnReload??this.options.unmaskOnReload??!1)&&(o.state.__tempKey=this.tempLocationKey)),o.state.__hashScrollIntoViewOptions=a??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=e,r=n.replace?`REPLACE`:`PUSH`,this.history[r===`REPLACE`?`replace`:`push`](o.publicHref,o.state,{ignoreBlocker:t})}return this.resetNextScroll=n.resetScroll??!0,this.history.subscribers.size||this.load(r?{action:{type:r}}:void 0),this.commitLocationPromise},this.buildAndCommitLocation=({replace:e,resetScroll:t,hashScrollIntoView:n,viewTransition:r,ignoreBlocker:i,href:a,...o}={})=>{if(a){let t=this.history.location.state.__TSR_index,n=_t(a,{__TSR_index:e?t:t+1}),r=new URL(n.pathname,this.origin);o.to=ot(this.rewrite,r).pathname,o.search=this.options.parseSearch(n.search),o.hash=n.hash.slice(1)}let s=this.buildLocation({...o,_includeValidateSearch:!0});this.pendingBuiltLocation=s;let c=this.commitLocation({...s,viewTransition:r,replace:e,resetScroll:t,hashScrollIntoView:n,ignoreBlocker:i});return Promise.resolve().then(()=>{this.pendingBuiltLocation===s&&(this.pendingBuiltLocation=void 0)}),c},this.navigate=async({to:e,reloadDocument:t,href:n,publicHref:r,...i})=>{let a=!1;if(n)try{new URL(`${n}`),a=!0}catch{}if(a&&!t&&(t=!0),t){if(e!==void 0||!n){let t=this.buildLocation({to:e,...i});n??=t.publicHref,r??=t.publicHref}let t=!a&&r?r:n;if(te(t,this.protocolAllowlist))return Promise.resolve();if(!i.ignoreBlocker){let e=this.history.getBlockers?.()??[];for(let t of e)if(t?.blockerFn&&await t.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:`PUSH`}))return Promise.resolve()}return i.replace?window.location.replace(t):window.location.href=t,Promise.resolve()}return this.buildAndCommitLocation({...i,href:n,to:e,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();let e=this.matchRoutes(this.latestLocation),t=this.stores.cachedMatches.get().filter(t=>!e.some(e=>e.id===t.id));this.batch(()=>{this.stores.status.set(`pending`),this.stores.statusCode.set(200),this.stores.isLoading.set(!0),this.stores.location.set(this.latestLocation),this.stores.setPending(e),this.stores.setCached(t)})},this.load=async e=>{let t=e?.action?.type,n,r,i,a=this.stores.resolvedLocation.get()??this.stores.location.get();for(i=new Promise(o=>{this.startTransition(async()=>{try{this.beforeLoad(),t?yt.set(this.latestLocation,t):yt.delete(this.latestLocation);let n=this.latestLocation,r=q(n,this.stores.resolvedLocation.get());this.stores.redirect.get()||this.emit({type:`onBeforeNavigate`,...r}),this.emit({type:`onBeforeLoad`,...r}),await $e({router:this,sync:e?.sync,forceStaleReload:a.href===n.href,matches:this.stores.pendingMatches.get(),location:n,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let e=null,t=null,n=null,r=null;this.batch(()=>{let i=this.stores.pendingMatches.get(),a=i.length,o=this.stores.matches.get();e=a?o.filter(e=>!this.stores.pendingMatchStores.has(e.id)):null;let s=new Set;for(let e of this.stores.pendingMatchStores.values())e.routeId&&s.add(e.routeId);let c=new Set;for(let e of this.stores.matchStores.values())e.routeId&&c.add(e.routeId);t=a?o.filter(e=>!s.has(e.routeId)):null,n=a?i.filter(e=>!c.has(e.routeId)):null,r=a?i.filter(e=>c.has(e.routeId)):o,this.stores.isLoading.set(!1),this.stores.loadedAt.set(Date.now()),a&&(this.stores.setMatches(i),this.stores.setPending([]),this.stores.setCached([...this.stores.cachedMatches.get(),...e.filter(e=>e.status!==`error`&&e.status!==`notFound`&&e.status!==`redirected`)]),this.clearExpiredCache())});for(let[e,i]of[[t,`onLeave`],[n,`onEnter`],[r,`onStay`]])if(e)for(let t of e)this.looseRoutesById[t.routeId].options[i]?.(t)})})}})}catch(e){U(e)?(n=e,this.navigate({...n.options,replace:!0,ignoreBlocker:!0})):H(e)&&(r=e);let t=n?n.status:r?404:this.stores.matches.get().some(e=>e.status===`error`)?500:200;this.batch(()=>{this.stores.statusCode.set(t),this.stores.redirect.set(n)})}this.latestLoadPromise===i&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),o()})}),this.latestLoadPromise=i,await i;this.latestLoadPromise&&i!==this.latestLoadPromise;)await this.latestLoadPromise;let o;this.hasNotFoundMatch()?o=404:this.stores.matches.get().some(e=>e.status===`error`)&&(o=500),o!==void 0&&this.stores.statusCode.set(o)},this.startViewTransition=e=>{let t=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,t&&typeof document<`u`&&`startViewTransition`in document&&typeof document.startViewTransition==`function`){let n;if(typeof t==`object`&&this.isViewTransitionTypesSupported){let r=this.latestLocation,i=this.stores.resolvedLocation.get(),a=typeof t.types==`function`?t.types(q(r,i)):t.types;if(a===!1){e();return}n={update:e,types:a}}else n=e;document.startViewTransition(n)}else e()},this.updateMatch=(e,t)=>{this.startTransition(()=>{let n=this.stores.pendingMatchStores.get(e);if(n){n.set(t);return}let r=this.stores.matchStores.get(e);if(r){r.set(t);return}let i=this.stores.cachedMatchStores.get(e);if(i){let n=t(i.get());n.status===`redirected`?this.stores.cachedMatchStores.delete(e)&&this.stores.cachedIds.set(t=>t.filter(t=>t!==e)):i.set(n)}})},this.getMatch=e=>this.stores.cachedMatchStores.get(e)?.get()??this.stores.pendingMatchStores.get(e)?.get()??this.stores.matchStores.get(e)?.get(),this.invalidate=e=>{let t=t=>e?.filter?.(t)??!0?{...t,invalid:!0,...e?.forcePending||t.status===`error`||t.status===`notFound`?{status:`pending`,error:void 0}:void 0}:t;return this.batch(()=>{this.stores.setMatches(this.stores.matches.get().map(t)),this.stores.setCached(this.stores.cachedMatches.get().map(t)),this.stores.setPending(this.stores.pendingMatches.get().map(t))}),this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.getParsedLocationHref=e=>e.publicHref||`/`,this.resolveRedirect=e=>{let t=e.headers.get(`Location`);if(!e.options.href||e.options._builtLocation){let t=e.options._builtLocation??this.buildLocation(e.options),n=this.getParsedLocationHref(t);e.options.href=n,e.headers.set(`Location`,n)}else if(t)try{let n=new URL(t);if(this.origin&&n.origin===this.origin){let t=n.pathname+n.search+n.hash;e.options.href=t,e.headers.set(`Location`,t)}}catch{}if(e.options.href&&!e.options._builtLocation&&te(e.options.href,this.protocolAllowlist))throw Error(`Redirect blocked: unsafe protocol`);return e.headers.get(`Location`)||e.headers.set(`Location`,e.options.href),e},this.clearCache=e=>{let t=e?.filter;t===void 0?this.stores.setCached([]):this.stores.setCached(this.stores.cachedMatches.get().filter(e=>!t(e)))},this.clearExpiredCache=()=>{let e=Date.now();this.clearCache({filter:t=>{let n=this.looseRoutesById[t.routeId];if(!n.options.loader)return!0;let r=(t.preload?n.options.preloadGcTime??this.options.defaultPreloadGcTime:n.options.gcTime??this.options.defaultGcTime)??300*1e3;return t.status===`error`?!0:e-t.updatedAt>=r}})},this.loadRouteChunk=tt,this.preloadRoute=async e=>{let t=e._builtLocation??this.buildLocation(e),n=this.matchRoutes(t,{throwOnError:!0,preload:!0,dest:e}),r=new Set([...this.stores.matchesId.get(),...this.stores.pendingIds.get()]),i=new Set([...r,...this.stores.cachedIds.get()]),a=n.filter(e=>!i.has(e.id));if(a.length){let e=this.stores.cachedMatches.get();this.stores.setCached([...e,...a])}try{return n=await $e({router:this,matches:n,location:t,preload:!0,updateMatch:(e,t)=>{r.has(e)?n=n.map(n=>n.id===e?t(n):n):this.updateMatch(e,t)}}),n}catch(e){if(U(e))return e.options.reloadDocument?void 0:await this.preloadRoute({...e.options,_fromLocation:t});H(e)||console.error(e);return}},this.matchRoute=(e,t)=>{let n={...e,to:e.to?this.resolvePathWithBase(e.from||``,e.to):void 0,params:e.params||{},leaveParams:!0},r=this.buildLocation(n);if(t?.pending&&this.stores.status.get()!==`pending`)return!1;let i=(t?.pending===void 0?!this.stores.isLoading.get():t.pending)?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),a=N(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,i.pathname,this.processedTree);return!a||e.params&&!C(a.rawParams,e.params,{partial:!0})?!1:t?.includeSearch??!0?C(i.search,r.search,{partial:!0})?a.rawParams:!1:a.rawParams},this.hasNotFoundMatch=()=>this.stores.matches.get().some(e=>e.status===`notFound`||e.globalNotFound),this.getStoreConfig=t,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??`fuzzy`,stringifySearch:e.stringifySearch??Ne,parseSearch:e.parseSearch??Me,protocolAllowlist:e.protocolAllowlist??ee}),typeof document<`u`&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.stores.__store.get()}setRoutes({routesById:e,routesByPath:t,processedTree:n}){this.routesById=e,this.routesByPath=t,this.processedTree=n;let r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}getRouteBranch(e){let t=this.routeBranchCache.get(e);return t||(t=he(e),this.routeBranchCache.set(e,t)),t}get looseRoutesById(){return this.routesById}getParentContext(e){return e?.id?e.context??this.options.context??void 0:this.options.context??void 0}matchRoutesInternal(e,t){let n=this.getMatchedRoutes(e.pathname),{foundRoute:r,routeParams:i}=n,{matchedRoutes:a}=n,o=!1;(r?r.path!==`/`&&i[`**`]:V(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:o=!0);let s=o?Ot(this.options.notFoundMode,a):void 0,c=Array(a.length),l=new Map;for(let e of this.stores.matchStores.values())e.routeId&&l.set(e.routeId,e.get());for(let n=0;n<a.length;n++){let r=a[n],o=c[n-1],u,d,f;{let n=o?.search??e.search,i=o?._strictSearch??void 0;try{let e=wt(r.options.validateSearch,{...n})??void 0;u={...n,...e},d={...i,...e},f=void 0}catch(e){let r=e;if(e instanceof xt||(r=new xt(e.message,{cause:e})),t?.throwOnError)throw r;u=n,d={},f=r}}let p=r.options.loaderDeps?.({search:u})??``,m=p?JSON.stringify(p):``,{interpolatedPath:h,usedParams:g}=De({path:r.fullPath,params:i,decoder:this.pathParamsDecoder,server:this.isServer}),y=r.id+h+m,b=this.getMatch(y),x=l.get(r.id),S=b?._strictParams??g,C;if(!b)try{kt(r,S)}catch(e){if(C=H(e)||U(e)?e:new St(e.message,{cause:e}),t?.throwOnError)throw C}Object.assign(i,S);let T=x?`stay`:`enter`,E;if(b)E={...b,cause:T,params:x?.params??i,_strictParams:S,search:_(x?x.search:b.search,u),_strictSearch:d};else{let e=r.options.loader||r.options.beforeLoad||r.lazyFn||nt(r)?`pending`:`success`;E={id:y,ssr:r.options.ssr,index:n,routeId:r.id,params:x?.params??i,_strictParams:S,pathname:h,updatedAt:Date.now(),search:x?_(x.search,u):u,_strictSearch:d,searchError:void 0,status:e,isFetching:!1,error:void 0,paramsError:C,__routeContext:void 0,_nonReactive:{loadPromise:w()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:T,loaderDeps:x?v(x.loaderDeps,p):p,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:r.options.staticData||{},fullPath:r.fullPath}}t?.preload||(E.globalNotFound=s===r.id),E.searchError=f;let D=this.getParentContext(o);E.context={...D,...E.__routeContext,...E.__beforeLoadContext},c[n]=E}for(let t=0;t<c.length;t++){let n=c[t],r=this.looseRoutesById[n.routeId],a=this.getMatch(n.id),o=l.get(n.routeId);if(n.params=o?_(o.params,i):i,!a){let i=c[t-1],a=this.getParentContext(i);if(r.options.context){let t={deps:n.loaderDeps,params:n.params,context:a??{},location:e,navigate:t=>this.navigate({...t,_fromLocation:e}),buildLocation:this.buildLocation,cause:n.cause,abortController:n.abortController,preload:!!n.preload,matches:c,routeId:r.id};n.__routeContext=r.options.context(t)??void 0}n.context={...a,...n.__routeContext,...n.__beforeLoadContext}}}return c}matchRoutesLightweight(e){let{matchedRoutes:t,routeParams:n}=this.getMatchedRoutes(e.pathname),r=u(t),i={...e.search};for(let e of t)try{Object.assign(i,wt(e.options.validateSearch,i))}catch{}let a=u(this.stores.matchesId.get()),o=a&&this.stores.matchStores.get(a)?.get(),s=o&&o.routeId===r.id&&o.pathname===e.pathname,c;if(s)c=o.params;else{let e=Object.assign(Object.create(null),n);for(let n of t)try{kt(n,e)}catch{}c=e}return{matchedRoutes:t,fullPath:r.fullPath,search:i,params:c}}},xt=class extends Error{},St=class extends Error{};function Ct(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:`idle`,resolvedLocation:void 0,location:e,matches:[],statusCode:200}}function wt(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new xt(`Async validation not supported`);if(n.issues)throw new xt(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return`parse`in e?e.parse(t):typeof e==`function`?e(t):{}}function Tt({pathname:e,routesById:t,processedTree:n}){let r=Object.create(null),i=V(e),a,o=P(i,n,!0);return o&&(a=o.route,Object.assign(r,o.rawParams)),{matchedRoutes:o?.branch||[t.__root__],routeParams:r,foundRoute:a}}function Et({search:e,dest:t,destRoutes:n,_includeValidateSearch:r}){return Dt(n)(e,t,r??!1)}function Dt(e){let t={dest:null,_includeValidateSearch:!1,middlewares:[]};for(let n of e)`search`in n.options?n.options.search?.middlewares&&t.middlewares.push(...n.options.search.middlewares):(n.options.preSearchFilters||n.options.postSearchFilters)&&t.middlewares.push(({search:e,next:t})=>{let r=e;`preSearchFilters`in n.options&&n.options.preSearchFilters&&(r=n.options.preSearchFilters.reduce((e,t)=>t(e),e));let i=t(r);return`postSearchFilters`in n.options&&n.options.postSearchFilters?n.options.postSearchFilters.reduce((e,t)=>t(e),i):i}),n.options.validateSearch&&t.middlewares.push(({search:e,next:r})=>{let i=r(e);if(!t._includeValidateSearch)return i;try{return{...i,...wt(n.options.validateSearch,i)??void 0}}catch{return i}});t.middlewares.push(({search:e})=>{let n=t.dest;return n.search?n.search===!0?e:f(n.search,e):{}});let n=(e,t,r)=>{if(e>=r.length)return t;let i=r[e];return i({search:t,next:t=>n(e+1,t,r)})};return function(e,r,i){return t.dest=r,t._includeValidateSearch=i,n(0,e,t.middlewares)}}function Ot(e,t){if(e!==`root`)for(let e=t.length-1;e>=0;e--){let n=t[e];if(n.children)return n.id}return Ie}function kt(e,t){let n=e.options.params?.parse??e.options.parseParams;if(n){let e=n(t);if(e===!1)throw Error(`Route params.parse returned false for a matched route`);Object.assign(t,e)}}function At(){try{return sessionStorage}catch{return}}var jt=`tsr-scroll-restoration-v1_3`,Mt=At();function Nt(){try{return JSON.parse(Mt?.getItem(`tsr-scroll-restoration-v1_3`)||`{}`)}catch{return{}}}function Pt(){try{Mt?.setItem(jt,JSON.stringify(Ft))}catch{}}var Ft=Nt(),It=`data-scroll-restoration-id`,Lt=e=>e.state.__TSR_key||e.href;function Rt(e){let t=e.getAttribute(It);if(t)return`[${It}="${t}"]`;let n=``,r=e,i;for(;i=r.parentNode;){let e=1,t=r;for(;t=t.previousElementSibling;)e++;let a=`${r.localName}:nth-child(${e})`;n=n?`${a} > ${n}`:a,r=i}return n}var zt=!1,Bt=`window`;function Vt(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function Ht(e){let t=[];for(let n of e){if(n===Bt)continue;let e=Vt(n);e&&t.push(e)}return t}function Ut(e,t){if((t??e.options.scrollRestoration)&&(e.isScrollRestoring=!0),e.isScrollRestorationSetup)return;e.isScrollRestorationSetup=!0,zt=!1;let n=e.options.getScrollRestorationKey||Lt,r=new Map,i=(e,t,n)=>{let i=r.get(e)||{};i.scrollX=t,i.scrollY=n,r.set(e,i)};history.scrollRestoration=`manual`;let a=t=>{if(!(zt||!e.isScrollRestoring))if(t.target===document)i(Bt,scrollX,scrollY);else{let e=t.target;i(e,e.scrollLeft,e.scrollTop)}},o=t=>{if(!e.isScrollRestoring)return;let n=Ft[t]||={};for(let[e,t]of r)e===Bt?n[Bt]=t:e.isConnected&&(n[Rt(e)]=t)};document.addEventListener(`scroll`,a,!0),e.subscribe(`onBeforeLoad`,e=>{e.fromLocation&&o(n(e.fromLocation)),r.clear()}),addEventListener(`pagehide`,()=>{o(n(e.stores.resolvedLocation.get()??e.stores.location.get())),Pt()}),e.subscribe(`onRendered`,t=>{let i=e.options.scrollRestorationBehavior,a=e.options.scrollToTopSelectors,o=e.resetNextScroll,s;if(r.clear(),o||(e.resetNextScroll=!0),typeof e.options.scrollRestoration==`function`&&!e.options.scrollRestoration({location:e.latestLocation}))return;let c=n(t.toLocation),l=t.fromLocation&&n(t.fromLocation);if(e.isScrollRestoring&&l&&l!==c){let e=Ft[l];if(e){let t=Ft[c];for(let n in e){if(n===Bt){if(o)continue}else{let e=Vt(n);if(!e||o&&a&&(s??=Ht(a),s.includes(e)))continue}t||=Ft[c]={},t[n]??=e[n]}}}zt=!0;try{let n=t.toLocation.hash,r=t.toLocation.state.__hashScrollIntoViewOptions??!0,l=!1;if(o){let o=yt.get(t.toLocation),u=n&&r&&(o===`PUSH`||o===`REPLACE`),d=e.isScrollRestoring?Ft[c]:void 0;if(d)for(let e in d){let{scrollX:t,scrollY:n}=d[e];if(e===Bt){if(u)continue;scrollTo({top:n,left:t,behavior:i}),l=!0}else{let r=Vt(e);r&&(r.scrollLeft=t,r.scrollTop=n)}}if(!l&&!n){let e={top:0,left:0,behavior:i};if(scrollTo(e),a){s??=Ht(a);for(let t of s)t.scrollTo(e)}}}!l&&n&&r&&document.getElementById(n)?.scrollIntoView(r)}finally{zt=!1}})}var Wt=`Error preloading route! ☝️`,Gt=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=e=>{this.originalIndex=e.originalIndex;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=Ie:this.parentRoute||k();let r=n?Ie:t?.path;r&&r!==`/`&&(r=be(r));let i=t?.id||r,a=n?Ie:z([this.parentRoute.id===`__root__`?``:this.parentRoute.id,i]);r===`__root__`&&(r=`/`),a!==`__root__`&&(a=z([`/`,a]));let o=a===`__root__`?`/`:z([this.parentRoute.fullPath,r]);this._path=r,this._id=a,this._fullPath=o,this._to=V(o)},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e==`object`&&e&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.redirect=e=>Le({from:this.fullPath,...e}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw Error(`Route cannot have both an 'id' and a 'path' option.`)}},Kt=class extends Gt{constructor(e){super(e)}},qt=e(i(),1),J=r();function Jt(e){let t=e.errorComponent??Xt;return(0,J.jsx)(Yt,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:r})=>n?a.createElement(t,{error:n,reset:r}):e.children})}var Yt=class extends a.Component{constructor(...e){super(...e),this.state={error:null}}static getDerivedStateFromProps(e,t){let n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:null}:{resetKey:n}}static getDerivedStateFromError(e){return{error:e}}reset(){this.setState({error:null})}componentDidCatch(e,t){this.props.onCatch&&this.props.onCatch(e,t)}render(){return this.props.children({error:this.state.error,reset:()=>{this.reset()}})}};function Xt({error:e}){let[t,n]=a.useState(!1);return(0,J.jsxs)(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[(0,J.jsx)(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),(0,J.jsx)(`button`,{style:{appearance:`none`,fontSize:`.6em`,border:`1px solid currentColor`,padding:`.1rem .2rem`,fontWeight:`bold`,borderRadius:`.25rem`},onClick:()=>n(e=>!e),children:t?`Hide Error`:`Show Error`})]}),(0,J.jsx)(`div`,{style:{height:`.25rem`}}),t?(0,J.jsx)(`div`,{children:(0,J.jsx)(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e.message?(0,J.jsx)(`code`,{children:e.message}):null})}):null]})}function Zt({children:e,fallback:t=null}){return Qt()?(0,J.jsx)(a.Fragment,{children:e}):(0,J.jsx)(a.Fragment,{children:t})}function Qt(){return a.useSyncExternalStore($t,()=>!0,()=>!1)}function $t(){return()=>{}}var en=a.createContext(null);function Y(e){return a.useContext(en)}var tn=a.createContext(void 0),nn=a.createContext(void 0),X=(e=>(e[e.None=0]=`None`,e[e.Mutable=1]=`Mutable`,e[e.Watching=2]=`Watching`,e[e.RecursedCheck=4]=`RecursedCheck`,e[e.Recursed=8]=`Recursed`,e[e.Dirty=16]=`Dirty`,e[e.Pending=32]=`Pending`,e))(X||{});function rn({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(!0)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(!0)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function an(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var on=[],sn=0,{link:cn,unlink:ln,propagate:un,checkDirty:dn,shallowPropagate:fn}=rn({update(e){return e._update()},notify(e){on[mn++]=e,e.flags&=~X.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=X.Mutable|X.Dirty,_n(e))}}),pn=0,mn=0,Z,hn=0;function gn(e){try{++hn,e()}finally{--hn||vn()}}function _n(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=ln(n,e)}function vn(){if(!(hn>0)){for(;pn<mn;){let e=on[pn];on[pn++]=void 0,e.notify()}pn=0,mn=0}}function yn(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?X.None:X.Mutable,get(){return Z!==void 0&&cn(i,Z,sn),i._snapshot},subscribe(e){let t=an(e),n={current:!1},r=bn(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=Z,o=t?.compare??Object.is;if(n)Z=i,++sn,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=X.Mutable|X.RecursedCheck);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{Z=a,n&&(i.flags&=~X.RecursedCheck),_n(i)}}};return n?(i.flags=X.Mutable|X.Dirty,i.get=function(){let e=i.flags;if(e&X.Dirty||e&X.Pending&&dn(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&fn(e)}}else e&X.Pending&&(i.flags=e&~X.Pending);return Z!==void 0&&cn(i,Z,sn),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(un(e),fn(e),vn())}},i}function bn(e){let t=()=>{let t=Z;Z=n,++sn,n.depsTail=void 0,n.flags=X.Watching|X.RecursedCheck;try{return e()}finally{Z=t,n.flags&=~X.RecursedCheck,_n(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:X.Watching|X.RecursedCheck,notify(){let e=this.flags;e&X.Dirty||e&X.Pending&&dn(this.deps,this)?t():this.flags=X.Watching},stop(){this.flags=X.None,this.depsTail=void 0,_n(this)}};return t(),n}var xn=n();function Sn(e,t){return e===t}function Q(e,t,n=Sn){let r=(0,a.useCallback)(t=>{if(!e)return()=>{};let{unsubscribe:n}=e.subscribe(t);return n},[e]),i=(0,a.useCallback)(()=>e?.get(),[e]);return(0,xn.useSyncExternalStoreWithSelector)(r,i,i,t,n)}var Cn={get:()=>void 0,subscribe:()=>({unsubscribe:()=>{}})};function $(e){let t=Y(),n=a.useContext(e.from?nn:tn),r=e.from??n,i=r?e.from?t.stores.getRouteMatchStore(r):t.stores.matchStores.get(r):void 0,o=a.useRef(void 0);return Q(i??Cn,n=>{if((e.shouldThrow??!0)&&!n&&k(),n===void 0)return;let r=e.select?e.select(n):n;if(e.structuralSharing??t.options.defaultStructuralSharing){let e=v(o.current,r);return o.current=e,e}return r})}function wn(e){return $({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function Tn(e){let{select:t,...n}=e;return $({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function En(e){return $({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function Dn(e){return $({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function On(e){let t=Y();return a.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function kn(e){return $({...e,select:t=>e.select?e.select(t.context):t.context})}function An(e,t){let n=Y(),r=l(t),{activeProps:i,inactiveProps:o,activeOptions:s,to:u,preload:d,preloadDelay:p,preloadIntentProximity:m,hashScrollIntoView:h,replace:g,startTransition:_,resetScroll:v,viewTransition:y,children:b,target:x,disabled:S,style:w,className:T,onClick:E,onBlur:D,onFocus:ee,onMouseEnter:O,onMouseLeave:ne,onTouchStart:re,ignoreBlocker:k,params:ie,search:A,hash:ae,state:oe,mask:se,reloadDocument:ce,unsafeRelative:le,from:j,_fromLocation:M,...ue}=e,de=Qt(),fe=a.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),N=Q(n.stores.location,e=>e,(e,t)=>e.href===t.href),P=a.useMemo(()=>{let e={_fromLocation:N,...fe};return n.buildLocation(e)},[n,N,fe]),pe=P.maskedLocation?P.maskedLocation.publicHref:P.publicHref,me=P.maskedLocation?P.maskedLocation.external:P.external,F=a.useMemo(()=>zn(pe,me,n.history,S),[S,me,pe,n.history]),I=a.useMemo(()=>{if(F?.external)return te(F.href,n.protocolAllowlist)?void 0:F.href;if(!Bn(u)&&!(typeof u!=`string`||u.indexOf(`:`)===-1))try{return new URL(u),te(u,n.protocolAllowlist)?void 0:u}catch{}},[u,F,n.protocolAllowlist]),he=a.useMemo(()=>{if(I)return!1;if(s?.exact){if(!Ce(N.pathname,P.pathname,n.basepath))return!1}else{let e=Se(N.pathname,n.basepath),t=Se(P.pathname,n.basepath);if(!(e.startsWith(t)&&(e.length===t.length||e[t.length]===`/`)))return!1}return(s?.includeSearch??!0)&&!C(N.search,P.search,{partial:!s?.exact,ignoreUndefined:!s?.explicitUndefined})?!1:s?.includeHash?de&&N.hash===P.hash:!0},[s?.exact,s?.explicitUndefined,s?.includeHash,s?.includeSearch,N,I,de,P.hash,P.pathname,P.search,n.basepath]),ge=he?f(i,{})??Mn:jn,_e=he?jn:f(o,{})??jn,L=[T,ge.className,_e.className].filter(Boolean).join(` `),ve=(w||ge.style||_e.style)&&{...w,...ge.style,..._e.style},[ye,R]=a.useState(!1),z=a.useRef(!1),B=e.reloadDocument||I?!1:d??n.options.defaultPreload,be=p??n.options.defaultPreloadDelay??0,V=a.useCallback(()=>{n.preloadRoute({...fe,_builtLocation:P}).catch(e=>{console.warn(e),console.warn(Wt)})},[n,fe,P]);c(r,a.useCallback(e=>{e?.isIntersecting&&V()},[V]),Ln,{disabled:!!S||B!==`viewport`}),a.useEffect(()=>{z.current||!S&&B===`render`&&(V(),z.current=!0)},[S,V,B]);let xe=e=>{let t=e.currentTarget.getAttribute(`target`),r=x===void 0?t:x;if(!S&&!Hn(e)&&!e.defaultPrevented&&(!r||r===`_self`)&&e.button===0){e.preventDefault(),(0,qt.flushSync)(()=>{R(!0)});let t=n.subscribe(`onResolved`,()=>{t(),R(!1)});n.navigate({...fe,replace:g,resetScroll:v,hashScrollIntoView:h,startTransition:_,viewTransition:y,ignoreBlocker:k})}};if(I)return{...ue,ref:r,href:I,...b&&{children:b},...x&&{target:x},...S&&{disabled:S},...w&&{style:w},...T&&{className:T},...E&&{onClick:E},...D&&{onBlur:D},...ee&&{onFocus:ee},...O&&{onMouseEnter:O},...ne&&{onMouseLeave:ne},...re&&{onTouchStart:re}};let we=e=>{if(S||B!==`intent`)return;if(!be){V();return}let t=e.currentTarget;if(In.has(t))return;let n=setTimeout(()=>{In.delete(t),V()},be);In.set(t,n)},Te=e=>{S||B!==`intent`||V()},Ee=e=>{if(S||!B||!be)return;let t=e.currentTarget,n=In.get(t);n&&(clearTimeout(n),In.delete(t))};return{...ue,...ge,..._e,href:F?.href,ref:r,onClick:Rn([E,xe]),onBlur:Rn([D,Ee]),onFocus:Rn([ee,we]),onMouseEnter:Rn([O,we]),onMouseLeave:Rn([ne,Ee]),onTouchStart:Rn([re,Te]),disabled:!!S,target:x,...ve&&{style:ve},...L&&{className:L},...S&&Nn,...he&&Pn,...de&&ye&&Fn}}var jn={},Mn={className:`active`},Nn={role:`link`,"aria-disabled":!0},Pn={"data-status":`active`,"aria-current":`page`},Fn={"data-transitioning":`transitioning`},In=new WeakMap,Ln={rootMargin:`100px`},Rn=e=>t=>{for(let n of e)if(n){if(t.defaultPrevented)return;n(t)}};function zn(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||`/`,external:!1}}function Bn(e){if(typeof e!=`string`)return!1;let t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var Vn=a.forwardRef((e,t)=>{let{_asChild:n,...r}=e,{type:i,...o}=An(r,t),s=typeof r.children==`function`?r.children({isActive:o[`data-status`]===`active`}):r.children;if(!n){let{disabled:e,...t}=o;return a.createElement(`a`,t,s)}return a.createElement(n,o,s)});function Hn(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var Un=class extends Gt{constructor(e){super(e),this.useMatch=e=>$({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>kn({...e,from:this.id}),this.useSearch=e=>Dn({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>En({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>Tn({...e,from:this.id}),this.useLoaderData=e=>wn({...e,from:this.id}),this.useNavigate=()=>On({from:this.fullPath}),this.Link=a.forwardRef((e,t)=>(0,J.jsx)(Vn,{ref:t,from:this.fullPath,...e}))}};function Wn(e){return new Un(e)}var Gn=class extends Kt{constructor(e){super(e),this.useMatch=e=>$({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>kn({...e,from:this.id}),this.useSearch=e=>Dn({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>En({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>Tn({...e,from:this.id}),this.useLoaderData=e=>wn({...e,from:this.id}),this.useNavigate=()=>On({from:this.fullPath}),this.Link=a.forwardRef((e,t)=>(0,J.jsx)(Vn,{ref:t,from:this.fullPath,...e}))}};function Kn(e){return new Gn(e)}function qn(e){return new Jn(e,{silent:!0}).createRoute}var Jn=class{constructor(e,t){this.path=e,this.createRoute=e=>{let t=Wn(e);return t.isRoot=!1,t},this.silent=t?.silent}};function Yn(e){let t=Y(),n=`not-found-${Q(t.stores.location,e=>e.pathname)}-${Q(t.stores.status,e=>e)}`;return(0,J.jsx)(Jt,{getResetKey:()=>n,onCatch:(t,n)=>{if(H(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(H(t))return e.fallback?.(t);throw t},children:e.children})}function Xn(){return(0,J.jsx)(`p`,{children:`Not Found`})}function Zn(e){return(0,J.jsx)(J.Fragment,{children:e.children})}function Qn(e,t,n){return t.options.notFoundComponent?(0,J.jsx)(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?(0,J.jsx)(e.options.defaultNotFoundComponent,{...n}):(0,J.jsx)(Xn,{})}var $n=a.memo(function({matchId:e}){let t=Y(),n=t.stores.matchStores.get(e);n||k();let r=Q(t.stores.loadedAt,e=>e),i=Q(n,e=>e);return(0,J.jsx)(er,{router:t,matchId:e,resetKey:r,matchState:a.useMemo(()=>{let e=i.routeId,n=t.routesById[e].parentRoute?.id;return{routeId:e,ssr:i.ssr,_displayPending:i._displayPending,parentRouteId:n}},[i._displayPending,i.routeId,i.ssr,t.routesById])})});function er({router:e,matchId:t,resetKey:n,matchState:r}){let i=e.routesById[r.routeId],o=i.options.pendingComponent??e.options.defaultPendingComponent,s=o?(0,J.jsx)(o,{}):null,c=i.options.errorComponent??e.options.defaultErrorComponent,l=i.options.onCatch??e.options.defaultOnCatch,u=i.isRoot?i.options.notFoundComponent??e.options.notFoundRoute?.options.component:i.options.notFoundComponent,d=r.ssr===!1||r.ssr===`data-only`,f=(!i.isRoot||i.options.wrapInSuspense||d)&&(i.options.wrapInSuspense??o??(i.options.errorComponent?.preload||d))?a.Suspense:Zn,p=c?Jt:Zn,m=u?Yn:Zn;return(0,J.jsxs)(i.isRoot?i.options.shellComponent??Zn:Zn,{children:[(0,J.jsx)(tn.Provider,{value:t,children:(0,J.jsx)(f,{fallback:s,children:(0,J.jsx)(p,{getResetKey:()=>n,errorComponent:c||Xt,onCatch:(e,t)=>{if(H(e))throw e.routeId??=r.routeId,e;l?.(e,t)},children:(0,J.jsx)(m,{fallback:e=>{if(e.routeId??=r.routeId,!u||e.routeId&&e.routeId!==r.routeId||!e.routeId&&!i.isRoot)throw e;return a.createElement(u,e)},children:d||r._displayPending?(0,J.jsx)(Zt,{fallback:s,children:(0,J.jsx)(nr,{matchId:t})}):(0,J.jsx)(nr,{matchId:t})})})})}),r.parentRouteId===`__root__`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(tr,{resetKey:n}),(e.options.scrollRestoration,null)]}):null]})}function tr({resetKey:e}){let t=Y(),n=a.useRef(void 0);return o(()=>{let e=t.latestLocation.href;(n.current===void 0||n.current!==e)&&(t.emit({type:`onRendered`,...q(t.stores.location.get(),t.stores.resolvedLocation.get())}),n.current=e)},[t.latestLocation.state.__TSR_key,e,t]),null}var nr=a.memo(function({matchId:e}){let t=Y(),n=(e,n)=>t.getMatch(e.id)?._nonReactive[n]??e._nonReactive[n],r=t.stores.matchStores.get(e);r||k();let i=Q(r,e=>e),o=i.routeId,s=t.routesById[o],c=a.useMemo(()=>{let e=(t.routesById[o].options.remountDeps??t.options.defaultRemountDeps)?.({routeId:o,loaderDeps:i.loaderDeps,params:i._strictParams,search:i._strictSearch});return e?JSON.stringify(e):void 0},[o,i.loaderDeps,i._strictParams,i._strictSearch,t.options.defaultRemountDeps,t.routesById]),l=a.useMemo(()=>{let e=s.options.component??t.options.defaultComponent;return e?(0,J.jsx)(e,{},c):(0,J.jsx)(rr,{})},[c,s.options.component,t.options.defaultComponent]);if(i._displayPending)throw n(i,`displayPendingPromise`);if(i._forcePending)throw n(i,`minPendingPromise`);if(i.status===`pending`){let e=s.options.pendingMinMs??t.options.defaultPendingMinMs;if(e){let n=t.getMatch(i.id);if(n&&!n._nonReactive.minPendingPromise){let t=w();n._nonReactive.minPendingPromise=t,setTimeout(()=>{t.resolve(),n._nonReactive.minPendingPromise=void 0},e)}}throw n(i,`loadPromise`)}if(i.status===`notFound`)return H(i.error)||k(),Qn(t,s,i.error);if(i.status===`redirected`)throw U(i.error)||k(),n(i,`loadPromise`);if(i.status===`error`)throw i.error;return l}),rr=a.memo(function(){let e=Y(),t=a.useContext(tn),n,r=!1,i;{let a=t?e.stores.matchStores.get(t):void 0;[n,r]=Q(a,e=>[e?.routeId,e?.globalNotFound??!1]),i=Q(e.stores.matchesId,e=>e[e.findIndex(e=>e===t)+1])}let o=n?e.routesById[n]:void 0,s=e.options.defaultPendingComponent?(0,J.jsx)(e.options.defaultPendingComponent,{}):null;if(r)return o||k(),Qn(e,o,void 0);if(!i)return null;let c=(0,J.jsx)($n,{matchId:i});return n===`__root__`?(0,J.jsx)(a.Suspense,{fallback:s,children:c}):c});function ir(){let e=Y(),t=a.useRef({router:e,mounted:!1}),[n,r]=a.useState(!1),i=Q(e.stores.isLoading,e=>e),c=Q(e.stores.hasPending,e=>e),l=s(i),u=i||n||c,d=s(u),f=i||c,p=s(f);return e.startTransition=e=>{r(!0),a.startTransition(()=>{e(),r(!1)})},a.useEffect(()=>{let t=e.history.subscribe(e.load),n=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return V(e.latestLocation.publicHref)!==V(n.publicHref)&&e.commitLocation({...n,replace:!0}),()=>{t()}},[e,e.history]),o(()=>{typeof window<`u`&&e.ssr||t.current.router===e&&t.current.mounted||(t.current={router:e,mounted:!0},(async()=>{try{await e.load()}catch(e){console.error(e)}})())},[e]),o(()=>{l&&!i&&e.emit({type:`onLoad`,...q(e.stores.location.get(),e.stores.resolvedLocation.get())})},[l,e,i]),o(()=>{p&&!f&&e.emit({type:`onBeforeRouteMount`,...q(e.stores.location.get(),e.stores.resolvedLocation.get())})},[f,p,e]),o(()=>{if(d&&!u){let t=q(e.stores.location.get(),e.stores.resolvedLocation.get());e.emit({type:`onResolved`,...t}),gn(()=>{e.stores.status.set(`idle`),e.stores.resolvedLocation.set(e.stores.location.get())})}},[u,d,e]),null}function ar(){let e=Y(),t=e.routesById.__root__.options.pendingComponent??e.options.defaultPendingComponent,n=t?(0,J.jsx)(t,{}):null,r=(0,J.jsxs)(typeof document<`u`&&e.ssr?Zn:a.Suspense,{fallback:n,children:[(0,J.jsx)(ir,{}),(0,J.jsx)(or,{})]});return e.options.InnerWrap?(0,J.jsx)(e.options.InnerWrap,{children:r}):r}function or(){let e=Y(),t=Q(e.stores.firstId,e=>e),n=Q(e.stores.loadedAt,e=>e),r=t?(0,J.jsx)($n,{matchId:t}):null;return(0,J.jsx)(tn.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?r:(0,J.jsx)(Jt,{getResetKey:()=>n,errorComponent:Xt,onCatch:void 0,children:r})})}var sr=e=>({createMutableStore:yn,createReadonlyStore:yn,batch:gn}),cr=e=>new lr(e),lr=class extends bt{constructor(e){super(e,sr)}};function ur({router:e,children:t,...n}){h(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});let r=(0,J.jsx)(en.Provider,{value:e,children:t});return e.options.Wrap?(0,J.jsx)(e.options.Wrap,{children:r}):r}function dr({router:e,...t}){return(0,J.jsx)(ur,{router:e,...t,children:(0,J.jsx)(ar,{})})}function fr(e){let t=Y(),n=(0,a.useRef)(void 0);return Q(t.stores.location,r=>{let i=e?.select?e.select(r):r;if(e?.structuralSharing??t.options.defaultStructuralSharing){let e=v(n.current,i);return n.current=e,e}return i})}export{qn as a,On as c,rr as i,En as l,dr as n,Kn as o,cr as r,Vn as s,fr as t,Le as u};
|
package/dist/index.html
CHANGED
|
@@ -3,13 +3,41 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<link rel="icon" type="image/svg+xml" href="/_studio/vite.svg" />
|
|
6
|
+
<meta name="color-scheme" content="dark light" />
|
|
6
7
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
7
8
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
8
9
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap" rel="stylesheet">
|
|
9
10
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
10
11
|
<title>ObjectStack Studio</title>
|
|
11
|
-
<script
|
|
12
|
-
|
|
12
|
+
<script>
|
|
13
|
+
// Apply theme before React mounts so the user never sees a light flash
|
|
14
|
+
// on dark theme (or vice versa). Mirrors theme-toggle.tsx logic.
|
|
15
|
+
(function applyInitialTheme() {
|
|
16
|
+
try {
|
|
17
|
+
var stored = localStorage.getItem('theme');
|
|
18
|
+
var prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
19
|
+
var dark = stored === 'dark' || (stored !== 'light' && prefersDark);
|
|
20
|
+
if (dark) document.documentElement.classList.add('dark');
|
|
21
|
+
// Set bg-color directly on <html> so any area outside the React
|
|
22
|
+
// tree (e.g. router pending fallback) matches the theme.
|
|
23
|
+
document.documentElement.style.backgroundColor = dark ? 'hsl(240 10% 3.9%)' : 'hsl(0 0% 100%)';
|
|
24
|
+
} catch (_) { /* localStorage unavailable — fall through to CSS defaults */ }
|
|
25
|
+
})();
|
|
26
|
+
</script>
|
|
27
|
+
<script type="module" crossorigin src="/_studio/assets/index-81ZhtCq-.js"></script>
|
|
28
|
+
<link rel="modulepreload" crossorigin href="/_studio/assets/rolldown-runtime-aKtaBQYM.js">
|
|
29
|
+
<link rel="modulepreload" crossorigin href="/_studio/assets/vendor-rQmwIIxi.js">
|
|
30
|
+
<link rel="modulepreload" crossorigin href="/_studio/assets/vendor-react-CfxtBSJn.js">
|
|
31
|
+
<link rel="modulepreload" crossorigin href="/_studio/assets/vendor-charts-CMWbKNvz.js">
|
|
32
|
+
<link rel="modulepreload" crossorigin href="/_studio/assets/vendor-icons-C-VDCqO9.js">
|
|
33
|
+
<link rel="modulepreload" crossorigin href="/_studio/assets/vendor-object-ui-core-C_SRaIe4.js">
|
|
34
|
+
<link rel="modulepreload" crossorigin href="/_studio/assets/vendor-object-ui-grid-BvNa3IUR.js">
|
|
35
|
+
<link rel="modulepreload" crossorigin href="/_studio/assets/vendor-object-ui-views-CyaLQwFl.js">
|
|
36
|
+
<link rel="modulepreload" crossorigin href="/_studio/assets/vendor-object-ui-form-DRRdiS9F.js">
|
|
37
|
+
<link rel="modulepreload" crossorigin href="/_studio/assets/vendor-radix-DlDjksHy.js">
|
|
38
|
+
<link rel="modulepreload" crossorigin href="/_studio/assets/vendor-tanstack-D6oxbowc.js">
|
|
39
|
+
<link rel="stylesheet" crossorigin href="/_studio/assets/vendor-kzrx2K5g.css">
|
|
40
|
+
<link rel="stylesheet" crossorigin href="/_studio/assets/index-CSlaSCb_.css">
|
|
13
41
|
</head>
|
|
14
42
|
<body>
|
|
15
43
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@objectstack/studio",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.0",
|
|
4
4
|
"description": "ObjectStack Studio - A metadata-driven admin interface for managing data and configuration",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -12,15 +12,21 @@
|
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@ai-sdk/react": "^3.0.192",
|
|
15
|
-
"@
|
|
16
|
-
"@
|
|
17
|
-
"@
|
|
18
|
-
"@object-ui/
|
|
19
|
-
"@object-ui/
|
|
20
|
-
"@object-ui/plugin-
|
|
21
|
-
"@object-ui/plugin-
|
|
22
|
-
"@object-ui/
|
|
23
|
-
"@object-ui/
|
|
15
|
+
"@dnd-kit/core": "^6.3.1",
|
|
16
|
+
"@dnd-kit/sortable": "^10.0.0",
|
|
17
|
+
"@dnd-kit/utilities": "^3.2.2",
|
|
18
|
+
"@object-ui/core": "^5.2.1",
|
|
19
|
+
"@object-ui/data-objectstack": "^5.2.1",
|
|
20
|
+
"@object-ui/plugin-calendar": "^5.2.1",
|
|
21
|
+
"@object-ui/plugin-dashboard": "^5.2.1",
|
|
22
|
+
"@object-ui/plugin-detail": "^5.2.1",
|
|
23
|
+
"@object-ui/plugin-form": "^5.2.1",
|
|
24
|
+
"@object-ui/plugin-grid": "^5.2.1",
|
|
25
|
+
"@object-ui/plugin-kanban": "^5.2.1",
|
|
26
|
+
"@object-ui/plugin-report": "^5.2.1",
|
|
27
|
+
"@object-ui/plugin-timeline": "^5.2.1",
|
|
28
|
+
"@object-ui/react": "^5.2.1",
|
|
29
|
+
"@object-ui/types": "^5.2.1",
|
|
24
30
|
"@radix-ui/react-avatar": "^1.1.11",
|
|
25
31
|
"@radix-ui/react-checkbox": "^1.3.3",
|
|
26
32
|
"@radix-ui/react-collapsible": "^1.1.12",
|
|
@@ -46,19 +52,19 @@
|
|
|
46
52
|
"react-dom": "^19.2.6",
|
|
47
53
|
"react-resizable-panels": "^4.11.1",
|
|
48
54
|
"tailwind-merge": "^3.6.0",
|
|
49
|
-
"@objectstack/client": "5.
|
|
50
|
-
"@objectstack/client-react": "5.
|
|
51
|
-
"@objectstack/driver-memory": "5.
|
|
52
|
-
"@objectstack/metadata": "5.
|
|
53
|
-
"@objectstack/objectql": "5.
|
|
54
|
-
"@objectstack/platform-objects": "5.
|
|
55
|
-
"@objectstack/plugin-msw": "5.
|
|
56
|
-
"@objectstack/runtime": "5.
|
|
57
|
-
"@objectstack/service-ai": "5.
|
|
58
|
-
"@objectstack/service-analytics": "5.
|
|
59
|
-
"@objectstack/service-automation": "5.
|
|
60
|
-
"@objectstack/service-feed": "5.
|
|
61
|
-
"@objectstack/spec": "5.
|
|
55
|
+
"@objectstack/client": "5.2.0",
|
|
56
|
+
"@objectstack/client-react": "5.2.0",
|
|
57
|
+
"@objectstack/driver-memory": "5.2.0",
|
|
58
|
+
"@objectstack/metadata": "5.2.0",
|
|
59
|
+
"@objectstack/objectql": "5.2.0",
|
|
60
|
+
"@objectstack/platform-objects": "5.2.0",
|
|
61
|
+
"@objectstack/plugin-msw": "5.2.0",
|
|
62
|
+
"@objectstack/runtime": "5.2.0",
|
|
63
|
+
"@objectstack/service-ai": "5.2.0",
|
|
64
|
+
"@objectstack/service-analytics": "5.2.0",
|
|
65
|
+
"@objectstack/service-automation": "5.2.0",
|
|
66
|
+
"@objectstack/service-feed": "5.2.0",
|
|
67
|
+
"@objectstack/spec": "5.2.0"
|
|
62
68
|
},
|
|
63
69
|
"devDependencies": {
|
|
64
70
|
"@playwright/test": "^1.60.0",
|
|
@@ -81,7 +87,7 @@
|
|
|
81
87
|
"typescript": "^6.0.3",
|
|
82
88
|
"vite": "^8.0.14",
|
|
83
89
|
"vitest": "^4.1.7",
|
|
84
|
-
"@objectstack/cli": "5.
|
|
90
|
+
"@objectstack/cli": "5.2.0"
|
|
85
91
|
},
|
|
86
92
|
"msw": {
|
|
87
93
|
"workerDirectory": [
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{A as e,C as t,D as n,E as r,F as i,I as a,M as o,N as s,O as c,P as l,S as u,T as d,_ as f,a as p,b as m,c as h,d as g,f as _,g as v,h as y,i as b,j as x,k as S,l as C,m as w,n as T,o as E,p as D,r as O,s as k,t as A,u as j,v as M,w as N,x as P,y as F}from"./index-DYSVcooZ.js";var I=a(i(),1),L=l(),ee=`bg-blue-100 text-blue-900 border border-blue-200`,te=new Date,R=[`bg-blue-100 text-blue-900 border border-blue-200`,`bg-emerald-100 text-emerald-900 border border-emerald-200`,`bg-amber-100 text-amber-900 border border-amber-200`,`bg-rose-100 text-rose-900 border border-rose-200`,`bg-violet-100 text-violet-900 border border-violet-200`,`bg-cyan-100 text-cyan-900 border border-cyan-200`,`bg-orange-100 text-orange-900 border border-orange-200`,`bg-fuchsia-100 text-fuchsia-900 border border-fuchsia-200`],z=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i,B=/(^|\s)(bg|text|from|to|via)-/;function V(e){if(!e)return{className:ee};if(z.test(e))return{className:`text-white`,inlineColor:e};if(B.test(e))return{className:e};let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return{className:R[Math.abs(t)%R.length]}}var H={"calendar.today":`Today`,"calendar.month":`Month`,"calendar.week":`Week`,"calendar.day":`Day`,"calendar.newEvent":`New event`,"calendar.moreEvents":`+{{count}} more`,"calendar.allDay":`all-day`};function U(){try{let e=N();return e.t(`calendar.today`)===`calendar.today`?{t:(e,t)=>{let n=H[e]||e;if(t)for(let[e,r]of Object.entries(t))n=n.replace(`{{${e}}}`,String(r));return n},language:`en`}:{t:e.t,language:e.language}}catch{return{t:(e,t)=>{let n=H[e]||e;if(t)for(let[e,r]of Object.entries(t))n=n.replace(`{{${e}}}`,String(r));return n},language:`en`}}}function ne({events:n=[],view:r=`month`,currentDate:i=te,locale:a=`default`,onEventClick:c,onDateClick:l,onViewChange:u,onNavigate:d,onAddClick:f,onEventDrop:p,onTimeRangeSelect:m,slotMinutes:_=30,className:b}){let[S,C]=I.useState(r),[T,O]=I.useState(i),{t:k,language:A}=U(),M=a===`default`?A:a;I.useEffect(()=>{O(i)},[i]),I.useEffect(()=>{C(r)},[r]);let N=I.useRef(u);N.current=u,I.useEffect(()=>{let e=window.matchMedia(`(max-width: 639px)`),t=e=>{e.matches&&(C(`day`),N.current?.(`day`))};return t(e),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let ee=()=>{let e=new Date(T);S===`month`?e.setMonth(e.getMonth()-1):S===`week`?e.setDate(e.getDate()-7):e.setDate(e.getDate()-1),O(e),d?.(e)},R=()=>{let e=new Date(T);S===`month`?e.setMonth(e.getMonth()+1):S===`week`?e.setDate(e.getDate()+7):e.setDate(e.getDate()+1),O(e),d?.(e)},z=()=>{let e=new Date;O(e),d?.(e)},B=e=>{C(e),u?.(e)},V=()=>{if(S===`month`)return T.toLocaleDateString(M,{month:`long`,year:`numeric`});if(S===`week`){let e=W(T),t=new Date(e);return t.setDate(t.getDate()+6),`${e.toLocaleDateString(M,{month:`short`,day:`numeric`})} - ${t.toLocaleDateString(M,{month:`short`,day:`numeric`,year:`numeric`})}`}else return T.toLocaleDateString(M,{weekday:`long`,month:`long`,day:`numeric`,year:`numeric`})},H=I.useRef(0);return(0,L.jsxs)(`div`,{role:`region`,"aria-label":`Calendar`,className:E(`flex flex-col h-full bg-background min-w-0 overflow-hidden`,b),children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 p-2 sm:p-4 border-b min-w-0`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,L.jsxs)(`div`,{className:`flex items-center bg-muted/50 rounded-lg p-1 gap-1`,children:[(0,L.jsx)(F,{variant:`ghost`,size:`sm`,onClick:z,className:`h-8`,"aria-label":`Go to today`,children:k(`calendar.today`)}),(0,L.jsx)(`div`,{className:`h-4 w-px bg-border mx-1`}),(0,L.jsx)(F,{variant:`ghost`,size:`icon`,"aria-label":`Previous period`,onClick:ee,className:`h-8 w-8`,children:(0,L.jsx)(o,{className:`h-4 w-4`})}),(0,L.jsx)(F,{variant:`ghost`,size:`icon`,"aria-label":`Next period`,onClick:R,className:`h-8 w-8`,children:(0,L.jsx)(x,{className:`h-4 w-4`})})]}),(0,L.jsxs)(h,{children:[(0,L.jsx)(D,{asChild:!0,children:(0,L.jsxs)(F,{variant:`ghost`,"aria-label":`Current date: ${V()}`,className:E(`text-base sm:text-xl font-semibold h-auto px-2 sm:px-3 py-1 hover:bg-muted/50 transition-colors`,`flex items-center gap-2`),children:[(0,L.jsx)(s,{className:`h-5 w-5 text-muted-foreground`}),(0,L.jsx)(`span`,{children:V()})]})}),(0,L.jsx)(g,{className:`w-auto p-0`,align:`start`,children:(0,L.jsx)(t,{mode:`single`,selected:T,onSelect:e=>{e&&(O(e),d?.(e))},initialFocus:!0,fromYear:2e3,toYear:2050})})]})]}),(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsxs)(w,{value:S,onValueChange:B,children:[(0,L.jsx)(y,{className:`w-32 bg-background`,children:(0,L.jsx)(P,{})}),(0,L.jsxs)(v,{children:[(0,L.jsx)(j,{value:`day`,children:k(`calendar.day`)}),(0,L.jsx)(j,{value:`week`,children:k(`calendar.week`)}),(0,L.jsx)(j,{value:`month`,children:k(`calendar.month`)})]})]}),f&&(0,L.jsxs)(F,{onClick:f,size:`sm`,className:`gap-1`,children:[(0,L.jsx)(e,{className:`h-4 w-4`}),k(`calendar.newEvent`)]})]})]}),(0,L.jsxs)(`div`,{className:`flex-1 overflow-auto`,onTouchStart:e=>{H.current=e.touches[0].clientX},onTouchEnd:e=>{let t=H.current-e.changedTouches[0].clientX;if(Math.abs(t)>50){let e=new Date(T);S===`day`?e.setDate(e.getDate()+(t>0?1:-1)):S===`week`?e.setDate(e.getDate()+(t>0?7:-7)):e.setMonth(e.getMonth()+(t>0?1:-1)),O(e),d?.(e)}},children:[S===`month`&&(0,L.jsx)(ae,{date:T,events:n,locale:M,onEventClick:c,onDateClick:l,onEventDrop:p}),S===`week`&&(0,L.jsx)(oe,{mode:`week`,date:T,events:n,locale:M,slotMinutes:_,onEventClick:c,onEventDrop:p,onTimeRangeSelect:m}),S===`day`&&(0,L.jsx)(oe,{mode:`day`,date:T,events:n,locale:M,slotMinutes:_,onEventClick:c,onEventDrop:p,onTimeRangeSelect:m})]})]})}function W(e){let t=new Date(e),n=t.getDay(),r=t.getDate()-n;return t.setDate(r),t}function re(e){let t=e.getFullYear(),n=e.getMonth(),r=new Date(t,n,1),i=new Date(t,n+1,0),a=r.getDay(),o=[];for(let e=a-1;e>=0;e--){let t=new Date(r.getTime());t.setDate(t.getDate()-(e+1)),o.push(t)}for(let e=1;e<=i.getDate();e++)o.push(new Date(t,n,e));let s=42-o.length;for(let e=1;e<=s;e++){let t=new Date(i.getTime());t.setDate(t.getDate()+e),o.push(t)}return o}function ie(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function ae({date:e,events:t,locale:n=`default`,onEventClick:r,onDateClick:i,onEventDrop:a}){let o=I.useMemo(()=>re(e),[e.getFullYear(),e.getMonth()]),s=I.useMemo(()=>new Date,[]),{t:c}=U(),l=I.useMemo(()=>{let e=new Date(2024,0,7);return Array.from({length:7},(t,r)=>{let i=new Date(e);return i.setDate(i.getDate()+r),i.toLocaleDateString(n,{weekday:`short`})})},[n]),[u,d]=I.useState(null),[f,p]=I.useState(null),m=I.useMemo(()=>{let e=new Map;for(let n of t){let t=new Date(n.start),r=n.end?new Date(n.end):new Date(t);t.setHours(0,0,0,0),r.setHours(0,0,0,0);let i=new Date(t);for(;i<=r;){let a=`${i.getFullYear()}-${i.getMonth()}-${i.getDate()}`,o=i.getTime()===t.getTime(),s=i.getTime()===r.getTime(),c=o||s||i.getDay()===0,l=e.get(a),u={event:n,isTitleDay:c,isSpanStart:o,isSpanEnd:s};l?l.push(u):e.set(a,[u]),i.setDate(i.getDate()+1)}}return e},[t]),h=(e,t,n=`move`,r)=>{d(t.id),e.dataTransfer.effectAllowed=`move`;let i={id:t.id,mode:n,...r?{sourceDay:`${r.getFullYear()}-${r.getMonth()}-${r.getDate()}`}:{}};e.dataTransfer.setData(`text/plain`,JSON.stringify(i)),n===`resize-end`&&e.stopPropagation()},g=()=>{d(null),p(null)},_=(e,t)=>{e.preventDefault(),e.dataTransfer.dropEffect=`move`,p(t)},v=e=>{e.currentTarget.contains(e.relatedTarget)||p(null)},y=(e,n)=>{if(e.preventDefault(),p(null),d(null),!a)return;let r=e.dataTransfer.getData(`text/plain`),i;try{i=JSON.parse(r)}catch{i={id:r,mode:`move`}}let o=t.find(e=>String(e.id)===String(i.id));if(!o)return;let s=new Date(n);if(s.setHours(0,0,0,0),i.mode===`resize-end`){let e=o.end?new Date(o.end):new Date(o.start),t=new Date(e);if(t.setHours(0,0,0,0),s.getTime()===t.getTime())return;let n=new Date(o.start);if(n.setHours(0,0,0,0),s.getTime()<n.getTime())return;let r=new Date(s);r.setHours(e.getHours(),e.getMinutes(),e.getSeconds(),0),a(o,new Date(o.start),r);return}let c=new Date(o.start),l;if(i.sourceDay){let[e,t,n]=i.sourceDay.split(`-`).map(e=>parseInt(e,10));l=new Date(e,t,n)}else l=new Date(c);l.setHours(0,0,0,0);let u=s.getTime()-l.getTime();if(u===0)return;let f=new Date(c.getTime()+u),m;o.end&&(m=new Date(new Date(o.end).getTime()+u)),a(o,f,m)};return(0,L.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,L.jsx)(`div`,{role:`row`,className:`grid grid-cols-7 border-b`,children:l.map(e=>(0,L.jsx)(`div`,{role:`columnheader`,className:`p-2 text-center text-sm font-medium text-muted-foreground border-r last:border-r-0`,children:e},e))}),(0,L.jsx)(`div`,{role:`grid`,"aria-label":`Calendar grid`,className:`grid grid-cols-7 flex-1 auto-rows-fr`,children:o.map((t,n)=>{let o=`${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`,l=m.get(o)||[],d=t.getMonth()===e.getMonth(),p=ie(t,s);return(0,L.jsxs)(`div`,{role:`gridcell`,"aria-label":`${t.toLocaleDateString(`default`,{weekday:`long`,month:`long`,day:`numeric`,year:`numeric`})}${l.length>0?`, ${l.length} event${l.length>1?`s`:``}`:``}`,className:E(`border-b border-r last:border-r-0 p-2 min-h-[100px] cursor-pointer hover:bg-accent/50`,!d&&`bg-muted/50 text-muted-foreground opacity-50`,f===n&&`ring-2 ring-primary`),onClick:()=>i?.(t),onDragOver:e=>_(e,n),onDragLeave:v,onDrop:e=>y(e,t),children:[(0,L.jsx)(`div`,{className:E(`text-sm font-medium mb-2`,p&&`inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground h-6 w-6`),...p?{"aria-current":`date`}:{},children:t.getDate()}),(0,L.jsxs)(`div`,{className:`space-y-0.5`,children:[l.slice(0,4).map(({event:e,isTitleDay:n,isSpanStart:i,isSpanEnd:o},s)=>{let c=!n,{className:l,inlineColor:d}=V(e.color),f=!!a&&o;return(0,L.jsxs)(`div`,{role:`button`,title:e.title,"aria-label":e.title,draggable:!!a,onDragStart:n=>h(n,e,`move`,t),onDragEnd:g,className:E(`relative text-xs hover:opacity-80 truncate`,a?`cursor-move`:`cursor-pointer`,c?`h-1.5`:`px-2 py-0.5`,i?`rounded-l`:`rounded-l-none`,o?`rounded-r`:`rounded-r-none`,!o&&`-mr-2`,l,u===e.id&&`opacity-50`),style:d?{backgroundColor:d}:void 0,onClick:t=>{t.stopPropagation(),r?.(e)},children:[c?``:e.title,f&&(0,L.jsx)(`span`,{role:`separator`,"aria-label":`Resize event end`,title:`Drag to change end date`,draggable:!0,onDragStart:n=>h(n,e,`resize-end`,t),onDragEnd:g,onClick:e=>e.stopPropagation(),className:`absolute inset-y-0 right-0 w-2 cursor-ew-resize bg-black/25 hover:bg-black/50 rounded-r`})]},`${e.id}-${s}`)}),l.length>4&&(0,L.jsx)(`div`,{className:`text-xs text-muted-foreground px-2`,children:c(`calendar.moreEvents`,{count:l.length-4})})]})]},n)})})]})}var G=48;function K(e){let t=new Date(e);return t.setHours(0,0,0,0),t}function q(e){return e.getHours()*60+e.getMinutes()}function J(e){return`${e.getFullYear()}-${e.getMonth()}-${e.getDate()}`}function oe({mode:e,date:t,events:n,locale:r=`default`,slotMinutes:i=30,onEventClick:a,onEventDrop:o,onTimeRangeSelect:s}){let{t:c}=U(),l=G*i/60,u=G*24,d=I.useMemo(()=>{if(e===`day`)return[K(t)];let n=W(t);return Array.from({length:7},(e,t)=>{let r=new Date(n);return r.setDate(n.getDate()+t),K(r)})},[e,t.getFullYear(),t.getMonth(),t.getDate()]),f=I.useMemo(()=>new Date,[]),p=I.useCallback(e=>{if(e.allDay)return!0;let t=new Date(e.start),n=e.end?new Date(e.end):new Date(t),r=t.getHours()===0&&t.getMinutes()===0&&t.getSeconds()===0,i=n.getHours()===0&&n.getMinutes()===0&&n.getSeconds()===0,a=n.getTime()-t.getTime();return!!(r&&i||a>=1440*60*1e3)},[]),{allDayEvents:m,timedEvents:h}=I.useMemo(()=>{let e=[],t=[];for(let r of n)p(r)?e.push(r):t.push(r);return{allDayEvents:e,timedEvents:t}},[n,p]),g=I.useMemo(()=>{let e=new Map;for(let t of d)e.set(J(t),[]);for(let t of m){let n=K(new Date(t.start)),r=t.end?new Date(t.end):new Date(t.start),i=K(r);r.getHours()===0&&r.getMinutes()===0&&r.getSeconds()===0&&r.getTime()>n.getTime()&&(i=new Date(i),i.setDate(i.getDate()-1));for(let r of d){let a=K(r);a<n||a>i||e.get(J(r)).push({event:t,isStart:a.getTime()===n.getTime(),isEnd:a.getTime()===i.getTime()})}}return e},[d,m]),_=I.useMemo(()=>{let e=new Map;for(let t of d)e.set(J(t),[]);for(let t of h){let n=new Date(t.start),r=t.end?new Date(t.end):new Date(n.getTime()+3600*1e3);for(let i of d){let a=K(i),o=new Date(a);if(o.setDate(o.getDate()+1),r<=a||n>=o)continue;let s=n<a?a:n,c=r>o?o:r,l=q(s),u=c.getTime()===o.getTime()?1440:q(c);e.get(J(i)).push({event:t,startMin:l,endMin:Math.max(u,l+15),isStart:s.getTime()===n.getTime(),isEnd:c.getTime()===r.getTime()})}}return e},[d,h]),v=I.useMemo(()=>{let e=new Map;for(let[t,n]of _){let r=[...n].sort((e,t)=>e.startMin-t.startMin||e.endMin-t.endMin),i=[],a=[],o=[];for(let e of r){let t=0;for(;i[t]&&i[t].endMin>e.startMin;)t++;i[t]={endMin:e.endMin},a.push({entry:e,col:t})}for(let e=0;e<a.length;e++){let t=a[e],n=t.col;for(let r=0;r<a.length;r++){if(r===e)continue;let i=a[r];i.entry.startMin<t.entry.endMin&&i.entry.endMin>t.entry.startMin&&i.col>n&&(n=i.col)}o.push({...t.entry,col:t.col,cols:n+1})}e.set(t,o)}return e},[_]),y=I.useRef(null),b=I.useRef([]),[x,S]=I.useState(null),C=I.useRef(null);C.current=x;let w=I.useRef(!1),T=I.useCallback((e,t)=>{let n=b.current[t];if(!n)return 0;let r=(e-n.getBoundingClientRect().top+n.scrollTop)/G*60,a=Math.round(r/i)*i;return Math.max(0,Math.min(1440,a))},[i]),D=I.useCallback(e=>{for(let t=0;t<b.current.length;t++){let n=b.current[t];if(!n)continue;let r=n.getBoundingClientRect();if(e>=r.left&&e<=r.right)return t}return-1},[]);I.useEffect(()=>{if(!x)return;let e=e=>{let t=x.kind===`select`||x.kind===`move`?D(e.clientX):x.dayIndex,n=t<0?x.dayIndex??0:t,r=T(e.clientY,n);S(e=>e&&(e.kind===`select`?{...e,dayIndex:n>=0?n:e.dayIndex,headMinutes:r}:e.kind===`move`?{...e,dayIndex:n,minutes:r}:{...e,minutes:r}))},t=e=>{let t=C.current;if(!t){S(null);return}try{if(t.kind===`select`&&s){let e=Math.min(t.anchorMinutes,t.headMinutes),n=Math.max(t.anchorMinutes,t.headMinutes),r=e,a=n===e?Math.min(1440,e+i):n,o=d[t.dayIndex]??d[0],c=new Date(o);c.setHours(0,Math.round(r),0,0);let l=new Date(o);l.setHours(0,Math.round(a),0,0),w.current=!0,s(c,l)}else if(t.kind===`move`&&o){let e=n.find(e=>String(e.id)===String(t.eventId));if(e){let n=t.dayIndex<0?0:t.dayIndex,r=t.minutes-t.grabMinuteOffset,a=Math.max(0,Math.min(1440-t.durationMin,Math.round(r/i)*i)),s=d[n]??d[0],c=new Date(s);c.setHours(0,a,0,0);let l=new Date(c.getTime()+t.durationMin*60*1e3);w.current=!0,o(e,c,l)}}else if(t.kind===`resize-top`&&o){let e=n.find(e=>String(e.id)===String(t.eventId));if(e){let n=d[t.dayIndex]??d[0],r=Math.min(t.anchorEndMin-i,Math.max(0,t.minutes)),a=new Date(n);a.setHours(0,r,0,0);let s=new Date(n);s.setHours(0,t.anchorEndMin,0,0),w.current=!0,o(e,a,s)}}else if(t.kind===`resize-bottom`&&o){let e=n.find(e=>String(e.id)===String(t.eventId));if(e){let n=d[t.dayIndex]??d[0],r=Math.max(t.anchorStartMin+i,Math.min(1440,t.minutes)),a=new Date(n);a.setHours(0,t.anchorStartMin,0,0);let s=new Date(n);s.setHours(0,r,0,0),w.current=!0,o(e,a,s)}}}finally{S(null),setTimeout(()=>{w.current=!1},50)}};return window.addEventListener(`pointermove`,e),window.addEventListener(`pointerup`,t),()=>{window.removeEventListener(`pointermove`,e),window.removeEventListener(`pointerup`,t)}},[x,d,n,i,o,s,D,T]);let O=I.useMemo(()=>d.map(e=>({weekday:e.toLocaleDateString(r,{weekday:`short`}),day:e.getDate(),month:e.toLocaleDateString(r,{month:`short`}),isToday:ie(e,f)})),[d,r,f]),k=I.useMemo(()=>Array.from({length:24},(e,t)=>new Date(2024,0,1,t,0).toLocaleTimeString(r,{hour:`numeric`})),[r]),A=(e,t,n,r)=>{if(!o||e.button!==0)return;e.stopPropagation(),e.preventDefault();let i=T(e.clientY,n);S(r===`body`?{kind:`move`,eventId:t.event.id,grabMinuteOffset:Math.max(0,i-t.startMin),durationMin:t.endMin-t.startMin,dayIndex:n,minutes:i}:r===`top`?{kind:`resize-top`,eventId:t.event.id,anchorEndMin:t.endMin,dayIndex:n,minutes:i}:{kind:`resize-bottom`,eventId:t.event.id,anchorStartMin:t.startMin,dayIndex:n,minutes:i})},j=(e,t)=>{if(!s||e.button!==0)return;e.preventDefault();let n=T(e.clientY,t);S({kind:`select`,dayIndex:t,anchorMinutes:n,headMinutes:n})},M=e=>{if(!x)return null;if(x.kind===`select`&&x.dayIndex===e){let t=Math.min(x.anchorMinutes,x.headMinutes),n=Math.max(x.anchorMinutes,x.headMinutes);return(0,L.jsx)(`div`,{className:`absolute left-1 right-1 rounded bg-primary/30 border border-primary pointer-events-none z-10`,style:{top:t/60*G,height:Math.max(l,(n-t)/60*G)},"aria-hidden":!0,children:(0,L.jsx)(`div`,{className:`px-2 py-0.5 text-xs font-medium text-primary`,children:Y(d[e],t,n,r)})})}if(x.kind===`move`&&x.dayIndex===e){let t=x.minutes-x.grabMinuteOffset,n=Math.max(0,Math.min(1440-x.durationMin,Math.round(t/i)*i));return(0,L.jsx)(`div`,{className:`absolute left-1 right-1 rounded border-2 border-dashed border-primary bg-primary/10 pointer-events-none z-10`,style:{top:n/60*G,height:x.durationMin/60*G},"aria-hidden":!0,children:(0,L.jsx)(`div`,{className:`px-2 py-0.5 text-xs font-medium text-primary`,children:Y(d[e],n,n+x.durationMin,r)})})}if((x.kind===`resize-top`||x.kind===`resize-bottom`)&&x.dayIndex===e){let t,n;return x.kind===`resize-top`?(t=Math.min(x.anchorEndMin-i,Math.max(0,x.minutes)),n=x.anchorEndMin):(t=x.anchorStartMin,n=Math.max(x.anchorStartMin+i,Math.min(1440,x.minutes))),(0,L.jsx)(`div`,{className:`absolute left-1 right-1 rounded border-2 border-dashed border-primary bg-primary/10 pointer-events-none z-10`,style:{top:t/60*G,height:(n-t)/60*G},"aria-hidden":!0,children:(0,L.jsx)(`div`,{className:`px-2 py-0.5 text-xs font-medium text-primary`,children:Y(d[e],t,n,r)})})}return null};return(0,L.jsxs)(`div`,{className:`flex flex-col h-full`,ref:y,children:[(0,L.jsxs)(`div`,{className:`flex border-b sticky top-0 bg-background z-20`,children:[(0,L.jsx)(`div`,{className:`w-14 shrink-0 border-r`,"aria-hidden":!0}),O.map((e,t)=>(0,L.jsxs)(`div`,{role:`columnheader`,className:E(`flex-1 p-2 text-center text-sm border-r last:border-r-0`,e.isToday&&`bg-primary/5`),children:[(0,L.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.weekday}),(0,L.jsx)(`div`,{className:E(`font-medium`,e.isToday&&`inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground h-6 w-6 mx-auto`),children:e.day})]},t))]}),m.length>0&&(0,L.jsxs)(`div`,{className:`flex border-b bg-muted/20 max-h-[140px] overflow-y-auto`,children:[(0,L.jsx)(`div`,{className:`w-14 shrink-0 border-r flex items-start justify-end pr-1 pt-1 text-[10px] text-muted-foreground sticky left-0 bg-muted/20`,children:c(`calendar.allDay`)===`calendar.allDay`?`all-day`:c(`calendar.allDay`)}),d.map(e=>{let t=J(e);return(0,L.jsx)(`div`,{className:`flex-1 border-r last:border-r-0 min-h-[28px] p-0.5 space-y-0.5`,children:(g.get(t)??[]).map(({event:e,isStart:t,isEnd:n},r)=>{let{className:i,inlineColor:o}=V(e.color);return(0,L.jsx)(`div`,{role:`button`,title:e.title,onClick:t=>{t.stopPropagation(),a?.(e)},className:E(`text-[11px] px-2 py-0.5 truncate cursor-pointer hover:opacity-80`,t?`rounded-l`:`rounded-l-none -ml-0.5`,n?`rounded-r`:`rounded-r-none -mr-0.5`,i),style:o?{backgroundColor:o}:void 0,children:t?e.title:`\xA0`},`${e.id}-${r}`)})},t)})]}),(0,L.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,L.jsxs)(`div`,{className:`flex`,style:{height:u},children:[(0,L.jsx)(`div`,{className:`w-14 shrink-0 border-r relative`,children:k.map((e,t)=>(0,L.jsx)(`div`,{className:`absolute right-1 text-[10px] text-muted-foreground -translate-y-1/2`,style:{top:t*G},children:t===0?``:e},t))}),d.map((e,t)=>{let n=J(e),s=v.get(n)??[];return(0,L.jsxs)(`div`,{ref:e=>{b.current[t]=e},className:`flex-1 border-r last:border-r-0 relative select-none`,style:{height:u},onPointerDown:e=>j(e,t),"aria-label":e.toLocaleDateString(r,{weekday:`long`,month:`long`,day:`numeric`,year:`numeric`}),children:[Array.from({length:24},(e,t)=>(0,L.jsx)(`div`,{className:`absolute left-0 right-0 border-t border-muted/60 pointer-events-none`,style:{top:t*G}},t)),i<60&&Array.from({length:Math.floor(1440/i)},(e,t)=>{let n=t*i;return n%60==0?null:(0,L.jsx)(`div`,{className:`absolute left-0 right-0 border-t border-dashed border-muted/30 pointer-events-none`,style:{top:n/60*G}},t)}),s.map(n=>{let i=n.startMin/60*G,s=Math.max(l,(n.endMin-n.startMin)/60*G),c=100/n.cols,u=n.col*c,{className:d,inlineColor:f}=V(n.event.color),p=x&&x.eventId===n.event.id;return(0,L.jsxs)(`div`,{role:`button`,tabIndex:0,title:n.event.title,"aria-label":n.event.title,onPointerDown:e=>A(e,n,t,`body`),onClick:e=>{if(w.current){e.stopPropagation();return}e.stopPropagation(),a?.(n.event)},className:E(`absolute rounded text-xs px-2 py-1 overflow-hidden shadow-sm`,o?`cursor-move`:`cursor-pointer`,d,p&&`opacity-40`),style:{top:i,height:s,left:`calc(${u}% + 2px)`,width:`calc(${c}% - 4px)`,...f?{backgroundColor:f}:{}},children:[(0,L.jsx)(`div`,{className:`font-medium truncate`,children:n.event.title}),(0,L.jsx)(`div`,{className:`text-[10px] opacity-80 truncate`,children:Y(e,n.startMin,n.endMin,r)}),o&&n.isStart&&(0,L.jsx)(`div`,{onPointerDown:e=>A(e,n,t,`top`),className:`absolute top-0 left-0 right-0 h-1.5 cursor-ns-resize`,"aria-label":`Resize start`}),o&&n.isEnd&&(0,L.jsx)(`div`,{onPointerDown:e=>A(e,n,t,`bottom`),className:`absolute bottom-0 left-0 right-0 h-1.5 cursor-ns-resize`,"aria-label":`Resize end`})]},`${n.event.id}-${n.startMin}`)}),M(t)]},n)})]})})]})}function Y(e,t,n,r){let i=new Date(e);i.setHours(0,Math.round(t),0,0);let a=new Date(e);a.setHours(0,Math.round(n),0,0);let o=e=>e.toLocaleTimeString(r,{hour:`numeric`,minute:`2-digit`});return`${o(i)} – ${o(a)}`}function se(e){return`data`in e&&e.data?e.data:`staticData`in e&&e.staticData?{provider:`value`,items:e.staticData}:e.objectName?{provider:`object`,object:e.objectName}:null}function ce(e){if(e){if(typeof e==`string`){let t=e.split(` `),n=t[0],r=t[1]?.toLowerCase()===`desc`?`desc`:`asc`;return{[n]:r}}if(Array.isArray(e))return e.reduce((e,t)=>(t.field&&t.order&&(e[t.field]=t.order),e),{})}}function le(e){return`filter`in e&&e.filter&&typeof e.filter==`object`&&`calendar`in e.filter?e.filter.calendar:e.calendar?e.calendar:e.startDateField||e.dateField?{startDateField:e.startDateField||e.dateField,endDateField:e.endDateField||e.endField,titleField:e.titleField,colorField:e.colorField,allDayField:e.allDayField}:null}var X=({schema:e,dataSource:t,className:r,data:i,loading:a,onEventClick:o,onRowClick:s,onDateClick:l,onNavigate:h,onViewChange:g,onEventDrop:v,locale:y})=>{let x=Array.isArray(i),[S,w]=(0,I.useState)(x?i:[]),[E,D]=(0,I.useState)(x?a??!1:!0),[j,N]=(0,I.useState)(null),[P,ee]=(0,I.useState)(null),[te,R]=(0,I.useState)(new Date),z=p(),B=e.defaultView,[V,H]=(0,I.useState)(()=>{let e=B===`day`||!B;return typeof window<`u`&&window.innerWidth<768&&e?`month`:B||`month`});(0,I.useEffect)(()=>{z&&V===`day`&&(B===`day`||!B)&&H(`month`)},[z]);let[U,W]=(0,I.useState)(0);(0,I.useEffect)(()=>{if(!x&&!(!t?.onMutation||!e.objectName))return t.onMutation(t=>{t.resource===e.objectName&&W(e=>e+1)})},[t,e.objectName,x]);let{ref:re,isRefreshing:ie,pullDistance:ae}=O({onRefresh:(0,I.useCallback)(async()=>{W(e=>e+1)},[]),enabled:!!t&&!!e.objectName}),G=(0,I.useMemo)(()=>se(e),[e.data,e.staticData,e.objectName]),K=(0,I.useMemo)(()=>le(e),[e.filter,e.calendar,e.dateField,e.endField,e.titleField,e.colorField]),q=G?.provider===`value`,J=(0,I.useRef)(null);J.current=P,(0,I.useEffect)(()=>{x&&w(i)},[i,x]),(0,I.useEffect)(()=>{x&&a!==void 0&&D(a)},[a,x]),(0,I.useEffect)(()=>{if(x)return;let r=!0;return(async()=>{try{if(!r)return;if(D(!0),q&&G?.provider===`value`){r&&(w(G.items),D(!1));return}if(!t||typeof t.find!=`function`)throw Error(`DataSource required for object/api providers`);if(G?.provider===`object`){let i=G.object,a=n(J.current?.fields),o=c(await t.find(i,{$filter:e.filter,$orderby:ce(e.sort),...a.length>0?{$expand:a}:{}}));r&&w(o)}else G?.provider===`api`&&(console.warn(`API provider not yet implemented for ObjectCalendar`),r&&w([]));r&&D(!1)}catch(e){console.error(`[ObjectCalendar] Error fetching data:`,e),r&&(N(e),D(!1))}})(),()=>{r=!1}},[x,G,t,q,e.filter,e.sort,U]),(0,I.useEffect)(()=>{!q&&t&&(async()=>{try{if(!t)return;let n=G?.provider===`object`?G.object:e.objectName;if(!n)return;ee(await t.getObjectSchema(n))}catch(e){console.error(`Failed to fetch object schema:`,e)}})()},[e.objectName,t,q,G]);let oe=(0,I.useMemo)(()=>{if(!K||!S.length)return[];let{startDateField:e,endDateField:t,titleField:n,colorField:r}=K,i=P?.titleFormat,a=typeof i==`string`?i:i&&typeof i==`object`&&typeof i.source==`string`?i.source:void 0,o=P?.NAME_FIELD_KEY,s=[`name`,`full_name`,`fullName`,`title`,`subject`,`label`,`display_name`,`displayName`],c=(e,t)=>{let n=`[-\\u2013\\u2014|/·,:]`,r=!1,i=e.replace(/\{([^{}]+)\}/g,(e,n)=>{let i=t[n.trim()];return i!=null&&i!==``?(r=!0,String(i)):`\0`});return r?i.replace(RegExp(`\\s*${n}\\s*`,`g`),``).replace(RegExp(`\\s*${n}\\s*`,`g`),``).replace(RegExp(`\0`,`g`),``).replace(/\s+/g,` `).trim():``},l=e=>{let t;if(n&&(t=e[n],typeof t==`string`&&(t=t.trim())),!t&&a){let n=c(a,e);n&&(t=n)}if(!t&&o){let n=e[o];typeof n==`string`?t=n.trim():n&&(t=n)}if(!t)for(let n of s){let r=e[n],i=typeof r==`string`?r.trim():r;if(i){t=i;break}}return t||`Untitled`};return S.map((n,i)=>{let a=n[e],o=t?n[t]:null,s=l(n),c=r?n[r]:void 0;return{id:n.id||n._id||`event-${i}`,title:s,start:a?new Date(a):new Date,end:o?new Date(o):void 0,color:c,allDay:!o,data:n}}).filter(e=>!isNaN(e.start.getTime()))},[S,K,P]);(0,I.useCallback)(()=>{l?.(new Date)},[l]);let Y=e.navigation??{mode:`drawer`,width:`min(960px, 60vw)`},X=Y.mode===`drawer`||Y.mode===`modal`||Y.mode===`split`||Y.mode===`popover`,Z=d({navigation:Y,objectName:e.objectName,onRowClick:X?void 0:s}),ue=(0,I.useCallback)(async(n,r,i)=>{if(!K)return;let{startDateField:a,endDateField:o}=K,s=n?.id??n?._id;if(!s||!e.objectName||!t?.update)return;let c={[a]:r.toISOString()};o&&i&&(c[o]=i.toISOString());let l=S;w(e=>e.map(e=>(e?.id??e?._id)===s?{...e,...c}:e));try{await t.update(e.objectName,s,c)}catch(e){w(l),console.error(`[ObjectCalendar] Failed to persist drag-and-drop reschedule:`,e)}},[K,e.objectName,t,S]),[Q,$]=(0,I.useState)(null),de=(0,I.useCallback)(n=>{!K||!e.objectName||!t?.create||$({start:n,title:``,submitting:!1})},[K,e.objectName,t]),fe=(0,I.useCallback)((n,r)=>{!K||!e.objectName||!t?.create||$({start:n,end:r,title:``,submitting:!1})},[K,e.objectName,t]),pe=(0,I.useCallback)(async()=>{if(!Q||!K)return;let n=Q.title.trim();if(!n){$(e=>e&&{...e,error:`Title is required`});return}if(!e.objectName||!t?.create)return;$(e=>e&&{...e,submitting:!0,error:void 0});let{startDateField:r,endDateField:i,titleField:a}=K,o={[a||`name`]:n,[r]:Q.start.toISOString()};i&&(o[i]=(Q.end??Q.start).toISOString());let s=P?.fields;if(s&&typeof s==`object`){let e=Array.isArray(s)?s.map(e=>[e.name??e.apiName,e]):Object.entries(s);for(let[t,n]of e){if(!t||t in o||!n?.required)continue;if(n.defaultValue!==void 0&&n.defaultValue!==null){o[t]=n.defaultValue;continue}let e=n.type;if(e===`select`||e===`picklist`||e===`status`){let e=(n.options||n.choices||[])[0];e!==void 0&&(o[t]=typeof e==`object`?e.value??e.id:e)}else e===`boolean`||e===`checkbox`?o[t]=!1:(e===`number`||e===`integer`||e===`decimal`||e===`currency`||e===`percent`)&&(o[t]=0)}}try{let n=await t.create(e.objectName,o),r=(n&&(n.record||n.data||n))??null;r&&(r.id!==void 0||r._id!==void 0)&&w(e=>[...e,r]),$(null)}catch(e){let t=e?.message||String(e);$(e=>e&&{...e,submitting:!1,error:t}),console.error(`[ObjectCalendar] Quick-create failed:`,e)}},[Q,K,e.objectName,t,P]);return E?(0,L.jsx)(`div`,{className:r,children:(0,L.jsx)(`div`,{className:`flex items-center justify-center h-96`,children:(0,L.jsx)(`div`,{className:`text-muted-foreground`,children:`Loading calendar...`})})}):j?(0,L.jsx)(`div`,{className:r,children:(0,L.jsx)(`div`,{className:`flex items-center justify-center h-96`,children:(0,L.jsxs)(`div`,{className:`text-destructive`,children:[`Error: `,j.message]})})}):K?(0,L.jsxs)(`div`,{ref:re,className:r,children:[ae>0&&(0,L.jsx)(`div`,{className:`flex items-center justify-center text-xs text-muted-foreground`,style:{height:ae},children:ie?`Refreshing…`:`Pull to refresh`}),(0,L.jsx)(`div`,{className:`bg-background h-[calc(100vh-120px)] sm:h-[calc(100vh-160px)] md:h-[calc(100vh-200px)] min-h-[400px] sm:min-h-[600px]`,children:(0,L.jsx)(ne,{events:oe,currentDate:te,view:V,locale:y,onEventClick:e=>{Z.handleClick(e.data),X||o?.(e.data)},onDateClick:e=>{l?l(e):de(e)},onNavigate:e=>{R(e),h?.(e)},onViewChange:e=>{H(e),g?.(e)},onAddClick:void 0,onEventDrop:(e,t,n)=>{v?v(e.data,t,n):ue(e.data,t,n)},onTimeRangeSelect:fe})}),(0,L.jsx)(m,{open:!!Q,onOpenChange:e=>{e||$(null)},children:(0,L.jsxs)(C,{className:`sm:max-w-md`,children:[(0,L.jsxs)(b,{children:[(0,L.jsx)(u,{children:`New event`}),(0,L.jsx)(M,{children:Q&&(()=>{let e=Q.end&&Q.end.getTime()!==Q.start.getTime(),t=Q.start.toLocaleDateString(y,{year:`numeric`,month:`long`,day:`numeric`});if(e){let e=e=>e.toLocaleTimeString(y,{hour:`numeric`,minute:`2-digit`});return(0,L.jsxs)(L.Fragment,{children:[t,` · `,e(Q.start),` – `,e(Q.end)]})}return(0,L.jsxs)(L.Fragment,{children:[`On `,t]})})()})]}),(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(k,{htmlFor:`quick-create-title`,children:`Title`}),(0,L.jsx)(_,{id:`quick-create-title`,autoFocus:!0,value:Q?.title??``,onChange:e=>$(t=>t&&{...t,title:e.target.value,error:void 0}),onKeyDown:e=>{e.key===`Enter`&&!Q?.submitting&&(e.preventDefault(),pe())},placeholder:`What's this event about?`,disabled:Q?.submitting}),Q?.error&&(0,L.jsx)(`p`,{className:`text-sm text-destructive`,children:Q.error})]}),(0,L.jsxs)(f,{children:[(0,L.jsx)(F,{variant:`outline`,onClick:()=>$(null),disabled:Q?.submitting,children:`Cancel`}),(0,L.jsx)(F,{onClick:()=>void pe(),disabled:Q?.submitting||!Q?.title.trim(),children:Q?.submitting?`Creating…`:`Create`})]})]})}),Z.isOverlay&&Z.isOpen&&Z.selectedRecord&&(()=>{let n=G?.provider===`object`?G.object:e.objectName,r=Z.selectedRecord,i=r.id??r._id;if(!n||i==null)return null;let a=K?.titleField?String(r[K.titleField]??`Event Details`):`Event Details`;return(0,L.jsx)(T,{open:!0,onClose:Z.close,title:a,record:r,objectName:n,recordId:i,dataSource:t,objectSchema:P,width:Z.width??`min(960px, 60vw)`,fullPageHref:A(n,i)??void 0,onFieldSave:async(e,r)=>{t?.update&&(await t.update(n,String(i),{[e]:r}),w(t=>t.map(t=>String(t.id??t._id)===String(i)?{...t,[e]:r}:t)))},onDelete:async()=>{t?.delete&&(await t.delete(n,String(i)),w(e=>e.filter(e=>String(e.id??e._id)!==String(i))))}})})()]}):(0,L.jsx)(`div`,{className:r,children:(0,L.jsx)(`div`,{className:`flex items-center justify-center h-96`,children:(0,L.jsx)(`div`,{className:`text-muted-foreground`,children:`Calendar configuration required. Please specify startDateField and titleField.`})})})};S.register(`calendar-view`,({schema:e,className:t,onAction:n,...r})=>(0,L.jsx)(ne,{className:t,events:I.useMemo(()=>!e.data||!Array.isArray(e.data)?[]:e.data.map((t,n)=>{let r=e.titleField||`title`,i=e.startDateField||`start`,a=e.endDateField||`end`,o=e.colorField||`color`,s=e.allDayField||`allDay`;return{id:t.id||t._id||n,title:t[r]||`Untitled Event`,start:new Date(t[i]),end:t[a]?new Date(t[a]):void 0,allDay:t[s],color:t[o],data:t}}),[e.data,e.titleField,e.startDateField,e.endDateField,e.colorField,e.allDayField]),onEventClick:e=>{n?.({type:`event-click`,payload:e})},...r}),{namespace:`plugin-calendar`,label:`Calendar View`,inputs:[{name:`data`,type:`array`,label:`Data`,description:`Array of record objects to display as events`},{name:`titleField`,type:`string`,label:`Title Field`,defaultValue:`title`,description:`Field name to use for event title`},{name:`startDateField`,type:`string`,label:`Start Date Field`,defaultValue:`start`,description:`Field name for event start date`},{name:`endDateField`,type:`string`,label:`End Date Field`,defaultValue:`end`,description:`Field name for event end date (optional)`},{name:`allDayField`,type:`string`,label:`All Day Field`,defaultValue:`allDay`,description:`Field name for all-day flag`},{name:`colorField`,type:`string`,label:`Color Field`,defaultValue:`color`,description:`Field name for event color`},{name:`colorMapping`,type:`object`,label:`Color Mapping`,description:`Map field values to colors (e.g., {meeting: "blue", deadline: "red"})`},{name:`view`,type:`enum`,enum:[`month`,`week`,`day`],defaultValue:`month`,label:`View Mode`,description:`Calendar view mode (month, week, or day)`},{name:`currentDate`,type:`string`,label:`Current Date`,description:`ISO date string for initial calendar date`},{name:`allowCreate`,type:`boolean`,label:`Allow Create`,defaultValue:!1,description:`Allow creating events by clicking on dates`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{view:`month`,titleField:`title`,startDateField:`start`,endDateField:`end`,allDayField:`allDay`,colorField:`color`,allowCreate:!1,data:[{id:1,title:`Team Meeting`,start:new Date(new Date().setHours(10,0,0,0)).toISOString(),end:new Date(new Date().setHours(11,0,0,0)).toISOString(),color:`#3b82f6`,allDay:!1},{id:2,title:`Project Deadline`,start:new Date(new Date().setDate(new Date().getDate()+3)).toISOString(),color:`#ef4444`,allDay:!0},{id:3,title:`Conference`,start:new Date(new Date().setDate(new Date().getDate()+7)).toISOString(),end:new Date(new Date().setDate(new Date().getDate()+9)).toISOString(),color:`#10b981`,allDay:!0}],className:`h-[600px] border rounded-lg`}});var Z=({schema:e,...t})=>{let{dataSource:n}=r()||{};return(0,L.jsx)(X,{schema:e,dataSource:n,...t})};S.register(`object-calendar`,Z,{namespace:`plugin-calendar`,label:`Object Calendar`,category:`view`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`calendar`,type:`object`,label:`Calendar Config`,description:`startDateField, endDateField, titleField, colorField`}]}),S.register(`calendar`,Z,{namespace:`view`,label:`Calendar View`,category:`view`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`calendar`,type:`object`,label:`Calendar Config`,description:`startDateField, endDateField, titleField, colorField`}]});export{ne as CalendarView,X as ObjectCalendar,Z as ObjectCalendarRenderer};
|