mirror of
https://github.com/detleph/components.git
synced 2026-09-05 23:43:50 +02:00
52 lines
30 KiB
JavaScript
52 lines
30 KiB
JavaScript
var be=Object.defineProperty;var s=(e,t)=>be(e,"name",{value:t,configurable:!0});import{b as H,r as f,j as g,a as le,F as ue,R as ce}from"./jsx-runtime.9b32e5bc.js";import{j as Pe}from"./iframe.5dc793d5.js";import{m as _e}from"./make-decorator.3ed3b0eb.js";import{S as Te}from"./search.b1198e31.js";/**
|
|
* @remix-run/router v1.4.0
|
|
*
|
|
* Copyright (c) Remix Software Inc.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE.md file in the root directory of this source tree.
|
|
*
|
|
* @license MIT
|
|
*/function B(){return B=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},B.apply(this,arguments)}s(B,"_extends$1");var _;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(_||(_={}));function we(e){e===void 0&&(e={});let{initialEntries:t=["/"],initialIndex:r,v5Compat:n=!1}=e,a;a=t.map((d,y)=>h(d,typeof d=="string"?null:d.state,y===0?"default":void 0));let o=u(r==null?a.length-1:r),i=_.Pop,l=null;function u(d){return Math.min(Math.max(d,0),a.length-1)}s(u,"clampIndex");function c(){return a[o]}s(c,"getCurrentLocation");function h(d,y,v){y===void 0&&(y=null);let R=Ae(a?c().pathname:"/",d,y,v);return O(R.pathname.charAt(0)==="/","relative pathnames are not supported in memory history: "+JSON.stringify(d)),R}s(h,"createMemoryLocation");function p(d){return typeof d=="string"?d:J(d)}return s(p,"createHref"),{get index(){return o},get action(){return i},get location(){return c()},createHref:p,createURL(d){return new URL(p(d),"http://localhost")},encodeLocation(d){let y=typeof d=="string"?A(d):d;return{pathname:y.pathname||"",search:y.search||"",hash:y.hash||""}},push(d,y){i=_.Push;let v=h(d,y);o+=1,a.splice(o,a.length,v),n&&l&&l({action:i,location:v,delta:1})},replace(d,y){i=_.Replace;let v=h(d,y);a[o]=v,n&&l&&l({action:i,location:v,delta:0})},go(d){i=_.Pop;let y=u(o+d),v=a[y];o=y,l&&l({action:i,location:v,delta:d})},listen(d){return l=d,()=>{l=null}}}}s(we,"createMemoryHistory");function x(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}s(x,"invariant");function O(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}s(O,"warning");function Le(){return Math.random().toString(36).substr(2,8)}s(Le,"createKey");function Ae(e,t,r,n){return r===void 0&&(r=null),B({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?A(t):t,{state:r,key:t&&t.key||n||Le()})}s(Ae,"createLocation");function J(e){let{pathname:t="/",search:r="",hash:n=""}=e;return r&&r!=="?"&&(t+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}s(J,"createPath");function A(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}s(A,"parsePath");var Z;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Z||(Z={}));function Oe(e,t,r){r===void 0&&(r="/");let n=typeof t=="string"?A(t):t,a=X(n.pathname||"/",r);if(a==null)return null;let o=fe(e);Ie(o);let i=null;for(let l=0;i==null&&l<o.length;++l)i=We(o[l],He(a));return i}s(Oe,"matchRoutes");function fe(e,t,r,n){t===void 0&&(t=[]),r===void 0&&(r=[]),n===void 0&&(n="");let a=s((o,i,l)=>{let u={relativePath:l===void 0?o.path||"":l,caseSensitive:o.caseSensitive===!0,childrenIndex:i,route:o};u.relativePath.startsWith("/")&&(x(u.relativePath.startsWith(n),'Absolute route path "'+u.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),u.relativePath=u.relativePath.slice(n.length));let c=T([n,u.relativePath]),h=r.concat(u);o.children&&o.children.length>0&&(x(o.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+c+'".')),fe(o.children,t,h,c)),!(o.path==null&&!o.index)&&t.push({path:c,score:Ne(c,o.index),routesMeta:h})},"flattenRoute");return e.forEach((o,i)=>{var l;if(o.path===""||!((l=o.path)!=null&&l.includes("?")))a(o,i);else for(let u of he(o.path))a(o,i,u)}),t}s(fe,"flattenRoutes");function he(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,a=r.endsWith("?"),o=r.replace(/\?$/,"");if(n.length===0)return a?[o,""]:[o];let i=he(n.join("/")),l=[];return l.push(...i.map(u=>u===""?o:[o,u].join("/"))),a&&l.push(...i),l.map(u=>e.startsWith("/")&&u===""?"/":u)}s(he,"explodeOptionalSegments");function Ie(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:De(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}s(Ie,"rankRouteBranches");const ke=/^:\w+$/,Ue=3,$e=2,Me=1,je=10,Be=-2,ee=s(e=>e==="*","isSplat");function Ne(e,t){let r=e.split("/"),n=r.length;return r.some(ee)&&(n+=Be),t&&(n+=$e),r.filter(a=>!ee(a)).reduce((a,o)=>a+(ke.test(o)?Ue:o===""?Me:je),n)}s(Ne,"computeScore");function De(e,t){return e.length===t.length&&e.slice(0,-1).every((n,a)=>n===t[a])?e[e.length-1]-t[t.length-1]:0}s(De,"compareIndexes");function We(e,t){let{routesMeta:r}=e,n={},a="/",o=[];for(let i=0;i<r.length;++i){let l=r[i],u=i===r.length-1,c=a==="/"?t:t.slice(a.length)||"/",h=Fe({path:l.relativePath,caseSensitive:l.caseSensitive,end:u},c);if(!h)return null;Object.assign(n,h.params);let p=l.route;o.push({params:n,pathname:T([a,h.pathname]),pathnameBase:ze(T([a,h.pathnameBase])),route:p}),h.pathnameBase!=="/"&&(a=T([a,h.pathnameBase]))}return o}s(We,"matchRouteBranch");function Ve(e,t){t===void 0&&(t={});let r=e;r.endsWith("*")&&r!=="*"&&!r.endsWith("/*")&&(O(!1,'Route path "'+r+'" will be treated as if it were '+('"'+r.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+r.replace(/\*$/,"/*")+'".')),r=r.replace(/\*$/,"/*"));const n=r.startsWith("/")?"/":"",a=r.split(/\/+/).map((o,i,l)=>{if(i===l.length-1&&o==="*")return t["*"];const c=o.match(/^:(\w+)(\??)$/);if(c){const[,h,p]=c;let m=t[h];return p==="?"?m==null?"":m:(m==null&&x(!1,'Missing ":'+h+'" param'),m)}return o.replace(/\?$/g,"")}).filter(o=>!!o);return n+a.join("/")}s(Ve,"generatePath");function Fe(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=Ge(e.path,e.caseSensitive,e.end),a=t.match(r);if(!a)return null;let o=a[0],i=o.replace(/(.)\/+$/,"$1"),l=a.slice(1);return{params:n.reduce((c,h,p)=>{if(h==="*"){let m=l[p]||"";i=o.slice(0,o.length-m.length).replace(/(.)\/+$/,"$1")}return c[h]=Je(l[p]||"",h),c},{}),pathname:o,pathnameBase:i,pattern:e}}s(Fe,"matchPath");function Ge(e,t,r){t===void 0&&(t=!1),r===void 0&&(r=!0),O(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 n=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^$?{}|()[\]]/g,"\\$&").replace(/\/:(\w+)/g,(i,l)=>(n.push(l),"/([^\\/]+)"));return e.endsWith("*")?(n.push("*"),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),n]}s(Ge,"compilePath");function He(e){try{return decodeURI(e)}catch(t){return O(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}s(He,"safelyDecodeURI");function Je(e,t){try{return decodeURIComponent(e)}catch(r){return O(!1,'The value for the URL param "'+t+'" will not be decoded because'+(' the string "'+e+'" is a malformed URL segment. This is probably')+(" due to a bad percent encoding ("+r+").")),e}}s(Je,"safelyDecodeURIComponent");function X(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&n!=="/"?null:e.slice(r)||"/"}s(X,"stripBasename");function Ke(e,t){t===void 0&&(t="/");let{pathname:r,search:n="",hash:a=""}=typeof e=="string"?A(e):e;return{pathname:r?r.startsWith("/")?r:Ye(r,t):t,search:qe(n),hash:Xe(a)}}s(Ke,"resolvePath");function Ye(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?r.length>1&&r.pop():a!=="."&&r.push(a)}),r.length>1?r.join("/"):"/"}s(Ye,"resolvePathname");function V(e,t,r,n){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}s(V,"getInvalidPathError");function pe(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}s(pe,"getPathContributingMatches");function de(e,t,r,n){n===void 0&&(n=!1);let a;typeof e=="string"?a=A(e):(a=B({},e),x(!a.pathname||!a.pathname.includes("?"),V("?","pathname","search",a)),x(!a.pathname||!a.pathname.includes("#"),V("#","pathname","hash",a)),x(!a.search||!a.search.includes("#"),V("#","search","hash",a)));let o=e===""||a.pathname==="",i=o?"/":a.pathname,l;if(n||i==null)l=r;else{let p=t.length-1;if(i.startsWith("..")){let m=i.split("/");for(;m[0]==="..";)m.shift(),p-=1;a.pathname=m.join("/")}l=p>=0?t[p]:"/"}let u=Ke(a,l),c=i&&i!=="/"&&i.endsWith("/"),h=(o||i===".")&&r.endsWith("/");return!u.pathname.endsWith("/")&&(c||h)&&(u.pathname+="/"),u}s(de,"resolveTo");const T=s(e=>e.join("/").replace(/\/\/+/g,"/"),"joinPaths"),ze=s(e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),"normalizePathname"),qe=s(e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,"normalizeSearch"),Xe=s(e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,"normalizeHash");function Qe(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}s(Qe,"isRouteErrorResponse");const Ze=["post","put","patch","delete"];[...Ze];/**
|
|
* React Router v6.9.0
|
|
*
|
|
* Copyright (c) Remix Software Inc.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE.md file in the root directory of this source tree.
|
|
*
|
|
* @license MIT
|
|
*/function et(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}s(et,"isPolyfill");const tt=typeof Object.is=="function"?Object.is:et,{useState:rt,useEffect:nt,useLayoutEffect:at,useDebugValue:ot}=H;function it(e,t,r){const n=t(),[{inst:a},o]=rt({inst:{value:n,getSnapshot:t}});return at(()=>{a.value=n,a.getSnapshot=t,F(a)&&o({inst:a})},[e,n,t]),nt(()=>(F(a)&&o({inst:a}),e(s(()=>{F(a)&&o({inst:a})},"handleStoreChange"))),[e]),ot(n),n}s(it,"useSyncExternalStore$2");function F(e){const t=e.getSnapshot,r=e.value;try{const n=t();return!tt(r,n)}catch{return!0}}s(F,"checkIfSnapshotChanged");function st(e,t,r){return t()}s(st,"useSyncExternalStore$1");const lt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",ut=!lt,ct=ut?st:it;"useSyncExternalStore"in H&&(e=>e.useSyncExternalStore)(H);const me=f.exports.createContext(null),ye=f.exports.createContext(null),I=f.exports.createContext(null),k=f.exports.createContext(null),P=f.exports.createContext({outlet:null,matches:[]}),ve=f.exports.createContext(null);function K(){return K=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},K.apply(this,arguments)}s(K,"_extends");function ft(e,t){let{relative:r}=t===void 0?{}:t;U()||x(!1);let{basename:n,navigator:a}=f.exports.useContext(I),{hash:o,pathname:i,search:l}=xe(e,{relative:r}),u=i;return n!=="/"&&(u=i==="/"?n:T([n,i])),a.createHref({pathname:u,search:l,hash:o})}s(ft,"useHref");function U(){return f.exports.useContext(k)!=null}s(U,"useInRouterContext");function w(){return U()||x(!1),f.exports.useContext(k).location}s(w,"useLocation");function ht(){return f.exports.useContext(k).navigationType}s(ht,"useNavigationType");function ge(){U()||x(!1);let{basename:e,navigator:t}=f.exports.useContext(I),{matches:r}=f.exports.useContext(P),{pathname:n}=w(),a=JSON.stringify(pe(r).map(l=>l.pathnameBase)),o=f.exports.useRef(!1);return f.exports.useEffect(()=>{o.current=!0}),f.exports.useCallback(function(l,u){if(u===void 0&&(u={}),!o.current)return;if(typeof l=="number"){t.go(l);return}let c=de(l,JSON.parse(a),n,u.relative==="path");e!=="/"&&(c.pathname=c.pathname==="/"?e:T([e,c.pathname])),(u.replace?t.replace:t.push)(c,u.state,u)},[e,t,a,n])}s(ge,"useNavigate");function pt(){let{matches:e}=f.exports.useContext(P),t=e[e.length-1];return t?t.params:{}}s(pt,"useParams");function xe(e,t){let{relative:r}=t===void 0?{}:t,{matches:n}=f.exports.useContext(P),{pathname:a}=w(),o=JSON.stringify(pe(n).map(i=>i.pathnameBase));return f.exports.useMemo(()=>de(e,JSON.parse(o),a,r==="path"),[e,o,a,r])}s(xe,"useResolvedPath");function dt(e,t){U()||x(!1);let{navigator:r}=f.exports.useContext(I),n=f.exports.useContext(ye),{matches:a}=f.exports.useContext(P),o=a[a.length-1],i=o?o.params:{};o&&o.pathname;let l=o?o.pathnameBase:"/";o&&o.route;let u=w(),c;if(t){var h;let v=typeof t=="string"?A(t):t;l==="/"||((h=v.pathname)==null?void 0:h.startsWith(l))||x(!1),c=v}else c=u;let p=c.pathname||"/",m=l==="/"?p:p.slice(l.length)||"/",d=Oe(e,{pathname:m}),y=vt(d&&d.map(v=>Object.assign({},v,{params:Object.assign({},i,v.params),pathname:T([l,r.encodeLocation?r.encodeLocation(v.pathname).pathname:v.pathname]),pathnameBase:v.pathnameBase==="/"?l:T([l,r.encodeLocation?r.encodeLocation(v.pathnameBase).pathname:v.pathnameBase])})),a,n||void 0);return t&&y?g(k.Provider,{value:{location:K({pathname:"/",search:"",hash:"",state:null,key:"default"},c),navigationType:_.Pop},children:y}):y}s(dt,"useRoutes");function mt(){let e=Ct(),t=Qe(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null;return le(ue,{children:[g("h2",{children:"Unexpected Application Error!"}),g("h3",{style:{fontStyle:"italic"},children:t}),r?g("pre",{style:{padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"},children:r}):null,null]})}s(mt,"DefaultErrorComponent");class Se extends f.exports.Component{constructor(t){super(t),this.state={location:t.location,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,r){return r.location!==t.location?{error:t.error,location:t.location}:{error:t.error||r.error,location:r.location}}componentDidCatch(t,r){console.error("React Router caught the following error during render",t,r)}render(){return this.state.error?g(P.Provider,{value:this.props.routeContext,children:g(ve.Provider,{value:this.state.error,children:this.props.component})}):this.props.children}}s(Se,"RenderErrorBoundary");function yt(e){let{routeContext:t,match:r,children:n}=e,a=f.exports.useContext(me);return a&&a.static&&a.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=r.route.id),g(P.Provider,{value:t,children:n})}s(yt,"RenderedRoute");function vt(e,t,r){if(t===void 0&&(t=[]),e==null)if(r!=null&&r.errors)e=r.matches;else return null;let n=e,a=r==null?void 0:r.errors;if(a!=null){let o=n.findIndex(i=>i.route.id&&(a==null?void 0:a[i.route.id]));o>=0||x(!1),n=n.slice(0,Math.min(n.length,o+1))}return n.reduceRight((o,i,l)=>{let u=i.route.id?a==null?void 0:a[i.route.id]:null,c=null;r&&(i.route.ErrorBoundary?c=f.exports.createElement(i.route.ErrorBoundary,null):i.route.errorElement?c=i.route.errorElement:c=g(mt,{}));let h=t.concat(n.slice(0,l+1)),p=s(()=>{let m=o;return u?m=c:i.route.Component?m=f.exports.createElement(i.route.Component,null):i.route.element&&(m=i.route.element),g(yt,{match:i,routeContext:{outlet:o,matches:h},children:m})},"getChildren");return r&&(i.route.ErrorBoundary||i.route.errorElement||l===0)?g(Se,{location:r.location,component:c,error:u,children:p(),routeContext:{outlet:null,matches:h}}):p()},null)}s(vt,"_renderMatches");var te;(function(e){e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator"})(te||(te={}));var N;(function(e){e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator"})(N||(N={}));function gt(e){let t=f.exports.useContext(ye);return t||x(!1),t}s(gt,"useDataRouterState");function xt(e){let t=f.exports.useContext(P);return t||x(!1),t}s(xt,"useRouteContext");function St(e){let t=xt(),r=t.matches[t.matches.length-1];return r.route.id||x(!1),r.route.id}s(St,"useCurrentRouteId");function Ct(){var e;let t=f.exports.useContext(ve),r=gt(N.UseRouteError),n=St(N.UseRouteError);return t||((e=r.errors)==null?void 0:e[n])}s(Ct,"useRouteError");function Rt(e){let{basename:t,children:r,initialEntries:n,initialIndex:a}=e,o=f.exports.useRef();o.current==null&&(o.current=we({initialEntries:n,initialIndex:a,v5Compat:!0}));let i=o.current,[l,u]=f.exports.useState({action:i.action,location:i.location});return f.exports.useLayoutEffect(()=>i.listen(u),[i]),g(Et,{basename:t,children:r,location:l.location,navigationType:l.action,navigator:i})}s(Rt,"MemoryRouter");function Y(e){x(!1)}s(Y,"Route");function Et(e){let{basename:t="/",children:r=null,location:n,navigationType:a=_.Pop,navigator:o,static:i=!1}=e;U()&&x(!1);let l=t.replace(/^\/*/,"/"),u=f.exports.useMemo(()=>({basename:l,navigator:o,static:i}),[l,o,i]);typeof n=="string"&&(n=A(n));let{pathname:c="/",search:h="",hash:p="",state:m=null,key:d="default"}=n,y=f.exports.useMemo(()=>{let v=X(c,l);return v==null?null:{location:{pathname:v,search:h,hash:p,state:m,key:d},navigationType:a}},[l,c,h,p,m,d,a]);return y==null?null:g(I.Provider,{value:u,children:g(k.Provider,{children:r,value:y})})}s(Et,"Router");function bt(e){let{children:t,location:r}=e,n=f.exports.useContext(me),a=n&&!t?n.router.routes:z(t);return dt(a,r)}s(bt,"Routes");var re;(function(e){e[e.pending=0]="pending",e[e.success=1]="success",e[e.error=2]="error"})(re||(re={}));new Promise(()=>{});function z(e,t){t===void 0&&(t=[]);let r=[];return f.exports.Children.forEach(e,(n,a)=>{if(!f.exports.isValidElement(n))return;if(n.type===f.exports.Fragment){r.push.apply(r,z(n.props.children,t));return}n.type!==Y&&x(!1),!n.props.index||!n.props.children||x(!1);let o=[...t,a],i={id:n.props.id||o.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(i.children=z(n.props.children,o)),r.push(i)}),r}s(z,"createRoutesFromChildren");/**
|
|
* React Router DOM v6.9.0
|
|
*
|
|
* Copyright (c) Remix Software Inc.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE.md file in the root directory of this source tree.
|
|
*
|
|
* @license MIT
|
|
*/function Pt(e,t){if(e==null)return{};var r={},n=Object.keys(e),a,o;for(o=0;o<n.length;o++)a=n[o],!(t.indexOf(a)>=0)&&(r[a]=e[a]);return r}s(Pt,"_objectWithoutPropertiesLoose");function _t(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}s(_t,"isModifiedEvent");function Tt(e,t){return e.button===0&&(!t||t==="_self")&&!_t(e)}s(Tt,"shouldProcessLinkClick");function q(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map(a=>[r,a]):[[r,n]])},[]))}s(q,"createSearchParams");function wt(e,t){let r=q(e);if(t)for(let n of t.keys())r.has(n)||t.getAll(n).forEach(a=>{r.append(n,a)});return r}s(wt,"getSearchParamsForLocation");const Lt=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset"],At=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Ot=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,It=f.exports.forwardRef(s(function(t,r){let{onClick:n,relative:a,reloadDocument:o,replace:i,state:l,target:u,to:c,preventScrollReset:h}=t,p=Pt(t,Lt),{basename:m}=f.exports.useContext(I),d,y=!1;if(typeof c=="string"&&Ot.test(c)&&(d=c,At)){let S=new URL(window.location.href),b=c.startsWith("//")?new URL(S.protocol+c):new URL(c),L=X(b.pathname,m);b.origin===S.origin&&L!=null?c=L+b.search+b.hash:y=!0}let v=ft(c,{relative:a}),R=kt(c,{replace:i,state:l,target:u,preventScrollReset:h,relative:a});function E(S){n&&n(S),S.defaultPrevented||R(S)}return s(E,"handleClick"),g("a",{...p,href:d||v,onClick:y||o?n:E,ref:r,target:u})},"LinkWithRef"));var ne;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmitImpl="useSubmitImpl",e.UseFetcher="useFetcher"})(ne||(ne={}));var ae;(function(e){e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(ae||(ae={}));function kt(e,t){let{target:r,replace:n,state:a,preventScrollReset:o,relative:i}=t===void 0?{}:t,l=ge(),u=w(),c=xe(e,{relative:i});return f.exports.useCallback(h=>{if(Tt(h,r)){h.preventDefault();let p=n!==void 0?n:J(u)===J(c);l(e,{replace:p,state:a,preventScrollReset:o,relative:i})}},[u,l,c,n,a,r,e,o,i])}s(kt,"useLinkClickHandler");function Ut(e){let t=f.exports.useRef(q(e)),r=f.exports.useRef(!1),n=w(),a=f.exports.useMemo(()=>wt(n.search,r.current?null:t.current),[n.search]),o=ge(),i=f.exports.useCallback((l,u)=>{const c=q(typeof l=="function"?l(a):l);r.current=!0,o("?"+c,u)},[o,a]);return[a,i]}s(Ut,"useSearchParams");var $="storybook/react-router-v6",$t="reactRouter",C={CLEAR:"".concat($,"/clear"),NAVIGATION:"".concat($,"/navigation"),STORY_LOADED:"".concat($,"/story-loaded"),ROUTE_MATCHES:"".concat($,"/route-matches")},Mt=s(function(){var t=w();return"".concat(t.pathname).concat(t.search).concat(t.hash)},"useCurrentUrl"),Ce=ce.createContext([]),Re=s(function(){return ce.useContext(Ce)},"useDeepRouteMatches");function jt(e,t){return Wt(e)||Dt(e,t)||Nt(e,t)||Bt()}s(jt,"_slicedToArray$2");function Bt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}s(Bt,"_nonIterableRest$2");function Nt(e,t){if(!!e){if(typeof e=="string")return oe(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return oe(e,t)}}s(Nt,"_unsupportedIterableToArray$2");function oe(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}s(oe,"_arrayLikeToArray$2");function Dt(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],a=!0,o=!1,i,l;try{for(r=r.call(e);!(a=(i=r.next()).done)&&(n.push(i.value),!(t&&n.length===t));a=!0);}catch(u){o=!0,l=u}finally{try{!a&&r.return!=null&&r.return()}finally{if(o)throw l}}return n}}s(Dt,"_iterableToArrayLimit$2");function Wt(e){if(Array.isArray(e))return e}s(Wt,"_arrayWithHoles$2");var Vt=s(function(){var t=w(),r=pt(),n=Ut(),a=jt(n,1),o=a[0],i=ht(),l=Re(),u={};o.forEach(function(p,m){u[m]=p});var c=Mt(),h=l.map(function(p){return[p.route.path,p.params]});return function(p){switch(p){case C.STORY_LOADED:{var m={url:c,path:t.pathname,routeParams:r,searchParams:u,routeMatches:h,hash:t.hash,routeState:t.state};return{key:t.key,type:C.STORY_LOADED,data:m}}case C.NAVIGATION:{var d={url:c,path:t.pathname,routeParams:r,searchParams:u,hash:t.hash,routeState:t.state,routeMatches:h,navigationType:i};return{key:t.key,type:C.NAVIGATION,data:d}}case C.ROUTE_MATCHES:return{key:"matches-".concat(t.key,"-").concat(h.length),type:C.ROUTE_MATCHES,data:{matches:h}}}}},"useRouterEvent");function Ft(){var e={};return e.promise=new Promise(function(t,r){e.resolve=t,e.reject=r}),e}s(Ft,"defer");function G(e,t){return Kt(e)||Jt(e,t)||Ht(e,t)||Gt()}s(G,"_slicedToArray$1");function Gt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}s(Gt,"_nonIterableRest$1");function Ht(e,t){if(!!e){if(typeof e=="string")return ie(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ie(e,t)}}s(Ht,"_unsupportedIterableToArray$1");function ie(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}s(ie,"_arrayLikeToArray$1");function Jt(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],a=!0,o=!1,i,l;try{for(r=r.call(e);!(a=(i=r.next()).done)&&(n.push(i.value),!(t&&n.length===t));a=!0);}catch(u){o=!0,l=u}finally{try{!a&&r.return!=null&&r.return()}finally{if(o)throw l}}return n}}s(Jt,"_iterableToArrayLimit$1");function Kt(e){if(Array.isArray(e))return e}s(Kt,"_arrayWithHoles$1");var Yt=s(function(t){var r=t.children,n=Pe.getChannel(),a=w(),o=f.exports.useState(),i=G(o,2),l=i[0],u=i[1],c=f.exports.useState(!1),h=G(c,2),p=h[0],m=h[1],d=f.exports.useState([]),y=G(d,2),v=y[0],R=y[1],E=Vt(),S=Re(),b=f.exports.useRef(Ft());return f.exports.useLayoutEffect(function(){u(a)}),f.exports.useEffect(function(){p&&b.current.resolve()},[p]),f.exports.useEffect(function(){R(S);var L=setTimeout(function(){p||(m(!0),n.emit(C.STORY_LOADED,E(C.STORY_LOADED)))},0);return function(){return clearTimeout(L)}},[p,S]),f.exports.useEffect(function(){l!==void 0&&l.key!==a.key&&b.current.promise.then(function(){n.emit(C.NAVIGATION,E(C.NAVIGATION))})},[a]),f.exports.useEffect(function(){p&&S.length>v.length&&(R(S),n.emit(C.ROUTE_MATCHES,E(C.ROUTE_MATCHES)))},[S]),g(ue,{children:r})},"RouterLogger");function zt(e,t){return Zt(e)||Qt(e,t)||Xt(e,t)||qt()}s(zt,"_slicedToArray");function qt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}s(qt,"_nonIterableRest");function Xt(e,t){if(!!e){if(typeof e=="string")return se(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return se(e,t)}}s(Xt,"_unsupportedIterableToArray");function se(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}s(se,"_arrayLikeToArray");function Qt(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],a=!0,o=!1,i,l;try{for(r=r.call(e);!(a=(i=r.next()).done)&&(n.push(i.value),!(t&&n.length===t));a=!0);}catch(u){o=!0,l=u}finally{try{!a&&r.return!=null&&r.return()}finally{if(o)throw l}}return n}}s(Qt,"_iterableToArrayLimit");function Zt(e){if(Array.isArray(e))return e}s(Zt,"_arrayWithHoles");var er=s(function(t){var r,n=t.children,a=t.browserPath,o=t.routePath,i=t.routeParams,l=t.searchParams,u=t.routeState,c=t.outlet,h=Ve(o,i),p=new URLSearchParams(l).toString(),m=p.length>0?"?".concat(p):"",d=f.exports.useState([]),y=zt(d,2),v=y[0],R=y[1];P.Provider._context=new Proxy((r=P.Provider._context)!==null&&r!==void 0?r:{},{set:s(function(b,L,W){return L==="_currentValue"&&R(function(Q){return W.matches.length>Q.length?W.matches:Q}),Reflect.set(b,L,W)},"set")});var E={search:m,state:u};return a!==void 0&&(E.pathname=a),a===void 0&&h!==""&&(E.pathname=h),g(Ce.Provider,{value:v,children:g(Rt,{initialEntries:[E],children:g(bt,{children:g(Y,{path:o,element:g(Yt,{children:n}),children:c&&g(Y,{index:!0,element:c})})})})})},"StoryRouter");function D(e){return D=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},D(e)}s(D,"_typeof");var tr=_e({name:"withRouter",parameterName:$t,wrapper:s(function(t,r,n){var a=n.parameters,o=a===void 0?{}:a,i=o.routePath,l=i===void 0?"*":i,u=o.routeParams,c=o.routeState,h=o.searchParams,p=o.outlet,m=o.browserPath;if(typeof l!="string")throw new Error("React Router decorator : `path` must be a string");if(u!==void 0&&D(u)!=="object")throw new Error("React Router decorator : `params` must be an object with strings as values");if(h!==void 0&&D(h)!=="object")throw new Error("React Router decorator : `search` must be an object with strings as values");return g(er,{browserPath:m,routePath:l,routeParams:u,searchParams:h,routeState:c,outlet:p,children:t(r)})},"wrapper")});module&&module.hot&&module.hot.decline&&module.hot.decline();const rr="_tile_1c4l6_1",nr="_background_1c4l6_12",ar="_textContainer_1c4l6_40",or="_iconContainer_1c4l6_46",M={tile:rr,background:nr,textContainer:ar,iconContainer:or},j=s(({text:e,icon:t,linkTo:r,onClick:n})=>le(It,{to:r,onClick:n,className:M.tile,children:[g("div",{className:M.background}),g("span",{className:M.iconContainer,children:g(t,{})}),g("span",{className:M.textContainer,children:e})]}),"Tile"),Ee=j;try{j.displayName="Tile",j.__docgenInfo={description:"",displayName:"Tile",props:{text:{defaultValue:null,description:"",name:"text",required:!0,type:{name:"string"}},icon:{defaultValue:null,description:"",name:"icon",required:!0,type:{name:"FunctionComponent<Component<SVGProps<SVGSVGElement>>> & { title?: string | undefined; }"}},linkTo:{defaultValue:null,description:"",name:"linkTo",required:!0,type:{name:"string"}},onClick:{defaultValue:null,description:"",name:"onClick",required:!1,type:{name:"(() => unknown)"}}}},typeof STORYBOOK_REACT_CLASSES<"u"&&(STORYBOOK_REACT_CLASSES["src/components/tile/Tile.tsx#Tile"]={docgenInfo:j.__docgenInfo,name:"Tile",path:"src/components/tile/Tile.tsx#Tile"})}catch{}const pr={parameters:{storySource:{source:`import React from "react";
|
|
import { withRouter } from "storybook-addon-react-router-v6";
|
|
// @ts-ignore
|
|
import { ReactComponent as Icon } from "../assets/search.svg";
|
|
|
|
import { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
|
|
import Tile from "../components/tile";
|
|
import { Link } from "react-router-dom";
|
|
|
|
export default { title: "Tile", component: Tile, decorators: [withRouter] } as ComponentMeta<typeof Tile>;
|
|
|
|
const Template: ComponentStory<typeof Tile> = (args) => <Tile {...args} />;
|
|
|
|
export const defaultTile = Template.bind({});
|
|
|
|
defaultTile.args = {
|
|
icon: Icon,
|
|
};
|
|
`,locationsMap:{"default-tile":{startLoc:{col:46,line:13},endLoc:{col:74,line:13},startBody:{col:46,line:13},endBody:{col:74,line:13}}}}},title:"Tile",component:Ee,decorators:[tr]},ir=s(e=>g(Ee,{...e}),"Template"),sr=ir.bind({});sr.args={icon:Te};const dr=["defaultTile"];export{dr as __namedExportsOrder,pr as default,sr as defaultTile};
|
|
//# sourceMappingURL=Tile.stories.2b08f929.js.map
|