@krantho/studio 1.0.0 → 1.0.1
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/AssistantPanel-B7HETGhh.js +8 -0
- package/dist/assets/GraphBrowser-DIjsu_2L.js +2 -0
- package/dist/assets/GraphCanvas-B1JM8f2x.js +1 -0
- package/dist/assets/{action-button-Co7fp7HS.js → action-button-DIrhqMRc.js} +1 -1
- package/dist/assets/{api-seo-2H6_VoWE.js → api-seo-Cjv4a9Y_.js} +1 -1
- package/dist/assets/{arduino-CEYAtK6G.js → arduino-DKR9_xyJ.js} +1 -1
- package/dist/assets/{arrow-down-CsgZZR1B.js → arrow-down-B5kfR2lG.js} +1 -1
- package/dist/assets/{arrow-left-DKjipJjb.js → arrow-left-7opbl8fu.js} +1 -1
- package/dist/assets/{auth-GRfs02w7.js → auth-CIpilSKF.js} +1 -1
- package/dist/assets/{c-C8PoWFx3.js → c-CEM0h_nK.js} +1 -1
- package/dist/assets/{circle-check-big-zoQrH4Hp.js → circle-check-big-DQjpuxcC.js} +1 -1
- package/dist/assets/{circle-dashed-Cu2MEHnb.js → circle-dashed-cuYrILNo.js} +1 -1
- package/dist/assets/{circle-x-DMb3ZtiK.js → circle-x-peGpq98w.js} +1 -1
- package/dist/assets/{clike-jjKDqbJf.js → clike-BlGBRct5.js} +1 -1
- package/dist/assets/{clock-CzpAlvS3.js → clock-DoBIVjZO.js} +1 -1
- package/dist/assets/collection-view-CUWLWvwR.js +5 -0
- package/dist/assets/{copy-DloNx7rC.js → copy-V85khWct.js} +1 -1
- package/dist/assets/{corner-down-right-D2cWjQTP.js → corner-down-right-BpwOGRFR.js} +1 -1
- package/dist/assets/{cpp-BNrDeSFM.js → cpp-C0nea612.js} +1 -1
- package/dist/assets/createLucideIcon-BklFHeMd.js +1 -0
- package/dist/assets/{csharp-C2EQRp-I.js → csharp-C430X67Y.js} +1 -1
- package/dist/assets/{data-table-D8BsE1pn.js → data-table-B1kqxrEw.js} +1 -1
- package/dist/assets/editor-page-jSK3xMkh.js +27 -0
- package/dist/assets/{empty-state-CU7q3Ypl.js → empty-state-CeUZocHx.js} +1 -1
- package/dist/assets/{export-helpers-B2KV_EB5.js → export-helpers-C_HVpJN9.js} +1 -1
- package/dist/assets/{external-link-BRKJTCZG.js → external-link-Dh7p8Ii6.js} +1 -1
- package/dist/assets/{fill-job-D41ra-DR.js → fill-job-B-Z4jnVQ.js} +1 -1
- package/dist/assets/{fill-run-view-DFeyjdsI.js → fill-run-view-Bx-nSvtd.js} +1 -1
- package/dist/assets/{findability-CUYOthYI.js → findability-BrhtZ2yD.js} +1 -1
- package/dist/assets/{format-pPdsDgeS.js → format-C3ZX9yGM.js} +1 -1
- package/dist/assets/{go-BTdFQSkQ.js → go-2ldyX7zA.js} +1 -1
- package/dist/assets/graph-config-BJA_ztYM.js +1 -0
- package/dist/assets/image-editor-CEzh5OFw.js +1 -0
- package/dist/assets/index-qiIlvPyv.js +2 -0
- package/dist/assets/{info-B69U-gXd.js → info-Cxkabti5.js} +1 -1
- package/dist/assets/{java-OEPW09uX.js → java-BaDy4FT-.js} +1 -1
- package/dist/assets/{javascript-DWFokqmn.js → javascript-DoKZVVG7.js} +1 -1
- package/dist/assets/{kotlin-lSpEPTBz.js → kotlin-aNSUnDDr.js} +1 -1
- package/dist/assets/{layers-BQ89qo5R.js → layers-0VWe0rKm.js} +1 -1
- package/dist/assets/{list-checks-DmMdd-uP.js → list-checks-BCEhMMVY.js} +1 -1
- package/dist/assets/live-markdown-editor-BGbJGFKJ.js +54 -0
- package/dist/assets/{markdown-D0Y7CUbI.js → markdown-ChIsYjIt.js} +1 -1
- package/dist/assets/{markup-Bfi2BWVm.js → markup-C09yLKTH.js} +1 -1
- package/dist/assets/{markup-templating-BkH2dBCn.js → markup-templating-DNhq-UOv.js} +1 -1
- package/dist/assets/media-page-B3Q4EH3m.js +1 -0
- package/dist/assets/{meter-mJxPk3I3.js → meter-ZOLJ0WhG.js} +1 -1
- package/dist/assets/{objectivec-Cv_qlwGW.js → objectivec-s2I4Tn1D.js} +1 -1
- package/dist/assets/{pen-line-CZkcVGBd.js → pen-line-B524Nue8.js} +1 -1
- package/dist/assets/{pencil-BHnNXVY1.js → pencil-xdGZtrO4.js} +1 -1
- package/dist/assets/{php-MrfIyKXK.js → php-B_6N-5RT.js} +1 -1
- package/dist/assets/pulse-page-HsxpGgEu.js +1 -0
- package/dist/assets/rolldown-runtime-COiEfhsA.js +1 -0
- package/dist/assets/{rotate-ccw-CjpQmti_.js → rotate-ccw-BgARBEK3.js} +1 -1
- package/dist/assets/ruby-C8GJZDTg.js +1 -0
- package/dist/assets/{save-kXwhieDK.js → save-ClSXW9cb.js} +1 -1
- package/dist/assets/{send-ib_sr-OU.js → send-kYpW5JED.js} +1 -1
- package/dist/assets/setup-page-DsYYpFrd.js +1 -0
- package/dist/assets/{site-XpqFn80l.js → site-BfbIKOk1.js} +1 -1
- package/dist/assets/site-model-CoSgHHeY.js +1 -0
- package/dist/assets/site-overview-BJNMesQZ.js +1 -0
- package/dist/assets/structure-page-ZD8c7Ukz.js +2 -0
- package/dist/assets/{trash-Cknp3eZ5.js → trash-DzRCm500.js} +1 -1
- package/dist/assets/triangle-exclamation-point-ttN5lZI0.js +1 -0
- package/dist/assets/{typescript-Brau3Puh.js → typescript-s_P45ayF.js} +1 -1
- package/dist/assets/{upload-BvBYjswd.js → upload-CaqQJaUr.js} +1 -1
- package/dist/assets/{use-drawer-actions-DChrztN2.js → use-drawer-actions-D-rIBvJ8.js} +1 -1
- package/dist/assets/{use-loaded-C3hBdQe0.js → use-loaded-DFUDFVFt.js} +1 -1
- package/dist/assets/{use-locale-versions-Bp4V9fN-.js → use-locale-versions-DHt-x8c_.js} +1 -1
- package/dist/assets/{vendor-diff-Dm2YfgXt.js → vendor-diff-DGCTJYJ4.js} +14 -14
- package/dist/assets/vendor-markdown-pd8vs9n-.js +74 -0
- package/dist/assets/{vendor-media-yY6fAUvp.js → vendor-media-DXSmPN_d.js} +1 -1
- package/dist/assets/vendor-react-CXaWJ_ii.js +15 -0
- package/dist/assets/{vendor-reactflow-5Qvgw90M.js → vendor-reactflow-CMKi7AEX.js} +1 -1
- package/dist/assets/vendor-router-B4czwg8X.js +1 -0
- package/dist/index.html +8 -8
- package/package.json +18 -18
- package/dist/assets/AssistantPanel-CzFfUizn.js +0 -8
- package/dist/assets/GraphBrowser-DvcHXw-i.js +0 -2
- package/dist/assets/GraphCanvas-Bq75rYgC.js +0 -1
- package/dist/assets/collection-view-BlqX2SDN.js +0 -5
- package/dist/assets/createLucideIcon-D_HN41p3.js +0 -1
- package/dist/assets/editor-page-C8G81B5n.js +0 -27
- package/dist/assets/graph-config-ZUe9BjGK.js +0 -1
- package/dist/assets/image-editor-Bmjrioxz.js +0 -1
- package/dist/assets/index-DVe5jFLX.js +0 -2
- package/dist/assets/live-markdown-editor-CTvxOTrh.js +0 -53
- package/dist/assets/media-page-DYRRse48.js +0 -1
- package/dist/assets/pulse-page-B44AnguJ.js +0 -1
- package/dist/assets/rolldown-runtime-Dd_uD5pT.js +0 -1
- package/dist/assets/ruby-DGkU311C.js +0 -1
- package/dist/assets/setup-page-x51U8px6.js +0 -1
- package/dist/assets/site-model-DX8WxTJg.js +0 -1
- package/dist/assets/site-overview--k6hNYk0.js +0 -1
- package/dist/assets/structure-page-BW1y8L1n.js +0 -2
- package/dist/assets/triangle-alert-C4yqbtOC.js +0 -1
- package/dist/assets/vendor-markdown-DlwjVoJi.js +0 -66
- package/dist/assets/vendor-react-DMqGe90A.js +0 -15
- package/dist/assets/vendor-router-DjV3D6zM.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{s as t}from"./vendor-diff-DGCTJYJ4.js";var n=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,r=/^[\\/]{2}/;function i(e,t){return t+e.replace(/\\/g,`/`)}var a=`popstate`;function o(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function s(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return f(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:p(t)}return h(t,n,null,e)}function c(e,t){if(e===!1||e==null)throw Error(t)}function l(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function u(){return Math.random().toString(36).substring(2,10)}function d(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function f(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?m(t):t,state:n,key:t&&t.key||r||u(),mask:i}}function p({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function m(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function h(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:s=!1}=r,c=i.history,l=`POP`,u=null,p=m();p??(p=0,c.replaceState({...c.state,idx:p},``));function m(){return(c.state||{idx:null}).idx}function h(){l=`POP`;let e=m(),t=e==null?null:e-p;p=e,u&&u({action:l,location:b.location,delta:t})}function _(e,t){l=`PUSH`;let r=o(e)?e:f(b.location,e,t);n&&n(r,e),p=m()+1;let a=d(r,p),h=b.createHref(r.mask||r);try{c.pushState(a,``,h)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(h)}s&&u&&u({action:l,location:b.location,delta:1})}function v(e,t){l=`REPLACE`;let r=o(e)?e:f(b.location,e,t);n&&n(r,e),p=m();let i=d(r,p),a=b.createHref(r.mask||r);c.replaceState(i,``,a),s&&u&&u({action:l,location:b.location,delta:0})}function y(e){return g(i,e)}let b={get action(){return l},get location(){return e(i,c)},listen(e){if(u)throw Error(`A history only accepts one active listener`);return i.addEventListener(a,h),u=e,()=>{i.removeEventListener(a,h),u=null}},createHref(e){return t(i,e)},createURL:y,encodeLocation(e){let t=y(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:_,replace:v,go(e){return c.go(e)}};return b}function g(e,t,n=!1){let i=`http://localhost`;e&&(i=e.location.origin===`null`?e.location.href:e.location.origin),c(i,`No window.location.(origin|href) available to create URL`);let a=typeof t==`string`?t:p(t);return a=a.replace(/ $/,`%20`),!n&&r.test(a)&&(a=i+a),new URL(a,i)}var _=e(t(),1),v=class{#e=new Map;constructor(e){if(e)for(let[t,n]of e)this.set(t,n)}get(e){if(this.#e.has(e))return this.#e.get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw Error(`No value found for context`)}set(e,t){this.#e.set(e,t)}},y=class extends Error{},b=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`children`,`unstable_validateParams`]);function x(e){return b.has(e)}var S=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`middleware`,`children`,`unstable_validateParams`]);function C(e){return S.has(e)}function w(e){return e.index===!0}function T(e){let t={};return e.Component&&Object.assign(t,{element:_.createElement(e.Component),Component:void 0}),e.HydrateFallback&&Object.assign(t,{hydrateFallbackElement:_.createElement(e.HydrateFallback),HydrateFallback:void 0}),e.ErrorBoundary&&Object.assign(t,{errorElement:_.createElement(e.ErrorBoundary),ErrorBoundary:void 0}),t}function E(e,t=T,n=[],r={},i=!1){return e.map((e,a)=>{let o=[...n,String(a)],s=typeof e.id==`string`?e.id:o.join(`-`);if(c(e.index!==!0||!e.children,`Cannot specify children on an index route`),c(i||!r[s],`Found a route id collision on id "${s}". Route id's must be globally unique within Data Router usages`),w(e)){let n={...e,id:s};return r[s]=D(n,t(n)),n}{let n={...e,id:s,children:void 0};return r[s]=D(n,t(n)),e.children&&(n.children=E(e.children,t,o,r,i)),n}})}function D(e,t){return Object.assign(e,{...t,...typeof t.lazy==`object`&&t.lazy!=null?{lazy:{...e.lazy,...t.lazy}}:{}})}function O(e,t,n=`/`){return ee(e,t,n,!1)}function ee(e,t,n,r,i){let a=H((typeof t==`string`?m(t):t).pathname||`/`,n);if(a==null)return null;let o=i??te(e),s=null,c=ce(a);for(let e=0;s==null&&e<o.length;++e)s=z(o[e],c,r);return s}function k(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,loaderData:t[n.id],handle:n.handle}}function te(e){let t=A(e);return ne(t),t}function A(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let l={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(l.relativePath.startsWith(`/`)){if(!l.relativePath.startsWith(r)&&o)return;c(l.relativePath.startsWith(r),`Absolute route path "${l.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),l.relativePath=l.relativePath.slice(r.length)}let u=W([r,l.relativePath]),d=n.concat(l);e.children&&e.children.length>0&&(c(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${u}".`),A(e.children,t,d,u,o)),(e.path!=null||e.index)&&t.push({path:u,score:ae(u,e.index),routesMeta:d.map((e,t)=>{let[n,r]=se(e.relativePath,e.caseSensitive,t===d.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of j(e.path))a(e,t,!0,n)}),t}function j(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=j(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function ne(e){e.sort((e,t)=>e.score===t.score?oe(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var M=/^:[\w-]+$/,N=/^:[\w-]+/,re=3.5,P=3,F=2,I=1,L=10,R=-2,ie=e=>e===`*`;function ae(e,t){let n=e.split(`/`),r=n.length;return n.some(ie)&&(r+=R),t&&(r+=F),n.filter(e=>!ie(e)).reduce((e,t)=>e+(M.test(t)?P:N.test(t)?re:t===``?I:L),r)}function oe(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function z(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u={path:s.relativePath,caseSensitive:s.caseSensitive,end:c},d=s.matcher&&s.compiledParams?V(u,l,s.matcher,s.compiledParams):B(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=B({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:W([a,d.pathname]),pathnameBase:ve(W([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=W([a,d.pathnameBase]))}return o}function B(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=se(e.path,e.caseSensitive,e.end);return V(e,t,n,r)}function V(e,t,n,r){let i=t.match(n);if(!i)return null;let a=i[0],o=_e(a,1),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=_e(a.slice(0,a.length-e.length),1)}let i=s[r];return e[t]=n&&!i?void 0:(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function se(e,t=!1,n=!0){l(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/((?:[^/?()[\]*^\\]|\\.)+)\?(?=\/|$|\()/g,`(?:/$1)?`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function ce(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return l(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function H(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function le({basename:e,pathname:t}){return t===`/`?e:W([e,t])}var ue=e=>n.test(e);function de(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?m(e):e,a;return n?(n=ge(n),a=n.startsWith(`/`)||n.startsWith(`\\`)?fe(n.substring(1),`/`):fe(n,t)):a=t,{pathname:a,search:G(r),hash:ye(i)}}function fe(e,t){let n=_e(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function pe(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function U(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function me(e){let t=U(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function he(e,t,n,r=!1){let i;typeof e==`string`?i=m(e):(i={...e},c(!i.pathname||!i.pathname.includes(`?`),pe(`?`,`pathname`,`search`,i)),c(!i.pathname||!i.pathname.includes(`#`),pe(`#`,`pathname`,`hash`,i)),c(!i.search||!i.search.includes(`#`),pe(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let l=de(i,s),u=o&&o!==`/`&&o.endsWith(`/`),d=(a||o===`.`)&&n.endsWith(`/`);return!l.pathname.endsWith(`/`)&&(u||d)&&(l.pathname+=`/`),l}var ge=e=>e.replace(/[\\/]{2,}/g,`/`),W=e=>ge(e.join(`/`));function _e(e,t=0){let n=e.length;for(;n>t&&e.charCodeAt(n-1)===47;)n--;return n===e.length?e:e.slice(0,n)}var ve=e=>_e(e).replace(/^\/*/,`/`),G=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,ye=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,be=[`EvalError`,`RangeError`,`ReferenceError`,`SyntaxError`,`TypeError`,`URIError`],xe=class{status;statusText;data;error;internal;constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Se(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function Ce(e){return W(e.map(e=>e.route.path).filter(Boolean))||`/`}function we(e,t){let n=new URL(typeof e==`string`||e instanceof URL?e:e.url),r=typeof t==`string`?m(t):t;if(n.pathname=r.pathname||`/`,r.search){let e=new URLSearchParams(r.search),t=e.getAll(`index`);e.delete(`index`);for(let n of t.filter(Boolean))e.append(`index`,n);let i=e.toString();n.search=i?`?${i}`:``}else n.search=``;return n.hash=r.hash||``,n}var Te=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Ee(e,t){let a=e;if(typeof a!=`string`||!n.test(a))return{absoluteURL:void 0,isExternal:!1,to:a};let o=a,s=!1;if(Te)try{let e=new URL(window.location.href),n=r.test(a)?new URL(i(a,e.protocol)):new URL(a),o=H(n.pathname,t);n.origin===e.origin&&o!=null?a=o+n.search+n.hash:s=!0}catch{l(!1,`<Link to="${a}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:o,isExternal:s,to:a}}var De=Symbol(`Uninstrumented`),Oe=new WeakMap;function ke(e,t){let n={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(e=>e({id:t.id,index:t.index,path:t.path,instrument(e){e.lazy!=null&&n.lazy.push(e.lazy),e[`lazy.loader`]!=null&&n[`lazy.loader`].push(e[`lazy.loader`]),e[`lazy.action`]!=null&&n[`lazy.action`].push(e[`lazy.action`]),e[`lazy.middleware`]!=null&&n[`lazy.middleware`].push(e[`lazy.middleware`]),e.middleware!=null&&n.middleware.push(e.middleware),e.loader!=null&&n.loader.push(e.loader),e.action!=null&&n.action.push(e.action)}}));let r={};if(typeof t.lazy==`function`&&n.lazy.length>0){let e=t.lazy;r.lazy=async(...t)=>Fe(await K(n.lazy,void 0,()=>e(...t),q))}if(typeof t.lazy==`object`){let e=t.lazy;if(typeof e.middleware==`function`&&n[`lazy.middleware`].length>0){let t=e.middleware;r.lazy=Object.assign(r.lazy||{},{middleware:async(...e)=>Fe(await K(n[`lazy.middleware`],void 0,()=>t(...e),q))})}if(typeof e.loader==`function`&&n[`lazy.loader`].length>0){let t=e.loader;r.lazy=Object.assign(r.lazy||{},{loader:async(...e)=>Fe(await K(n[`lazy.loader`],void 0,()=>t(...e),q))})}if(typeof e.action==`function`&&n[`lazy.action`].length>0){let t=e.action;r.lazy=Object.assign(r.lazy||{},{action:async(...e)=>Fe(await K(n[`lazy.action`],void 0,()=>t(...e),q))})}}if(typeof t.loader==`function`&&n.loader.length>0){let e=je(t.loader),i=async(...t)=>Fe(await K(n.loader,Ie(t[0]),()=>e(...t),q));e.hydrate===!0&&(i.hydrate=!0),Me(i,e),r.loader=i}if(typeof t.action==`function`&&n.action.length>0){let e=je(t.action),i=async(...t)=>Fe(await K(n.action,Ie(t[0]),()=>e(...t),q));Me(i,e),r.action=i}return t.middleware&&t.middleware.length>0&&n.middleware.length>0&&(r.middleware=t.middleware.map(e=>{let t=je(e),r=async(...e)=>Fe(await K(n.middleware,Ie(e[0]),()=>t(...e),q));return Me(r,t),r})),r}function Ae(e,t){let n={navigate:[],fetch:[]};if(t.forEach(e=>e({instrument(e){e.navigate!=null&&n.navigate.push(e.navigate),e.fetch!=null&&n.fetch.push(e.fetch)}})),n.navigate.length>0){let t=je(e.navigate),r=async(...r)=>{let[i,a]=r,o,s={to:typeof i==`number`||typeof i==`string`?i:i?p(i):`.`,...Le(e,a??{})};return Fe(await K(n.navigate,s,async()=>{if(typeof i==`number`)return await t(...r);let n=Ne(e,e=>{o=e});try{return await t(...r)}finally{n()}},e=>({...q(e),meta:o})))};Me(r,t),e.navigate=r}if(n.fetch.length>0){let t=je(e.fetch),r=async(...r)=>{let[i,a,o,s]=r,c;return Fe(await K(n.fetch,{href:o??`.`,fetcherKey:i,...Le(e,s??{})},async()=>{let n=Ne(e,e=>{c=e});try{return await t(...r)}finally{n()}},e=>({...q(e),meta:c})))};Me(r,t),e.fetch=r}return e}function je(e){return e[De]??e}function Me(e,t){e[De]=t}function Ne(e,t){return Oe.set(e,t),()=>{Oe.get(e)===t&&Oe.delete(e)}}function Pe(e){let t=Oe.get(e);return Oe.delete(e),t}function Fe(e){if(e.type===`error`)throw e.value;return e.value}async function K(e,t,n,r,i={result:null,innerResult:null},a=e.length-1){let o=e[a];if(o){let s,l=async()=>(s?console.error(`You cannot call instrumented handlers more than once`):s=K(e,t,n,r,i,a-1),await s,c(i.innerResult,`Expected an inner result`),i.innerResult);try{await o(l,t)}catch(e){console.error(`An instrumentation function threw an error:`,e)}s||await l(),await s}else{try{i.result={type:`success`,value:await n()}}catch(e){i.result={type:`error`,value:e}}i.innerResult=r(i.result,t)}return i.result||(i.result={type:`error`,value:Error(`No result assigned in instrumentation chain.`)},i.innerResult=r(i.result,t)),i.result}function q(e){return e.type===`error`&&e.value instanceof Error?{status:`error`,error:e.value}:{status:`success`,error:void 0}}function Ie(e){let{request:t,context:n,params:r}=e;return{...e,request:Re(t),params:{...r},context:ze(n)}}function Le(e,t){return{currentUrl:p(e.state.location),...`formMethod`in t?{formMethod:t.formMethod}:{},...`formEncType`in t?{formEncType:t.formEncType}:{},...`formData`in t?{formData:t.formData}:{},...`body`in t?{body:t.body}:{}}}function Re(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function ze(e){return{get:t=>e.get(t)}}var Be=class{#e=[];#t=[];#n;#r=0;constructor(e){this.#n=e}update(e){this.#e=e,this.#t=te(e),this.#r=this.#t.reduce((e,t)=>e+t.routesMeta.length,0)}get matchCost(){return this.#r}match(e,t=!1){return ee(this.#e,e,this.#n,t,this.#t)}},Ve=new URL(`http://localhost`);function He(e){if(e.createURL)return e.createURL(`/`);try{return new URL(e.createHref(`/`),Ve)}catch{return Ve}}function Ue(e,t){return e.origin===t.origin&&(e.origin!==`null`||e.protocol===t.protocol&&e.host===t.host)}function We(e,t){if(e.startsWith(`//`))return!0;let n=t.protocol.toLowerCase();return e.toLowerCase().startsWith(n)?t.host===``||e.slice(n.length).startsWith(`//`):!1}function Ge(e,t,n,r){let i=null;try{i=e==null?null:new URL(e,n)}catch{}let a=new URL(t,n),o=i!=null&&!Ue(i,n),s=!Ue(a,n);if(r===`reject`){if(o||s)throw Error(`External navigation is not allowed`)}else if(s&&(i==null||!We(e,i)||!Ue(i,a)))throw Error(`External navigation is not allowed`)}var Ke=[`POST`,`PUT`,`PATCH`,`DELETE`],qe=new Set(Ke),Je=[`GET`,...Ke],Ye=new Set(Je),Xe=new Set([301,302,303,307,308]),Ze=new Set([307,308]),Qe={state:`idle`,location:void 0,matches:void 0,historyAction:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},$e={state:`idle`,data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},et={state:`unblocked`,proceed:void 0,reset:void 0,location:void 0},tt=`remix-router-transitions`,nt=Symbol(`ResetLoaderData`);function rt(e,t){return e.unstable_routePatternMatching?(c(void 0,`You must call unstable_preloadRoutePattern() from "react-router/route-pattern" before enabling future.unstable_routePatternMatching.`),new(void 0)(t)):new Be(t)}var it=class{#e;#t;#n;constructor(e,t){this.#e=e,this.#n=t,this.#n.update(e)}get stableRoutes(){return this.#e}get activeRoutes(){return this.#t??this.#e}get hasHMRRoutes(){return this.#t!=null}setRoutes(e){this.#e=e,this.#t||this.#n.update(e)}setHmrRoutes(e){this.#t=e,this.#n.update(e)}commitHmrRoutes(){this.#t&&(this.#e=this.#t,this.#t=void 0,this.#n.update(this.#e))}},at=new WeakMap;function ot(e){let t=e.window?e.window:typeof window<`u`?window:void 0,n=t!==void 0&&t.document!==void 0&&t.document.createElement!==void 0;c(e.routes.length>0,`You must provide a non-empty routes array to createRouter`);let i=e.hydrationRouteProperties||[],a=e.mapRouteProperties,o=a||(()=>({}));if(e.instrumentations){let t=e.instrumentations;o=e=>({...a?.(e),...ke(t.map(e=>e.route).filter(Boolean),e)})}let s={...e.future},u=e.basename||`/`;u.startsWith(`/`)||(u=`/${u}`);let d=rt(s,u),h={},_=new it(E(e.routes,o,void 0,h),d),b=e.dataStrategy||Ct,x=null,S=new Set,C=null,w=null,T=null,D=e.hydrationData!=null,O=d.match(e.history.location),ee=!1,te=null,A,j;if(O==null&&!e.patchRoutesOnNavigation){let t=J(404,{pathname:e.history.location.pathname}),{matches:n,route:r}=Kt(_.activeRoutes);A=!0,j=!A,O=n,te={[r.id]:t}}else if(O&&!e.hydrationData&&_t(O,e.history.location.pathname).active&&(O=null),!O){A=!1,j=!A,O=[];let t=_t(null,e.history.location.pathname);t.active&&t.matches&&(ee=!0,O=t.matches)}else if(O.some(e=>e.route.lazy))A=!1,j=!A;else if(!O.some(e=>dt(e.route)))A=!0,j=!A;else{let t=e.hydrationData?e.hydrationData.loaderData:null,n=e.hydrationData?e.hydrationData.errors:null,r=O;if(n){let e=O.findIndex(e=>n[e.route.id]!==void 0);r=r.slice(0,e+1)}j=!1,A=!0,r.forEach(e=>{let r=ft(e.route,t,n);j||=r.renderFallback,A&&=!r.shouldLoad})}let ne,M={historyAction:e.history.action,location:e.history.location,matches:O,initialized:A,renderFallback:j,navigation:Qe,restoreScrollPosition:e.hydrationData==null&&null,preventScrollReset:!1,revalidation:`idle`,loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||te,fetchers:new Map,blockers:new Map},N=`POP`,re=0,P,F=null,I=!1,L,R=!1,ie=new Map,ae=null,oe=!1,z=!1,B=new Set,V=new Map,se=0,ce=-1,le=new Map,de=new Set,fe=new Map,pe=new Map,U=new Set,me=new Map,he,ge=null;function W(){if(x=e.history.listen(({action:t,location:n,delta:r})=>{if(he){he(),he=void 0;return}l(me.size===0||r!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let i=nt({currentLocation:M.location,nextLocation:n,historyAction:t});if(i&&r!=null){let t=new Promise(e=>{he=e});e.history.go(r*-1),tt(i,{state:`blocked`,location:n,proceed(){tt(i,{state:`proceeding`,proceed:void 0,reset:void 0,location:n}),t.then(()=>e.history.go(r))},reset(){let e=new Map(M.blockers);e.set(i,et),G({blockers:e})}}),F?.resolve(),F=null}else return s.unstable_customRouteDiscovery&&(re+=r||0),we(t,n)}),n){hn(t,ie);let e=()=>gn(t,ie);t.addEventListener(`pagehide`,e),ae=()=>t.removeEventListener(`pagehide`,e)}return M.initialized||we(`POP`,M.location,{initialHydration:!0}),ne}function _e(){x&&x(),ae&&ae(),S.clear(),L&&L.abort(),M.fetchers.forEach((e,t)=>He(M.fetchers,t)),M.blockers.forEach((e,t)=>Xe(t))}function ve(e){return S.add(e),()=>S.delete(e)}function G(e,t={}){let n=e.errors??null,r=n?at.get(n):void 0;r!==void 0&&(n=r),(e.errors!==void 0||e.initialized)&&(M.errors&&at.delete(M.errors),e.errors&&at.set(e.errors,n)),e.matches&&=e.matches.map(e=>{let t=h[e.route.id],n=e.route;return n.element!==t.element||n.errorElement!==t.errorElement||n.hydrateFallbackElement!==t.hydrateFallbackElement?{...e,route:t}:e}),M={...M,...e};let i=[],a=[];M.fetchers.forEach((e,t)=>{e.state===`idle`&&(U.has(t)?i.push(t):a.push(t))}),U.forEach(e=>{!M.fetchers.has(e)&&!V.has(e)&&i.push(e)}),[...S].forEach(e=>e(M,{deletedFetchers:i,newErrors:n,viewTransitionOpts:t.viewTransitionOpts,flushSync:t.flushSync===!0})),i.forEach(e=>He(M.fetchers,e)),a.forEach(e=>M.fetchers.delete(e))}function ye(t,n,{flushSync:r}={}){let i=M.actionData!=null&&M.navigation.formMethod!=null&&X(M.navigation.formMethod)&&M.navigation.state===`loading`&&t.state?._isRedirect!==!0,a;a=n.actionData?Object.keys(n.actionData).length>0?n.actionData:null:i?M.actionData:null;let o=n.loaderData?Ut(M.loaderData,n.loaderData,n.matches||[],n.errors):M.loaderData,s=M.blockers;s.size>0&&!oe&&(s=new Map(s),s.forEach((e,t)=>s.set(t,et)));let c=!oe&&ht(t,n.matches||M.matches),l=I===!0||M.navigation.formMethod!=null&&X(M.navigation.formMethod)&&t.state?._isRedirect!==!0;_.commitHmrRoutes(),oe||N===`POP`||(N===`PUSH`?e.history.push(t,t.state):N===`REPLACE`&&e.history.replace(t,t.state));let u;if(N===`POP`&&!oe&&t!==M.location){let e=ie.get(M.location.pathname);e&&e.has(t.pathname)?u={currentLocation:M.location,nextLocation:t}:ie.has(t.pathname)&&(u={currentLocation:t,nextLocation:M.location})}else if(R){let e=ie.get(M.location.pathname);e?e.add(t.pathname):(e=new Set([t.pathname]),ie.set(M.location.pathname,e)),u={currentLocation:M.location,nextLocation:t}}G({...n,actionData:a,loaderData:o,historyAction:N,location:t,initialized:!0,renderFallback:!1,navigation:Qe,revalidation:`idle`,restoreScrollPosition:c,preventScrollReset:l,blockers:s},{viewTransitionOpts:u,flushSync:r===!0}),be(),F?.resolve(),F=null,ge?.resolve(),ge=null}function be(){re=0,N=`POP`,I=!1,R=!1,oe=!1,z=le.size>0}async function xe(t,n){if(P&&await P,F?.resolve(),F=null,typeof t==`number`){F||=_n();let n=F.promise;return e.history.go(t),n}let i=Pe(ne),{path:a,submission:o,error:s}=lt(!1,ct(M.location,M.matches,u,t,n?.fromRouteId,n?.relative),n),c;if(n?.mask){let t=typeof n.mask==`string`?m(n.mask):{...M.location.mask,...n.mask};if(c={pathname:t.pathname??``,search:t.search??``,hash:t.hash??``},r.test(c.pathname))throw Error(`External navigation is not allowed`);c.pathname.startsWith(`\\`)&&(c.pathname=c.pathname.replace(/^\\+/,`/`)),Ge(typeof n.mask==`string`?n.mask:p(n.mask),p(c),e.history.createURL(`/`),`reject`)}let l=M.location,d=f(l,a,n&&n.state,void 0,c);d={...d,...e.history.encodeLocation(d)},Ge(t==null?e.history.createHref(M.location):typeof t==`string`?t:p(t),e.history.createHref(d.mask||d),e.history.createURL(`/`),`reject`);let h=n&&n.replace!=null?n.replace:void 0,g=`PUSH`,_=M.location.pathname+M.location.search;h===!0?g=`REPLACE`:h===!1||o!=null&&X(o.formMethod)&&(o.formAction===_||d.pathname+d.search===_)&&(g=`REPLACE`);let v=n&&`preventScrollReset`in n?n.preventScrollReset===!0:void 0,y=(n&&n.flushSync)===!0,b=nt({currentLocation:l,nextLocation:d,historyAction:g});b?tt(b,{state:`blocked`,location:d,proceed(){tt(b,{state:`proceeding`,proceed:void 0,reset:void 0,location:d}),xe(t,n)},reset(){let e=new Map(M.blockers);e.set(b,et),G({blockers:e})}}):await we(g,d,{submission:o,pendingError:s,preventScrollReset:v,replace:n&&n.replace,enableViewTransition:n&&n.viewTransition,flushSync:y,callSiteDefaultShouldRevalidate:n&&n.defaultShouldRevalidate,instrumentationNavigateMetaReceiver:i})}function Ce(){if(P)return P.then(Ce);ge||=_n(),Le(),G({revalidation:`loading`});let e=ge.promise;return M.navigation.state===`submitting`?e:M.navigation.state===`idle`?(we(M.historyAction,M.location,{startUninterruptedRevalidation:!0,dataStrategyInitiator:`revalidation`}),e):(we(N||M.historyAction,M.navigation.location,{overrideNavigation:M.navigation,dataStrategyInitiator:`revalidation`,enableViewTransition:R===!0}),e)}async function we(t,n,r){P&&await P,L&&L.abort(),L=null,N=t,oe=(r&&r.startUninterruptedRevalidation)===!0,mt(M.location,M.matches),I=(r&&r.preventScrollReset)===!0,R=(r&&r.enableViewTransition)===!0;let i=r?.initialHydration&&M.matches&&M.matches.length>0&&!ee?M.matches:d.match(n),a=(r&&r.flushSync)===!0;if(i&&M.initialized&&!z&&Yt(M.location,n)&&!(r&&r.submission&&X(r.submission.formMethod))){ye(n,{matches:i},{flushSync:a});return}let o=_t(i,n.pathname);if(o.active&&o.matches&&(i=o.matches),r?.instrumentationNavigateMetaReceiver){let t=ln(e.history,n,i);r.instrumentationNavigateMetaReceiver(t)}if(!i){let{error:e,notFoundMatches:t,route:r}=ot(n.pathname);ye(n,{matches:t,loaderData:{},errors:{[r.id]:e}},{flushSync:a});return}let s=r&&r.overrideNavigation?{...r.overrideNavigation,matches:i,historyAction:t}:void 0;L=new AbortController;let c=Rt(e.history,n,L.signal,r&&r.submission),l=r?.initialHydration?`initialization`:r?.dataStrategyInitiator??`navigation`,u=e.getContext?await e.getContext():new v,f;if(r&&r.pendingError)f=[Gt(i).route.id,{type:`error`,error:r.pendingError}];else if(r&&r.submission&&X(r.submission.formMethod)){let d=await Ee(c,l,n,r.submission,i,t,u,o.active,r&&r.initialHydration===!0,{replace:r.replace,flushSync:a});if(d.shortCircuited)return;if(d.pendingActionResult){let[e,t]=d.pendingActionResult;if(Y(t)&&Se(t.error)&&t.error.status===404){L=null,ye(n,{matches:d.matches,loaderData:{},errors:{[e]:t.error}});return}}i=d.matches||i,f=d.pendingActionResult,s=dn(n,i,t,r.submission),a=!1,o.active=!1,c=Rt(e.history,c.url,c.signal)}let{shortCircuited:p,matches:m,loaderData:h,errors:g,workingFetchers:_}=await De(c,l,n,i,t,u,o.active,s,r&&r.submission,r&&r.fetcherSubmission,r&&r.replace,r&&r.initialHydration===!0,a,f,r&&r.callSiteDefaultShouldRevalidate);p||(L=null,ye(n,{matches:m||i,...Wt(f),loaderData:h,errors:g,..._?{fetchers:_}:{}}))}function Te(){let t=_n();P=t.promise;let n=re,r=F;F=null,L?.abort(),L=null,be(),ge?.resolve(),ge=null;let i=new Map(M.blockers);i.forEach((e,t)=>{e.state===`proceeding`&&i.set(t,et)});let a=new Map(M.fetchers),o=qe(a);a.forEach((e,t)=>{e.state===`loading`&&!V.has(t)&&(a.set(t,Z(e.data)),o=!0)}),B.clear(),G({navigation:Qe,revalidation:`idle`,blockers:i,...o?{fetchers:a}:{}});function s(){P=void 0,r?.resolve(),t.resolve()}return n?(he=s,e.history.go(-n)):s(),t.promise}async function Ee(t,n,r,a,c,l,d,f,p,m={}){if(s.unstable_customRouteDiscovery||Le(),G({navigation:fn(r,c,l,a)},{flushSync:m.flushSync===!0}),f){let e=await vt(c,r.pathname,t.signal);if(s.unstable_customRouteDiscovery&&t.signal.aborted||e.type===`aborted`)return{shortCircuited:!0};if(e.type===`cancelled`)return await Te(),{shortCircuited:!0};if(e.type===`error`){if(e.partialMatches.length===0){let{matches:t,route:n}=Kt(_.activeRoutes);return{matches:t,pendingActionResult:[n.id,{type:`error`,error:e.error}]}}let t=Gt(e.partialMatches).route.id;return{matches:e.partialMatches,pendingActionResult:[t,{type:`error`,error:e.error}]}}if(e.matches)c=e.matches;else{let{notFoundMatches:e,error:t,route:n}=ot(r.pathname);return{matches:e,pendingActionResult:[n.id,{type:`error`,error:t}]}}}s.unstable_customRouteDiscovery&&Le();let g,v=cn(c,r);if(!v.route.action&&!v.route.lazy)g={type:`error`,error:J(405,{method:t.method,pathname:r.pathname,routeId:v.route.id})};else{let e=await q(t,r,kt(o,h,t,r,c,v,p?[]:i,d),d,null,n,l);if(g=e[v.route.id],!g){for(let t of c)if(e[t.route.id]){g=e[t.route.id];break}}if(t.signal.aborted)return{shortCircuited:!0}}if(en(g)){let r;return r=m&&m.replace!=null?m.replace:Lt(g.response.headers.get(`Location`),new URL(t.url),u,e.history)===M.location.pathname+M.location.search,await K(t,g,!0,n,{submission:a,replace:r}),{shortCircuited:!0}}if(Y(g)){let e=Gt(c,v.route.id);return(m&&m.replace)!==!0&&(N=`PUSH`),{matches:c,pendingActionResult:[e.route.id,g,v.route.id]}}return{matches:c,pendingActionResult:[v.route.id,g]}}async function De(t,n,r,a,c,l,u,f,p,m,g,v,y,b,x){let S=f||dn(r,a,c,p),C=p||m||un(S),w=!oe&&!v;if(u){if(w){let e=Oe(b);G({navigation:S,...e===void 0?{}:{actionData:e}},{flushSync:y})}let e=await vt(a,r.pathname,t.signal);if(s.unstable_customRouteDiscovery&&t.signal.aborted||e.type===`aborted`)return{shortCircuited:!0};if(e.type===`cancelled`)return await Te(),{shortCircuited:!0};if(e.type===`error`){if(e.partialMatches.length===0){let{matches:t,route:n}=Kt(_.activeRoutes);return{matches:t,loaderData:{},errors:{[n.id]:e.error}}}let t=Gt(e.partialMatches).route.id;return{matches:e.partialMatches,loaderData:{},errors:{[t]:e.error}}}if(e.matches)a=e.matches,v&&!t.signal.aborted&&G({matches:a});else{let{error:e,notFoundMatches:t,route:n}=ot(r.pathname);return{matches:t,loaderData:{},errors:{[n.id]:e}}}}let{dsMatches:T,revalidatingFetchers:E}=ut(t,l,o,h,e.history,M,a,C,r,v?[]:i,v===!0,z,B,U,fe,de,d,b,x);if(ce=++se,!e.dataStrategy&&!T.some(e=>e.shouldLoad)&&!T.some(e=>e.route.middleware&&e.route.middleware.length>0)&&E.length===0){let e=new Map(M.fetchers),t=qe(e);return ye(r,{matches:a,loaderData:{},errors:b&&Y(b[1])?{[b[0]]:b[1].error}:null,...Wt(b),...t?{fetchers:e}:{}},{flushSync:y}),{shortCircuited:!0}}if(w){let e={};if(!u){e.navigation=S;let t=Oe(b);t!==void 0&&(e.actionData=t)}E.length>0&&(e.fetchers=je(E)),G(e,{flushSync:y})}E.forEach(e=>{We(e.key),e.controller&&V.set(e.key,e.controller)});let D=()=>E.forEach(e=>{V.get(e.key)===e.controller&&We(e.key)});L&&L.signal.addEventListener(`abort`,D);let{loaderResults:O,fetcherResults:ee}=await Ie(T,E,t,r,l,n,c);if(t.signal.aborted)return{shortCircuited:!0};L&&L.signal.removeEventListener(`abort`,D),E.forEach(e=>{V.get(e.key)===e.controller&&V.delete(e.key)});let k=qt(O);if(k)return await K(t,k.result,!0,n,{replace:g}),{shortCircuited:!0};if(k=qt(ee),k)return de.add(k.key),await K(t,k.result,!0,n,{replace:g}),{shortCircuited:!0};let te=new Map(M.fetchers),{loaderData:A,errors:j}=Ht(M,a,O,b,E,ee,te);if(v&&M.errors){let e=j??null;j={...M.errors,...j},at.set(j,e)}let ne=qe(te),N=Je(ce,te),re=ne||N||E.length>0;return{matches:a,loaderData:A,errors:j,...re?{workingFetchers:te}:{}}}function Oe(e){if(e&&!Y(e[1]))return{[e[0]]:e[1].data};if(M.actionData)return Object.keys(M.actionData).length===0?null:M.actionData}function je(e){let t=new Map(M.fetchers);return e.forEach(e=>{let n=t.get(e.key),r=pn(void 0,n?n.data:void 0);t.set(e.key,r)}),t}async function Me(t,n,r,i){P&&await P,We(t);let a=(i&&i.flushSync)===!0,o=Pe(ne),s=ct(M.location,M.matches,u,r,n,i?.relative),c=d.match(s),l=_t(c,s);if(l.active&&l.matches&&(c=l.matches),o&&o(ln(e.history,s,c)),!c){ze(t,n,J(404,{pathname:s}),{flushSync:a});return}let{path:f,submission:p,error:m}=lt(!0,s,i);if(m){ze(t,n,m,{flushSync:a});return}let h=e.getContext?await e.getContext():new v,g=(i&&i.preventScrollReset)===!0;if(p&&X(p.formMethod)){await Ne(t,n,f,c,h,l.active,a,g,p,i&&i.defaultShouldRevalidate);return}let _={routeId:n,path:f,isDiscovering:l.active};fe.set(t,_),await Fe(t,_,c,h,a,g,p)}async function Ne(t,n,r,a,l,u,f,p,m,g){s.unstable_customRouteDiscovery||Le(),fe.delete(t);let _=M.fetchers.get(t);Re(t,mn(m,_),{flushSync:f});let v=new AbortController;s.unstable_customRouteDiscovery&&V.set(t,v);let y=Rt(e.history,r,v.signal,m);if(u){let e=await vt(a,new URL(y.url).pathname,y.signal,t);if(s.unstable_customRouteDiscovery&&y.signal.aborted||e.type===`aborted`)return;if(e.type===`cancelled`){V.delete(t),fe.delete(t),Re(t,Z(_?.data),{flushSync:f});return}if(e.type===`error`){ze(t,n,e.error,{flushSync:f});return}if(e.matches)a=e.matches;else{ze(t,n,J(404,{pathname:r}),{flushSync:f});return}}let b=cn(a,r);if(!b.route.action&&!b.route.lazy){ze(t,n,J(405,{method:m.formMethod,pathname:r,routeId:n}),{flushSync:f});return}s.unstable_customRouteDiscovery&&Le(),V.set(t,v);let x=se,S=kt(o,h,y,r,a,b,i,l),C=await q(y,r,S,l,t,`fetcher`),w=C[b.route.id];if(!w){for(let e of S)if(C[e.route.id]){w=C[e.route.id];break}}if(y.signal.aborted){V.get(t)===v&&V.delete(t);return}if(U.has(t)){if(Y(w)){Re(t,Z(void 0));return}en(w)&&(z=!0,w={type:`data`,data:void 0})}else{if(en(w)){if(ce>x)z=!0,w={type:`data`,data:void 0};else return V.delete(t),de.add(t),Re(t,pn(m)),K(y,w,!1,`fetcher`,{fetcherSubmission:m,preventScrollReset:p})}if(Y(w)){ze(t,n,w.error);return}}z=!0;let T=M.navigation.location||M.location,E=Rt(e.history,T,v.signal),D=M.navigation.state===`idle`?M.matches:d.match(M.navigation.location);c(D,`Didn't find any matches after fetcher action`);let O=++se;le.set(t,O);let{dsMatches:ee,revalidatingFetchers:k}=ut(E,l,o,h,e.history,M,D,m,T,i,!1,z,B,U,fe,de,d,[b.route.id,w],g),te=pn(m,w.data),A=new Map(M.fetchers);A.set(t,te),k.filter(e=>e.key!==t).forEach(e=>{let t=e.key,n=A.get(t),r=pn(void 0,n?n.data:void 0);A.set(t,r),We(t),e.controller&&V.set(t,e.controller)}),G({fetchers:A});let j=()=>k.forEach(e=>{V.get(e.key)===e.controller&&We(e.key)});v.signal.addEventListener(`abort`,j);let{loaderResults:ne,fetcherResults:re}=await Ie(ee,k,E,T,l,`fetcher`);if(v.signal.aborted){le.get(t)===O&&le.delete(t);return}v.signal.removeEventListener(`abort`,j),le.delete(t),V.delete(t),k.forEach(e=>{V.get(e.key)===e.controller&&V.delete(e.key)});let P=M.fetchers.has(t),F=e=>{if(!P)return e;let n=new Map(e.fetchers);return n.set(t,Z(w.data)),{...e,fetchers:n}},I=qt(ne);if(I)return M=F(M),K(E,I.result,!1,`fetcher`,{preventScrollReset:p});if(I=qt(re),I)return de.add(I.key),M=F(M),K(E,I.result,!1,`fetcher`,{preventScrollReset:p});let R=new Map(M.fetchers);P&&R.set(t,Z(w.data));let{loaderData:ie,errors:ae}=Ht(M,D,ne,void 0,k,re,R);Je(O,R),M.navigation.state===`loading`&&O>ce?(c(N,`Expected pending action`),L&&L.abort(),qe(R),ye(M.navigation.location,{matches:D,loaderData:ie,errors:ae,fetchers:R})):(G({errors:ae,loaderData:Ut(M.loaderData,ie,D,ae),fetchers:R}),z=le.size>0)}async function Fe(t,n,r,a,c,l,u){let{routeId:d,path:f}=n,p=M.fetchers.get(t);Re(t,pn(u,p?p.data:void 0),{flushSync:c});let m=new AbortController;s.unstable_customRouteDiscovery&&V.set(t,m);let g=Rt(e.history,f,m.signal);if(n.isDiscovering){let e=await vt(r,new URL(g.url).pathname,g.signal,t);if(s.unstable_customRouteDiscovery&&g.signal.aborted||e.type===`aborted`)return;if(e.type===`cancelled`){V.delete(t),fe.delete(t),Re(t,Z(p?.data),{flushSync:c});return}if(e.type===`error`){ze(t,d,e.error,{flushSync:c});return}if(e.matches)r=e.matches,n.isDiscovering=!1;else{ze(t,d,J(404,{pathname:f}),{flushSync:c});return}}let _=cn(r,f);V.set(t,m);let v=se,y=await q(g,f,kt(o,h,g,f,r,_,i,a),a,t,`fetcher`),b=y[_.route.id];if(!b){for(let e of r)if(y[e.route.id]){b=y[e.route.id];break}}if(V.get(t)===m&&V.delete(t),!g.signal.aborted){if(U.has(t))Re(t,Z(void 0));else{if(en(b)){if(ce>v){Re(t,Z(void 0));return}de.add(t),await K(g,b,!1,`fetcher`,{preventScrollReset:l});return}Y(b)?ze(t,d,b.error):Re(t,Z(b.data))}}}async function K(r,i,a,o,{submission:s,fetcherSubmission:l,preventScrollReset:d,replace:p}={}){a||(F?.resolve(),F=null),i.response.headers.has(`X-Remix-Revalidate`)&&(z=!0);let m=i.response.headers.get(`Location`);c(m,`Expected a Location header on the redirect Response`);let h=m,_=new URL(r.url);m=Lt(m,_,u,e.history),Ge(h,m,_,`allow-explicit`);let v=f(M.location,m,{_isRedirect:!0});if(n){let e=!1;if(i.response.headers.has(`X-Remix-Reload-Document`))e=!0;else if(ue(m)){let n=g(t,m,!0);e=n.origin!==t.location.origin||H(n.pathname,u)==null}if(e){p?t.location.replace(m):t.location.assign(m);return}}L=null;let y=p===!0||i.response.headers.has(`X-Remix-Replace`)?`REPLACE`:`PUSH`,{formMethod:b,formAction:x,formEncType:S}=M.navigation;!s&&!l&&b&&x&&S&&(s=un(M.navigation));let C=s||l;Ze.has(i.response.status)&&C&&X(C.formMethod)?await we(y,v,{submission:{...C,formAction:m},preventScrollReset:d||I,enableViewTransition:a?R:void 0,dataStrategyInitiator:o}):await we(y,v,{overrideNavigation:dn(v,[],y,s),fetcherSubmission:l,preventScrollReset:d||I,enableViewTransition:a?R:void 0,dataStrategyInitiator:o})}async function q(e,t,n,r,i,a,o=null){let s,c={};try{s=await At(b,e,t,n,i,a,r,!1,o)}catch(e){return n.filter(e=>e.shouldLoad).forEach(t=>{c[t.route.id]={type:`error`,error:e}}),c}if(e.signal.aborted)return c;if(!X(e.method))for(let e of n){if(s[e.route.id]?.type===`error`)break;s.hasOwnProperty(e.route.id)||M.loaderData.hasOwnProperty(e.route.id)||M.errors&&M.errors.hasOwnProperty(e.route.id)||!e.shouldCallHandler()||(s[e.route.id]={type:`error`,result:Error(`No result returned from dataStrategy for route ${e.route.id}`)})}for(let[t,r]of Object.entries(s))if($t(r)){let i=r.result;c[t]={type:`redirect`,response:Pt(i,e,t,n,u)}}else c[t]=await Nt(r);return c}async function Ie(e,t,n,r,i,a,o=null){let s=q(n,r,e,i,null,a,o),c=Promise.all(t.map(async e=>{if(e.matches&&e.match&&e.request&&e.controller){let t=(await q(e.request,e.path,e.matches,i,e.key,a,o))[e.match.route.id];return{[e.key]:t}}return Promise.resolve({[e.key]:{type:`error`,error:J(404,{pathname:e.path})}})}));return{loaderResults:await s,fetcherResults:(await c).reduce((e,t)=>Object.assign(e,t),{})}}function Le(){z=!0,fe.forEach((e,t)=>{s.unstable_customRouteDiscovery&&e.isDiscovering||(V.has(t)&&B.add(t),We(t))})}function Re(e,t,n={}){let r=new Map(M.fetchers);r.set(e,t),G({fetchers:r},{flushSync:(n&&n.flushSync)===!0})}function ze(e,t,n,r={}){let i=Gt(M.matches,t),a=new Map(M.fetchers);He(a,e),G({errors:{[i.route.id]:n},fetchers:a},{flushSync:(r&&r.flushSync)===!0})}function Be(e){return pe.set(e,(pe.get(e)||0)+1),U.has(e)&&U.delete(e),M.fetchers.get(e)||$e}function Ve(e,t){We(e,t?.reason),fe.delete(e),B.delete(e),Re(e,Z(null))}function He(e,t){let n=M.fetchers.get(t);V.has(t)&&!(n&&n.state===`loading`&&le.has(t))&&We(t),fe.delete(t),le.delete(t),de.delete(t),U.delete(t),B.delete(t),e.delete(t)}function Ue(e){let t=(pe.get(e)||0)-1;t<=0?(pe.delete(e),U.add(e)):pe.set(e,t),G({fetchers:new Map(M.fetchers)})}function We(e,t){let n=V.get(e);n&&(n.abort(t),V.delete(e))}function Ke(e,t){for(let n of e){let e=t.get(n);c(e,`Expected fetcher: ${n}`);let r=Z(e.data);t.set(n,r)}}function qe(e){let t=[],n=!1;for(let r of de){let i=e.get(r);c(i,`Expected fetcher: ${r}`),i.state===`loading`&&(de.delete(r),t.push(r),n=!0)}return Ke(t,e),n}function Je(e,t){let n=[];for(let[r,i]of le)if(i<e){let e=t.get(r);c(e,`Expected fetcher: ${r}`),e.state===`loading`&&(We(r),le.delete(r),n.push(r))}return Ke(n,t),n.length>0}function Ye(e,t){let n=M.blockers.get(e)||et;return me.get(e)!==t&&me.set(e,t),n}function Xe(e){M.blockers.delete(e),me.delete(e)}function tt(e,t){let n=M.blockers.get(e)||et;c(n.state===`unblocked`&&t.state===`blocked`||n.state===`blocked`&&t.state===`blocked`||n.state===`blocked`&&t.state===`proceeding`||n.state===`blocked`&&t.state===`unblocked`||n.state===`proceeding`&&t.state===`unblocked`,`Invalid blocker state transition: ${n.state} -> ${t.state}`);let r=new Map(M.blockers);r.set(e,t),G({blockers:r})}function nt({currentLocation:e,nextLocation:t,historyAction:n}){if(me.size===0)return;me.size>1&&l(!1,`A router only supports one blocker at a time`);let r=Array.from(me.entries()),[i,a]=r[r.length-1],o=M.blockers.get(i);if(!(o&&o.state===`proceeding`)&&a({currentLocation:e,nextLocation:t,historyAction:n}))return i}function ot(e){let t=J(404,{pathname:e}),n=_.activeRoutes,{matches:r,route:i}=Kt(n);return{notFoundMatches:r,route:i,error:t}}function st(e,t,n){if(C=e,T=t,w=n||null,!D&&M.navigation===Qe){D=!0;let e=ht(M.location,M.matches);e!=null&&G({restoreScrollPosition:e})}return()=>{C=null,T=null,w=null}}function pt(e,t){return w&&w(e,t.map(e=>k(e,M.loaderData)))||e.key}function mt(e,t){if(C&&T){let n=pt(e,t);C[n]=T()}}function ht(e,t){if(C){let n=pt(e,t),r=C[n];if(typeof r==`number`)return r}return null}function _t(t,n){if(e.patchRoutesOnNavigation){if(!t)return{active:!0,matches:d.match(n,!0)||[]};if(Object.keys(t[0].params).length>0)return{active:!0,matches:d.match(n,!0)}}return{active:!1,matches:null}}async function vt(t,n,r,i){if(!e.patchRoutesOnNavigation)return{type:`success`,matches:t};let a=t;for(;;){let t=h;try{await e.patchRoutesOnNavigation({signal:r,path:n,matches:a,fetcherKey:i,patch:(e,n)=>{r.aborted||gt(e,n,_,t,o,!1)}})}catch(e){if(s.unstable_customRouteDiscovery){if(r.aborted)return{type:`aborted`};if(e instanceof y)return{type:`cancelled`}}return{type:`error`,error:e,partialMatches:a}}if(r.aborted)return{type:`aborted`};let c=d.match(n),l=null;if(c&&(Object.keys(c[0].params).length===0||(l=d.match(n,!0),!(l&&a.length<l.length&&yt(a,l.slice(0,a.length))))))return{type:`success`,matches:c};if(l||=d.match(n,!0),!l||yt(a,l))return{type:`success`,matches:null};a=l}}function yt(e,t){return e.length===t.length&&e.every((e,n)=>e.route.id===t[n].route.id)}function bt(e){h={},_.setHmrRoutes(E(e,o,void 0,h))}function xt(e,t,n=!1){gt(e,t,_,h,o,n),_.hasHMRRoutes||G({})}return ne={get basename(){return u},get future(){return s},get state(){return M},get routes(){return _.stableRoutes},match(e){return d.match(e)},get manifest(){return h},get window(){return t},initialize:W,subscribe:ve,enableScrollRestoration:st,navigate:xe,fetch:Me,revalidate:Ce,createHref:t=>e.history.createHref(t),createURL:t=>e.history.createURL(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:Be,resetFetcher:Ve,deleteFetcher:Ue,dispose:_e,getBlocker:Ye,deleteBlocker:Xe,patchRoutes:xt,_internalFetchControllers:V,_internalSetRoutes:bt,_internalSetStateDoNotUseOrYouWillBreakYourApp(e){G(e)}},e.instrumentations&&(ne=Ae(ne,e.instrumentations.map(e=>e.router).filter(Boolean))),ne}function st(e){return e!=null&&(`formData`in e&&e.formData!=null||`body`in e&&e.body!==void 0)}function ct(e,t,n,r,i,a){let o,s;if(i){o=[];for(let e of t)if(o.push(e),e.route.id===i){s=e;break}}else o=t,s=t[t.length-1];let c=he(r||`.`,me(o),H(e.pathname,n)||e.pathname,a===`path`);if(r??(c.search=e.search,c.hash=e.hash),(r==null||r===``||r===`.`)&&s){let e=sn(c.search);if(s.route.index&&!e)c.search=c.search?c.search.replace(/^\?/,`?index&`):`?index`;else if(!s.route.index&&e){let e=new URLSearchParams(c.search),t=e.getAll(`index`);e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();c.search=n?`?${n}`:``}}return n!==`/`&&(c.pathname=le({basename:n,pathname:c.pathname})),p(c)}function lt(e,t,n){if(!n||!st(n))return{path:t};if(n.formMethod&&!on(n.formMethod))return{path:t,error:J(405,{method:n.formMethod})};let r=()=>({path:t,error:J(400,{type:`invalid-body`})}),i=(n.formMethod||`get`).toUpperCase(),a=Jt(t);if(n.body!==void 0){if(n.formEncType===`text/plain`){if(!X(i))return r();let e=typeof n.body==`string`?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((e,[t,n])=>`${e}${t}=${n}\n`,``):String(n.body);return{path:t,submission:{formMethod:i,formAction:a,formEncType:n.formEncType,formData:void 0,json:void 0,text:e}}}if(n.formEncType===`application/json`){if(!X(i))return r();try{let e=typeof n.body==`string`?JSON.parse(n.body):n.body;return{path:t,submission:{formMethod:i,formAction:a,formEncType:n.formEncType,formData:void 0,json:e,text:void 0}}}catch{return r()}}}c(typeof FormData==`function`,`FormData is not available in this environment`);let o,s;if(n.formData)o=zt(n.formData),s=n.formData;else if(n.body instanceof FormData)o=zt(n.body),s=n.body;else if(n.body instanceof URLSearchParams)o=n.body,s=Bt(o);else if(n.body==null)o=new URLSearchParams,s=new FormData;else try{o=new URLSearchParams(n.body),s=Bt(o)}catch{return r()}let l={formMethod:i,formAction:a,formEncType:n&&n.formEncType||`application/x-www-form-urlencoded`,formData:s,json:void 0,text:void 0};if(X(l.formMethod))return{path:t,submission:l};let u=m(t);return e&&u.search&&sn(u.search)&&o.append(`index`,``),u.search=`?${o}`,{path:p(u),submission:l}}function ut(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v){let y=_?Y(_[1])?_[1].error:_[1].data:void 0,b=i.createURL(a.location),x=i.createURL(c),S;if(u&&a.errors){let e=Object.keys(a.errors)[0];S=o.findIndex(t=>t.route.id===e)}else if(_&&Y(_[1])){let e=_[0];S=o.findIndex(t=>t.route.id===e)-1}let C=_?_[1].statusCode:void 0,w=C&&C>=400,T={currentUrl:b,currentParams:a.matches[0]?.params||{},nextUrl:x,nextParams:o[0].params,...s,actionResult:y,actionStatus:C},E=Ce(o),D=o.map((i,o)=>{let{route:s}=i,f=null;if(S!=null&&o>S)f=!1;else if(s.lazy)f=!0;else if(!dt(s))f=!1;else if(u){let{shouldLoad:e}=ft(s,a.loaderData,a.errors);f=e}else pt(a.loaderData,a.matches[o],i)&&(f=!0);if(f!==null)return Ot(n,r,e,c,E,i,l,t,f);let p=!1;typeof v==`boolean`?p=v:w?p=!1:d||b.pathname+b.search===x.pathname+x.search?p=!0:b.search===x.search?mt(a.matches[o],i)&&(p=!0):p=!0;let m={...T,defaultShouldRevalidate:p};return Ot(n,r,e,c,E,i,l,t,ht(i,m),m,v)}),O=[];return m.forEach((e,s)=>{if(u||!o.some(t=>t.route.id===e.routeId)||p.has(s)||e.isDiscovering)return;let c=a.fetchers.get(s),m=c&&c.state!==`idle`&&c.data===void 0,_=g.match(e.path);if(!_){O.push({key:s,routeId:e.routeId,path:e.path,matches:null,match:null,request:null,controller:null});return}if(h.has(s))return;let y=cn(_,e.path),b=new AbortController,x=Rt(i,e.path,b.signal),S=null;if(f.has(s))f.delete(s),S=kt(n,r,x,e.path,_,y,l,t);else if(m)d&&(S=kt(n,r,x,e.path,_,y,l,t));else{let i;i=typeof v==`boolean`?v:!w&&d;let a={...T,defaultShouldRevalidate:i};ht(y,a)&&(S=kt(n,r,x,e.path,_,y,l,t,a))}S&&O.push({key:s,routeId:e.routeId,path:e.path,matches:S,match:y,request:x,controller:b})}),{dsMatches:D,revalidatingFetchers:O}}function dt(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function ft(e,t,n){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!dt(e))return{shouldLoad:!1,renderFallback:!1};let r=t!=null&&e.id in t,i=n!=null&&n[e.id]!==void 0;if(!r&&i)return{shouldLoad:!1,renderFallback:!1};if(typeof e.loader==`function`&&e.loader.hydrate===!0)return{shouldLoad:!0,renderFallback:!r};let a=!r&&!i;return{shouldLoad:a,renderFallback:a}}function pt(e,t,n){let r=!t||n.route.id!==t.route.id,i=!e.hasOwnProperty(n.route.id);return r||i}function mt(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith(`*`)&&e.params[`*`]!==t.params[`*`]}function ht(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n==`boolean`)return n}return t.defaultShouldRevalidate}function gt(e,t,n,r,i,a){let o;if(e){let t=r[e];c(t,`No route found to patch children into: routeId = ${e}`),t.children||=[],o=t.children}else o=n.activeRoutes;let s=[],l=[];if(t.forEach(e=>{let t=o.find(t=>_t(e,t));t?l.push({existingRoute:t,newRoute:e}):s.push(e)}),s.length>0){let t=E(s,i,[e||`_`,`patch`,String(o?.length||`0`)],r);o.push(...t)}if(a&&l.length>0)for(let e=0;e<l.length;e++){let{existingRoute:t,newRoute:n}=l[e],r=t,[a]=E([n],i,[],{},!0);Object.assign(r,{element:a.element?a.element:r.element,errorElement:a.errorElement?a.errorElement:r.errorElement,hydrateFallbackElement:a.hydrateFallbackElement?a.hydrateFallbackElement:r.hydrateFallbackElement})}n.hasHMRRoutes||n.setRoutes([...n.activeRoutes])}function _t(e,t){return`id`in e&&`id`in t&&e.id===t.id?!0:e.index!==t.index||e.path!==t.path||e.caseSensitive!==t.caseSensitive?!1:(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children?.every((e,n)=>t.children?.some(t=>_t(e,t)))??!1}var vt=new WeakMap,yt=({key:e,route:t,manifest:n,mapRouteProperties:r})=>{let i=n[t.id];if(c(i,`No route found in manifest`),!i.lazy||typeof i.lazy!=`object`)return;let a=i.lazy[e];if(!a)return;let o=vt.get(i);o||(o={},vt.set(i,o));let s=o[e];if(s)return s;let u=(async()=>{let t=x(e),n=i[e]!==void 0;if(t)l(!t,`Route property `+e+` is not a supported lazy route property. This property will be ignored.`),o[e]=Promise.resolve();else if(n)l(!1,`Route "${i.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let t=await a();t!=null&&(Object.assign(i,{[e]:t}),Object.assign(i,r(i)))}typeof i.lazy==`object`&&(i.lazy[e]=void 0,Object.values(i.lazy).every(e=>e===void 0)&&(i.lazy=void 0))})();return o[e]=u,u.catch(()=>{o[e]===u&&delete o[e]}),u},bt=new WeakMap;function xt(e,t,n,r,i){let a=n[e.id];if(c(a,`No route found in manifest`),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy==`function`){let t=bt.get(a);if(t)return{lazyRoutePromise:t,lazyHandlerPromise:t};let n=(async()=>{c(typeof e.lazy==`function`,`No lazy route function found`);let t=await e.lazy(),n={};for(let e in t){let r=t[e];if(r===void 0)continue;let i=C(e),o=a[e]!==void 0;i?l(!i,`Route property `+e+` is not a supported property to be returned from a lazy route function. This property will be ignored.`):o?l(!o,`Route "${a.id}" has a static property "${e}" defined but its lazy function is also returning a value for this property. The lazy route property "${e}" will be ignored.`):n[e]=r}Object.assign(a,n),Object.assign(a,{...r(a),lazy:void 0})})();return bt.set(a,n),n.catch(()=>{bt.get(a)===n&&bt.delete(a)}),{lazyRoutePromise:n,lazyHandlerPromise:n}}let o=Object.keys(e.lazy),s=[],u;for(let a of o){if(i&&i.includes(a))continue;let o=yt({key:a,route:e,manifest:n,mapRouteProperties:r});o&&(s.push(o),a===t&&(u=o))}let d=s.length>0?Promise.all(s).then(()=>{}):void 0;return d?.catch(()=>{}),u?.catch(()=>{}),{lazyRoutePromise:d,lazyHandlerPromise:u}}async function St(e){let t=e.matches.filter(e=>e.shouldLoad),n={};return(await Promise.all(t.map(e=>e.resolve()))).forEach((e,r)=>{n[t[r].route.id]=e}),n}async function Ct(e){return e.matches.some(e=>e.route.middleware)?wt(e,()=>St(e)):St(e)}function wt(e,t){return Tt(e,t,e=>{if(an(e))throw e;return e},Zt,n);async function n(t,n,r){if(r)return Object.assign(r.value,{[n]:{type:`error`,result:t}});{let{matches:r}=e,i=Math.min(Math.max(r.findIndex(e=>e.route.id===n),0),Math.max(r.findIndex(e=>e.shouldCallHandler()),0)),a=r[i].route.id;for(let e of r.slice(0,i+1))try{await e._lazyPromises?.route}catch{a=e.route.id;break}return{[Gt(r,a).route.id]:{type:`error`,result:t}}}}}async function Tt(e,t,n,r,i){let{matches:a,...o}=e;return await Et(o,a.flatMap(e=>e.route.middleware?e.route.middleware.map(t=>[e.route.id,t]):[]),t,n,r,i)}async function Et(e,t,n,r,i,a,o=0){let{request:s}=e;if(s.signal.aborted)throw s.signal.reason??Error(`Request aborted: ${s.method} ${s.url}`);let c=t[o];if(!c)return await n();let[l,u]=c,d,f=async()=>{if(d)throw Error("You may only call `next()` once per middleware");try{return d={value:await Et(e,t,n,r,i,a,o+1)},d.value}catch(e){return d={value:await a(e,l,d)},d.value}};try{let t=await u(e,f),n=t==null?void 0:r(t);return i(n)?n:d?n??d.value:(d={value:await f()},d.value)}catch(e){return await a(e,l,d)}}function Dt(e,t,n,r,i){let a=yt({key:`middleware`,route:r.route,manifest:t,mapRouteProperties:e}),o=xt(r.route,X(n.method)?`action`:`loader`,t,e,i);return{middleware:a,route:o.lazyRoutePromise,handler:o.lazyHandlerPromise}}function Ot(e,t,n,r,i,a,o,s,c,l=null,u){let d=!1,f=Dt(e,t,n,a,o);return{...a,_lazyPromises:f,shouldLoad:c,shouldRevalidateArgs:l,shouldCallHandler(e){return d=!0,l?typeof u==`boolean`?ht(a,{...l,defaultShouldRevalidate:u}):typeof e==`boolean`?ht(a,{...l,defaultShouldRevalidate:e}):ht(a,l):c},resolve(e){let{lazy:t,loader:o,middleware:l}=a.route,u=d||c||e&&!X(n.method)&&(t||o),p=l&&l.length>0&&!o&&!t;return u&&(X(n.method)||!p)?jt({request:n,path:r,pattern:i,match:a,lazyHandlerPromise:f?.handler,lazyRoutePromise:f?.route,handlerOverride:e,scopedContext:s}):Promise.resolve({type:`data`,result:void 0})}}}function kt(e,t,n,r,i,a,o,s,c=null){return i.map(l=>l.route.id===a.route.id?Ot(e,t,n,r,Ce(i),l,o,s,!0,c):{...l,shouldLoad:!1,shouldRevalidateArgs:c,shouldCallHandler:()=>!1,_lazyPromises:Dt(e,t,n,l,o),resolve:()=>Promise.resolve({type:`data`,result:void 0})})}async function At(e,t,n,r,i,a,o,s,c=null){r.some(e=>e._lazyPromises?.middleware)&&await Promise.all(r.map(e=>e._lazyPromises?.middleware));let l={request:t,url:we(t,n),pattern:Ce(r),params:r[0].params,context:o,matches:r,unstable_initiator:a,unstable_navigationType:a===`navigation`?c:null},u=s?()=>{throw Error("You cannot call `runClientMiddleware()` from a static handler `dataStrategy`. Middleware is run outside of `dataStrategy` during SSR in order to bubble up the Response. You can enable middleware via the `respond` API in `query`/`queryRoute`")}:e=>{let t=l;return wt(t,()=>e({...t,fetcherKey:i,runClientMiddleware:()=>{throw Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))},d=await e({...l,fetcherKey:i,runClientMiddleware:u});try{await Promise.all(r.flatMap(e=>[e._lazyPromises?.handler,e._lazyPromises?.route]))}catch{}return d}async function jt({request:e,path:t,pattern:n,match:r,lazyHandlerPromise:i,lazyRoutePromise:a,handlerOverride:o,scopedContext:s}){let c,l,u=X(e.method),d=u?`action`:`loader`,f=i=>{let a,c=new Promise((e,t)=>a=t);l=()=>a(),e.signal.addEventListener(`abort`,l);let u=a=>typeof i==`function`?i({request:e,url:we(e,t),pattern:n,params:r.params,context:s},...a===void 0?[]:[a]):Promise.reject(Error(`You cannot call the handler for a route which defines a boolean "${d}" [routeId: ${r.route.id}]`)),f=(async()=>{try{return{type:`data`,result:await(o?o(e=>u(e)):u())}}catch(e){return{type:`error`,result:e}}})();return Promise.race([f,c])};try{let t=u?r.route.action:r.route.loader;if(i||a){if(t){let e,[n]=await Promise.all([f(t).catch(t=>{e=t}),i,a]);if(e!==void 0)throw e;c=n}else{await i;let t=u?r.route.action:r.route.loader;if(t)[c]=await Promise.all([f(t),a]);else if(d===`action`){let t=new URL(e.url),n=t.pathname+t.search;throw J(405,{method:e.method,pathname:n,routeId:r.route.id})}else return await a,{type:`data`,result:void 0}}}else if(t)c=await f(t);else{let t=new URL(e.url);throw J(404,{pathname:t.pathname+t.search})}}catch(e){return{type:`error`,result:e}}finally{l&&e.signal.removeEventListener(`abort`,l)}return c}async function Mt(e){let t=e.headers.get(`Content-Type`);return t&&/\bapplication\/json\b/.test(t)?e.body==null?null:e.json():e.text()}async function Nt(e){let{result:t,type:n}=e;if(nn(t)){let e;try{e=await Mt(t)}catch(e){return{type:`error`,error:e}}return n===`error`?{type:`error`,error:new xe(t.status,t.statusText,e),statusCode:t.status,headers:t.headers}:{type:`data`,data:e,statusCode:t.status,headers:t.headers}}return n===`error`?tn(t)?t.data instanceof Error?{type:`error`,error:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`error`,error:Xt(t),statusCode:Se(t)?t.status:void 0,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`error`,error:t,statusCode:Se(t)?t.status:void 0}:tn(t)?{type:`data`,data:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`data`,data:t}}function Pt(e,t,n,r,i){let a=e.headers.get(`Location`);if(c(a,`Redirects returned/thrown from loaders/actions must have a Location header`),!ue(a)){let o=r.slice(0,r.findIndex(e=>e.route.id===n)+1);a=ct(new URL(t.url),o,i,a),e.headers.set(`Location`,a)}return e}var Ft=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function It(e){try{return Ft.includes(new URL(e).protocol)}catch{return!1}}function Lt(e,t,n,a){if(ue(e)){let a=e,o=r.test(a)?new URL(i(a,t.protocol)):new URL(a);if(It(o.toString()))throw Error(`Invalid redirect location`);let s=H(o.pathname,n)!=null;if(o.origin===t.origin&&s)return ge(o.pathname)+o.search+o.hash}try{if(It(a.createURL(e).toString()))throw Error(`Invalid redirect location`)}catch{}return e}function Rt(e,t,n,r){let i=e.createURL(Jt(t)).toString(),a={signal:n};if(r&&X(r.formMethod)){let{formMethod:e,formEncType:t}=r;a.method=e.toUpperCase(),t===`application/json`?(a.headers=new Headers({"Content-Type":t}),a.body=JSON.stringify(r.json)):a.body=t===`text/plain`?r.text:t===`application/x-www-form-urlencoded`&&r.formData?zt(r.formData):r.formData}return new Request(i,a)}function zt(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r==`string`?r:r.name);return t}function Bt(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function Vt(e,t,n,r=!1,i=!1){let a={},o=null,s,l=!1,u={},d=n&&Y(n[1])?n[1].error:void 0;return e.forEach(n=>{if(!(n.route.id in t))return;let f=n.route.id,p=t[f];if(c(!en(p),`Cannot handle redirect results in processLoaderData`),Y(p)){let t=p.error;if(d!==void 0&&(t=d,d=void 0),o||={},i)o[f]=t;else{let n=Gt(e,f);o[n.route.id]??(o[n.route.id]=t)}r||(a[f]=nt),l||(l=!0,s=Se(p.error)?p.error.status:500),p.headers&&(u[f]=p.headers)}else a[f]=p.data,p.statusCode&&p.statusCode!==200&&!l&&(s=p.statusCode),p.headers&&(u[f]=p.headers)}),d!==void 0&&n&&(o={[n[0]]:d},n[2]&&(a[n[2]]=void 0)),{loaderData:a,errors:o,statusCode:s||200,loaderHeaders:u}}function Ht(e,t,n,r,i,a,o){let{loaderData:s,errors:l}=Vt(t,n,r);return i.filter(e=>!e.matches||e.matches.some(e=>e.shouldLoad)).forEach(t=>{let{key:n,routeId:r,controller:i}=t;if(i&&i.signal.aborted)return;let s=a[n];if(c(s,`Did not find corresponding fetcher result`),Y(s)){let t=Gt(e.matches,r);l&&l[t.route.id]||(l={...l,[t.route.id]:s.error}),o.delete(n)}else if(en(s))c(!1,`Unhandled fetcher revalidation redirect`);else{let e=Z(s.data);o.set(n,e)}}),{loaderData:s,errors:l}}function Ut(e,t,n,r){let i=Object.entries(t).filter(([,e])=>e!==nt).reduce((e,[t,n])=>(e[t]=n,e),{}),a=0;for(let o of n){let n=o.route.id;if(!t.hasOwnProperty(n)&&e.hasOwnProperty(n)&&o.route.loader&&(i[n]=e[n],a++),r&&r.hasOwnProperty(n))break}return Object.keys(t).length===0&&a===Object.keys(e).length?e:i}function Wt(e){return e?Y(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function Gt(e,t){return(t?e.slice(0,e.findIndex(e=>e.route.id===t)+1):[...e]).reverse().find(e=>e.route.ErrorBoundary!=null||e.route.errorElement!=null)||e[0]}function Kt(e){let t=e.length===1?e[0]:e.find(e=>e.index||!e.path||e.path===`/`)||{id:`__shim-error-route__`};return{matches:[{params:{},pathname:``,pathnameBase:``,route:t}],route:t}}function J(e,{pathname:t,routeId:n,method:r,type:i,message:a}={}){let o=`Unknown Server Error`,s=`Unknown @remix-run/router error`;return e===400?(o=`Bad Request`,r&&t&&n?s=`You made a ${r} request to "${t}" but did not provide a \`loader\` for route "${n}", so there is no way to handle the request.`:i===`invalid-body`&&(s=`Unable to encode submission body`)):e===403?(o=`Forbidden`,s=`Route "${n}" does not match URL "${t}"`):e===404?(o=`Not Found`,s=`No route matches URL "${t}"`):e===405&&(o=`Method Not Allowed`,r&&t&&n?s=`You made a ${r.toUpperCase()} request to "${t}" but did not provide an \`action\` for route "${n}", so there is no way to handle the request.`:r&&(s=`Invalid request method "${r.toUpperCase()}"`)),new xe(e||500,o,Error(s),!0)}function qt(e){let t=Object.entries(e);for(let e=t.length-1;e>=0;e--){let[n,r]=t[e];if(en(r))return{key:n,result:r}}}function Jt(e){return p({...typeof e==`string`?m(e):e,hash:``})}function Yt(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===``?t.hash!==``:e.hash===t.hash||t.hash!==``}function Xt(e){return new xe(e.init?.status??500,e.init?.statusText??`Internal Server Error`,e.data)}function Zt(e){return typeof e==`object`&&!!e&&Object.entries(e).every(([e,t])=>typeof e==`string`&&Qt(t))}function Qt(e){return typeof e==`object`&&!!e&&`type`in e&&`result`in e&&(e.type===`data`||e.type===`error`)}function $t(e){return nn(e.result)&&Xe.has(e.result.status)}function Y(e){return e.type===`error`}function en(e){return(e&&e.type)===`redirect`}function tn(e){return typeof e==`object`&&!!e&&`type`in e&&`data`in e&&`init`in e&&e.type===`DataWithResponseInit`}function nn(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.headers==`object`&&e.body!==void 0}function rn(e){return Xe.has(e)}function an(e){return nn(e)&&rn(e.status)&&e.headers.has(`Location`)}function on(e){return Ye.has(e.toUpperCase())}function X(e){return qe.has(e.toUpperCase())}function sn(e){return new URLSearchParams(e).getAll(`index`).some(e=>e===``)}function cn(e,t){let n=typeof t==`string`?m(t).search:t.search;if(e[e.length-1].route.index&&sn(n||``))return e[e.length-1];let r=U(e);return r[r.length-1]}function ln(e,t,n){return{url:we(e.createURL(t),t),pattern:n?Ce(n):``,params:n?.[0]?.params?{...n[0].params}:{}}}function un(e){let{formMethod:t,formAction:n,formEncType:r,text:i,formData:a,json:o}=e;if(t&&n&&r){if(i!=null)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:i};if(a!=null)return{formMethod:t,formAction:n,formEncType:r,formData:a,json:void 0,text:void 0};if(o!==void 0)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:o,text:void 0}}}function dn(e,t,n,r){return r?{state:`loading`,location:e,matches:t,historyAction:n,formMethod:r.formMethod,formAction:r.formAction,formEncType:r.formEncType,formData:r.formData,json:r.json,text:r.text}:{state:`loading`,location:e,matches:t,historyAction:n,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function fn(e,t,n,r){return{state:`submitting`,location:e,matches:t,historyAction:n,formMethod:r.formMethod,formAction:r.formAction,formEncType:r.formEncType,formData:r.formData,json:r.json,text:r.text}}function pn(e,t){return e?{state:`loading`,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:`loading`,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function mn(e,t){return{state:`submitting`,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function Z(e){return{state:`idle`,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function hn(e,t){try{let n=e.sessionStorage.getItem(tt);if(n){let e=JSON.parse(n);for(let[n,r]of Object.entries(e||{}))r&&Array.isArray(r)&&t.set(n,new Set(r||[]))}}catch{}}function gn(e,t){if(t.size>0){let n={};for(let[e,r]of t)n[e]=[...r];try{e.sessionStorage.setItem(tt,JSON.stringify(n))}catch(e){l(!1,`Failed to save applied view transitions in sessionStorage (${e}).`)}}}function _n(){let e,t,n=new Promise((r,i)=>{e=async e=>{r(e);try{await n}catch{}},t=async e=>{i(e);try{await n}catch{}}});return{promise:n,resolve:e,reject:t}}var vn=_.createContext(null);vn.displayName=`DataRouter`;var yn=_.createContext(null);yn.displayName=`DataRouterState`;var bn=_.createContext(null);bn.displayName=`DataRouterData`;var xn=_.createContext(null);xn.displayName=`DataRouterNavigation`;var Sn=_.createContext(!1);function Cn(){return _.useContext(Sn)}var wn=_.createContext({isTransitioning:!1});wn.displayName=`ViewTransition`;var Tn=_.createContext(null);Tn.displayName=`Fetchers`;var En=_.createContext(null);En.displayName=`Await`;var Q=_.createContext(null);Q.displayName=`Navigation`;var Dn=_.createContext(null);Dn.displayName=`Location`;var On=_.createContext({outlet:null,matches:[],isDataRoute:!1});On.displayName=`Route`;var kn=_.createContext(!1);kn.displayName=`IsDataRoute`;var An=_.createContext(void 0);An.displayName=`RouteId`;var jn=_.createContext(null);jn.displayName=`RouteError`;var Mn=`REACT_ROUTER_ERROR`,Nn=`REDIRECT`,Pn=`ROUTE_ERROR_RESPONSE`;function Fn(e){if(e.startsWith(`${Mn}:${Nn}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function In(e){if(e.startsWith(`${Mn}:${Pn}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new xe(t.status,t.statusText,t.data)}catch{}}function Ln(e,{relative:t}={}){c(Rn(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=_.useContext(Q),{hash:i,pathname:a,search:o}=Kn(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:W([n,a])),r.createHref({pathname:s,search:o,hash:i})}function Rn(){return _.useContext(Dn)!=null}function $(){return c(Rn(),`useLocation() may be used only in the context of a <Router> component.`),_.useContext(Dn).location}var zn=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function Bn(){return _.useContext(kn)?ur():Vn()}function Vn(){c(Rn(),`useNavigate() may be used only in the context of a <Router> component.`);let e=_.useContext(vn),{basename:t,navigator:n}=_.useContext(Q),{matches:r}=_.useContext(On),{pathname:i}=$(),a=JSON.stringify(me(r)),o=_.useRef(!1);return _.useLayoutEffect(()=>{o.current=!0}),_.useCallback((r,s={})=>{if(l(o.current,zn),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=he(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:W([t,c.pathname])),Ge(typeof r==`string`?r:p(r),n.createHref(c),He(n),`reject`),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}var Hn=_.createContext(null);function Un(){return _.useContext(Hn)}function Wn(e){let t=_.useContext(On).outlet;return _.useMemo(()=>t&&_.createElement(Hn.Provider,{value:e},t),[t,e])}function Gn(){let{matches:e}=_.useContext(On);return e[e.length-1]?.params??{}}function Kn(e,{relative:t}={}){let{matches:n}=_.useContext(On),{pathname:r}=$(),i=JSON.stringify(me(n));return _.useMemo(()=>he(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function qn(e,t,n){c(Rn(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=_.useContext(Q),{matches:i}=_.useContext(On),a=i[i.length-1],o=a?a.params:{};a&&a.pathname;let s=a?a.pathnameBase:`/`;a&&a.route;let l=$(),u;if(t){let e=typeof t==`string`?m(t):t;c(s===`/`||e.pathname?.startsWith(s),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${s}" but pathname "${e.pathname}" was given in the \`location\` prop.`),u=e}else u=l;let d=u.pathname||`/`,f=d;if(s!==`/`){let e=s.replace(/^\//,``).split(`/`);f=`/`+d.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let p;p=n?n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):n.router.match(n.state.location):O(e,{pathname:f});let h=er(p&&p.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:W([s,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?s:W([s,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?_.createElement(Dn.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...u},navigationType:`POP`}},h):h}function Jn(){let e=sr(),t=Se(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null;return _.createElement(_.Fragment,null,_.createElement(`h2`,null,`Unexpected Application Error!`),_.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?_.createElement(`pre`,{style:{padding:`0.5rem`,backgroundColor:`rgba(200,200,200, 0.5)`}},n):null,null)}var Yn=_.createElement(Jn,null),Xn=class extends _.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static contextType=Sn;static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=In(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:_.createElement(On.Provider,{value:this.props.routeContext},_.createElement(kn.Provider,{value:this.props.routeContext.isDataRoute},_.createElement(An.Provider,{value:this.props.routeContext.matches[this.props.routeContext.matches.length-1]?.route.id},_.createElement(jn.Provider,{value:e,children:this.props.component}))));return this.context?_.createElement(Qn,{error:e},t):t}},Zn=new WeakMap;function Qn({children:e,error:t}){let{basename:n,navigator:r}=_.useContext(Q);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Fn(t.digest);if(e){let i=Zn.get(t);if(i)throw i;let a=Ee(e.location,n),o=a.absoluteURL||a.to;if(Ge(e.location,o,He(r),`allow-explicit`),It(o))throw Error(`Invalid redirect location`);if(Te&&!Zn.get(t)){if(a.isExternal||e.reloadDocument)window.location.href=o;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:e.replace}));throw Zn.set(t,n),n}}return _.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${o}`})}}return e}function $n({routeContext:e,match:t,children:n}){let r=_.useContext(vn);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),_.createElement(On.Provider,{value:e},_.createElement(kn.Provider,{value:e.isDataRoute},_.createElement(An.Provider,{value:t.route.id},n)))}function er(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);c(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let l=n?.onError,u=r&&l?(e,t)=>{l(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:Ce(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let l,d=!1,f=null,p=null;r&&(l=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||Yn,o&&(s<0&&c===0?(fr(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=l?f:d?p:n.route.Component?_.createElement(n.route.Component,null):n.route.element?n.route.element:e,_.createElement($n,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?_.createElement(Xn,{location:r.location,revalidation:r.revalidation,component:f,error:l,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:u}):h()},null)}function tr(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function nr(e){let t=_.useContext(vn);return c(t,tr(e)),t}function rr(e){let t=_.useContext(yn);return c(t,tr(e)),t}function ir(e){let t=_.useContext(bn);return c(t,tr(e)),t}function ar(e){let t=_.useContext(An);return c(t,`${e} can only be used on routes that contain a unique "id"`),t}function or(){let{matches:e}=rr(`useMatches`),{loaderData:t}=ir(`useMatches`);return _.useMemo(()=>e.map(e=>k(e,t)),[e,t])}function sr(){let e=_.useContext(jn),t=ir(`useRouteError`),n=ar(`useRouteError`);return e===void 0?t.errors?.[n]:e}var cr=0;function lr(e){let{router:t,basename:n}=nr(`useBlocker`),r=rr(`useBlocker`),[i,a]=_.useState(``),o=_.useCallback(t=>{if(typeof e!=`function`)return!!e;if(n===`/`)return e(t);let{currentLocation:r,nextLocation:i,historyAction:a}=t;return e({currentLocation:{...r,pathname:H(r.pathname,n)||r.pathname},nextLocation:{...i,pathname:H(i.pathname,n)||i.pathname},historyAction:a})},[n,e]);return _.useEffect(()=>{let e=String(++cr);return a(e),()=>t.deleteBlocker(e)},[t]),_.useEffect(()=>{i!==``&&t.getBlocker(i,o)},[t,i,o]),i&&r.blockers.has(i)?r.blockers.get(i):et}function ur(){let{router:e}=nr(`useNavigate`),t=ar(`useNavigate`),n=_.useRef(!1);return _.useLayoutEffect(()=>{n.current=!0}),_.useCallback(async(r,i={})=>{l(n.current,zn),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var dr={};function fr(e,t,n){!t&&!dr[e]&&(dr[e]=!0,l(!1,n))}function pr(e,t){if(e===!1||e==null)throw Error(t)}function mr(e,t,n){let r=typeof e==`string`?new URL(e,n??(typeof window>`u`?`server://singlefetch/`:window.location.origin)):new URL(e);return n&&r.origin!==n&&(r=new URL(r.pathname+r.search+r.hash,n)),r.pathname.endsWith(`/`)?r.pathname=`${r.pathname}_.${t}`:r.pathname=`${r.pathname}.${t}`,r}async function hr(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function gr(e){return e!=null&&typeof e.page==`string`}function _r(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function vr(e,t,n){return Cr((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await hr(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(_r).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function yr(e,t,n,r,i,a){let o=(e,t)=>!n[t]||e.route.id!==n[t].route.id,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function br(e,t,{includeHydrateFallback:n}={}){return xr(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function xr(e){return[...new Set(e)]}function Sr(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Cr(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!gr(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(Sr(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}var wr={};function Tr(e,t){!e&&!wr[t]&&(wr[t]=!0,console.warn(t))}var Er=_.createContext(void 0);Er.displayName=`FrameworkContext`;function Dr(){let e=_.useContext(Er);return pr(e,`You must render this element inside a <HydratedRouter> element`),e}function Or(e,t){let n=_.useContext(Er),[r,i]=_.useState(!1),[a,o]=_.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=_.useRef(null);_.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),_.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:kr(s,p),onBlur:kr(c,m),onMouseEnter:kr(l,p),onMouseLeave:kr(u,m),onTouchStart:kr(d,p)}]:[a,f,{}]:[!1,f,{}]}function kr(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Ar({page:e,...t}){let n=Cn(),{nonce:r}=Dr(),{router:i}=nr(`PrefetchPageLinks`),a=_.useMemo(()=>i.match(e),[i,i.routes,e]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?_.createElement(Mr,{page:e,matches:a,...t}):_.createElement(Nr,{page:e,matches:a,...t})):null}function jr(e){let{manifest:t,routeModules:n}=Dr(),[r,i]=_.useState([]);return _.useEffect(()=>{let r=!1;return vr(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function Mr({page:e,matches:t,...n}){let r=$(),{unstable_apiServerOrigin:i}=Dr(),a=_.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=mr(e,`rsc`,i),a=!1,o=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?a=!0:o.push(e.route.id);return a&&o.length>0&&n.searchParams.set(`_routes`,o.join(`,`)),[i?n.toString():n.pathname+n.search]},[e,r,t,i]);return _.createElement(_.Fragment,null,a.map(e=>_.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function Nr({page:e,matches:t,...n}){let r=$(),{manifest:i,routeModules:a,unstable_apiServerOrigin:o}=Dr(),{matches:s}=rr(`PrefetchPageLinks`),{loaderData:c}=ir(`PrefetchPageLinks`),l=_.useMemo(()=>yr(e,t,s,i,r,`data`),[e,t,s,i,r]),u=_.useMemo(()=>yr(e,t,s,i,r,`assets`),[e,t,s,i,r]),d=_.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,s=!1;if(t.forEach(e=>{let t=i.routes[e.route.id];t&&t.hasLoader&&(!l.some(t=>t.route.id===e.route.id)&&e.route.id in c&&a[e.route.id]?.shouldRevalidate||t.hasClientLoader?s=!0:n.add(e.route.id))}),n.size===0)return[];let u=mr(e,`data`,o);return s&&n.size>0&&u.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[o?u.toString():u.pathname+u.search]},[c,r,i,l,t,e,a,o]),f=_.useMemo(()=>br(u,i),[u,i]),p=jr(u);return _.createElement(_.Fragment,null,d.map(e=>_.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),f.map(e=>_.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),p.map(({key:e,link:t})=>_.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function Pr(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}var Fr=[`HydrateFallback`,`hydrateFallbackElement`],Ir=class{status=`pending`;promise;resolve;reject;constructor(){this.promise=new Promise((e,t)=>{this.resolve=t=>{this.status===`pending`&&(this.status=`resolved`,e(t))},this.reject=e=>{this.status===`pending`&&(this.status=`rejected`,t(e))}})}};function Lr(e,t){e.ready.catch(e=>{if(!(t.visibilityState===`hidden`||typeof e==`object`&&e&&`name`in e&&e.name===`AbortError`))throw e})}function Rr({router:e,flushSync:t,onError:n,useTransitions:r}){r=Cn()||r;let[i,a]=_.useState(e.state),[o,s]=(0,_.useOptimistic)(i),c=_.useRef(o),[l,u]=_.useState(),[d,f]=_.useState({isTransitioning:!1}),[p,m]=_.useState(),[h,g]=_.useState(),[v,y]=_.useState(),b=_.useRef(new Map),x=_.useRef(new WeakSet),S=_.useCallback((i,{deletedFetchers:o,newErrors:l,flushSync:d,viewTransitionOpts:v})=>{c.current=i,l&&i.errors&&at.has(i.errors)&&(x.current.has(i.errors)?l=null:x.current.add(i.errors)),l&&n&&Object.values(l).forEach(e=>n(e,{location:i.location,params:i.matches[0]?.params??{},pattern:Ce(i.matches)})),i.fetchers.forEach((e,t)=>{e.data!==void 0&&b.current.set(t,e.data)}),o.forEach(e=>b.current.delete(e)),Tr(d===!1||t!=null,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let S=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition==`function`;if(Tr(v==null||S,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!v||!S)t&&d?t(()=>a(i)):r===!1?a(i):_.startTransition(()=>{r===!0&&s(e=>zr(e,i)),a(i)});else if(t&&d){t(()=>{h&&(p?.resolve(),h.skipTransition()),f({isTransitioning:!0,flushSync:!0,currentLocation:v.currentLocation,nextLocation:v.nextLocation})});let n=e.window.document.startViewTransition(()=>{t(()=>a(i))});Lr(n,e.window.document),n.finished.finally(()=>{t(()=>{m(void 0),g(void 0),u(void 0),f({isTransitioning:!1})})}),t(()=>g(n))}else h?(p?.resolve(),h.skipTransition(),y({state:i,currentLocation:v.currentLocation,nextLocation:v.nextLocation})):(u(i),f({isTransitioning:!0,flushSync:!1,currentLocation:v.currentLocation,nextLocation:v.nextLocation}))},[e.window,t,h,p,r,s,n]);_.useLayoutEffect(()=>e.subscribe(S),[e,S]),_.useLayoutEffect(()=>{let t=e.state.errors,n=t?at.get(t):null;(c.current!==e.state||t&&n&&!x.current.has(t))&&S(e.state,{deletedFetchers:[],flushSync:!1,newErrors:n??null})},[e,S]),_.useEffect(()=>{d.isTransitioning&&!d.flushSync&&m(new Ir)},[d]),_.useEffect(()=>{if(p&&l&&e.window){let t=l,n=p.promise,i=e.window.document.startViewTransition(async()=>{r===!1?a(t):_.startTransition(()=>{r===!0&&s(e=>zr(e,t)),a(t)}),await n});Lr(i,e.window.document),i.finished.finally(()=>{m(void 0),g(void 0),u(void 0),f({isTransitioning:!1})}),g(i)}},[l,p,e.window,r,s]),_.useEffect(()=>{p&&l&&o.location.key===l.location.key&&p.resolve()},[p,h,o.location,l]),_.useEffect(()=>{!d.isTransitioning&&v&&(u(v.state),f({isTransitioning:!0,flushSync:!1,currentLocation:v.currentLocation,nextLocation:v.nextLocation}),y(void 0))},[d.isTransitioning,v]);let C=_.useMemo(()=>({createHref:e.createHref,createURL:e.createURL,encodeLocation:e.encodeLocation,go:t=>e.navigate(t),push:(t,n,r)=>e.navigate(t,{state:n,preventScrollReset:r?.preventScrollReset}),replace:(t,n,r)=>e.navigate(t,{replace:!0,state:n,preventScrollReset:r?.preventScrollReset})}),[e]),w=e.basename||`/`,T=_.useMemo(()=>({router:e,navigator:C,static:!1,basename:w,onError:n}),[e,C,w,n]),E=_.useMemo(()=>({historyAction:o.historyAction,location:o.location,matches:o.matches,initialized:o.initialized,renderFallback:o.renderFallback,restoreScrollPosition:o.restoreScrollPosition,preventScrollReset:o.preventScrollReset,blockers:o.blockers}),[o.historyAction,o.location,o.matches,o.initialized,o.renderFallback,o.restoreScrollPosition,o.preventScrollReset,o.blockers]),D=_.useMemo(()=>({navigation:o.navigation,revalidation:o.revalidation}),[o.navigation,o.revalidation]),O=_.useMemo(()=>({loaderData:o.loaderData,actionData:o.actionData,errors:o.errors}),[o.loaderData,o.actionData,o.errors]),ee=_.useMemo(()=>({fetchers:o.fetchers,fetcherData:b.current}),[o.fetchers]);return _.createElement(_.Fragment,null,_.createElement(vn.Provider,{value:T},_.createElement(yn.Provider,{value:E},_.createElement(xn.Provider,{value:D},_.createElement(bn.Provider,{value:O},_.createElement(Tn.Provider,{value:ee},_.createElement(wn.Provider,{value:d},_.createElement(Wr,{basename:w,location:o.location,navigationType:o.historyAction,navigator:C,useTransitions:r},_.createElement(Br,{routes:e.routes,manifest:e.manifest,state:o,isStatic:!1,onError:n})))))))),null)}function zr(e,t){return{...e,navigation:t.navigation.state===`idle`?e.navigation:t.navigation,revalidation:t.revalidation===`idle`?e.revalidation:t.revalidation,actionData:t.navigation.state===`submitting`?e.actionData:t.actionData,fetchers:t.fetchers}}var Br=_.memo(Vr);function Vr({routes:e,manifest:t,state:n,isStatic:r,onError:i}){let a=_.useContext(vn);c(a,`You must render this element inside a <DataRouterContext.Provider> element`);let o=_.useContext(Er)?.routeDiscoveryRuntime;return _.useEffect(()=>{n.initialized&&o?.markReady()},[n.initialized,o]),qn(e,void 0,{router:a.router,manifest:t,state:n,isStatic:r,onError:i})}function Hr({to:e,replace:t,state:n,relative:r}){c(Rn(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i,navigator:a}=_.useContext(Q);l(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:o}=_.useContext(On),{pathname:s}=$(),u=Bn(),d=he(e,me(o),s,r===`path`);Ge(typeof e==`string`?e:p(e),a.createHref(d),He(a),`reject`);let f=JSON.stringify(d);return _.useEffect(()=>{u(JSON.parse(f),{replace:t,state:n,relative:r})},[u,f,r,t,n]),null}function Ur(e){return Wn(e.context)}function Wr({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){c(!Rn(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),u=_.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=m(n));let{pathname:d=`/`,search:f=``,hash:p=``,state:h=null,key:g=`default`,mask:v}=n,y=_.useMemo(()=>{let e=H(d,s);return e==null?null:{location:{pathname:e,search:f,hash:p,state:h,key:g,mask:v},navigationType:r}},[s,d,f,p,h,g,r,v]);return l(y!=null,`<Router basename="${s}"> is not able to match the URL "${d}${f}${p}" because it does not start with the basename, so the <Router> won't render anything.`),y==null?null:_.createElement(Q.Provider,{value:u},_.createElement(Dn.Provider,{children:t,value:y}))}_.Component;var Gr=`application/x-www-form-urlencoded`;function Kr(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function qr(e){return Kr(e)&&e.tagName.toLowerCase()===`button`}function Jr(e){return Kr(e)&&e.tagName.toLowerCase()===`form`}function Yr(e){return Kr(e)&&e.tagName.toLowerCase()===`input`}function Xr(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Zr(e,t){return e.button===0&&(!t||t===`_self`)&&!Xr(e)}function Qr(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function $r(e,t){let n=Qr(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var ei=null;function ti(){if(ei===null)try{new FormData(document.createElement(`form`),0),ei=!1}catch{ei=!0}return ei}var ni=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function ri(e){return e!=null&&!ni.has(e)?(l(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Gr}"`),null):e}function ii(e,t){let n,r,i,a,o;if(Jr(e)){let o=e.getAttribute(`action`);r=o?H(o,t):null,n=e.getAttribute(`method`)||`get`,i=ri(e.getAttribute(`enctype`))||Gr,a=new FormData(e)}else if(qr(e)||Yr(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?H(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||`get`,i=ri(e.getAttribute(`formenctype`))||ri(o.getAttribute(`enctype`))||Gr,a=new FormData(o,e),!ti()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(Kr(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=`get`,r=null,i=Gr,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}var ai=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{ai&&(window.__reactRouterVersion=`8`)}catch{}function oi(e,t){return ot({basename:t?.basename,getContext:t?.getContext,future:t?.future,history:s({window:t?.window}),hydrationData:t?.hydrationData||si(),routes:e,mapRouteProperties:T,hydrationRouteProperties:Fr,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window,instrumentations:t?.instrumentations}).initialize()}function si(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:ci(e.errors)}),e}function ci(e){if(!e)return null;let t=Object.entries(e),n={};for(let[e,r]of t)if(r&&r.__type===`RouteErrorResponse`)n[e]=new xe(r.status,r.statusText,r.data,r.internal===!0);else if(r&&r.__type===`Error`){if(typeof r.__subType==`string`&&be.includes(r.__subType)){let t=window[r.__subType];if(typeof t==`function`)try{let i=new t(r.message);i.stack=``,n[e]=i}catch{}}if(n[e]==null){let t=Error(r.message);t.stack=``,n[e]=t}}else n[e]=r;return n}var li=_.forwardRef(function({onClick:e,discover:t=`render`,prefetch:r=`none`,relative:i,reloadDocument:a,replace:o,mask:s,state:c,target:l,to:u,preventScrollReset:d,viewTransition:f,defaultShouldRevalidate:p,...m},h){let{basename:g,navigator:v,useTransitions:y}=_.useContext(Q),b=typeof u==`string`&&n.test(u),x=Ee(u,g);u=x.to;let S=Ln(u,{relative:i}),C=$(),w=null;if(s){let e=he(s,[],C.mask?C.mask.pathname:`/`,!0);g!==`/`&&(e.pathname=e.pathname===`/`?g:W([g,e.pathname])),w=v.createHref(e)}let[T,E,D]=Or(r,m),O=fi(u,{replace:o,mask:s,state:c,target:l,preventScrollReset:d,relative:i,viewTransition:f,defaultShouldRevalidate:p,useTransitions:y});function ee(t){e&&e(t),t.defaultPrevented||O(t)}let k=!(x.isExternal||a),te=_.createElement(`a`,{...m,...D,href:(k?w:void 0)||x.absoluteURL||S,onClick:k?ee:e,ref:Pr(h,E),target:l,"data-discover":!b&&t===`render`?`true`:void 0});return T&&!b?_.createElement(_.Fragment,null,te,_.createElement(Ar,{page:S})):te});li.displayName=`Link`;var ui=_.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=Kn(a,{relative:c.relative}),d=$(),f=_.useContext(xn),{navigator:p,basename:m}=_.useContext(Q),h=f!=null&&vi(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,v=d.pathname,y=f?.navigation.location?f.navigation.location.pathname:null;t||(v=v.toLowerCase(),y=y?y.toLowerCase():null,g=g.toLowerCase()),y&&m&&(y=H(y,m)||y);let b=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,x=v===g||!r&&v.startsWith(g)&&v.charAt(b)===`/`,S=y!=null&&(y===g||!r&&y.startsWith(g)&&y.charAt(b)===`/`),C={isActive:x,isPending:S,isTransitioning:h},w=x?e:void 0,T;T=typeof n==`function`?n(C):[n,x?`active`:null,S?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let E=typeof i==`function`?i(C):i;return _.createElement(li,{...c,"aria-current":w,className:T,ref:l,style:E,to:a,viewTransition:o},typeof s==`function`?s(C):s)});ui.displayName=`NavLink`;var di=_.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:r,reloadDocument:i,replace:a,state:o,method:s=`get`,action:c,onSubmit:l,relative:u,preventScrollReset:d,viewTransition:f,defaultShouldRevalidate:p,...m},h)=>{let{useTransitions:g}=_.useContext(Q),v=gi(),y=_i(c,{relative:u}),b=s.toLowerCase()===`get`?`get`:`post`,x=typeof c==`string`&&n.test(c);return _.createElement(`form`,{ref:h,method:b,action:y,onSubmit:i?l:e=>{if(l&&l(e),e.defaultPrevented)return;e.preventDefault();let n=e.nativeEvent.submitter,i=n?.getAttribute(`formmethod`)||s,c=()=>v(n||e.currentTarget,{fetcherKey:t,method:i,navigate:r,replace:a,state:o,relative:u,preventScrollReset:d,viewTransition:f,defaultShouldRevalidate:p});g&&r!==!1?_.startTransition(()=>c()):c()},...m,"data-discover":!x&&e===`render`?`true`:void 0})});di.displayName=`Form`;function fi(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=Bn(),d=$(),f=Kn(e,{relative:o});return _.useCallback(m=>{if(Zr(m,t)){m.preventDefault();let t=n===void 0?p(d)===p(f):n,h=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?_.startTransition(()=>h()):h()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}function pi(e){l(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=_.useRef(Qr(e)),n=_.useRef(!1),r=$(),i=_.useMemo(()=>$r(r.search,n.current?null:t.current),[r.search]),a=Bn();return[i,_.useCallback((e,t)=>{let r=Qr(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var mi=0,hi=()=>`__${String(++mi)}__`;function gi(){let{router:e}=nr(`useSubmit`),{basename:t}=_.useContext(Q),n=ar(`useSubmit`),r=e.fetch,i=e.navigate;return _.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=ii(e,t);a.navigate===!1?await r(a.fetcherKey||hi(),n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,relative:a.relative,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync}):await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,relative:a.relative,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function _i(e,{relative:t}={}){let{basename:n}=_.useContext(Q),r=_.useContext(On);c(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...Kn(e||`.`,{relative:t})},o=$();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:W([n,a.pathname])),p(a)}function vi(e,{relative:t}={}){let n=_.useContext(wn);c(n!=null,"`useViewTransitionState` must be used within `react-router/dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=nr(`useViewTransitionState`),i=Kn(e,{relative:t});if(!n.isTransitioning)return!1;let a=H(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=H(n.nextLocation.pathname,r)||n.nextLocation.pathname;return B(i.pathname,o)!=null||B(i.pathname,a)!=null}export{Ur as a,$ as c,Un as d,Gn as f,Hr as i,or as l,oi as n,Rr as o,B as p,pi as r,lr as s,li as t,Bn as u};
|
package/dist/index.html
CHANGED
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
document.documentElement.setAttribute('data-theme', t)
|
|
18
18
|
})()
|
|
19
19
|
</script>
|
|
20
|
-
<script type="module" crossorigin src="/studio/assets/index-
|
|
21
|
-
<link rel="modulepreload" crossorigin href="/studio/assets/rolldown-runtime-
|
|
22
|
-
<link rel="modulepreload" crossorigin href="/studio/assets/vendor-diff-
|
|
23
|
-
<link rel="modulepreload" crossorigin href="/studio/assets/vendor-react-
|
|
24
|
-
<link rel="modulepreload" crossorigin href="/studio/assets/vendor-router-
|
|
25
|
-
<link rel="modulepreload" crossorigin href="/studio/assets/auth-
|
|
26
|
-
<link rel="modulepreload" crossorigin href="/studio/assets/format-
|
|
27
|
-
<link rel="modulepreload" crossorigin href="/studio/assets/createLucideIcon-
|
|
20
|
+
<script type="module" crossorigin src="/studio/assets/index-qiIlvPyv.js"></script>
|
|
21
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/rolldown-runtime-COiEfhsA.js">
|
|
22
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/vendor-diff-DGCTJYJ4.js">
|
|
23
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/vendor-react-CXaWJ_ii.js">
|
|
24
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/vendor-router-B4czwg8X.js">
|
|
25
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/auth-CIpilSKF.js">
|
|
26
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/format-C3ZX9yGM.js">
|
|
27
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/createLucideIcon-BklFHeMd.js">
|
|
28
28
|
<link rel="modulepreload" crossorigin href="/studio/assets/api-client-BRi_ki2Y.js">
|
|
29
29
|
<link rel="stylesheet" crossorigin href="/studio/assets/vendor-react-DLioOiRN.css">
|
|
30
30
|
<link rel="stylesheet" crossorigin href="/studio/assets/createLucideIcon-DO6kYgVn.css">
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@krantho/studio",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Studio, the krantho dashboard for editors: a prebuilt React single-page app that every krantho server serves at /studio.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://krantho.com",
|
|
@@ -29,31 +29,31 @@
|
|
|
29
29
|
"@milkdown/prose": "7.22.3",
|
|
30
30
|
"@milkdown/utils": "7.22.2",
|
|
31
31
|
"@testing-library/jest-dom": "^7.0.1",
|
|
32
|
-
"@testing-library/react": "^16.3.
|
|
33
|
-
"@testing-library/user-event": "^14.6.
|
|
32
|
+
"@testing-library/react": "^16.3.3",
|
|
33
|
+
"@testing-library/user-event": "^14.6.10",
|
|
34
34
|
"@types/dagre": "^0.7.54",
|
|
35
35
|
"@types/node": "^25.9.9",
|
|
36
|
-
"@types/react": "^19.
|
|
37
|
-
"@types/react-dom": "^19.
|
|
38
|
-
"@vitejs/plugin-react": "^6.0
|
|
39
|
-
"@xyflow/react": "^12.
|
|
36
|
+
"@types/react": "^19.3.0",
|
|
37
|
+
"@types/react-dom": "^19.3.0",
|
|
38
|
+
"@vitejs/plugin-react": "^6.3.0",
|
|
39
|
+
"@xyflow/react": "^12.12.1",
|
|
40
40
|
"dagre": "^0.8.5",
|
|
41
41
|
"diff": "^9.0.0",
|
|
42
42
|
"dompurify": "^3.4.17",
|
|
43
43
|
"jsdom": "^29.1.1",
|
|
44
|
-
"lucide-react": "^1.
|
|
45
|
-
"marked": "^18.0
|
|
46
|
-
"react": "^19.
|
|
47
|
-
"react-diff-viewer-continued": "^4.
|
|
48
|
-
"react-dom": "^19.
|
|
44
|
+
"lucide-react": "^1.72.0",
|
|
45
|
+
"marked": "^18.2.0",
|
|
46
|
+
"react": "^19.3.1",
|
|
47
|
+
"react-diff-viewer-continued": "^4.4.0",
|
|
48
|
+
"react-dom": "^19.3.1",
|
|
49
49
|
"react-image-crop": "^11.1.2",
|
|
50
|
-
"react-router": "^8.1
|
|
50
|
+
"react-router": "^8.5.1",
|
|
51
51
|
"typescript": "^6.0.3",
|
|
52
|
-
"vite": "^8.3.
|
|
53
|
-
"vitest": "^4.1.
|
|
54
|
-
"@krantho/ai": "1.0.
|
|
55
|
-
"@krantho/core": "1.0.
|
|
56
|
-
"@krantho/seo-shared": "1.0.
|
|
52
|
+
"vite": "^8.3.8",
|
|
53
|
+
"vitest": "^4.1.12",
|
|
54
|
+
"@krantho/ai": "1.0.1",
|
|
55
|
+
"@krantho/core": "1.0.1",
|
|
56
|
+
"@krantho/seo-shared": "1.0.1"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
59
|
"dev": "vite",
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{a as t,i as n,r,s as i}from"./vendor-diff-Dm2YfgXt.js";import{c as a,p as o,t as s}from"./vendor-router-DjV3D6zM.js";import{i as c,n as l}from"./auth-GRfs02w7.js";import{i as u,n as d,t as f}from"./createLucideIcon-D_HN41p3.js";import{t as p}from"./circle-check-big-zoQrH4Hp.js";import{t as m}from"./circle-x-DMb3ZtiK.js";import{t as h}from"./clock-CzpAlvS3.js";import{t as g}from"./copy-DloNx7rC.js";import{t as _}from"./info-B69U-gXd.js";import{t as v}from"./send-ib_sr-OU.js";import{t as y}from"./triangle-alert-C4yqbtOC.js";import{n as b,t as x}from"./api-client-BRi_ki2Y.js";import{St as ee,Tt as te,bt as ne,d as re,tt as ie}from"./index-DVe5jFLX.js";import{r as ae,t as oe}from"./vendor-markdown-DlwjVoJi.js";var S={name:`lightbulb`,size:24,node:[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]};S.node;var C=f(S),w={name:`loader-circle`,size:24,node:[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]],aliases:[`loader-2`]};w.node;var T=f(w),E={name:`message-square-plus`,size:24,node:[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M12 8v6`,key:`1ib9pf`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}]]};E.node;var se=f(E),D={name:`square`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]};D.node;var ce=f(D);function O(){return{event:``,data:[]}}async function*le(e,t){let n=e.getReader(),r=new TextDecoder,i=()=>{n.cancel().catch(()=>void 0)};t?.addEventListener(`abort`,i,{once:!0});let a=!1,o=``,s=O();try{for(;;){if(k(t))return;let{value:e,done:i}=await n.read();if(k(t))return;o+=i?r.decode():r.decode(e,{stream:!0});for(let e=A(o,i);e!==null;e=A(o,i)){o=e.rest;let t=j(s,e.text);t!==void 0&&(s=O(),t!==null&&(yield t))}if(i)break}a=!0,o!==``&&j(s,o);let e=M(s);e!==null&&(yield e)}finally{t?.removeEventListener(`abort`,i),a||await n.cancel().catch(()=>void 0),n.releaseLock()}}function k(e){return e?.aborted===!0}function A(e,t){let n=e.search(/[\r\n]/);if(n===-1)return null;if(e[n]===`
|
|
2
|
-
`)return{text:e.slice(0,n),rest:e.slice(n+1)};if(n===e.length-1&&!t)return null;let r=e[n+1]===`
|
|
3
|
-
`?2:1;return{text:e.slice(0,n),rest:e.slice(n+r)}}function j(e,t){if(t===``)return M(e);if(t.startsWith(`:`))return;let n=t.indexOf(`:`),r=n===-1?t:t.slice(0,n),i=n===-1?``:t.slice(n+1),a=i.startsWith(` `)?i.slice(1):i;r===`event`?e.event=a:r===`data`?e.data.push(a):r===`id`&&(e.id=a)}function M(e){let t=e.data.join(`
|
|
4
|
-
`);if(t===``)return null;let n={event:e.event===``?`message`:e.event,data:t};return e.id!==void 0&&(n.id=e.id),n}var N=e(i(),1),ue=new Set([`text`,`tool`,`activity`,`usage`,`error`,`done`]);async function P(e){let t={};try{t=await e.json()}catch{}let n=typeof t.error==`string`?t.error:`Request failed: ${e.status}`;return new x(n,e.status,t)}function F(e,t,n){return l(`${b}${e}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t),...n?{signal:n}:{}})}async function de(){let e=await l(`${b}/assistant`);if(!e.ok)throw await P(e);return await e.json()}async function fe(e,t,n){let r=await F(`/assistant/chat`,e,n);if(!r.ok)throw await P(r);if(!r.body)throw new x(`The assistant sent no response`,r.status,{});for await(let e of le(r.body,n))ue.has(e.event)&&t({...JSON.parse(e.data),type:e.event})}async function pe(e){let t=await F(`/assistant/confirm`,{token:e});if(!t.ok)throw await P(t);return await t.json()}var I={entries:[],streaming:!1,pending:{},notes:[],streamId:null,nextId:1};function L(e,t){return e.entries.map(n=>n.kind===`assistant`&&n.id===e.streamId?t(n):n)}function R(e,t,n){let r={kind:`error`,id:`e${e.nextId}`,code:t,message:n};return{...e,entries:[...e.entries,r],nextId:e.nextId+1}}function z(e,t){let n=L(e,e=>({...e,tools:e.tools.filter(e=>e.id!==t.id),activities:[...e.activities,t]})),r=t.pending;return r?{...e,entries:n,pending:{...e.pending,[r.token]:{view:r,phase:`open`}}}:{...e,entries:n}}function B(e,t){switch(t.type){case`text`:return{...e,entries:L(e,e=>({...e,text:e.text+t.text}))};case`tool`:{let n={id:t.id,tool:t.tool,label:t.label};return{...e,entries:L(e,e=>({...e,tools:[...e.tools,n]}))}}case`activity`:return z(e,t.activity);case`error`:return R(e,t.code,t.message);case`done`:return V(e);default:return e}}function V(e){if(e.streamId===null)return e;let t=e.entries.flatMap(t=>t.kind!==`assistant`||t.id!==e.streamId?[t]:t.text===``&&t.activities.length===0?[]:[{...t,streaming:!1,tools:[]}]);return{...e,entries:t,streaming:!1,streamId:null}}function H(e,t){return e.streamId===`a${t}`}function U(e,t,n,r,i){let a=e.pending[t];return a?{...e,pending:{...e.pending,[t]:{...a,phase:n,result:r}},notes:i===null?e.notes:[...e.notes,i]}:e}function me(e,t,n){return t?`Confirmed: ${e} — ${n}`:`Confirmation failed: ${e} — ${n}`}function he(e,t){switch(t.type){case`send`:{let n={kind:`user`,id:`u${t.seq}`,text:t.text,notes:e.notes},r=`a${t.seq}`,i={kind:`assistant`,id:r,text:``,streaming:!0,tools:[],activities:[]},a=[...e.entries,n,i];return{...e,entries:a,streaming:!0,streamId:r,notes:[]}}case`event`:return H(e,t.seq)?B(e,t.event):e;case`fail`:return H(e,t.seq)?R(e,t.code,t.message):e;case`finish`:return H(e,t.seq)?V(e):e;case`confirming`:return U(e,t.token,`confirming`,void 0,null);case`resolved`:{let n=me(e.pending[t.token]?.view.title??``,t.ok,t.message),r=t.ok?`done`:`failed`;return U(e,t.token,r,t.message,n)}case`cancel`:{let n=e.pending[t.token];return n?.phase===`open`?U(e,t.token,`cancelled`,void 0,`Cancelled: ${n.view.title}`):e}case`reset`:return{...I,nextId:e.nextId}}}function W(e,t){return e.length===0?t:`${e.join(`
|
|
5
|
-
`)}\n\n${t}`}function ge(e){if(e.kind===`user`)return{role:`user`,content:W(e.notes,e.text)};if(e.kind!==`assistant`)return null;let t=e.activities.map(e=>`[${e.summary}]`).join(`
|
|
6
|
-
`),n=[e.text.trim(),t].filter(e=>e!==``).join(`
|
|
7
|
-
|
|
8
|
-
`);return n===``?null:{role:`assistant`,content:n}}function _e(e,t,n,r){let i=e.flatMap(e=>ge(e)??[]);i.push({role:`user`,content:W(n,t)});let a=[],o=0;for(let e=i.length-1;e>=0;e--){let t=i[e];if(!t||a.length>=r.maxHistoryMessages||a.length>0&&o+t.content.length>r.maxInputChars)break;a.unshift(t),o+=t.content.length}for(;a.length>1&&a[0]?.role!==`user`;)a.shift();return a}function ve(e,t){let n=new URLSearchParams(t).get(`locale`)??void 0,r=o(`/layout/:slug`,e);if(r?.params.slug)return{collection:ee,slug:r.params.slug,locale:n};let i=o(`/site/:collection/:slug`,e),a=i?.params.collection,s=i?.params.slug;if(a&&s)return{collection:a,slug:s,locale:n}}var G=`krantho.assistant.provider`;function ye(){try{return localStorage.getItem(G)}catch{return null}}function be(e){try{localStorage.setItem(G,e)}catch{}}function K(e,t){if(e.phase!==`ready`||!e.status.configured)return null;let{providers:n}=e.status;return n.some(e=>e.provider===t)?t:null}function q(e){return e instanceof x?{code:typeof e.body.code==`string`?e.body.code:`http_${e.status}`,message:e.message}:{code:`network`,message:e instanceof Error?e.message:`Request failed`}}function xe(){let[e,t]=(0,N.useState)({phase:`loading`});return(0,N.useEffect)(()=>{let e=!0;return de().then(n=>e&&t({phase:`ready`,status:n})).catch(n=>e&&t({phase:`failed`,message:q(n).message})),()=>{e=!1}},[]),e}function Se(){let[e,t]=(0,N.useReducer)(he,I),n=xe(),[r,i]=(0,N.useState)(ye),o=K(n,r),s=a(),c=(0,N.useRef)(e),l=(0,N.useRef)(null),u=(0,N.useRef)(0);(0,N.useEffect)(()=>{c.current=e},[e]),(0,N.useEffect)(()=>()=>l.current?.abort(),[]);let d=(0,N.useMemo)(()=>ve(s.pathname,s.search),[s.pathname,s.search]),f=n.phase===`ready`&&n.status.configured?n.status.limits:null,p=(0,N.useCallback)(e=>{let n=c.current,r=e.trim();if(!f||l.current||r===``)return;let i=_e(n.entries,r,n.notes,f),a=++u.current;t({type:`send`,text:r,seq:a});let s=new AbortController;l.current=s;let p=e=>t({type:`event`,seq:a,event:e});fe({messages:i,...d?{context:d}:{},...o?{provider:o}:{}},p,s.signal).catch(e=>{s.signal.aborted||t({type:`fail`,seq:a,...q(e)})}).finally(()=>{l.current===s&&(l.current=null),t({type:`finish`,seq:a})})},[f,d,o]),m=(0,N.useCallback)(()=>l.current?.abort(),[]),h=(0,N.useCallback)(async e=>{if(c.current.pending[e]?.phase!==`open`)return!1;t({type:`confirming`,token:e});try{let n=await pe(e),r=n.results.map(e=>e.message).join(`; `)||`Done`;return t({type:`resolved`,token:e,ok:n.ok,message:r}),n.ok}catch(n){return t({type:`resolved`,token:e,ok:!1,message:q(n).message}),!1}},[]),g=(0,N.useCallback)(async e=>{for(let t of e)if(!await h(t))return},[h]),_=(0,N.useCallback)(e=>t({type:`cancel`,token:e}),[]),v=(0,N.useCallback)(()=>{l.current?.abort(),l.current=null,t({type:`reset`})},[]);return{status:n,picked:o,pick:(0,N.useCallback)(e=>{be(e),i(e)},[]),entries:e.entries,streaming:e.streaming,pending:e.pending,send:p,stop:m,confirm:h,confirmAll:g,cancel:_,reset:v}}var J=t();function Ce({title:e,message:t,confirmLabel:n=`Confirm`,cancelLabel:r=`Cancel`,onConfirm:i,onCancel:a}){let o=(0,N.useRef)(null);return(0,J.jsx)(re,{title:e,onClose:a,actions:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(d,{ref:o,onClick:a,children:r}),(0,J.jsx)(d,{variant:`danger`,onClick:i,children:n})]}),initialFocus:o,children:(0,J.jsx)(`p`,{children:t})})}function we({disabled:e,streaming:t,onSend:n,onStop:r,inputRef:i}){let[a,o]=(0,N.useState)(``),s=!e&&!t&&a.trim()!==``,c=()=>{s&&(n(a),o(``))};return(0,J.jsxs)(`form`,{className:`assistant-composer`,onSubmit:e=>{e.preventDefault(),c()},children:[(0,J.jsx)(`label`,{htmlFor:`assistant-input`,className:`assistant-sr-only`,children:`Ask the assistant`}),(0,J.jsx)(`textarea`,{id:`assistant-input`,ref:i,className:`assistant-input`,rows:3,placeholder:`Ask the assistant`,value:a,disabled:e,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key!==`Enter`||e.shiftKey||e.nativeEvent.isComposing||(e.preventDefault(),c())}}),t?(0,J.jsxs)(`button`,{type:`button`,className:u(`secondary`,`md`,`assistant-send`),onClick:r,children:[(0,J.jsx)(ce,{"aria-hidden":`true`}),`Stop`]}):(0,J.jsxs)(`button`,{type:`submit`,className:u(`primary`,`md`,`assistant-send`),disabled:!s,children:[(0,J.jsx)(v,{"aria-hidden":`true`}),`Send`]})]})}var Te=[`img`,`picture`,`video`,`audio`,`iframe`,`object`,`embed`,`form`,`input`,`style`];function Ee(e){return e.replaceAll(`&`,`&`).replaceAll(`<`,`<`).replaceAll(`>`,`>`).replaceAll(`"`,`"`)}var De=new oe({gfm:!0,async:!1,renderer:{html:({text:e})=>Ee(e)}}),Y=null;function Oe(e){if(e.tagName!==`A`)return;let t=e.getAttribute(`href`);if(t===null)return;let n;try{n=new URL(t,window.location.href)}catch{e.removeAttribute(`href`);return}if(n.protocol!==`http:`&&n.protocol!==`https:`){e.removeAttribute(`href`);return}n.origin!==window.location.origin&&(e.setAttribute(`rel`,`noopener noreferrer`),e.setAttribute(`target`,`_blank`))}function ke(){return Y||(Y=ae(window),Y.addHook(`afterSanitizeAttributes`,Oe),Y)}function Ae(e){let t=De.parse(e);return ke().sanitize(t,{FORBID_TAGS:Te,FORBID_ATTR:[`style`]})}function X({parts:e}){return(0,J.jsx)(J.Fragment,{children:e.map((e,t)=>{let n=`${t}-${e.added?`a`:e.removed?`r`:`c`}`;return e.added?(0,J.jsxs)(`ins`,{className:`assistant-diff-added`,children:[(0,J.jsx)(`span`,{className:`assistant-sr-only`,children:`added: `}),e.value]},n):e.removed?(0,J.jsxs)(`del`,{className:`assistant-diff-removed`,children:[(0,J.jsx)(`span`,{className:`assistant-sr-only`,children:`removed: `}),e.value]},n):(0,J.jsx)(`span`,{children:e.value},n)})})}function Z(e){return e==null||e===``}function Q(e){return typeof e==`string`?e:JSON.stringify(e,null,2)}function je(e){let{before:t,after:r}=e;if((typeof t==`string`||Z(t))&&typeof r==`string`)return n(Z(t)?``:t,r);let i=[];return Z(t)||i.push({value:Q(t),removed:!0}),Z(r)||i.push({value:Q(r),added:!0}),i}function $({change:e}){let{ref:t}=e,n=e.baseVersion===0?`new document`:`from v${e.baseVersion}`;return(0,J.jsxs)(`div`,{className:`assistant-change`,children:[(0,J.jsxs)(`p`,{className:`assistant-change-heading`,children:[t.collection,`/`,t.slug,` `,(0,J.jsxs)(`span`,{className:`assistant-muted`,children:[`(`,t.locale,`, `,n,`)`]})]}),(0,J.jsxs)(`dl`,{className:`assistant-change-list`,children:[e.status&&(0,J.jsxs)(`div`,{className:`assistant-change-row`,children:[(0,J.jsx)(`dt`,{children:`status`}),(0,J.jsxs)(`dd`,{children:[e.status.before,` → `,e.status.after]})]}),e.fields.map(e=>(0,J.jsxs)(`div`,{className:`assistant-change-row`,children:[(0,J.jsx)(`dt`,{children:e.name}),(0,J.jsx)(`dd`,{className:`assistant-change-value`,children:(0,J.jsx)(X,{parts:je(e)})})]},e.name)),e.body&&(0,J.jsxs)(`div`,{className:`assistant-change-row`,children:[(0,J.jsx)(`dt`,{children:`body`}),(0,J.jsx)(`dd`,{children:(0,J.jsx)(`pre`,{className:`assistant-change-body`,children:(0,J.jsx)(X,{parts:r(e.body.before,e.body.after)})})})]})]})]})}function Me(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}function Ne({entry:e}){return e.phase===`done`?(0,J.jsxs)(`p`,{className:`assistant-pending-outcome assistant-outcome-done`,children:[(0,J.jsx)(p,{"aria-hidden":`true`}),` `,e.result]}):e.phase===`failed`?(0,J.jsxs)(`p`,{className:`assistant-pending-outcome assistant-outcome-failed`,children:[(0,J.jsx)(m,{"aria-hidden":`true`}),` `,e.result]}):e.phase===`cancelled`?(0,J.jsx)(`p`,{className:`assistant-pending-outcome assistant-muted`,children:`Cancelled`}):null}function Pe({entry:e,changes:t,onConfirm:n,onCancel:r}){let{view:i,phase:a}=e,o=a===`open`||a===`confirming`,s=a===`confirming`,c=u(i.destructive?`danger`:`primary`,`sm`);return(0,J.jsxs)(`div`,{className:`assistant-pending`,children:[(0,J.jsxs)(`p`,{className:`assistant-pending-label`,children:[(0,J.jsx)(h,{"aria-hidden":`true`}),o?`Needs your confirmation`:`Proposal`]}),(0,J.jsx)(`p`,{className:`assistant-pending-title`,children:i.title}),t.length>0&&(0,J.jsxs)(`details`,{className:`assistant-details`,open:!0,children:[(0,J.jsx)(`summary`,{children:`Changes`}),t.map(e=>(0,J.jsx)($,{change:e},`${e.ref.collection}/${e.ref.slug}@${e.ref.locale}`))]}),o?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`p`,{className:`assistant-muted`,children:[`Expires at `,Me(i.expiresAt)]}),(0,J.jsxs)(`div`,{className:`assistant-pending-actions`,children:[(0,J.jsx)(`button`,{type:`button`,className:c,disabled:s,onClick:()=>n(i.token),children:s?`Confirming…`:i.confirmLabel}),(0,J.jsx)(`button`,{type:`button`,className:u(`secondary`,`sm`),disabled:s,onClick:()=>r(i.token),children:`Cancel`})]})]}):(0,J.jsx)(Ne,{entry:e})]})}var Fe={done:{icon:p,label:`Done`},failed:{icon:m,label:`Failed`},pending:{icon:h,label:`Waiting for confirmation`},proposed:{icon:C,label:`Proposed`}},Ie={error:{icon:m,label:`Error`},warning:{icon:y,label:`Warning`},info:{icon:_,label:`Info`}};function Le({findings:e}){return(0,J.jsx)(`ul`,{className:`assistant-findings`,children:e.map((e,t)=>{let{icon:n,label:r}=Ie[e.severity];return(0,J.jsxs)(`li`,{className:`assistant-finding assistant-finding-${e.severity}`,children:[(0,J.jsx)(n,{role:`img`,"aria-label":r}),(0,J.jsx)(`span`,{children:e.message})]},`${e.check}-${e.property??``}-${t}`)})})}function Re({label:e,text:t}){let[n,r]=(0,N.useState)(!1);return(0,J.jsxs)(`div`,{className:`assistant-proposal-item`,children:[(0,J.jsxs)(`div`,{className:`assistant-proposal-head`,children:[(0,J.jsx)(`span`,{className:`assistant-proposal-label`,children:e}),(0,J.jsxs)(`button`,{type:`button`,className:`assistant-icon-btn`,onClick:()=>{navigator.clipboard?.writeText(t).then(()=>r(!0)).catch(()=>r(!1))},children:[(0,J.jsx)(g,{"aria-hidden":`true`}),n?`Copied`:`Copy`]})]}),(0,J.jsx)(`pre`,{className:`assistant-proposal-text`,children:t})]})}function ze({activity:e,pending:t,onConfirm:n,onCancel:r}){let{icon:i,label:a}=Fe[e.status],o=e.changes??[];return(0,J.jsxs)(`li`,{className:`assistant-activity assistant-activity-${e.status}`,children:[(0,J.jsxs)(`p`,{className:`assistant-activity-summary`,children:[(0,J.jsx)(i,{role:`img`,"aria-label":a}),(0,J.jsx)(`span`,{children:e.summary})]}),e.documents.length>0&&(0,J.jsx)(`ul`,{className:`assistant-activity-docs`,children:e.documents.map(e=>(0,J.jsxs)(`li`,{children:[(0,J.jsxs)(s,{to:te(e.collection,e.slug,e.locale),children:[e.collection,`/`,e.slug]}),e.version!==void 0&&(0,J.jsxs)(`span`,{className:`assistant-muted`,children:[` v`,e.version]})]},`${e.collection}/${e.slug}@${e.locale}`))}),t?(0,J.jsx)(Pe,{entry:t,changes:o,onConfirm:n,onCancel:r}):o.length>0&&(0,J.jsxs)(`details`,{className:`assistant-details`,children:[(0,J.jsx)(`summary`,{children:`Show changes`}),o.map(e=>(0,J.jsx)($,{change:e},`${e.ref.collection}/${e.ref.slug}@${e.ref.locale}`))]}),e.findings&&e.findings.length>0&&(0,J.jsx)(Le,{findings:e.findings}),e.proposal&&(0,J.jsxs)(`div`,{className:`assistant-proposal`,children:[(0,J.jsx)(`p`,{className:`assistant-proposal-title`,children:e.proposal.title}),e.proposal.items.map((e,t)=>(0,J.jsx)(Re,{label:e.label,text:e.text},`${e.label}-${t}`))]})]})}var Be=new Set([`tools_unsupported`,`llm_unconfigured`,`llm_credential_missing`]);function Ve(e){let[t,n]=(0,N.useState)(e),r=(0,N.useRef)(e),i=(0,N.useRef)(null);return(0,N.useEffect)(()=>{r.current=e,i.current===null&&(i.current=requestAnimationFrame(()=>{i.current=null,n(r.current)}))},[e]),(0,N.useEffect)(()=>()=>{i.current!==null&&cancelAnimationFrame(i.current)},[]),t}function He({entry:e,pending:t,onConfirm:n,onConfirmAll:r,onCancel:i}){let a=Ve(e.text),o=e.streaming?a:e.text,s=(0,N.useMemo)(()=>Ae(o),[o]),c=e.activities.flatMap(e=>{let n=e.pending?.token;return n&&t[n]?.phase===`open`?[n]:[]});return(0,J.jsxs)(`div`,{className:`assistant-entry assistant-entry-assistant`,"aria-busy":e.streaming,children:[(0,J.jsx)(`span`,{className:`assistant-sr-only`,children:`Assistant:`}),s!==``&&(0,J.jsx)(`div`,{className:`assistant-markdown`,dangerouslySetInnerHTML:{__html:s}}),(e.tools.length>0||e.activities.length>0)&&(0,J.jsxs)(`ul`,{className:`assistant-activities`,children:[e.activities.map(e=>(0,J.jsx)(ze,{activity:e,pending:e.pending?t[e.pending.token]:void 0,onConfirm:n,onCancel:i},e.id)),e.tools.map(e=>(0,J.jsx)(`li`,{className:`assistant-activity assistant-activity-running`,children:(0,J.jsxs)(`p`,{className:`assistant-activity-summary`,children:[(0,J.jsx)(T,{className:`assistant-spinner`,role:`img`,"aria-label":`Running`}),(0,J.jsx)(`span`,{children:e.label})]})},e.id))]}),c.length>1&&(0,J.jsx)(`button`,{type:`button`,className:u(`primary`,`sm`),onClick:()=>r(c),children:`Confirm all`}),e.streaming&&e.tools.length===0&&o===``&&(0,J.jsxs)(`p`,{className:`assistant-muted`,children:[(0,J.jsx)(T,{className:`assistant-spinner`,"aria-hidden":`true`}),` Thinking…`]})]})}function Ue({entry:e,canOpenSettings:t,...n}){return e.kind===`user`?(0,J.jsxs)(`div`,{className:`assistant-entry assistant-entry-user`,children:[(0,J.jsx)(`span`,{className:`assistant-sr-only`,children:`You:`}),(0,J.jsx)(`p`,{children:e.text})]}):e.kind===`error`?(0,J.jsxs)(`div`,{className:`assistant-entry assistant-entry-error`,role:`alert`,children:[(0,J.jsx)(`p`,{children:e.message}),t&&Be.has(e.code)&&(0,J.jsx)(s,{to:`/setup/ai`,children:`Open Setup › AI provider`})]}):(0,J.jsx)(He,{entry:e,...n})}var We=48;function Ge(e,t){if(e.phase===`loading`)return`Connecting…`;if(e.phase!==`ready`||!e.status.configured)return`Not available`;let{provider:n,model:r,providers:i}=e.status,a=t??n,o=i.find(e=>e.provider===a)?.label??a;return a===n?i.length>1?r:`${o} · ${r}`:o}function Ke({status:e,picked:t,onPick:n}){if(e.phase!==`ready`||!e.status.configured)return null;let{providers:r,provider:i}=e.status;return r.length<2?null:(0,J.jsx)(`select`,{className:`assistant-picker`,"aria-label":`AI used by the assistant`,value:t??i,onChange:e=>n(e.target.value),children:r.map(e=>(0,J.jsx)(`option`,{value:e.provider,children:e.label},e.provider))})}function qe({status:e,canOpenSettings:t}){return e.phase===`loading`?null:e.phase===`failed`?(0,J.jsx)(`div`,{className:`assistant-entry assistant-entry-error`,role:`alert`,children:(0,J.jsx)(`p`,{children:e.message})}):e.status.configured?null:(0,J.jsxs)(`div`,{className:`assistant-entry assistant-entry-error`,role:`alert`,children:[(0,J.jsx)(`p`,{children:e.status.error}),t&&(0,J.jsx)(s,{to:`/setup/ai`,children:`Open Setup › AI provider`})]})}function Je({status:e,picked:t,onPick:n,canReset:r,onReset:i,onClose:a}){return(0,J.jsxs)(`header`,{className:`assistant-header`,children:[(0,J.jsxs)(`div`,{className:`assistant-header-text`,children:[(0,J.jsx)(`h2`,{className:`assistant-title`,children:`Assistant`}),(0,J.jsxs)(`div`,{className:`assistant-ai-row`,children:[(0,J.jsx)(Ke,{status:e,picked:t,onPick:n}),(0,J.jsx)(`p`,{className:`assistant-muted assistant-model`,children:Ge(e,t)})]})]}),(0,J.jsxs)(`button`,{type:`button`,className:`assistant-icon-btn`,onClick:i,disabled:!r,children:[(0,J.jsx)(se,{"aria-hidden":`true`}),`New conversation`]}),(0,J.jsx)(`button`,{type:`button`,className:`assistant-icon-btn`,"aria-label":`Close assistant`,onClick:a,children:(0,J.jsx)(ie,{"aria-hidden":`true`})})]})}function Ye(e){let t=(0,N.useRef)(null),n=(0,N.useRef)(!0),r=(0,N.useCallback)(()=>{let e=t.current;e&&(n.current=e.scrollHeight-e.scrollTop-e.clientHeight<We)},[]);return(0,N.useEffect)(()=>{let e=t.current;e&&n.current&&(e.scrollTop=e.scrollHeight)},[e]),{logRef:t,onScroll:r}}function Xe(){let e=ne(),t=Se(),{hasRole:n}=c(),r=(0,N.useRef)(null),[i,a]=(0,N.useState)(!1),{logRef:o,onScroll:s}=Ye(t.entries),l=e?.open??!1,u=t.status.phase===`ready`&&t.status.status.configured;if((0,N.useEffect)(()=>{l&&u&&r.current?.focus()},[l,u]),!e)return null;let d=n(`admin`),f=Object.values(t.pending).some(e=>e.phase===`open`);return(0,J.jsxs)(`aside`,{id:`assistant-panel`,className:`assistant-panel`,"aria-label":`Assistant`,hidden:!l,onKeyDown:t=>{t.key===`Escape`&&(t.stopPropagation(),a(!1),e.close())},children:[(0,J.jsx)(Je,{status:t.status,picked:t.picked,onPick:t.pick,canReset:t.entries.length>0,onReset:()=>{t.streaming||f?a(!0):t.reset()},onClose:e.close}),(0,J.jsxs)(`div`,{ref:o,className:`assistant-log`,role:`log`,"aria-live":`polite`,"aria-relevant":`additions`,onScroll:s,children:[(0,J.jsx)(qe,{status:t.status,canOpenSettings:d}),t.entries.length===0&&u&&(0,J.jsx)(`p`,{className:`assistant-muted assistant-intro`,children:`Ask for content, SEO or AEO work. What the assistant writes is saved as a draft; publishing, deleting and replacing text wait for your confirmation here.`}),t.entries.map(e=>(0,J.jsx)(Ue,{entry:e,pending:t.pending,canOpenSettings:d,onConfirm:e=>void t.confirm(e),onConfirmAll:e=>void t.confirmAll(e),onCancel:t.cancel},e.id))]}),(0,J.jsx)(we,{disabled:!u,streaming:t.streaming,onSend:t.send,onStop:t.stop,inputRef:r}),i&&(0,J.jsx)(Ce,{title:`Start a new conversation?`,message:`The current reply stops and proposals waiting for confirmation are dropped.`,confirmLabel:`Start over`,onConfirm:()=>{a(!1),t.reset()},onCancel:()=>a(!1)})]})}export{Xe as AssistantPanel};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GraphCanvas-Bq75rYgC.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/vendor-diff-Dm2YfgXt.js","assets/vendor-react-DMqGe90A.js","assets/vendor-react-DLioOiRN.css","assets/graph-config-ZUe9BjGK.js","assets/createLucideIcon-D_HN41p3.js","assets/createLucideIcon-DO6kYgVn.css","assets/use-loaded-C3hBdQe0.js","assets/index-DVe5jFLX.js","assets/vendor-router-DjV3D6zM.js","assets/auth-GRfs02w7.js","assets/format-pPdsDgeS.js","assets/api-client-BRi_ki2Y.js","assets/index-Buq8auz3.css","assets/copy-DloNx7rC.js","assets/corner-down-right-D2cWjQTP.js","assets/findability-CUYOthYI.js","assets/layers-BQ89qo5R.js","assets/guards-BFEDbduR.js","assets/graph-config-mZyX0Lqo.css","assets/vendor-reactflow-5Qvgw90M.js","assets/GraphCanvas-C_Wsk21g.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{a as t,o as n,s as r}from"./vendor-diff-Dm2YfgXt.js";import{t as i}from"./createLucideIcon-D_HN41p3.js";import{C as a,S as o,T as s,_ as c,b as l,d as u,f as d,g as f,h as p,m,p as h,v as g,x as _,y as v}from"./graph-config-ZUe9BjGK.js";import{n as y}from"./use-loaded-C3hBdQe0.js";import{t as b}from"./circle-check-big-zoQrH4Hp.js";import{t as x}from"./circle-x-DMb3ZtiK.js";import{a as S,i as C,n as w,r as T,t as E}from"./export-helpers-B2KV_EB5.js";import{t as D}from"./external-link-BRKJTCZG.js";import{t as ee}from"./save-kXwhieDK.js";import{t as O}from"./trash-Cknp3eZ5.js";import{t as k}from"./triangle-alert-C4yqbtOC.js";import{t as A}from"./upload-BvBYjswd.js";import{$ as j,mt as M,ot as N,pt as P,st as F,tt as I}from"./index-DVe5jFLX.js";import{n as te}from"./catalog-offer-CeRRk2Zo.js";var L={name:`arrow-up-right`,size:24,node:[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]};L.node;var R=i(L),z={name:`git-branch`,size:24,node:[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]};z.node;var B=i(z),V={name:`minus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]};V.node;var H=i(V),U={name:`undo-2`,size:24,node:[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]};U.node;var ne=i(U),W=e(r(),1);function G(){return{overrides:new Map,removed:new Map,added:new Map,deleted:new Set}}function re(e){return e.overrides.size>0||e.removed.size>0||e.added.size>0||e.deleted.size>0}function ie(e,t,n,r){let i=e.overrides.get(t)??{},a=new Map(e.overrides);a.set(t,{...i,[n]:r});let o=e.removed.get(t);if(o?.has(n)){let r=new Map(e.removed),i=new Set(o);return i.delete(n),i.size===0?r.delete(t):r.set(t,i),{...e,overrides:a,removed:r}}return{...e,overrides:a}}function ae(e,t,n){let r=e.removed.get(t),i=new Map(e.removed);i.set(t,new Set([...r??[],n]));let a=e.overrides.get(t);if(a&&n in a){let r=new Map(e.overrides),{[n]:o,...s}=a;return Object.keys(s).length===0?r.delete(t):r.set(t,s),{...e,overrides:r,removed:i}}return{...e,removed:i}}function oe(e,t){let n=ue(t),r=new Map(e.added);if(r.set(n,t),e.deleted.has(n)){let t=new Set(e.deleted);return t.delete(n),{...e,added:r,deleted:t}}return{...e,added:r}}function se(e,t){if(e.added.has(t)){let n=new Map(e.added);return n.delete(t),{...e,added:n}}let n=new Set(e.deleted);n.add(t);let r=new Map(e.overrides);r.delete(t);let i=new Map(e.removed);return i.delete(t),{...e,overrides:r,removed:i,deleted:n}}function ce(e,t){if(!re(t))return e;let n=[];for(let r of e.nodes){let e=J(r);if(t.deleted.has(e))continue;let i=t.overrides.get(e),a=t.removed.get(e);if(!i&&!a){n.push(r);continue}let o={};for(let[e,t]of Object.entries(r))a?.has(e)||(o[e]=t);if(i){let e=i[`@type`];typeof e==`string`&&(o[`@type`]=e);for(let[e,t]of Object.entries(i))e!==`@type`&&(o[e]=t)}n.push(o)}let r=0;for(let e of t.added.values()){let t={"@type":e[`@type`],...e.properties,_ek:`added:${r++}`};e[`@id`]&&(t[`@id`]=e[`@id`]),n.push(t)}let i=h(n),a=new Map;for(let e of n){let t=e[`@id`];typeof t==`string`&&a.set(t,e)}return{nodes:n,byEk:i,byId:a,referencedBy:p(n),primary:e.primary?a.get(e.primary[`@id`]??``)??null:null}}function le(e,t,n){let r=new Map;for(let[e,t]of n)r.set(t,e);let i=[];for(let n=0;n<t.entities.length;n++){let a=t.entities[n],o=r.get(n);if(o&&e.deleted.has(o))continue;let s=o?e.overrides.get(o):void 0,c=o?e.removed.get(o):void 0;if(!s&&!c){i.push({...a,properties:K(a.properties)});continue}let l={};for(let[e,t]of Object.entries(a.properties))c?.has(e)||(l[e]=t);if(s)for(let[e,t]of Object.entries(s))e!==`@type`&&(l[e]=t);let u=s?.[`@type`];i.push({"@type":typeof u==`string`?u:a[`@type`],...a[`@id`]?{"@id":a[`@id`]}:{},...a.role?{role:a.role}:{},properties:K(l)})}for(let t of e.added.values())i.push({...t,properties:K(t.properties)});return{...t,entities:i}}function K(e){let t={};for(let[n,r]of Object.entries(e))t[n]=q(r);return t}function q(e){if(typeof e!=`object`||!e)return e;if(Array.isArray(e))return e.map(q);let t=e;if(`@type`in t){let e={};for(let[n,r]of Object.entries(t))n!==`@id`&&(e[n]=q(r));return e}return e}function ue(e){return e[`@id`]?e[`@id`]:e.role?`${e[`@type`]}:${e.role}`:e[`@type`]}function J(e){let t=e._ek;if(typeof t==`string`)return t;let n=typeof e[`@type`]==`string`?e[`@type`]:Array.isArray(e[`@type`])?e[`@type`][0]:null;return typeof n==`string`?n:`unknown`}var Y=t();function de({catalogTypes:e,onAdd:t}){let[n,r]=(0,W.useState)(!1),[i,a]=(0,W.useState)(``),o=(0,W.useCallback)(e=>{e?.focus()},[]);if(!n)return(0,Y.jsxs)(`button`,{type:`button`,className:`graph-add-entity-btn`,onClick:()=>r(!0),children:[(0,Y.jsx)(N,{size:14}),` Add entity`]});let s=fe(e,i);return(0,Y.jsxs)(`div`,{className:`graph-add-entity-picker`,children:[(0,Y.jsxs)(`div`,{className:`graph-add-entity-header`,children:[(0,Y.jsx)(`input`,{type:`text`,className:`graph-input graph-input--text graph-add-entity-search`,value:i,onChange:e=>a(e.target.value),placeholder:`Search types…`,ref:o}),(0,Y.jsx)(`button`,{type:`button`,className:`graph-add-entity-close`,onClick:()=>{r(!1),a(``)},"aria-label":`Close picker`,children:(0,Y.jsx)(I,{size:16})})]}),(0,Y.jsxs)(`div`,{className:`graph-add-entity-list`,children:[s.length===0&&(0,Y.jsx)(`p`,{className:`graph-add-entity-empty`,children:`No matching types.`}),s.map(e=>(0,Y.jsxs)(`div`,{className:`graph-add-entity-group`,children:[(0,Y.jsx)(`div`,{className:`graph-add-entity-category`,children:e.label}),e.types.map(e=>(0,Y.jsxs)(`button`,{type:`button`,className:`graph-add-entity-type`,onClick:()=>{t(e.type),r(!1),a(``)},children:[(0,Y.jsx)(`span`,{className:`graph-add-entity-type-name`,children:e.type}),(0,Y.jsx)(`span`,{className:`graph-add-entity-type-desc`,children:e.label}),e.richResult&&(0,Y.jsx)(`span`,{className:`graph-add-entity-rich-badge`,children:`Rich result`}),e.lifecycle?.status===`pending`&&(0,Y.jsx)(`span`,{className:`graph-add-entity-rich-badge`,children:`pending`})]},e.type))]},e.category))]})]})}function fe(e,t){let n=e.filter(e=>te(e,!1)),r=t?n.filter(e=>e.type.toLowerCase().includes(t.toLowerCase())||e.label.toLowerCase().includes(t.toLowerCase())):n,i=new Map;for(let e of[`business`,`content`,`commerce`,`people`,`navigation`,`reviews`])i.set(e,{category:e,label:d[e],types:[]});for(let e of r){let t=e.category,n=i.get(t);n&&n.types.push(e)}return[...i.values()].filter(e=>e.types.length>0)}function X({category:e}){return e===null?null:(0,Y.jsx)(`span`,{className:`graph-category-badge graph-category-${e}`,children:d[e]})}function Z({node:e,category:t,classifications:n,selected:r,focused:i,onSelect:o,onToggleExpanded:s,expanded:c}){let l=a(e[`@type`])??`Unknown`,u=e[`@id`],d=Q(e),{requiredSet:f,requiredTotal:p}=g(n);return(0,Y.jsxs)(`div`,{className:[`graph-entity-header`,r?`graph-entity-header--selected`:``,i?`graph-focused`:``].filter(Boolean).join(` `),children:[(0,Y.jsx)(`button`,{type:`button`,className:`graph-entity-expand-button`,onClick:e=>{e.stopPropagation(),s()},"aria-expanded":c,"aria-label":c?`Collapse entity`:`Expand entity`,children:(0,Y.jsx)(`span`,{className:`graph-entity-chevron ${c?`graph-entity-chevron--open`:``}`,children:`▸`})}),(0,Y.jsxs)(`button`,{type:`button`,className:`graph-entity-header-main`,onClick:o,children:[(0,Y.jsxs)(`div`,{className:`graph-entity-header-row`,children:[(0,Y.jsx)(`span`,{className:`graph-entity-type`,children:l}),d&&(0,Y.jsx)(`span`,{className:`graph-entity-name`,children:d}),(0,Y.jsx)(X,{category:t})]}),(0,Y.jsxs)(`div`,{className:`graph-entity-header-meta`,children:[u&&(0,Y.jsx)(`span`,{className:`graph-entity-id`,children:u}),p>0&&(0,Y.jsxs)(`span`,{className:`graph-entity-eligibility ${f===p?`graph-entity-eligibility--complete`:`graph-entity-eligibility--incomplete`}`,title:`${f} of ${p} required properties set`,children:[f,`/`,p,` required`]})]})]})]})}function Q(e){for(let t of[`name`,`headline`,`title`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n}return null}function pe({value:e,onChange:t,label:n,placeholder:r}){let i=[...e],a=()=>{t([...i,``])},o=(e,n)=>{let r=[...i];r[e]=n,t(r)},s=e=>{t(i.filter((t,n)=>n!==e))};return(0,Y.jsxs)(`div`,{className:`graph-input graph-input--array`,role:`group`,"aria-label":n,children:[i.map((e,t)=>(0,Y.jsxs)(`div`,{className:`graph-input-array-item`,children:[(0,Y.jsx)(`input`,{type:`text`,className:`graph-input graph-input--text`,value:e,onChange:e=>o(t,e.target.value),placeholder:r}),(0,Y.jsx)(`button`,{type:`button`,className:`graph-input-array-remove`,onClick:()=>s(t),"aria-label":`Remove item`,children:(0,Y.jsx)(I,{size:14})})]},t)),(0,Y.jsxs)(`button`,{type:`button`,className:`graph-input-array-add`,onClick:a,children:[(0,Y.jsx)(N,{size:14}),` Add item`]})]})}function me({value:e,onChange:t,label:n}){return(0,Y.jsx)(`input`,{type:`date`,className:`graph-input graph-input--date`,value:e,onChange:e=>t(e.target.value),"aria-label":n})}function he({value:e,onChange:t,label:n,min:r,max:i}){return(0,Y.jsx)(`input`,{type:`number`,className:`graph-input graph-input--number`,value:e,onChange:e=>{let n=e.target.value;t(n===``?``:Number(n))},"aria-label":n,min:r,max:i})}function ge({value:e,onChange:t,label:n}){let r=(0,W.useId)(),i=(n,r,i)=>{t(e.map((e,t)=>t===n?{...e,[r]:i}:e))},a=n=>{t(e.filter((e,t)=>t!==n))},o=()=>{let n={},r=e[0];if(r)for(let[t,i]of Object.entries(r))t===`@type`?n[`@type`]=i:n[t]=typeof i==`number`?Math.max(...e.map(e=>Number(e[t])||0))+1:``;t([...e,n])},s=new Set;for(let t of e)for(let e of Object.keys(t))e!==`@type`&&s.add(e);let c=[...s];return(0,Y.jsxs)(`div`,{className:`graph-input graph-input--object-array`,role:`group`,"aria-label":n,children:[e.map((e,t)=>(0,Y.jsxs)(`div`,{className:`graph-object-array-item`,children:[(0,Y.jsxs)(`span`,{className:`graph-object-array-item-index`,children:[t+1,`.`]}),(0,Y.jsx)(`div`,{className:`graph-object-array-item-fields`,children:c.map(n=>{let a=e[n],o=`${r}-${t}-${n}`;return(0,Y.jsxs)(`div`,{className:`graph-object-array-field`,children:[(0,Y.jsx)(`label`,{htmlFor:o,className:`graph-object-array-field-label`,children:n}),typeof a==`string`||typeof a==`number`||a===void 0?(0,Y.jsx)(`input`,{id:o,type:`text`,className:`graph-input graph-input--text`,value:a===void 0?``:String(a),onChange:e=>{let r=typeof a==`number`&&Number(e.target.value)||e.target.value;i(t,n,r)},placeholder:n}):(0,Y.jsx)(`span`,{id:o,className:`graph-property-value-object`,children:JSON.stringify(a).slice(0,60)})]},n)})}),(0,Y.jsx)(`button`,{type:`button`,className:`graph-object-array-item-remove`,onClick:()=>a(t),"aria-label":`Remove item ${t+1}`,children:(0,Y.jsx)(O,{size:12})})]},t)),(0,Y.jsxs)(`button`,{type:`button`,className:`graph-input-array-add`,onClick:o,children:[(0,Y.jsx)(N,{size:14}),` Add item`]})]})}function _e({value:e,onChange:t,options:n,label:r}){return(0,Y.jsxs)(`select`,{className:`graph-input graph-input--select`,value:e,onChange:e=>t(e.target.value),"aria-label":r,children:[(0,Y.jsx)(`option`,{value:``,children:`Select…`}),n.map(e=>(0,Y.jsx)(`option`,{value:e,children:e},e))]})}function ve({value:e,onChange:t,placeholder:n,label:r}){return(0,Y.jsx)(`textarea`,{className:`graph-input graph-input--textarea`,value:e,onChange:e=>t(e.target.value),placeholder:n,"aria-label":r,rows:3})}function ye({value:e,onChange:t,placeholder:n,label:r}){return(0,Y.jsx)(`input`,{type:`text`,className:`graph-input graph-input--text`,value:e,onChange:e=>t(e.target.value),placeholder:n,"aria-label":r})}function be({value:e,onChange:t,placeholder:n,label:r}){let[i,a]=(0,W.useState)(!1),o=e===``||xe(e);return(0,Y.jsx)(`input`,{type:`url`,className:`graph-input graph-input--url ${i&&!o?`graph-input--invalid`:``}`,value:e,onChange:e=>t(e.target.value),onBlur:()=>a(!0),placeholder:n??`https://`,"aria-label":r,"aria-invalid":i&&!o})}function xe(e){try{return new URL(e),!0}catch{return!1}}function Se({classification:e,onFollowReference:t,onValueChange:n,onRemove:r}){let{property:i,value:a,importance:c,state:l,isReference:u,referenceId:d,def:f}=e,p=f?.label??i,m=we(c,l),h=n!==void 0;return(0,Y.jsxs)(`div`,{className:`graph-property-row ${m}`,children:[(0,Y.jsxs)(`div`,{className:`graph-property-label-col`,children:[(0,Y.jsx)(Te,{importance:c,state:l}),(0,Y.jsx)(`span`,{className:`graph-property-label`,children:p})]}),(0,Y.jsx)(`div`,{className:`graph-property-value`,children:u&&d!==void 0?(0,Y.jsxs)(`button`,{type:`button`,className:`graph-reference-link`,onClick:()=>t?.(d),"aria-label":`Follow reference to ${d}`,children:[(0,Y.jsx)(s,{size:12}),(0,Y.jsx)(`span`,{className:`graph-reference-link-id`,children:o(d)})]}):h?(0,Y.jsxs)(`div`,{className:`graph-property-input-row`,children:[(0,Y.jsx)(Ce,{property:i,value:a,fieldType:f?.fieldType,hint:f?.hint,onChange:e=>n(i,e)}),r&&(0,Y.jsx)(`button`,{type:`button`,className:`graph-property-remove`,onClick:()=>r(i),"aria-label":`Remove ${p}`,children:(0,Y.jsx)(I,{size:14})})]}):(0,Y.jsx)(Ee,{value:a})})]})}function Ce({property:e,value:t,fieldType:n,hint:r,onChange:i}){if(n!==`array`&&typeof t==`object`&&t){if(Array.isArray(t))return(0,Y.jsxs)(`span`,{className:`graph-property-value-array`,children:[`Array (`,t.length,` item`,t.length===1?``:`s`,`)`]});let e=t,n=typeof e[`@type`]==`string`?e[`@type`]:null;return(0,Y.jsx)(`span`,{className:`graph-property-value-object`,children:n?`{${n}}`:JSON.stringify(t).slice(0,80)})}let a=typeof t==`string`?t:t==null?``:String(t);switch(n){case`textarea`:return(0,Y.jsx)(ve,{value:a,onChange:i,label:e});case`url`:return(0,Y.jsx)(be,{value:a,onChange:i,label:e});case`date`:return(0,Y.jsx)(me,{value:a,onChange:i,label:e});case`number`:return(0,Y.jsx)(he,{value:typeof t==`number`?t:a,onChange:i,label:e});case`select`:{let t=r?r.split(`|`).map(e=>e.trim()).filter(Boolean):[];return(0,Y.jsx)(_e,{value:a,onChange:i,options:t,label:e})}case`array`:return Array.isArray(t)?t.some(e=>typeof e==`object`&&!!e)?(0,Y.jsx)(ge,{value:t,onChange:i,label:e}):(0,Y.jsx)(pe,{value:t.map(e=>typeof e==`string`?e:String(e)),onChange:i,label:e}):(0,Y.jsx)(ye,{value:``,onChange:i,label:e});case`email`:return(0,Y.jsx)(`input`,{type:`email`,className:`graph-input graph-input--email`,value:a,onChange:e=>i(e.target.value),"aria-label":e});case`tel`:return(0,Y.jsx)(`input`,{type:`tel`,className:`graph-input graph-input--tel`,value:a,onChange:e=>i(e.target.value),"aria-label":e});default:return(0,Y.jsx)(ye,{value:a,onChange:i,label:e})}}function we(e,t){return e===`required`&&t===`missing`?`graph-property-row--required-missing`:e===`recommended`&&t===`missing`?`graph-property-row--recommended-missing`:t===`set`&&e===`required`?`graph-property-row--required-set`:``}function Te({importance:e,state:t}){return e===`required`&&t===`missing`?(0,Y.jsx)(x,{size:14,className:`graph-property-badge graph-property-badge--required-missing`,"aria-label":`Missing required`}):e===`recommended`&&t===`missing`?(0,Y.jsx)(P,{size:14,className:`graph-property-badge graph-property-badge--recommended-missing`,"aria-label":`Missing recommended`}):t===`set`&&e===`required`?(0,Y.jsx)(b,{size:14,className:`graph-property-badge graph-property-badge--set`,"aria-label":`Set`}):(0,Y.jsx)(`span`,{className:`graph-property-badge graph-property-badge--placeholder`,"aria-hidden":!0})}function Ee({value:e}){if(e==null||e===``)return(0,Y.jsx)(`span`,{className:`graph-property-value-empty`,children:`—`});if(typeof e==`string`)return(0,Y.jsx)(`span`,{className:`graph-property-value-string`,children:De(e,120)});if(typeof e==`number`||typeof e==`boolean`)return(0,Y.jsx)(`span`,{className:`graph-property-value-primitive`,children:String(e)});if(Array.isArray(e))return(0,Y.jsxs)(`span`,{className:`graph-property-value-array`,children:[`Array (`,e.length,` item`,e.length===1?``:`s`,`)`]});if(typeof e==`object`){let t=e,n=typeof t[`@type`]==`string`?t[`@type`]:`object`;return(0,Y.jsx)(`span`,{className:`graph-property-value-object`,children:`{${n}}`})}return(0,Y.jsx)(`span`,{className:`graph-property-value-unknown`,children:String(e)})}function De(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}function Oe({node:e,catalogTypes:t,catalogDetail:n,selected:r,focused:i,onSelect:a,onFollowReference:o,initiallyExpanded:s=!1}){let[u,d]=(0,W.useState)(s),f=v(e,t),p=c(e,n),m=l(p),h=p.some(e=>e.importance===`required`&&e.state===`missing`);return(0,Y.jsxs)(`div`,{className:`graph-entity-card ${r?`graph-entity-card--selected`:``} ${h?`graph-entity-card--missing-required`:``}`,"data-entity-id":e[`@id`]??``,role:`treeitem`,tabIndex:r?0:-1,"aria-selected":r,"aria-expanded":u,children:[(0,Y.jsx)(Z,{node:e,category:f,classifications:p,selected:r,focused:i,onSelect:()=>a(e),onToggleExpanded:()=>d(e=>!e),expanded:u}),u&&(0,Y.jsx)(`div`,{className:`graph-entity-body`,children:m.length===0?(0,Y.jsx)(`p`,{className:`graph-entity-empty`,children:`No properties.`}):(0,Y.jsx)(`div`,{className:`graph-property-list`,children:m.map(e=>(0,Y.jsx)(Se,{classification:e,onFollowReference:o},e.property))})})]})}function ke({data:e,collection:t,slug:n}){let[r,i]=(0,W.useState)(!1),[a,o]=(0,W.useState)(!1),s=(0,W.useRef)(null),c=(0,W.useRef)(null);return(0,W.useEffect)(()=>()=>{c.current!==null&&clearTimeout(c.current)},[]),(0,W.useEffect)(()=>{if(!r)return;let e=e=>{s.current&&!s.current.contains(e.target)&&i(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[r]),(0,Y.jsxs)(`div`,{className:`graph-export-dropdown`,ref:s,children:[(0,Y.jsxs)(`button`,{type:`button`,className:`graph-export-btn`,onClick:()=>i(e=>!e),"aria-expanded":r,"aria-haspopup":`true`,children:[(0,Y.jsx)(S,{size:14}),` Export`]}),r&&(0,Y.jsxs)(`div`,{className:`graph-export-menu`,role:`menu`,children:[(0,Y.jsx)(`button`,{type:`button`,className:`graph-export-menu-item`,role:`menuitem`,onClick:()=>{let r=w(e),a=C(t,n);E(r,a,`application/ld+json`),i(!1)},children:`Download .jsonld`}),(0,Y.jsx)(`button`,{type:`button`,className:`graph-export-menu-item`,role:`menuitem`,onClick:()=>{let t=T(e);navigator.clipboard.writeText(t).then(()=>{o(`success`),c.current!==null&&clearTimeout(c.current),c.current=setTimeout(()=>o(!1),2e3)}).catch(()=>{o(`error`),c.current!==null&&clearTimeout(c.current),c.current=setTimeout(()=>o(!1),2e3)}),i(!1)},children:a===`success`?`Copied!`:a===`error`?`Copy failed`:`Copy as <script> tag`})]})]})}function Ae({label:e,variant:t,children:n}){return(0,Y.jsxs)(`section`,{className:`graph-section graph-section--${t}`,children:[(0,Y.jsx)(`h3`,{className:`graph-section-label`,children:e}),(0,Y.jsx)(`div`,{className:`graph-section-content`,children:n})]})}function je({model:e,layout:t,catalogTypes:n,catalogDetails:r}){let i=Me(e,n,r),a=`${t.siteContext.length} site, ${+!!t.page} page, ${+!!t.primary} primary, ${t.linked.length} linked`;return(0,Y.jsxs)(`header`,{className:`graph-summary`,children:[(0,Y.jsxs)(`div`,{className:`graph-summary-primary`,children:[(0,Y.jsxs)(`span`,{className:`graph-summary-metric`,children:[(0,Y.jsx)(`strong`,{children:i.entityCount}),` entities`]}),(0,Y.jsxs)(`span`,{className:`graph-summary-metric`,children:[(0,Y.jsx)(`strong`,{children:i.categories.size}),` categories`]}),(0,Y.jsxs)(`span`,{className:`graph-summary-metric`,children:[(0,Y.jsx)(`strong`,{children:i.richResultCount}),` rich-result eligible`]}),(0,Y.jsxs)(`span`,{className:`graph-summary-metric ${i.requiredTotal-i.requiredSet>0?`graph-summary-metric--warning`:``}`,children:[(0,Y.jsxs)(`strong`,{children:[i.requiredSet,`/`,i.requiredTotal]}),` `,`required set`,i.requiredTotal-i.requiredSet>0&&(0,Y.jsxs)(`span`,{className:`graph-summary-missing`,children:[`(`,i.requiredTotal-i.requiredSet,` missing)`]})]})]}),(0,Y.jsx)(`div`,{className:`graph-summary-secondary`,children:a})]})}function Me(e,t,n){let r=new Set,i=0,a=0,o=0,s=new Map;for(let e of t)s.set(e.type,e);for(let l of e.nodes){let e=v(l,t);e!==null&&r.add(e);let u=typeof l[`@type`]==`string`?l[`@type`]:null;if(u!==null){s.get(u)?.richResult&&(o+=1);let e=n.get(u)??null,t=c(l,e);for(let e of t)e.importance===`required`&&(a+=1,e.state===`set`&&(i+=1))}}return{entityCount:e.nodes.length,categories:r,richResultCount:o,requiredSet:i,requiredTotal:a}}function Ne(e,t,n,r){let i;try{i=JSON.parse(e)}catch(e){return ze(e instanceof Error?`Invalid JSON: ${e.message}`:`Invalid JSON`)}let o=_(i);if(o.nodes.length===0)return ze(`No entities found in the imported JSON-LD.`);let s=[],c=0;for(let e of o.nodes){let i=a(e[`@type`]);if(!i)continue;let o=typeof e.role==`string`?e.role:void 0,l=Re(t,i,o),u=!l,d=!n.has(i),f=r.get(i),p=[];for(let[t,n]of Object.entries(e)){if(t===`@type`||t===`@id`||t===`@context`||t===`role`)continue;let e=l?.[t],r=f?!f.has(t):!1;l&&t in l?Be(e,n)||p.push({entityType:i,entityRole:o,property:t,kind:`changed`,oldValue:e,newValue:n,unknownProperty:r}):p.push({entityType:i,entityRole:o,property:t,kind:`added`,oldValue:void 0,newValue:n,unknownProperty:r})}if(l)for(let[t,n]of Object.entries(l))t!==`@type`&&t!==`@id`&&t!==`@context`&&t!==`role`&&(t in e||p.push({entityType:i,entityRole:o,property:t,kind:`removed`,oldValue:n,newValue:void 0,unknownProperty:!1}));(p.length>0||u)&&(s.push({type:i,role:o,disabled:d,disabledReason:d?`${i} is not part of this document's archetype`:void 0,changes:p}),u&&(c+=1))}let l=s.reduce((e,t)=>e+t.changes.length,0);return{entities:s,totalPropertyChanges:l,totalEntityAdditions:c,requiresConfirmation:l>=10||s.length>=3,error:void 0,importedModel:o}}function Pe(e,t){if(e==null||typeof e==`string`)return e;if(Array.isArray(e))return e.map(e=>Pe(e,t));if(typeof e==`object`){let n=e,r={};for(let[e,i]of Object.entries(n))r[e]=e===`@id`&&typeof i==`string`?t.get(i)??i:Pe(i,t);return r}return e}function Fe(e,t,n){let r=new Map;for(let i of e.nodes){let e=i[`@id`];if(typeof e!=`string`)continue;let o=a(i[`@type`]);if(!o)continue;let s=Re(t,o,typeof i.role==`string`?i.role:void 0);s&&typeof s[`@id`]==`string`?r.set(e,s[`@id`]):r.set(e,`${n.replace(/\/+$/,``)}/#${o.toLowerCase()}`)}return r}function Ie(e,t,n){let r=e;for(let e of t){let t=Le(e),i=Pe(e.value,n);r=ie(r,t,e.property,i)}return r}function Le(e){return e.entityId?e.entityId:e.entityRole?`${e.entityType}:${e.entityRole}`:e.entityType}function Re(e,t,n){return e.nodes.find(e=>a(e[`@type`])===t?!n||e.role===n:!1)}function ze(e){return{entities:[],totalPropertyChanges:0,totalEntityAdditions:0,requiresConfirmation:!1,error:e,importedModel:void 0}}function Be(e,t){if(e===t)return!0;if(e===null||t===null||typeof e!=typeof t||typeof e!=`object`||Array.isArray(e)!==Array.isArray(t))return!1;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((e,n)=>Be(e,t[n]));let n=e,r=t,i=Object.keys(n),a=Object.keys(r);return i.length===a.length&&i.every(e=>Be(n[e],r[e]))}function Ve({entities:e,selectedProperties:t,onToggle:n}){return e.length===0?(0,Y.jsx)(`p`,{className:`import-diff-empty`,children:`No changes detected.`}):(0,Y.jsx)(`div`,{className:`import-diff-panel`,children:e.map(e=>(0,Y.jsxs)(`div`,{className:`import-diff-entity ${e.disabled?`import-diff-entity--disabled`:``}`,children:[(0,Y.jsxs)(`div`,{className:`import-diff-entity-header`,children:[(0,Y.jsx)(`span`,{className:`import-diff-entity-type`,children:e.type}),e.role&&(0,Y.jsx)(`span`,{className:`import-diff-entity-role`,children:e.role}),e.disabled&&(0,Y.jsx)(`span`,{className:`import-diff-entity-badge import-diff-entity-badge--disabled`,children:`Disabled`}),(0,Y.jsxs)(`span`,{className:`import-diff-entity-count`,children:[e.changes.length,` change`,e.changes.length===1?``:`s`]})]}),e.disabled&&e.disabledReason&&(0,Y.jsx)(`p`,{className:`import-diff-disabled-reason`,children:e.disabledReason}),(0,Y.jsx)(`div`,{className:`import-diff-changes`,children:e.changes.map(r=>{let i=He(e,r),a=t.has(i),o=!e.disabled&&r.kind!==`removed`;return(0,Y.jsxs)(`label`,{className:`import-diff-change import-diff-change--${r.kind}`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:a,disabled:!o,onChange:()=>n(i),className:`import-diff-checkbox`}),(0,Y.jsxs)(`div`,{className:`import-diff-change-content`,children:[(0,Y.jsxs)(`div`,{className:`import-diff-change-header`,children:[(0,Y.jsx)(Ue,{kind:r.kind}),(0,Y.jsx)(`span`,{className:`import-diff-property`,children:r.property}),r.unknownProperty&&(0,Y.jsxs)(`span`,{className:`import-diff-warning`,children:[(0,Y.jsx)(k,{size:12}),` Unknown property`]})]}),(0,Y.jsxs)(`div`,{className:`import-diff-change-values`,children:[r.kind===`changed`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`import-diff-old-value`,children:$(r.oldValue)}),(0,Y.jsx)(`span`,{className:`import-diff-arrow`,children:`→`}),(0,Y.jsx)(`span`,{className:`import-diff-new-value`,children:$(r.newValue)})]}),r.kind===`added`&&(0,Y.jsx)(`span`,{className:`import-diff-new-value`,children:$(r.newValue)}),r.kind===`removed`&&(0,Y.jsx)(`span`,{className:`import-diff-removed-value`,children:$(r.oldValue)})]})]})]},i)})})]},`${e.type}-${e.role??``}`))})}function He(e,t){return`${e.type}:${e.role??``}:${t.property}`}function Ue({kind:e}){switch(e){case`added`:return(0,Y.jsx)(N,{size:14,className:`import-diff-icon import-diff-icon--added`});case`changed`:return(0,Y.jsx)(y,{size:14,className:`import-diff-icon import-diff-icon--changed`});case`removed`:return(0,Y.jsx)(H,{size:14,className:`import-diff-icon import-diff-icon--removed`});default:return(0,Y.jsx)(y,{size:14})}}function $(e){if(e==null)return`—`;if(typeof e==`string`)return e.length>80?`${e.slice(0,77)}…`:e;if(typeof e==`number`||typeof e==`boolean`)return String(e);if(typeof e==`object`){let t=JSON.stringify(e);return t.length>80?`${t.slice(0,77)}…`:t}return String(e)}function We({currentModel:e,currentEntityTypes:t,catalogPropertySets:n,baseUrl:r,buffer:i,onApply:a,onClose:o}){let[s,c]=(0,W.useState)(``),[l,u]=(0,W.useState)(null),[d,f]=(0,W.useState)(new Set),[p,m]=(0,W.useState)(!1),h=(0,W.useRef)(null),g=(0,W.useId)();j(h,!0),(0,W.useEffect)(()=>{let e=e=>{e.key===`Escape`&&o()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[o]);let _=(0,W.useCallback)(()=>{let r=Ne(s,e,t,n);if(u(r),!r.error){let e=new Set;for(let t of r.entities)if(!t.disabled)for(let n of t.changes)n.kind!==`removed`&&e.add(He(t,n));f(e)}},[s,e,t,n]),v=(0,W.useCallback)(e=>{f(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),y=(0,W.useCallback)(()=>{if(!l?.importedModel)return;let t=[];for(let n of l.entities){if(n.disabled)continue;let r=e.nodes.find(e=>(typeof e[`@type`]==`string`?e[`@type`]:void 0)===n.type&&(!n.role||e.role===n.role)),i=typeof r?.[`@id`]==`string`?r[`@id`]:void 0;for(let e of n.changes){let r=He(n,e);d.has(r)&&e.kind!==`removed`&&t.push({entityType:e.entityType,entityRole:e.entityRole,entityId:i,property:e.property,value:e.newValue,kind:e.kind})}}if(t.length===0){o();return}a(Ie(i,t,Fe(l.importedModel,e,r))),o()},[l,d,e,r,i,a,o]),b=l!==null&&!l.error&&d.size>0&&(!l.requiresConfirmation||p);return(0,Y.jsxs)(`div`,{className:`import-modal-overlay`,children:[(0,Y.jsx)(`div`,{className:`import-modal-scrim`,"aria-hidden":`true`,onClick:o}),(0,Y.jsxs)(`div`,{ref:h,className:`import-modal`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":g,tabIndex:-1,children:[(0,Y.jsxs)(`div`,{className:`import-modal-header`,children:[(0,Y.jsxs)(`h2`,{id:g,className:`import-modal-title`,children:[(0,Y.jsx)(A,{size:18}),` Import JSON-LD`]}),(0,Y.jsx)(`button`,{type:`button`,className:`import-modal-close`,onClick:o,children:`×`})]}),(0,Y.jsx)(`div`,{className:`import-modal-body`,children:l?l.error?(0,Y.jsxs)(`div`,{className:`import-modal-error`,children:[(0,Y.jsx)(`p`,{children:l.error}),(0,Y.jsx)(`button`,{type:`button`,className:`import-modal-btn import-modal-btn--secondary`,onClick:()=>u(null),children:`Edit JSON`})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`import-modal-summary`,children:[l.totalPropertyChanges,` property change`,l.totalPropertyChanges===1?``:`s`,` across `,l.entities.length,` entit`,l.entities.length===1?`y`:`ies`,l.totalEntityAdditions>0&&` (${l.totalEntityAdditions} new entit${l.totalEntityAdditions===1?`y`:`ies`})`]}),(0,Y.jsx)(Ve,{entities:l.entities,selectedProperties:d,onToggle:v}),l.requiresConfirmation&&(0,Y.jsxs)(`label`,{className:`import-modal-confirm`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:p,onChange:e=>m(e.target.checked)}),`I've reviewed these changes`]})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`import-modal-hint`,children:`Paste a JSON-LD blob to import entities and properties into this document. Changes will be reviewed before applying.`}),(0,Y.jsx)(`textarea`,{className:`import-modal-textarea`,value:s,onChange:e=>c(e.target.value),placeholder:`{"@context": "https://schema.org", "@graph": [...]}`,rows:12})]})}),(0,Y.jsxs)(`div`,{className:`import-modal-footer`,children:[(0,Y.jsx)(`button`,{type:`button`,className:`import-modal-btn import-modal-btn--secondary`,onClick:o,children:`Cancel`}),l?l.error?null:(0,Y.jsxs)(`button`,{type:`button`,className:`import-modal-btn import-modal-btn--primary`,onClick:y,disabled:!b,children:[`Apply `,d.size,` change`,d.size===1?``:`s`]}):(0,Y.jsx)(`button`,{type:`button`,className:`import-modal-btn import-modal-btn--primary`,onClick:_,disabled:!s.trim(),children:`Parse`})]})]})]})}var Ge=`krantho:graphLayout`;function Ke({value:e,onChange:t}){let n=e===`tree`?`canvas`:`tree`,r=n===`canvas`?`Canvas`:`Tree`,i=n===`canvas`?F:B;return(0,Y.jsxs)(`button`,{type:`button`,className:`graph-layout-toggle-btn`,onClick:()=>t(n),title:`Switch to ${r} view`,children:[(0,Y.jsx)(i,{size:14}),` `,r]})}function qe(){let[e,t]=(0,W.useState)(()=>{try{return localStorage.getItem(Ge)===`canvas`?`canvas`:`tree`}catch{return`tree`}});return[e,e=>{t(e);try{localStorage.setItem(Ge,e)}catch{}}]}function Je({references:e,onFollow:t}){return e.length===0?(0,Y.jsx)(`p`,{className:`graph-references-empty`,children:`No inbound references.`}):(0,Y.jsx)(`ul`,{className:`graph-references-list`,children:e.map((e,n)=>{let r=e.source[`@id`],i=a(e.source[`@type`])??`Node`,o=`${r??`anon`}-${e.property}-${n}`;return(0,Y.jsx)(`li`,{className:`graph-references-item`,children:(0,Y.jsxs)(`button`,{type:`button`,className:`graph-references-link`,onClick:()=>r&&t?.(r),disabled:r===void 0,children:[(0,Y.jsx)(R,{size:12}),(0,Y.jsx)(`span`,{className:`graph-references-source`,children:i}),(0,Y.jsxs)(`span`,{className:`graph-references-property`,children:[`.`,e.property]})]})},o)})})}function Ye({value:e,onChange:t}){let n=(0,W.useId)();return(0,Y.jsxs)(`div`,{className:`graph-scope-propagation`,children:[(0,Y.jsx)(`span`,{className:`graph-scope-propagation-label`,children:`Apply changes to:`}),(0,Y.jsxs)(`label`,{className:`graph-scope-propagation-option`,children:[(0,Y.jsx)(`input`,{type:`radio`,name:n,value:`document`,checked:e===`document`,onChange:()=>t(`document`)}),`This document`]}),(0,Y.jsxs)(`label`,{className:`graph-scope-propagation-option`,children:[(0,Y.jsx)(`input`,{type:`radio`,name:n,value:`site`,checked:e===`site`,onChange:()=>t(`site`)}),`All documents (site-level)`]})]})}function Xe({classifications:e,compact:t=!1}){let n=e.filter(e=>e.importance===`required`),r=e.filter(e=>e.importance===`recommended`),i=n.filter(e=>e.state===`set`).length,a=r.filter(e=>e.state===`set`).length;if(n.length===0&&r.length===0)return(0,Y.jsx)(`span`,{className:`graph-validation-meter graph-validation-meter--empty`});let o=i===n.length?`graph-validation-meter--eligible`:`graph-validation-meter--incomplete`;return t?(0,Y.jsx)(`span`,{className:`graph-validation-meter graph-validation-meter--compact ${o}`,children:n.length>0&&(0,Y.jsxs)(`span`,{className:`graph-validation-meter-segment`,children:[i,`/`,n.length]})}):(0,Y.jsxs)(`div`,{className:`graph-validation-meter ${o}`,children:[n.length>0&&(0,Y.jsxs)(`span`,{className:`graph-validation-meter-segment graph-validation-meter-segment--required`,children:[i,`/`,n.length,` required`]}),r.length>0&&(0,Y.jsxs)(`span`,{className:`graph-validation-meter-segment graph-validation-meter-segment--recommended`,children:[a,`/`,r.length,` recommended`]})]})}function Ze({node:e,model:t,catalogTypes:n,catalogDetails:r,onFollowReference:i,onPropertyChange:o,onPropertyRemove:s,onDeleteEntity:u,isSiteLevel:f,propagationScope:p,onPropagationChange:m}){let[h,g]=(0,W.useState)(!1),[_,y]=(0,W.useState)(!1),b=o!==void 0;if((0,W.useEffect)(()=>{g(!1),y(!1)},[e]),e===null)return(0,Y.jsx)(`aside`,{className:`graph-property-panel graph-property-panel--empty`,children:(0,Y.jsx)(`p`,{className:`graph-property-panel-hint`,children:`Select an entity to see its details.`})});let x=a(e[`@type`])??`Unknown`,S=v(e,n),C=r.get(x)??null,w=c(e,C),T=l(w),E=Qe(C),ee=e[`@id`]?t.referencedBy.get(e[`@id`])??[]:[],k=new Set(Object.keys(e).filter(e=>e!==`@type`&&e!==`@id`&&e!==`@context`&&e!==`_ek`)),A=C?C.properties.filter(e=>!k.has(e.property)):[],j=J(e);return(0,Y.jsxs)(`aside`,{className:`graph-property-panel`,children:[(0,Y.jsxs)(`header`,{className:`graph-property-panel-header`,children:[(0,Y.jsxs)(`div`,{className:`graph-property-panel-title-row`,children:[(0,Y.jsx)(`h3`,{className:`graph-property-panel-title`,children:x}),(0,Y.jsx)(X,{category:S}),b&&u&&!_&&(0,Y.jsxs)(`button`,{type:`button`,className:`graph-property-panel-delete`,onClick:()=>y(!0),"aria-label":`Delete ${x} entity`,children:[(0,Y.jsx)(O,{size:12}),` Delete`]}),b&&u&&_&&(0,Y.jsxs)(`span`,{className:`graph-property-panel-delete-confirm`,children:[(0,Y.jsx)(`button`,{type:`button`,className:`graph-property-panel-delete graph-property-panel-delete--confirm`,onClick:()=>{u(j),y(!1)},children:`Confirm`}),(0,Y.jsx)(`button`,{type:`button`,className:`graph-property-panel-delete-cancel`,onClick:()=>y(!1),children:`Cancel`})]})]}),S&&(0,Y.jsx)(`p`,{className:`graph-property-panel-category-label`,children:d[S]}),E.map(e=>(0,Y.jsxs)(`div`,{className:`graph-property-panel-rich-result`,children:[(0,Y.jsxs)(`span`,{className:`graph-property-panel-rich-result-label`,children:[e.reader,`:`]}),` `,(0,Y.jsx)(`strong`,{children:e.feature}),e.status!==`active`&&` (${e.status})`,(0,Y.jsxs)(`a`,{href:e.source,target:`_blank`,rel:`noopener noreferrer`,className:`graph-property-panel-docs-link`,children:[`Docs `,(0,Y.jsx)(D,{size:12})]})]},e.reader)),(0,Y.jsx)(Xe,{classifications:w}),b&&f&&p&&m&&(0,Y.jsx)(Ye,{value:p,onChange:m})]}),(0,Y.jsxs)(`section`,{className:`graph-property-panel-section`,children:[(0,Y.jsx)(`h4`,{className:`graph-property-panel-section-label`,children:`Properties`}),T.length===0?(0,Y.jsx)(`p`,{className:`graph-property-panel-empty`,children:`No catalog properties available.`}):(0,Y.jsx)(`div`,{className:`graph-property-list`,children:T.map(e=>(0,Y.jsx)(Se,{classification:e,onFollowReference:i,onValueChange:b?(e,t)=>o(j,e,t):void 0,onRemove:b&&s?e=>s(j,e):void 0},e.property))}),b&&A.length>0&&(0,Y.jsx)(`div`,{className:`graph-property-add`,children:h?(0,Y.jsxs)(`div`,{className:`graph-property-add-picker`,children:[A.map(e=>(0,Y.jsxs)(`button`,{type:`button`,className:`graph-property-add-option`,onClick:()=>{o(j,e.property,``),g(!1)},children:[(0,Y.jsx)(`span`,{className:`graph-property-add-option-name`,children:e.label}),(0,Y.jsx)(`span`,{className:`graph-property-add-option-importance graph-property-add-option-importance--${e.importance}`,children:e.importance})]},e.property)),(0,Y.jsx)(`button`,{type:`button`,className:`graph-property-add-cancel`,onClick:()=>g(!1),children:`Cancel`})]}):(0,Y.jsxs)(`button`,{type:`button`,className:`graph-property-add-btn`,onClick:()=>g(!0),children:[(0,Y.jsx)(N,{size:14}),` Add property`]})})]}),(0,Y.jsxs)(`section`,{className:`graph-property-panel-section`,children:[(0,Y.jsx)(`h4`,{className:`graph-property-panel-section-label`,children:`Referenced by`}),(0,Y.jsx)(Je,{references:ee,onFollow:i})]})]})}function Qe(e){return(e?.rules??[]).flatMap(e=>e.feature?[{reader:e.readerName,feature:e.feature,status:e.status,source:e.source}]:[])}function $e({data:e}){let[t,n]=(0,W.useState)(!1);return(0,Y.jsxs)(`div`,{className:`graph-raw-toggle ${t?`graph-raw-toggle--open`:``}`,children:[(0,Y.jsxs)(`button`,{type:`button`,className:`graph-raw-toggle-button`,onClick:()=>n(e=>!e),"aria-expanded":t,children:[(0,Y.jsx)(M,{size:14,className:`graph-raw-toggle-chevron`}),t?`Hide raw JSON-LD`:`Show raw JSON-LD`]}),t&&(0,Y.jsx)(`div`,{className:`graph-raw-toggle-body`,children:(0,Y.jsx)(u,{data:e,label:`Raw JSON-LD`})})]})}var et=(0,W.lazy)(()=>n(()=>import(`./GraphCanvas-Bq75rYgC.js`).then(e=>({default:e.GraphCanvas})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22])));function tt({saveLabel:e=`Save`,model:t,catalogTypes:n,catalogDetails:r,rawData:i,configData:o,onSave:s,siteLevelTypeSet:c,collection:l,slug:u}){let d=o!==void 0&&s!==void 0,[p,h]=qe(),[g,_]=(0,W.useState)(!1),[v,y]=(0,W.useState)(G),[b,x]=(0,W.useState)(!1),S=re(v),C=(0,W.useMemo)(()=>S?ce(t,v):t,[t,v,S]),w=(0,W.useMemo)(()=>{let e=new Set;for(let t of C.nodes){let n=a(t[`@type`]);n&&e.add(n)}return e},[C]),T=(0,W.useMemo)(()=>{let e=new Map;for(let[t,n]of r)e.set(t,new Set(n.properties.map(e=>e.property)));return e},[r]),E=(0,W.useMemo)(()=>{if(c)return c;let e=new Set;for(let t of n)t.siteLevel&&e.add(t.type);return e},[n,c]),D=(0,W.useMemo)(()=>f(C,E),[C,E]),O=(0,W.useMemo)(()=>{let e=[];return e.push(...D.siteContext),D.page&&e.push(D.page),D.primary&&e.push(D.primary),e.push(...D.linked),e},[D]),[k,j]=(0,W.useState)(null),[M,N]=(0,W.useState)(null),P=(0,W.useRef)(null),F=(0,W.useRef)(null),[I,te]=(0,W.useState)(`site`);(0,W.useEffect)(()=>()=>{P.current!==null&&clearTimeout(P.current)},[]),(0,W.useEffect)(()=>{if(!S)return;let e=e=>{e.preventDefault()};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[S]);let L=(0,W.useMemo)(()=>o?m(C.nodes,o.entities):new Map,[C,o]),R=(0,W.useMemo)(()=>{if(k!==null){let e=C.byEk.get(k);if(e)return e}return D.primary??O[0]??null},[k,C,D.primary,O]),z=R?._ek??null,B=(0,W.useMemo)(()=>{if(!R)return!1;let e=a(R[`@type`]);return e!==null&&E.has(e)},[R,E]),V=(0,W.useCallback)(e=>{let t=e._ek;typeof t==`string`&&j(t)},[]),H=(0,W.useCallback)(e=>{let t=C.byId.get(e);if(!t)return;let n=t._ek;typeof n==`string`&&j(n),N(e),F.current&&F.current.querySelector(`[data-entity-id="${nt(e)}"]`)?.scrollIntoView({behavior:`smooth`,block:`center`}),P.current!==null&&clearTimeout(P.current),P.current=setTimeout(()=>N(null),1200)},[C]),U=(0,W.useCallback)(e=>{if(O.length===0)return;let t=O.findIndex(e=>e._ek===z);if(e.key===`ArrowDown`||e.key===`ArrowRight`){e.preventDefault();let n=O[Math.min(t+1,O.length-1)];n&&V(n)}else if(e.key===`ArrowUp`||e.key===`ArrowLeft`){e.preventDefault();let n=O[Math.max(t-1,0)];n&&V(n)}},[O,z,V]),K=(0,W.useCallback)((e,t,n)=>{y(r=>ie(r,e,t,n))},[]),q=(0,W.useCallback)((e,t)=>{y(n=>ae(n,e,t))},[]),ue=(0,W.useCallback)(e=>{y(t=>se(t,e))},[]),J=(0,W.useCallback)(e=>{y(t=>oe(t,{"@type":e,properties:{}}))},[]),fe=(0,W.useCallback)(()=>{y(G())},[]),X=(0,W.useCallback)(async()=>{if(s&&o&&S){x(!0);try{await s(le(v,o,L)),y(G())}finally{x(!1)}}},[s,o,v,S,L]);(0,W.useEffect)(()=>{if(!d)return;let e=e=>{(e.metaKey||e.ctrlKey)&&e.key===`s`&&(e.preventDefault(),S&&!b&&X())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[d,S,b,X]);let Z=(0,W.useCallback)((e,t,i)=>{let o=e._ek??`node-${i}`,s=a(e[`@type`]),c=s===null?null:r.get(s)??null;return(0,Y.jsx)(Oe,{node:e,catalogTypes:n,catalogDetail:c,selected:z===o,focused:M===e[`@id`],onSelect:V,onFollowReference:H,initiallyExpanded:t},o)},[r,n,M,H,V,z]);if(C.nodes.length===0&&!d)return(0,Y.jsxs)(`div`,{className:`graph-browser graph-browser--empty`,children:[(0,Y.jsx)(`p`,{className:`graph-browser-empty-message`,children:`This document has no composed JSON-LD graph yet. Configure a Schema.org archetype for the collection or document to see structured data here.`}),(0,Y.jsx)($e,{data:i})]});let Q=(0,Y.jsx)(Ze,{node:R,model:C,catalogTypes:n,catalogDetails:r,onFollowReference:H,onPropertyChange:d?K:void 0,onPropertyRemove:d?q:void 0,onDeleteEntity:d?ue:void 0,isSiteLevel:B,propagationScope:B?I:void 0,onPropagationChange:B?te:void 0});return(0,Y.jsxs)(`div`,{className:`graph-browser`,ref:F,role:`tree`,"aria-label":`JSON-LD graph browser`,tabIndex:0,onKeyDown:U,children:[(0,Y.jsxs)(`div`,{className:`graph-browser-header`,children:[(0,Y.jsx)(je,{model:C,layout:D,catalogTypes:n,catalogDetails:r}),(0,Y.jsxs)(`div`,{className:`graph-browser-header-actions`,children:[d&&(0,Y.jsxs)(`button`,{type:`button`,className:`graph-header-btn graph-header-btn--discard`,onClick:fe,disabled:!S||b,children:[(0,Y.jsx)(ne,{size:14}),` Discard`]}),(0,Y.jsx)(Ke,{value:p,onChange:h}),d&&(0,Y.jsxs)(`button`,{type:`button`,className:`graph-header-btn`,onClick:()=>_(!0),children:[(0,Y.jsx)(A,{size:14}),` Import`]}),(0,Y.jsx)(ke,{data:i,collection:l,slug:u}),d&&(0,Y.jsxs)(`button`,{type:`button`,className:`graph-header-btn graph-header-btn--save`,onClick:()=>void X(),disabled:!S||b,children:[(0,Y.jsx)(ee,{size:14}),` `,b?`${e}…`:e]})]})]}),(0,Y.jsx)(`div`,{className:`graph-browser-body`,children:p===`tree`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`graph-browser-tree`,children:[D.siteContext.length>0&&(0,Y.jsxs)(Ae,{label:`Site Context`,variant:`site`,children:[D.siteContext.map((e,t)=>Z(e,!1,t)),d&&(0,Y.jsx)(de,{catalogTypes:n.filter(e=>e.siteLevel),onAdd:J})]}),D.page&&(0,Y.jsx)(Ae,{label:`Page`,variant:`page`,children:Z(D.page,!1,0)}),(D.primary||d)&&(0,Y.jsxs)(Ae,{label:`Primary Entity`,variant:`primary`,children:[D.primary&&Z(D.primary,!0,0),D.linked.map((e,t)=>Z(e,!1,t+1)),d&&(0,Y.jsx)(de,{catalogTypes:n.filter(e=>e.documentLevel),onAdd:J})]})]}),Q]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(W.Suspense,{fallback:(0,Y.jsx)(`div`,{className:`graph-canvas-loading`,children:`Loading canvas…`}),children:(0,Y.jsx)(et,{model:C,catalogTypes:n,catalogDetails:r,selectedEk:z,onSelect:V})}),Q]})}),(0,Y.jsx)($e,{data:i}),g&&(0,Y.jsx)(We,{currentModel:C,currentEntityTypes:w,catalogPropertySets:T,baseUrl:typeof window<`u`?window.location.origin:``,buffer:v,onApply:e=>y(e),onClose:()=>_(!1)})]})}function nt(e){return typeof globalThis.CSS?.escape==`function`?globalThis.CSS.escape(e):e.replace(/[^a-zA-Z0-9_-]/g,`\\$&`)}export{tt as GraphBrowser,X as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{a as t,s as n}from"./vendor-diff-Dm2YfgXt.js";import{a as r,c as i,d as a,f as o,i as s,l as c,n as l,o as u,r as d,s as f,t as p,u as m}from"./vendor-react-DMqGe90A.js";import{C as h,S as g,_,v,y}from"./graph-config-ZUe9BjGK.js";import{t as b}from"./GraphBrowser-DvcHXw-i.js";import{t as x}from"./vendor-reactflow-5Qvgw90M.js";var S=e(n(),1),C=e(x(),1),w=t();function T({data:e}){let t=e.type,n=e.id,r=e.category,i=e.requiredSet,a=e.requiredTotal,o=e.selected;return(0,w.jsxs)(`div`,{className:`canvas-entity-node ${o?`canvas-entity-node--selected`:``} ${r?`canvas-entity-node--${r}`:``}`,children:[(0,w.jsx)(d,{type:`target`,position:m.Top,className:`canvas-handle`}),(0,w.jsxs)(`div`,{className:`canvas-entity-node-header`,children:[(0,w.jsx)(`span`,{className:`canvas-entity-node-type`,children:t}),(0,w.jsx)(b,{category:r})]}),n&&!n.startsWith(`__synthetic:`)&&(0,w.jsx)(`div`,{className:`canvas-entity-node-id`,children:g(n)}),a>0&&(0,w.jsxs)(`div`,{className:`canvas-entity-node-meter ${i===a?`canvas-entity-node-meter--complete`:``}`,children:[i,`/`,a,` required`]}),(0,w.jsx)(d,{type:`source`,position:m.Bottom,className:`canvas-handle`})]})}var E=220,D=100,O={entity:T};function k(e){return(0,w.jsx)(r,{children:(0,w.jsx)(A,{...e})})}function A({model:e,catalogTypes:t,catalogDetails:n,selectedEk:r,onSelect:d}){let{initialNodes:m,initialEdges:h}=(0,S.useMemo)(()=>j(e,t,n,null),[e,t,n]),[g,_,v]=i(m),[y,b,x]=f(h),{setViewport:C}=c(),T=(0,S.useRef)(null);(0,S.useEffect)(()=>{_(m),b(h)},[m,h,_,b]),(0,S.useEffect)(()=>{_(e=>e.map(e=>({...e,data:{...e.data,selected:e.id===r}})))},[r,_]),(0,S.useEffect)(()=>{if(g.length===0)return;let e=setTimeout(()=>{let e=a(g);if(!T.current)return;let{width:t,height:n}=T.current.getBoundingClientRect(),r=o(e,t,n,.2,1,.15);C({x:r.x,y:30,zoom:r.zoom},{duration:0})},100);return()=>clearTimeout(e)},[g,C]);let E=(0,S.useCallback)((t,n)=>{let r=e.byEk.get(n.id);r&&d(r)},[e,d]),D=(0,S.useCallback)(()=>{let e=M(m,h);_(e)},[m,h,_]);return(0,w.jsx)(`div`,{className:`graph-canvas-container`,children:(0,w.jsx)(`div`,{ref:T,className:`graph-canvas-flow`,children:(0,w.jsxs)(u,{nodes:g,edges:y,onNodesChange:v,onEdgesChange:x,onNodeClick:E,nodeTypes:O,minZoom:.2,maxZoom:2,children:[(0,w.jsx)(p,{}),(0,w.jsx)(l,{position:`bottom-left`,showInteractive:!1,children:(0,w.jsx)(`button`,{type:`button`,className:`react-flow__controls-button graph-canvas-reset-btn`,onClick:D,title:`Reset layout`,children:`↻`})}),(0,w.jsx)(s,{position:`bottom-right`,pannable:!0,zoomable:!0})]})})})}function j(e,t,n,r){let i=[],a=[];for(let a=0;a<e.nodes.length;a++){let o=e.nodes[a],s=h(o[`@type`])??`Unknown`,c=o._ek,l=typeof c==`string`?c:`__synthetic:${s}:${a}`,u=y(o,t),d=n.get(s)??null,f=_(o,d),{requiredSet:p,requiredTotal:m}=v(f);i.push({id:l,type:`entity`,position:{x:0,y:0},data:{type:s,id:l,category:u,requiredSet:p,requiredTotal:m,selected:l===r}})}let o=new Map;for(let t of e.nodes){let e=t[`@id`],n=t._ek;typeof e==`string`&&typeof n==`string`&&o.set(e,n)}for(let t of e.nodes){let e=t._ek;if(typeof e==`string`)for(let[n,r]of Object.entries(t)){if(n===`@type`||n===`@id`||n===`@context`||n===`_ek`)continue;let t=N(r);if(t){let r=o.get(t);r&&a.push({id:`${e}-${n}-${r}`,source:e,target:r,label:n,animated:!1,style:{stroke:`var(--color-border)`}})}}}return{initialNodes:M(i,a),initialEdges:a}}function M(e,t){let n=new C.default.graphlib.Graph;n.setGraph({rankdir:`TB`,nodesep:80,ranksep:120}),n.setDefaultEdgeLabel(()=>({}));for(let t of e)n.setNode(t.id,{width:E,height:D});for(let e of t)n.setEdge(e.source,e.target);return C.default.layout(n),e.map(e=>{let t=n.node(e.id);return{...e,position:{x:(t?.x??0)-E/2,y:(t?.y??0)-D/2}}})}function N(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let t=e;return typeof t[`@id`]==`string`?t[`@id`]:null}export{k as GraphCanvas};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{a as t,s as n}from"./vendor-diff-Dm2YfgXt.js";import{f as r,r as i,t as a,u as o}from"./vendor-router-DjV3D6zM.js";import{i as s}from"./auth-GRfs02w7.js";import{d as c,o as l,t as u}from"./format-pPdsDgeS.js";import{i as d,n as f,t as ee}from"./createLucideIcon-D_HN41p3.js";import{t as te}from"./use-loaded-C3hBdQe0.js";import{a as p,t as m}from"./export-helpers-B2KV_EB5.js";import{a as h}from"./findability-CUYOthYI.js";import{t as g}from"./trash-Cknp3eZ5.js";import{t as ne}from"./upload-BvBYjswd.js";import{Dt as re,J as ie,L as ae,N as oe,P as se,a as ce,d as _,f as v,ft as y,j as b,n as x,ot as S,t as C,tt as w,x as T}from"./index-DVe5jFLX.js";import{t as E}from"./empty-state-CU7q3Ypl.js";import{c as D,d as O,f as k,i as A,l as j,n as M,o as N,r as P,s as F,t as I}from"./site-model-DX8WxTJg.js";import{t as L}from"./guards-BFEDbduR.js";import{n as R,t as z}from"./data-table-D8BsE1pn.js";import{i as B,n as V,o as H,t as U}from"./site-XpqFn80l.js";var W={name:`search-x`,size:24,node:[[`path`,{d:`m13.5 8.5-5 5`,key:`1cs55j`}],[`path`,{d:`m8.5 8.5 5 5`,key:`a8mexj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]};W.node;var G=ee(W),K=e(n(),1),q=t();function J(e){return e===1?`1 document`:`${e} documents`}function Y(e,t){return{done:e,failures:t.filter(e=>!e.changed).map(e=>({slug:e.slug,error:e.error??`Not changed`}))}}async function le(e,t,n,r){if(e===`publish`){let{published:e,results:i}=await se(t,[...n],r);return Y(e,i.map(e=>({slug:e.slug,changed:e.published,error:e.error})))}let{deleted:i,results:a}=await oe(t,[...n],r);return Y(i,a.map(e=>({slug:e.slug,changed:e.deleted,error:e.error})))}var X={publish:{title:`Publish documents`,verb:`Publish`,busy:`Publishing…`,ask:`Publishing makes each saved version what visitors see.`},delete:{title:`Delete documents`,verb:`Delete`,busy:`Deleting…`,ask:`Each document leaves the site and Studio in this locale. This cannot be undone.`}};function ue({action:e,outcome:t}){return(0,q.jsxs)(`div`,{role:`status`,children:[(0,q.jsxs)(`p`,{children:[e===`publish`?`Published`:`Deleted`,` `,J(t.done),`.`]}),t.failures.length>0&&(0,q.jsx)(`ul`,{className:`site-outcome-failures`,children:t.failures.map(e=>(0,q.jsxs)(`li`,{children:[(0,q.jsx)(`code`,{children:e.slug}),`: `,e.error]},e.slug))})]})}function de({props:e,phase:t}){if(t.name===`done`)return(0,q.jsx)(ue,{action:e.action,outcome:t.outcome});if(t.name===`failed`)return(0,q.jsx)(`p`,{role:`alert`,children:t.message});let n=X[e.action];return(0,q.jsxs)(`p`,{children:[n.verb,` `,J(e.slugs.length),` in `,(0,q.jsx)(`code`,{children:e.locale}),`? `,n.ask]})}function fe({props:e,phase:t,safeRef:n,onRun:r}){if(t.name===`done`||t.name===`failed`)return(0,q.jsx)(f,{ref:n,onClick:e.onClose,children:`Close`});let i=t.name===`working`,a=X[e.action].verb;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(f,{ref:n,onClick:i?void 0:e.onClose,"aria-disabled":i,children:`Cancel`}),(0,q.jsx)(f,{variant:e.action===`delete`?`danger`:`primary`,onClick:i?void 0:r,"aria-disabled":i,children:i?X[e.action].busy:`${a} ${J(e.slugs.length)}`})]})}function pe(e){let[t,n]=(0,K.useState)({name:`ask`}),r=(0,K.useRef)(null),i=t.name===`working`;(0,K.useEffect)(()=>{(t.name===`done`||t.name===`failed`)&&r.current?.focus()},[t.name]);async function a(){n({name:`working`});try{let t=await le(e.action,e.collection,e.slugs,e.locale);n({name:`done`,outcome:t})}catch(t){n({name:`failed`,message:v(t,`${X[e.action].verb} failed`)})}e.onDone()}return(0,q.jsx)(_,{title:X[e.action].title,onClose:i?()=>void 0:e.onClose,initialFocus:r,busy:i,actions:(0,q.jsx)(fe,{props:e,phase:t,safeRef:r,onRun:()=>void a()}),children:(0,q.jsx)(de,{props:e,phase:t})})}function me(e=3e3){let[t,n]=(0,K.useState)(null),r=(0,K.useRef)(null),i=(0,K.useCallback)(()=>{r.current!==null&&(clearTimeout(r.current),r.current=null)},[]),a=(0,K.useCallback)(()=>{i(),n(null)},[i]),o=(0,K.useCallback)((t,a)=>{i(),n({text:t,kind:`success`});let o=a??e;o>0&&(r.current=setTimeout(()=>{n(null),r.current=null},o))},[i,e]),s=(0,K.useCallback)(e=>{i(),n({text:e,kind:`error`})},[i]);return(0,K.useEffect)(()=>()=>{i()},[i]),{message:t,showSuccess:o,showError:s,clear:a}}function Z(e){return typeof e==`string`&&e!==``?e:void 0}function he(e){if(!L(e)||!L(e.identity)||!L(e.fields)||!L(e.metadata)||!Array.isArray(e.defaults)||typeof e.body!=`string`)return null;let t=e.identity;return!Z(t.collection)||!Z(t.slug)||!Z(t.locale)?null:e}function ge(e){let t;try{t=JSON.parse(e)}catch{return{ok:!1,error:`This is not valid JSON.`}}let n=L(t)?t.items:void 0;if(!Array.isArray(n))return{ok:!1,error:`The JSON needs an "items" array.`};if(n.length===0)return{ok:!1,error:`The "items" array is empty.`};let r=[];for(let[e,t]of n.entries()){let n=he(t);if(!n)return{ok:!1,error:`Item ${e+1} is missing its document identity or portable content envelope.`};r.push(n)}return{ok:!0,items:r}}function _e(e,t){return`${e}-${t}.json`}function ve(e,t){let{message:n,showSuccess:r,showError:i}=me(4e3);async function a(){if(t)try{let n=await ae(e,`json`,t);m(JSON.stringify(n,null,2),_e(e,t),`application/json`),r(`Exported ${n.count===1?`1 document`:`${n.count} documents`}`)}catch(e){i(v(e,`Export failed`))}}return{notice:n,run:a}}function ye({name:e,notice:t,onExport:n,onImport:r}){let{hasRole:i}=s();return(0,q.jsxs)(`div`,{className:`site-header-actions`,children:[(0,q.jsx)(`p`,{className:t?`site-notice site-notice--${t.kind}`:`site-notice`,role:`status`,children:t?.text}),(0,q.jsx)(f,{icon:p,onClick:n,children:`Export`}),i(`editor`)&&(0,q.jsx)(f,{icon:ne,onClick:r,children:`Import`}),i(`editor`)&&(0,q.jsxs)(a,{to:re(e),className:d(`primary`),children:[(0,q.jsx)(S,{className:`ui-button-icon`,"aria-hidden":`true`}),`New `,l(e)]})]})}function be(e){let{name:t,data:n}=e,r=n?.collection?ce(n.collection):null;return(0,q.jsxs)(`header`,{className:`site-header site-header--row`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h1`,{className:`site-heading`,children:u(t)}),(0,q.jsxs)(`p`,{className:`site-lede`,children:[r?(0,q.jsx)(`code`,{children:r}):`No pages of its own`,n&&(0,q.jsxs)(q.Fragment,{children:[` `,`· in `,(0,q.jsx)(`code`,{children:n.locale})]})]})]}),n&&(0,q.jsx)(ye,{...e})]})}var xe={updated:`Last updated`,slug:`Slug`};function Se(e,t){return e===`all`?t.total:t[e]}function Ce({filter:e,counts:t,onFilter:n}){return(0,q.jsxs)(`fieldset`,{className:`site-filters`,children:[(0,q.jsx)(`legend`,{className:`visually-hidden`,children:`Status`}),M.map(r=>(0,q.jsxs)(`button`,{type:`button`,className:`site-filter`,"aria-pressed":e===r,onClick:()=>n(r),children:[r!==`all`&&(0,q.jsx)(T,{status:r,decorative:!0}),r===`all`?`All`:b[r],(0,q.jsx)(`span`,{className:`site-filter-count`,children:Se(r,t)})]},r))]})}function Q({label:e,value:t,options:n,labelOf:r,onChange:i}){let a=(0,K.useId)();return(0,q.jsxs)(`span`,{className:`site-picker`,children:[(0,q.jsx)(`label`,{htmlFor:a,children:e}),(0,q.jsx)(`select`,{id:a,value:t,onChange:e=>{let t=n.find(t=>t===e.target.value);t!==void 0&&i(t)},children:n.map(e=>(0,q.jsx)(`option`,{value:e,children:r(e)},e))})]})}function we(e){return(0,q.jsxs)(`div`,{className:`site-toolbar`,children:[(0,q.jsx)(Ce,{filter:e.filter,counts:e.counts,onFilter:e.onFilter}),(0,q.jsxs)(`div`,{className:`site-toolbar-end`,children:[e.locales.length>1&&(0,q.jsx)(Q,{label:`Locale`,value:e.locale,options:e.locales,labelOf:e=>e,onChange:e.onLocale}),(0,q.jsx)(Q,{label:`Sort`,value:e.order,options:I,labelOf:e=>xe[e],onChange:e.onOrder}),(0,q.jsxs)(`p`,{className:`site-shown`,role:`status`,children:[(0,q.jsx)(`span`,{className:`site-shown-number`,children:F(e.shown,e.counts.total)}),` `,`shown`]})]})]})}var Te=`{
|
|
2
|
-
"items": [
|
|
3
|
-
{ "identity": { "collection": "pages", "slug": "my-page", "locale": "en" }, "contract": null, "fields": { "title": "My page" }, "metadata": {}, "defaults": [], "body": "## Section" }
|
|
4
|
-
]
|
|
5
|
-
}`;function Ee({phase:e}){let t=e.results.filter(e=>!e.imported);return(0,q.jsxs)(`div`,{role:`status`,children:[(0,q.jsxs)(`p`,{children:[`Imported `,e.imported,` of `,e.total,`. Each is saved as a new version; visitors see it once it is published.`]}),t.length>0&&(0,q.jsx)(`ul`,{className:`site-outcome-failures`,children:t.map(e=>(0,q.jsxs)(`li`,{children:[(0,q.jsx)(`code`,{children:e.slug}),`: `,e.error??`Not imported`]},e.slug))})]})}function De({text:e,error:t,onText:n}){let r=(0,K.useId)(),i=(0,K.useId)();async function a(e){let t=e.target.files?.[0];t&&n(await t.text())}return(0,q.jsxs)(`div`,{className:`site-import`,children:[(0,q.jsx)(`p`,{children:`Paste a collection export or choose its JSON file. Reviewed changes become draft snapshots, including document details. Conflicting changes need review before importing.`}),(0,q.jsxs)(`label`,{className:`site-import-file`,children:[(0,q.jsx)(`span`,{children:`Choose file`}),(0,q.jsx)(`input`,{type:`file`,accept:`application/json,.json`,onChange:e=>void a(e)})]}),(0,q.jsx)(`label`,{htmlFor:r,className:`site-import-label`,children:`JSON`}),(0,q.jsx)(`textarea`,{id:r,className:`site-import-text`,rows:10,spellCheck:!1,value:e,placeholder:Te,"aria-invalid":t!==null,"aria-describedby":t?i:void 0,onChange:e=>n(e.target.value)}),t&&(0,q.jsx)(`p`,{id:i,className:`site-import-error`,role:`alert`,children:t})]})}function Oe(e,t){let[n,r]=(0,K.useState)({name:`edit`,error:null});async function i(n){let i=ge(n);if(!i.ok){r({name:`edit`,error:i.error});return}r({name:`importing`});try{let n=await ie(e,i.items);r({name:`done`,...n}),t()}catch(e){r({name:`edit`,error:v(e,`Import failed`)})}}return{phase:n,setPhase:r,run:i}}function ke({phase:e,ready:t,closeRef:n,onClose:r,onRun:i}){if(e.name===`done`)return(0,q.jsx)(f,{ref:n,onClick:r,children:`Close`});let a=e.name===`importing`;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(f,{onClick:a?void 0:r,"aria-disabled":a,children:`Cancel`}),(0,q.jsx)(f,{variant:`primary`,onClick:a||!t?void 0:i,"aria-disabled":a||!t,children:a?`Importing…`:`Import`})]})}function Ae({collection:e,onClose:t,onImported:n}){let[r,i]=(0,K.useState)(``),{phase:a,setPhase:o,run:s}=Oe(e,n),c=(0,K.useRef)(null),l=a.name===`importing`;return(0,K.useEffect)(()=>{a.name===`done`&&c.current?.focus()},[a.name]),(0,q.jsx)(_,{title:`Import documents`,onClose:l?()=>void 0:t,busy:l,actions:(0,q.jsx)(ke,{phase:a,ready:r.trim()!==``,closeRef:c,onClose:t,onRun:()=>void s(r)}),children:a.name===`done`?(0,q.jsx)(Ee,{phase:a}):(0,q.jsx)(De,{text:r,error:a.name===`edit`?a.error:null,onText:e=>{i(e),o({name:`edit`,error:null})}})})}function je({count:e,canPublish:t,canDelete:n,onAction:r,onClear:i}){return(0,q.jsxs)(`section`,{className:`site-selection`,"aria-label":`Selection`,children:[(0,q.jsxs)(`p`,{className:`site-selection-count`,children:[(0,q.jsx)(`span`,{className:`site-shown-number`,children:e}),` selected`]}),(0,q.jsxs)(`div`,{className:`site-selection-actions`,children:[t&&(0,q.jsx)(f,{size:`sm`,variant:`primary`,icon:y,onClick:()=>r(`publish`),children:`Publish`}),n&&(0,q.jsx)(f,{size:`sm`,icon:g,onClick:()=>r(`delete`),children:`Delete`}),(0,q.jsx)(f,{size:`sm`,variant:`ghost`,icon:w,onClick:i,children:`Clear selection`})]})]})}function Me(e,t){let n=C(),[r,i]=(0,K.useState)(null),a=(0,K.useRef)(!1),{selection:o,reload:s,loaded:c}=e,l=c.state===`ready`?c.data.locale:null;return{dialog:r,openBulk:(0,K.useCallback)(e=>{l&&(a.current=!1,i({kind:`bulk`,action:e,slugs:o.slugs,locale:l}))},[o.slugs,l]),openImport:(0,K.useCallback)(()=>{a.current=!1,i({kind:`import`})},[]),close:(0,K.useCallback)(()=>{a.current&&r?.kind===`bulk`&&t(),i(null)},[r,t]),changed:(0,K.useCallback)(()=>{a.current=!0,o.clear(),s(),n()},[o,s,n])}}function Ne(){let[e,t]=i(),n=e.get(`status`),r=e.get(`sort`);return[{filter:A(n)?n:`all`,order:P(r)?r:`updated`,locale:e.get(`locale`)},(0,K.useCallback)((e,n,r)=>{t(t=>{let i=new URLSearchParams(t);return n===r?i.delete(e):i.set(e,n),i},{replace:!0})},[t])]}function Pe(e){let[t,n]=(0,K.useState)(new Set),r=(0,K.useCallback)(e=>{n(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n})},[]),i=(0,K.useCallback)(()=>n(t=>O(t,e)),[e]),a=(0,K.useCallback)(()=>n(new Set),[]);return{slugs:N(t,e),selected:t,toggle:r,toggleAll:i,clear:a}}function $(e){let t=c(),[n,r]=Ne(),i=(0,K.useCallback)(()=>V(t,e,n.locale),[t,e,n.locale]),{loaded:a,reload:o}=te(i,`The collection could not load`),s=a.state===`ready`?a.data.rows:null,l=(0,K.useMemo)(()=>s?D(s,n.filter,n.order):[],[s,n.filter,n.order]),u=(0,K.useMemo)(()=>j(s??[]),[s]),d=Pe((0,K.useMemo)(()=>l.map(e=>e.slug),[l])),{clear:f}=d;return{loaded:a,reload:o,choices:n,choose:(0,K.useCallback)((e,t,n)=>{e!==`sort`&&f(),r(e,t,n)},[f,r]),rows:l,counts:u,selection:d}}function Fe(e){let{hasRole:t}=s(),{selected:n,toggle:r,toggleAll:i}=e.selection;return(0,K.useMemo)(()=>t(`editor`)?{selected:n,onToggle:r,onToggleAll:i,rowLabel:e=>e.slug}:void 0,[t,n,r,i])}function Ie({name:e,data:t,view:n,focus:r}){let i=o(),{site:a}=t.site,s=(0,K.useMemo)(()=>({baseUrl:a.baseUrl,defaultLocale:t.locales.defaultLocale}),[a.baseUrl,t.locales.defaultLocale]),c=(0,K.useMemo)(()=>B(s,t.localization),[s,t.localization]),l=Fe(n);return n.counts.total===0?(0,q.jsx)(E,{icon:h,title:`No ${u(e).toLowerCase()} yet`,children:`Documents you create in this collection show up here.`}):n.rows.length===0?(0,q.jsx)(E,{icon:G,title:`No document has this status`,action:(0,q.jsx)(f,{onClick:()=>{n.choose(`status`,`all`,`all`),r.request()},children:`Show all`})}):(0,q.jsx)(z,{caption:`${u(e)} in ${t.locale}`,columns:c,rows:n.rows,rowKey:e=>e.slug,onRowClick:e=>i(H(e,s.defaultLocale)),selection:l})}function Le({name:e,data:t,view:n,focus:r,onAction:i}){let{hasRole:a}=s();return(0,q.jsxs)(`section`,{ref:r.listingRef,className:`site-panel site-focus-target`,"aria-label":`${u(e)} documents`,tabIndex:-1,children:[(0,q.jsx)(we,{filter:n.choices.filter,order:n.choices.order,locale:t.locale,locales:t.locales.supportedLocales,counts:n.counts,shown:n.rows.length,onFilter:e=>n.choose(`status`,e,`all`),onOrder:e=>n.choose(`sort`,e,`updated`),onLocale:e=>n.choose(`locale`,e,t.locales.defaultLocale)}),n.selection.slugs.length>0&&(0,q.jsx)(je,{count:n.selection.slugs.length,canPublish:a(`editor`),canDelete:a(`admin`),onAction:i,onClear:()=>{n.selection.clear(),r.request()}}),(0,q.jsx)(Ie,{name:e,data:t,view:n,focus:r})]})}function Re({dialogs:e,name:t}){let{dialog:n,close:r,changed:i}=e;return n?.kind===`import`?(0,q.jsx)(Ae,{collection:t,onClose:r,onImported:i}):n?.kind===`bulk`?(0,q.jsx)(pe,{action:n.action,collection:t,slugs:n.slugs,locale:n.locale,onClose:r,onDone:i}):null}function ze({name:e,view:t,dialogs:n,focus:r}){let{loaded:i}=t;return i.state===`loading`?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`p`,{className:`visually-hidden`,role:`status`,children:[`Loading `,u(e).toLowerCase(),`…`]}),(0,q.jsx)(`div`,{className:`site-panel`,"aria-hidden":`true`,children:(0,q.jsx)(R,{rows:4})})]}):i.state===`error`?(0,q.jsx)(k,{title:`The collection could not load`,message:i.message,onRetry:()=>{t.reload(),r.request()},panelRef:r.errorRef}):(0,q.jsx)(Le,{name:e,data:i.data,view:t,focus:r,onAction:n.openBulk})}function Be(e){let t=(0,K.useRef)(null),n=(0,K.useRef)(null),r=U(e.loaded.state,{ready:t,error:n});return(0,K.useMemo)(()=>({listingRef:t,errorRef:n,request:r}),[r])}function Ve({name:e}){let t=$(e),n=Be(t),r=Me(t,n.request),i=t.loaded.state===`ready`?t.loaded.data:null,a=ve(e,i?.locale??null);return i&&!i.collection?(0,q.jsx)(x,{}):(0,q.jsxs)(`div`,{className:`site`,"aria-busy":t.loaded.state===`loading`,children:[(0,q.jsx)(be,{name:e,data:i,notice:a.notice,onExport:()=>void a.run(),onImport:r.openImport}),(0,q.jsx)(ze,{name:e,view:t,dialogs:r,focus:n}),(0,q.jsx)(Re,{dialogs:r,name:e})]})}function He(){let{collection:e}=r();return e?(0,q.jsx)(Ve,{name:e},e):(0,q.jsx)(x,{})}export{He as CollectionPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{a as t,s as n}from"./vendor-diff-Dm2YfgXt.js";var r=t();function i(e=`secondary`,t=`md`,n){return[`ui-button`,`ui-button--${e}`,`ui-button--${t}`,n].filter(Boolean).join(` `)}function a({variant:e,size:t,icon:n,className:a,children:o,type:s=`button`,...c}){return(0,r.jsxs)(`button`,{type:s,className:i(e,t,a),...c,children:[n&&(0,r.jsx)(n,{className:`ui-button-icon`,"aria-hidden":`true`}),o]})}function o({icon:e,label:t,variant:n=`ghost`,size:a,className:o,type:s=`button`,...c}){return(0,r.jsx)(`button`,{type:s,className:i(n,a,[`ui-button--icon`,o].filter(Boolean).join(` `)),"aria-label":t,title:t,...c,children:(0,r.jsx)(e,{className:`ui-button-icon`,"aria-hidden":`true`})})}var s=e(n(),1),c=e=>e?.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase();function l(e,t,n=[]){if(t==null)throw Error(`[lucide]: iconNode is required when icon name is used`);return{name:c(e),size:24,node:t,...n.length>0?{aliases:n}:{}}}var u=e=>{let t=``,n=!1;for(let r of e){if(r===`-`||r===`_`||r<=` `){n=t.length>0;continue}t.length===0?t+=r.toLowerCase():t+=n?r.toUpperCase():r,n=!1}return t},d=e=>{let t=u(e);return t.charAt(0).toUpperCase()+t.slice(1)},f=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),p={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`};function m(e){return e!=null}function h(e,t={}){let n=t.attributeNames??{},r=e=>n[e]??e,i=e.size??e.width??p.width,a=e.size??e.height??p.height,o=e.aliases?.filter(e=>typeof e==`string`&&e.trim()!==``).map(e=>`lucide-${e}`)??[],s=[...e.name?[`lucide-${e.name}`]:[],...o],c=t.className?.split(` `).filter(Boolean)??[],l=t.includeDefaultClasses===!1?f(...c):f(`lucide`,...s,...c),u=t.absoluteStrokeWidth?Number(t.strokeWidth??p[`stroke-width`])*Number(e.size??e.width??p.width)/Number(t.size??t.width??p.width):t.strokeWidth??p[`stroke-width`];return[`svg`,{...Object.entries(p).reduce((e,[t,n])=>(e[r(t)]=n,e),{}),...`color`in t&&t.color&&{[r(`stroke`)]:t.color},...`size`in t&&m(t.size)&&{[r(`width`)]:t.size,[r(`height`)]:t.size},...`width`in t&&m(t.width)&&{[r(`width`)]:t.width},...`height`in t&&m(t.height)&&{[r(`height`)]:t.height},[r(`stroke-width`)]:u,...l&&{[r(`class`)]:l},[r(`viewBox`)]:`0 0 ${i} ${a}`,...t.hasA11yProp===!1?{[r(`aria-hidden`)]:`true`}:{},...`attributes`in t&&t.attributes},e.node.map(e=>{let[n,i,a]=e,o=t.nonScalingStroke?{[r(`vector-effect`)]:`non-scaling-stroke`,...i}:i;return a?[n,o,a]:[n,o]})]}function g(e,t={}){return h(e,{...t,attributeNames:{...t.attributeNames,class:`className`,"stroke-width":`strokeWidth`,"stroke-linecap":`strokeLinecap`,"stroke-linejoin":`strokeLinejoin`,"vector-effect":`vectorEffect`}})}var _=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},v=(0,s.createContext)({}),y=()=>(0,s.useContext)(v),b=(0,s.forwardRef)(({color:e,size:t,width:n,height:r,strokeWidth:i,absoluteStrokeWidth:a,nonScalingStroke:o,className:c=``,children:l,iconNode:u=[],icon:d={node:u,aliases:[],size:24},...p},m)=>{let{size:h=24,strokeWidth:v=2,absoluteStrokeWidth:b=!1,nonScalingStroke:x=!1,color:S=`currentColor`,className:C=``}=y()??{},w=!!l||_(p),[T,E,D=[]]=g(d,{color:e??S,width:n??t??h,height:r??t??h,strokeWidth:i??v,absoluteStrokeWidth:a??b,nonScalingStroke:o??x,className:f(C,c),hasA11yProp:w,attributes:p});return(0,s.createElement)(T,{ref:m,...E},[...D.map(([e,t])=>(0,s.createElement)(e,t)),...Array.isArray(l)?l:[l]])});function x(e,t=[],n=[]){let r=typeof e==`string`?l(e,t,n):e,i=(0,s.forwardRef)(({className:e,...t},n)=>(0,s.createElement)(b,{ref:n,icon:r,className:e,...t}));return r.name&&(i.displayName=d(r.name)),i}export{i,a as n,o as r,x as t};
|