reactiveadmin 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +1 -1
- data/lib/reactive_admin/aa/input.rb +26 -0
- data/lib/reactive_admin/aa/v3/form_hooks.rb +38 -0
- data/lib/reactive_admin/aa/v3/forms.rb +9 -1
- data/lib/reactive_admin/aa/v3/recorders.rb +51 -0
- data/lib/reactive_admin/aa/v3/views.rb +20 -1
- data/lib/reactive_admin/aa/v3.rb +2 -0
- data/lib/reactive_admin/aa/v4.rb +10 -0
- data/lib/reactive_admin/aa.rb +2 -1
- data/lib/reactive_admin/engine.rb +6 -0
- data/lib/reactive_admin/form_field.rb +3 -3
- data/lib/reactive_admin/form_recorder.rb +8 -10
- data/lib/reactive_admin/html_nodes.rb +17 -16
- data/lib/reactive_admin/index_recorder.rb +9 -11
- data/lib/reactive_admin/open_api/page_doc.rb +2 -2
- data/lib/reactive_admin/open_api/parts.rb +3 -0
- data/lib/reactive_admin/open_api/resource_doc.rb +1 -8
- data/lib/reactive_admin/page_forms.rb +3 -26
- data/lib/reactive_admin/page_payload.rb +4 -6
- data/lib/reactive_admin/rspec.rb +12 -2
- data/lib/reactive_admin/show_payload.rb +4 -6
- data/lib/reactive_admin/style_sources.rb +1 -1
- data/lib/reactive_admin/template_form.rb +12 -27
- data/lib/reactive_admin/ui/assets.rb +19 -1
- data/lib/reactive_admin/ui/helper.rb +2 -2
- data/lib/reactive_admin/version.rb +1 -1
- data/openapi/core.yaml +59 -5
- data/vendor/client/assets/{ActionPage-XUYorI8E.js → ActionPage-B_eluF5e.js} +1 -1
- data/vendor/client/assets/{ActionView-BsZFcsgp.js → ActionView-CGcC3D3z.js} +1 -1
- data/vendor/client/assets/{CommandPalette-C59HT1ip.js → CommandPalette-IF4e0T2d.js} +1 -1
- data/vendor/client/assets/{DatePicker-DuaK0iMg.js → DatePicker-CgNVJIOj.js} +1 -1
- data/vendor/client/assets/DateRangeCalendar-BbIDUkc0.js +1 -0
- data/vendor/client/assets/{DegradedNotice-DiH5n2DO.js → DegradedNotice-DPH_YfUt.js} +1 -1
- data/vendor/client/assets/{FormDialog-pmYl8Eov.js → FormDialog-DzHVGQ6M.js} +1 -1
- data/vendor/client/assets/{FormSkeleton-DuSBZO3C.js → FormSkeleton-5eT0T2pe.js} +1 -1
- data/vendor/client/assets/{FrameView-zmUeDO8d.js → FrameView-CczSy0lF.js} +1 -1
- data/vendor/client/assets/{GroupOverview-DI5T3k5K.js → GroupOverview-BgyZuNFr.js} +1 -1
- data/vendor/client/assets/{InlineForm-CMEIMgeh.js → InlineForm-D0e87tnu.js} +1 -1
- data/vendor/client/assets/{JsonDiff-o7JWr7CH.js → JsonDiff-CAW7eyGU.js} +1 -1
- data/vendor/client/assets/{JsonEditor-D4VXdlEx.js → JsonEditor-DQGi6MrZ.js} +1 -1
- data/vendor/client/assets/{JsonView-BrJLDmSN.js → JsonView-WqpIBVJn.js} +1 -1
- data/vendor/client/assets/{MobileMenu-GAeFOeEb.js → MobileMenu-BmrGFN_r.js} +1 -1
- data/vendor/client/assets/{Node-SQl61V4K.js → Node-BFhcTc_1.js} +2 -2
- data/vendor/client/assets/{PageView-C-laNEPZ.js → PageView-DJSTdX6o.js} +1 -1
- data/vendor/client/assets/{ResourceForm-BPjsoCY6.js → ResourceForm-7FgpxGHE.js} +1 -1
- data/vendor/client/assets/{ResourceIndex-COezAw5t.js → ResourceIndex-BXnX5xpb.js} +3 -3
- data/vendor/client/assets/{ResourceOrPage-CRZGCY84.js → ResourceOrPage-54vonIqh.js} +1 -1
- data/vendor/client/assets/{ResourceShow-DweRXn18.js → ResourceShow-BAO32hZ2.js} +1 -1
- data/vendor/client/assets/{Sidebars-CsB9rFqX.js → Sidebars-C3SKSr0y.js} +1 -1
- data/vendor/client/assets/{breadcrumb-DSA3Tlyd.js → breadcrumb-FT076GDh.js} +1 -1
- data/vendor/client/assets/{calendar-BoyMpJIf.js → calendar-C7i0aj0N.js} +1 -1
- data/vendor/client/assets/{command-CMuk0oAt.js → command-Cxg-I-G2.js} +1 -1
- data/vendor/client/assets/{frames-C9gPCc3N.js → frames-5gaTmR-V.js} +1 -1
- data/vendor/client/assets/{index-B51aUaAY.js → index-BX4ymNYp.js} +2 -2
- data/vendor/client/assets/{json-oTp7Q-d-.js → json-DJQxJYgz.js} +1 -1
- data/vendor/client/assets/{media-D4a_En8R.js → media-D9RvvA8H.js} +1 -1
- data/vendor/client/assets/{popover-CDtI9R8Q.js → popover-C_DGv69u.js} +1 -1
- data/vendor/client/assets/{rich-BQc_q5T7.js → rich-Dl2s62g4.js} +1 -1
- data/vendor/client/assets/{select-C43qDA3k.js → select-DWKulrU7.js} +1 -1
- data/vendor/client/assets/{sheet-BPl2n-4n.js → sheet-CihU0Mcq.js} +1 -1
- data/vendor/client/assets/{useRecordForm-X_DExEP2.js → useRecordForm-BOmRWZbo.js} +1 -1
- data/vendor/client/index.html +1 -1
- data/vendor/client/manifest.json +110 -110
- data/vendor/client/reactiveadmin-client.json +1 -1
- metadata +38 -35
- data/vendor/client/assets/DateRangeCalendar-B2BDsG-X.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./vendor-react-C1iE8mnY.js";import{n as r}from"./dist-IW4yX942.js";import{l as i}from"./button-CvZ4_DFC.js";import{S as a,h as o,x as s}from"./Node-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./vendor-react-C1iE8mnY.js";import{n as r}from"./dist-IW4yX942.js";import{l as i}from"./button-CvZ4_DFC.js";import{S as a,h as o,x as s}from"./Node-BFhcTc_1.js";var c={name:`link-2`,size:24,node:[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]};c.node;var l=i(c),u=n(),d=e(t()),f=()=>{},p=e=>Array.isArray(e)?e:[e],m=e=>typeof e==`object`&&!!e,h=e=>typeof e==`object`&&!!e&&!Array.isArray(e),g=e=>e!=null&&(typeof e==`object`||typeof e==`function`)&&typeof e.then==`function`,_=e=>e&&typeof e==`object`&&`type`in e&&`target`in e&&`preventDefault`in e&&typeof e.preventDefault==`function`,v=(e,t)=>{if(typeof e!=`string`)return null;let n=t.filter(t=>t instanceof Object&&t.enum&&t.values.includes(e)&&t.matchPriority);return n.sort((e,t)=>(t.matchPriority??0)-(e.matchPriority??0)),n[0]??null},y=e=>{if(e!==b){if(e&&typeof e==`object`)for(let t in e){let n=e[t],r=y(n);r!==n&&(e[t]=r)}return e}},b=`__undefined__`,x=e=>e.split(/(\.|\[\d+\])/).filter(e=>e!==`.`&&e!==``).map(e=>{let t=/\[(\d+)\]/.exec(e);return t?Number(t[1]):e}),S=e=>typeof e==`string`?e:typeof e==`number`?String(e):e.reduce((e,t)=>typeof t==`number`?`${e}[${t}]`:e===``?t:`${e}.${t}`,``),C=e=>e.length===1&&e[0]===``?`\0`:e.map(e=>encodeURIComponent(String(e))).join(`/`),w=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),T=(e,t)=>e.length>=t.length&&t.every((t,n)=>t===e[n]),E=(e,t,n,r,i)=>{if(!r)throw Error(i??`Invalid property path: ${t}\nCouldn't access "${n}" in ${JSON.stringify(e)}`)},D=e=>Array.isArray(e),O=(e,t)=>e.filter((e,n)=>n!==t),k=(e,t,n,r={})=>{let{remove:i=!1,createNew:a=!0,noError:o=!1}=r,s=e,c=S(t),l={...r,remove:i,createNew:a,noError:o,fullData:s,fullPath:c},u=Array.isArray(t)?t:x(t);return D(e)&&i&&u.length===1?O(e,u[0]):A(e,u,n,l)},A=(e,t,n,r)=>{let i=h(e)?{...e}:null,a=D(e)?[...e]:null;if(t.length===0)return e;if(!i&&!a)throw Error(`Can't assign property -- invalid input object`);let{createNew:o,remove:s,noError:c,fullData:l,fullPath:u}=r,d=t[0];if(a&&typeof d==`string`)return a.map(e=>A(e,t,n,r));if(t.length===1)return i&&typeof d==`string`?j(i,d,n,r)??i:a&&typeof d==`number`?(M(a,d,n,r),a):(E(l,u,d,c),e);let f=i||a||[];if(s&&t.length===2&&typeof t[1]==`number`){let e=f[d],n=t[1];return D(e)?f[d]=O(e,n):E(l,u,d,c,`Trying to remove an indexed item from an object that is not an array`),f}let p=t.slice(1);if(d in e){if(m=f[d],!D(m)&&!h(m)){if(!o)return E(l,u,d,c),f;f[d]={}}return f[d]=A(f[d],p,n,r),f}var m;if(o){let e=typeof p[0]==`number`?[]:{};if(i)return f[d]=e,f[d]=A(f[d],p,n,r),f;if(a&&Array.isArray(f)){f.push(e);let t=f.length-1;return f[t]=A(f[t],p,n,r),f}}return E(l,u,d,c),f},j=(e,t,n,r)=>{let{remove:i,createNew:a,noError:o,insertAfter:s,insertBefore:c,fullData:l,fullPath:u}=r;if(c!==void 0||s!==void 0){let r=Object.entries(e),i;return i=typeof c==`number`?c:typeof s==`number`?s:r.findIndex(([e])=>e===(c??s)),s!==void 0&&i++,r.splice(i,0,[t,n]),Object.fromEntries(r)}let d=t in e;i?d?delete e[t]:E(l,u,t,o):a||d?e[t]=n:E(l,u,t,o)},M=(e,t,n,r)=>{let{noError:i,fullData:a,fullPath:o,createNew:s,insert:c}=r;c&&e.splice(t,0,n),t in e?e[t]=n:s?e.push(n):E(a,o,t,i)},N=(e,t,n)=>{let r=Array.isArray(t)?t:x(t);if(r.length===0)return e;let i=r[0];if(Array.isArray(e)&&typeof i!=`number`&&e.length>0)return e.map(e=>N(e,r,n));if(typeof e!=`object`||!e||!(i in e))return P(e,i,n);let a=e[i];return r.length===1?a:N(a,r.slice(1),n)},P=(e,t,n)=>{if(n===void 0)throw Error(`Unable to extract object property\nLooking for property: ${t}\nIn object: ${JSON.stringify(e)}`);return n},F=(e,t,n=``,r)=>{if(t.length===0)return{key:n,path:[],level:0,index:0,value:e,size:m(e)?Object.keys(e).length:1,parentData:null,fullData:e};let i=t[t.length-1],a=N(e,t),o=N(e,t.slice(0,-1))??null,s=0;if(Array.isArray(o))s=typeof i==`number`?i:Number(i);else if(o&&typeof o==`object`){let e=Object.entries(o);r?.(e,e=>e),s=e.findIndex(([e])=>e===i)}return{key:i,path:t,level:t.length,index:s,value:a,size:m(a)?Object.keys(a).length:null,parentData:o,fullData:e}},I=typeof window<`u`?d.useLayoutEffect:d.useEffect,L=({className:e,name:t,value:n,setValue:r,onKeyDown:i,styles:a,textAreaRef:o})=>{let s=(0,d.useRef)(null);if(I(()=>{let e=s.current;s.current=null;let t=o?.current;if(!e||!t)return;let r=e.start+n.length-e.sourceLength,i=Math.max(0,Math.min(r,n.length));t.selectionStart!==i&&t.setSelectionRange(i,i)},[n,o]),typeof n!=`string`)return null;let c=n.slice(-1)===`
|
|
2
2
|
`?n+`.`:n;return(0,u.jsxs)(`div`,{style:{display:`grid`},children:[(0,u.jsx)(`textarea`,{id:`${t}_textarea`,ref:o,style:{height:`auto`,gridArea:`1 / 1 / 2 / 2`,overflowY:`auto`,whiteSpace:`pre-wrap`,...a},rows:1,className:e,name:`${t}_textarea`,value:n,onChange:e=>{let{value:t,selectionStart:n}=e.target;s.current=n!==null&&n<t.length?{start:n,sourceLength:t.length}:null,r(t)},autoFocus:!0,onFocus:e=>{n.length<40&&e.target.select()},onKeyDown:i}),(0,u.jsx)(`span`,{className:e,style:{visibility:`hidden`,height:`auto`,gridArea:`1 / 1 / 2 / 2`,color:`red`,opacity:.9,whiteSpace:`pre-wrap`,overflowY:`auto`,border:`1px solid transparent`,...a},children:c})]})},R=e=>e.shiftKey?`Shift`:e.metaKey?`Meta`:e.ctrlKey?`Control`:e.altKey?`Alt`:void 0,z=(e,t,n)=>{if(!t)return!1;let r=e.key,i=R(e);if(Array.isArray(t))return!!i&&t.includes(i);let{key:a,modifier:o}=t;return(n!==`stringLineBreak`||r!==`Enter`||i!==`Shift`||a!==`Enter`||!o?.includes(`Shift`))&&r===a&&(o===i||Array.isArray(o)&&o.includes(i))},B={key:`Enter`},V={confirm:B,cancel:{key:`Escape`},objectConfirm:{...B,modifier:[`Meta`,`Shift`,`Control`]},objectLineBreak:B,stringConfirm:B,stringLineBreak:{...B,modifier:[`Shift`]},numberConfirm:B,numberUp:{key:`ArrowUp`},numberDown:{key:`ArrowDown`},tabForward:{key:`Tab`},tabBack:{key:`Tab`,modifier:`Shift`},booleanConfirm:B,booleanToggle:{key:` `},clipboardModifier:[`Meta`,`Control`],collapseModifier:[`Alt`]},ee=[`stringConfirm`,`numberConfirm`,`booleanConfirm`],te=(e,t)=>{let n=e.current,r=n.selectionStart??1/0,i=n.selectionEnd??1/0,a=n.value.slice(0,r)+t+n.value.slice(i);return n.value=a,n.setSelectionRange(r+1,r+1),a},ne=(e,t,n=`next`,r,i)=>{let a=t.slice(0,t.length-1),o=t.slice(-1)[0];if(o===void 0)return null;let s=N(e,a),c=ie(s);Array.isArray(s)||r(c,({key:e,value:t})=>[e,t]);let l=c[c.findIndex(e=>e.key===o)+(n===`next`?1:-1)];if(!l)return a.length===0?null:ne(e,a,n,r,i);let u;if(m(l.value)){if(Object.keys(l.value).length===0)return ne(e,[...a,l.key],n,r,i);u=re(e,[...a,l.key],n,r)}else u=[...a,l.key];return u?i(F(e,u,``,r))?u:ne(e,u,n,r,i):null},re=(e,t,n=`next`,r)=>{let i=N(e,t);if(!m(i))return t;let a=Array.isArray(i)?i.map((e,t)=>t):Object.keys(i);r(a,e=>[e,i]);let o=n===`next`?a[0]:a[a.length-1];return re(e,[...t,o],n,r)},ie=e=>Array.isArray(e)?e.map((e,t)=>({value:e,key:t})):Object.entries(e).map(([e,t])=>({key:e,value:t})),ae={fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2},oe={displayName:`Default`,icons:{add:{content:(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`path`,{d:`M13 7h-2v4H7v2h4v4h2v-4h4v-2h-4z`}),(0,u.jsx)(`path`,{d:`M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2zm0 18c-4.411 0-8-3.589-8-8s3.589-8 8-8 8 3.589 8 8-3.589 8-8 8z`})]})},edit:{content:(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`path`,{d:`M7 17.013l4.413-.015 9.632-9.54c.378-.378.586-.88.586-1.414s-.208-1.036-.586-1.414l-1.586-1.586c-.756-.756-2.075-.752-2.825-.003L7 12.583v4.43zM18.045 4.458l1.589 1.583-1.597 1.582-1.586-1.585 1.594-1.58zM9 13.417l6.03-5.973 1.586 1.586-6.029 5.971L9 15.006v-1.589z`}),(0,u.jsx)(`path`,{d:`M5 21h14c1.103 0 2-.897 2-2v-8.668l-2 2V19H8.158c-.026 0-.053.01-.079.01-.033 0-.066-.009-.1-.01H5V5h6.847l2-2H5c-1.103 0-2 .897-2 2v14c0 1.103.897 2 2 2z`})]}),svgProps:{transform:`translate(0, 0.5)`}},delete:{content:(0,u.jsx)(`path`,{d:`M6 19a2 2 0 002 2h8a2 2 0 002-2V7H6v12m2.46-7.12l1.41-1.41L12 12.59l2.12-2.12 1.41 1.41L13.41 14l2.12 2.12-1.41 1.41L12 15.41l-2.12 2.12-1.41-1.41L10.59 14l-2.13-2.12M15.5 4l-1-1h-5l-1 1H5v2h14V4h-3.5z`}),scale:1.04},copy:{content:(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`path`,{d:`M9 2 H15 A1 1 0 0 1 16 3 V5 A1 1 0 0 1 15 6 H9 A1 1 0 0 1 8 5 V3 A1 1 0 0 1 9 2 z`}),(0,u.jsx)(`path`,{d:`M8 4H6a2 2 0 00-2 2v14a2 2 0 002 2h12a2 2 0 002-2v-2M16 4h2a2 2 0 012 2v4M21 14H11`}),(0,u.jsx)(`path`,{d:`M15 10l-4 4 4 4`})]}),svgProps:ae,scale:.86},ok:{content:(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`path`,{d:`M22 11.08V12a10 10 0 11-5.93-9.14`}),(0,u.jsx)(`path`,{d:`M22 4L12 14.01l-3-3`})]}),svgProps:ae,scale:.9},cancel:{content:(0,u.jsx)(`path`,{d:`M12 4c-4.411 0-8 3.589-8 8s3.589 8 8 8 8-3.589 8-8-3.589-8-8-8zm-5 8c0-.832.224-1.604.584-2.295l6.711 6.711A4.943 4.943 0 0112 17c-2.757 0-5-2.243-5-5zm9.416 2.295L9.705 7.584A4.943 4.943 0 0112 7c2.757 0 5 2.243 5 5 0 .832-.224 1.604-.584 2.295z`}),svgProps:{baseProfile:`tiny`},scale:1.3},collection:{content:(0,u.jsx)(`path`,{d:`M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7 86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z`}),viewBox:`0 0 512 512`,scale:.7}},styles:{container:{backgroundColor:`#f6f6f6`,fontFamily:`monospace`},property:`#292929`,bracket:{color:`#002b36`,fontWeight:`bold`},itemCount:{color:`#0000004d`,fontStyle:`italic`},string:`#cb4b16`,number:`#268bd2`,boolean:`green`,null:{color:`#dc322f`,fontVariant:`small-caps`,fontWeight:`bold`},input:[`#292929`],inputHighlight:`#b3d8ff`,error:{fontSize:`0.8em`,color:`red`,fontWeight:`bold`},iconCollection:`#002b36`,iconEdit:`#2aa198`,iconDelete:`#cb4b16`,iconAdd:`#2aa198`,iconCopy:`#268bd2`,iconOk:`green`,iconCancel:`#cb4b16`}},se={container:`backgroundColor`,collection:`backgroundColor`,collectionInner:`backgroundColor`,collectionElement:`backgroundColor`,headerRow:`backgroundColor`,valueRow:`backgroundColor`,dropZone:`borderColor`,inputHighlight:`backgroundColor`},ce=e=>[oe,...p(e)].map(e=>`styles`in e?e:{styles:e}),H=e=>{let t={};for(let{icons:n}of ce(e))n&&Object.assign(t,n);return t},le=(0,d.createContext)({getStyles:()=>({}),icons:H(oe),cssVars:{}}),ue=({theme:e=oe,children:t})=>{let n=(0,d.useMemo)(()=>(e=>{var t;let n=ce(e),r={},i={};for(let{fragments:e,styles:t}of n)for(let n in t){let a=n;for(let n of[].concat(t[a]))if(typeof n==`function`)(i[a]??(i[a]=[])).push(n);else{let t=typeof n==`string`?e?.[n]??n:n;r[a]={...r[a],...typeof t==`string`?{[se[a]??`color`]:t}:t}}}for(let e in i)r[t=e]??(r[t]={});let a={};for(let e in r){let t=e,n=r[t],o=i[t];a[t]=o?e=>o.reduce((t,n)=>({...t,...n(e)??{}}),n):n}return a})(e),[e]),r=(0,d.useMemo)(()=>H(e),[e]),i=(0,d.useMemo)(()=>(e=>{let{inputHighlight:t,iconCopy:n}=e,r={};return typeof t!=`function`&&t?.backgroundColor&&(r[`--jer-highlight-color`]=t.backgroundColor),typeof n!=`function`&&n?.color&&(r[`--jer-icon-copy-color`]=n.color),r})(n),[n]),a=(0,d.useCallback)((e,t)=>((e,t,n)=>{let r=e[t];return typeof r==`function`?r(n):r??{}})(n,e,t),[n]),o=(0,d.useMemo)(()=>({getStyles:a,icons:r,cssVars:i}),[a,r,i]);return(0,u.jsx)(le.Provider,{value:o,children:t})},de=()=>(0,d.useContext)(le),fe={edit:{start:`startEdit`,submit:`submitEdit`,cancel:`cancelEdit`,commit:`commitEdit`},add:{start:`startAdd`,submit:`submitAdd`,cancel:`cancelAdd`,commit:`commitAdd`},rename:{start:`startRename`,submit:`submitRename`,cancel:`cancelRename`,commit:`commitRename`},delete:{commit:`delete`},move:{commit:`move`}},U=(e,t)=>fe[e][t]??null,W=(e,t)=>e!==null&&t!==null&&e.op===t.op&&w(e.path,t.path),pe={active:null,settling:{}},me=(0,d.createContext)(null),he=({children:e,onEditEvent:t,buildNodeDataFromPathRef:n,commitRef:r})=>{let i=(0,d.useRef)(t);i.current=t;let a=(0,d.useRef)(null);return a.current===null&&(a.current=((e,t,n)=>{let r=pe,i=new Set,a=null,o=null,s=!1,c=0,l=e=>{r=e,i.forEach(e=>e())},u=(t,n,r)=>{e.current?.({...t,...r,event:n})},d=(n,i,s)=>{if(!e.current)return;let c;try{c=t.current?.(n)}catch{l({...r,active:null}),a=null,o=null;return}c&&u(c,i,s)},f=(e,t)=>{var n;a=t?.cancelOp??null,o=t?.commitOp??null,n=e,W(r.active,n)&&r.active?.phase===n?.phase||l({...r,active:n});let i=U(e.op,`start`);i&&d(e.path,i)},p=(e,t,i,s,c,d,f,p,m)=>{let h=C(e);if(!f()){if(s.status===`cancel`||s.status===`error`){r.active&&w(r.active.path,e)&&(r.active.phase===`held`||r.active.phase===`editing`)&&(l({...r,active:null}),a=null,o=null);let n=U(t,`cancel`);return n&&u(p,n),s.status===`error`&&u(p,`updateError`,{operation:t,error:s.error}),s}c()}if(r.settling[h]===i){switch((e=>{if(!(e in r.settling))return;let t={...r.settling};delete t[e],l({...r,settling:t})})(h),s.status){case`cancel`:d();break;case`error`:d(),u(p,`updateError`,{operation:t,error:s.error});break;case`override`:n.current?.applyValue(s.path,s.value),u(p,`updateSuccess`,{operation:t,...m});break;case`commit`:u(p,`updateSuccess`,{operation:t,...m})}return s}};return{subscribe:e=>(i.add(e),()=>i.delete(e)),getSnapshot:()=>r,getServerSnapshot:()=>r,open:(e,t)=>{if(r.active?.phase===`held`)return;let n={path:e,op:t?.op??`edit`,phase:`editing`,force:t?.force},i=r.active,s=i!==null&&!W(i,n);if(s&&o)return void o(()=>f(n,t));let c=a;if(a=null,o=null,c&&c(),s&&W(r.active,i)){let e=U(i.op,`cancel`);e&&d(i.path,e)}f(n,t)},cancel:()=>{if(s||r.active?.phase===`held`)return;let e=r.active;s=!0;try{let t=a;if(a=null,o=null,t&&t(),e!==null){r.active!==null&&l({...r,active:null});let t=U(e.op,`cancel`);t&&d(e.path,t)}}finally{s=!1}},submit:e=>{let{op:t,path:i,instant:s,onCommit:f}=e,m=n.current,h;try{h=m?.buildCommit(e)??null}catch{return W(r.active,{path:i,op:t})&&l({...r,active:null}),a=null,o=null,f?.(),Promise.resolve(void 0)}let _=h?.extra,v=C(i),y=++c;if(!s){let e=U(t,`submit`);e&&d(i,e)}if(!h||h.isNoOp){W(r.active,{path:i,op:t})&&l({...r,active:null}),a=null,o=null;let e=U(t,`commit`);return e&&(h?u(h.nodeData,e,_):d(i,e,_)),f?.(),Promise.resolve(void 0)}let{input:b,nodeData:x,apply:S,revert:w}=h,T=!!m?.runUpdate,E=!1,D=!1,O=()=>{if(E)return;E=!0,S(),a=null,o=null,W(r.active,{path:i,op:t})&&l({...r,active:null}),T&&((e,t)=>{l({...r,settling:{...r.settling,[e]:t}})})(v,y);let e=U(t,`commit`);e&&u(x,e,_),f?.()},k={hold:()=>(D=!0,l({...r,active:{path:i,op:t,phase:`held`,force:r.active?.force}}),()=>O())};if(!T)return O(),Promise.resolve(void 0);let A=m.runUpdate(b,k),j=g(A);if(!D&&!s&&!j)return Promise.resolve(p(i,t,y,A,O,w,()=>E,x,_));let M=j?A:Promise.resolve(A),N;return D||(s?N=setTimeout(O,100):O()),M.then(e=>(clearTimeout(N),p(i,t,y,e,O,w,()=>E,x,_)))},areChildrenBeingEdited:e=>r.active!==null&&T(r.active.path,e)}})(i,n,r)),(0,u.jsx)(me.Provider,{value:a.current,children:e})},ge=()=>{let e=(0,d.useContext)(me);if(!e)throw Error(`Missing Editing Context Provider`);return e},G=e=>{let t=ge();return(0,d.useSyncExternalStore)(t.subscribe,()=>e(t.getSnapshot()),()=>e(t.getServerSnapshot()))},K=(0,d.createContext)(null),q=({children:e,onCollapse:t,buildNodeDataFromPathRef:n})=>{let[r,i]=(0,d.useState)({commands:null,version:0}),a=(0,d.useRef)(t);a.current=t;let o=(0,d.useCallback)(e=>{if(e===null)return void i(e=>e.commands===null?e:{commands:null,version:e.version});let t=p(e),r=t.map(e=>({...e,path:[...e.path]}));i(e=>({commands:r,version:e.version+1}));let o=a.current;o&&t.forEach(e=>{let t=n.current?.(e.path);t&&o({...t,collapsed:e.collapsed,includeChildren:e.includeChildren})})},[n]),s=(0,d.useMemo)(()=>({commands:r.commands,version:r.version,setCollapseState:o}),[r.commands,r.version,o]);return(0,u.jsx)(K.Provider,{value:s,children:e})},_e=()=>{let e=(0,d.useContext)(K);if(!e)throw Error(`Missing Collapse Context Provider`);return e},ve=(e,t)=>{if(!t.includeChildren)return t.path.length===e.length&&t.path.every((t,n)=>e[n]===t);for(let[n,r]of t.path.entries())if(r!==e[n])return!1;return!0},ye=(0,d.createContext)(null),be=({children:e})=>{let[t,n]=(0,d.useState)({path:null,canDelete:!1}),r=(0,d.useRef)(!1),i=(0,d.useMemo)(()=>({dragSource:t,setDragSource:n,armed:r}),[t]);return(0,u.jsx)(ye.Provider,{value:i,children:e})},J=({children:e,onEditEvent:t,onCollapse:n,buildNodeDataFromPathRef:r,commitRef:i})=>(0,u.jsx)(he,{onEditEvent:t,buildNodeDataFromPathRef:r,commitRef:i,children:(0,u.jsx)(q,{onCollapse:n,buildNodeDataFromPathRef:r,children:(0,u.jsx)(be,{children:e})})}),xe=(0,d.createContext)(void 0),Se=({value:e,children:t})=>(0,u.jsx)(xe.Provider,{value:e,children:t}),Y=()=>{let e=(0,d.useContext)(xe);if(e===void 0)throw Error(`Missing FilterStateProvider`);return e},Ce=e=>{let t=Y();return t===null||t.visiblePaths.has(C(e))},we=e=>{let t=Y();return t===null?null:t.visibleChildCounts.get(C(e))??null},Te=`**INVALID_FUNCTION**`,Ee=({nodeData:e,showStringQuotes:t=!0,stringTruncateLength:n=200,pathString:r,canEdit:i,setIsEditing:a,styles:o,translate:s,showIconTooltips:c=!1,value:l,TextWrapper:f=({children:e})=>e})=>{let p=l??e.value,[m,h]=(0,d.useState)(!1),g=t?`"`:``,_=p.length>n,v=()=>{i?a(!0):h(!m)},y=s(`SHOW_MORE`,e);return(0,u.jsxs)(`div`,{id:`${r}_display`,onDoubleClick:v,onClick:e=>{(e.getModifierState(`Control`)||e.getModifierState(`Meta`))&&v()},className:`jer-value-string`,style:o,children:[g,_?(0,u.jsxs)(u.Fragment,m?{children:[(0,u.jsx)(f,{children:(0,u.jsxs)(`span`,{children:[p,g]})}),` `,(0,u.jsx)(`button`,{type:`button`,tabIndex:-1,className:`jer-string-expansion jer-show-less`,onClick:()=>h(!1),children:s(`SHOW_LESS`,e)})]}:{children:[(0,u.jsxs)(f,{children:[(0,u.jsx)(`span`,{children:p.slice(0,n-2).trimEnd()}),` `]}),(0,u.jsx)(`button`,{type:`button`,tabIndex:-1,className:`jer-string-expansion jer-ellipsis`,onClick:()=>h(!0),"aria-label":y,title:c?y:``,children:`...`}),g]}):(0,u.jsx)(f,{children:`${p}${g}`})]})},De=({styles:e,pathString:t,value:n,setValue:r,handleEdit:i,handleKeyboard:a,keyboardCommon:o})=>{let s=(0,d.useRef)(null);return(0,u.jsx)(L,{className:`jer-input-text`,textAreaRef:s,name:t,value:n,setValue:r,onKeyDown:e=>{a(e,{stringConfirm:i,stringLineBreak:()=>{r(te(s,`
|
|
3
3
|
`))},...o})},styles:e})},Oe=({isEditing:e,path:t,enumType:n,...r})=>{let{getStyles:i}=de(),a=C(t),{value:o,setValue:s,nodeData:c,handleEdit:l,handleKeyboard:d,keyboardCommon:f,Select:p}=r;return e&&n?(0,u.jsx)(p,{name:`${a}-value-select`,value:o,onChange:s,options:n.values,autoFocus:!0,onKeyDown:e=>d(e,{stringConfirm:l,...f})}):e?(0,u.jsx)(De,{styles:i(`input`,c),pathString:a,...r,setValue:r.setValue}):(0,u.jsx)(Ee,{pathString:a,styles:i(`string`,c),...r})},ke=({value:e,setValue:t,isEditing:n,path:r,setIsEditing:i,handleEdit:a,nodeData:o,handleKeyboard:s,keyboardCommon:c})=>{let{getStyles:l}=de();return n?(0,u.jsx)(`input`,{className:`jer-input-number`,type:`text`,name:C(r),value:e,onChange:e=>t(e.target.value.replace(/[^0-9.-]/g,``)),autoFocus:!0,onFocus:e=>setTimeout(()=>e.target.select(),10),onKeyDown:n=>s(n,{numberConfirm:a,numberUp:()=>t(Number(e)+1),numberDown:()=>t(Number(e)-1),...c}),style:{width:String(e).length/1.5+2+`em`,...l(`input`,o)}}):(0,u.jsx)(`span`,{onDoubleClick:()=>i(!0),className:`jer-value-number`,style:l(`number`,o),children:e})},X=({value:e,setValue:t,isEditing:n,path:r,setIsEditing:i,handleEdit:a,nodeData:o,handleKeyboard:s,keyboardCommon:c})=>{let{getStyles:l}=de();return typeof e==`boolean`?n?(0,u.jsx)(`input`,{className:`jer-input-boolean`,type:`checkbox`,name:C(r),checked:e,onChange:()=>t(!e),onKeyDown:n=>{n.key===` `&&n.preventDefault(),s(n,{booleanConfirm:a,booleanToggle:()=>t(!e),...c})},autoFocus:!0}):(0,u.jsx)(`span`,{onDoubleClick:()=>i(!0),className:`jer-value-boolean`,style:l(`boolean`,o),children:String(e)}):null},Ae=(e,t)=>{let n=(0,d.useRef)(void 0),r=(0,d.useRef)(t);(0,d.useEffect)(()=>{r.current=t},[t]);let i=e=>{r.current(e)};(0,d.useEffect)(()=>{if(window.clearTimeout(n.current),e)return n.current=window.setTimeout(()=>{window.addEventListener(`keydown`,i)},100),()=>{window.clearTimeout(n.current),window.removeEventListener(`keydown`,i)}},[e])},je=({value:e,isEditing:t,setIsEditing:n,handleEdit:r,nodeData:i,handleKeyboard:a,keyboardCommon:o})=>{let{getStyles:s}=de();return Ae(t,e=>a(e,{confirm:r,...o})),(0,u.jsx)(`div`,{onDoubleClick:()=>n(!0),className:`jer-value-null`,style:s(`null`,i),children:String(e)})},Me=({value:e})=>{let t=`Error!`;switch(typeof e){case`string`:e===Te&&(t=`Function`);break;case`undefined`:t=`Undefined`;break;case`symbol`:t=`Symbol`}return(0,u.jsx)(`span`,{className:`jer-value-invalid`,children:t})},Z=({scale:e=1,viewBox:t=`0 0 24 24`,fill:n=`currentColor`,children:r,...i})=>{let a=1.4*e+`em`;return(0,u.jsx)(`svg`,{viewBox:t,fill:n,width:a,height:a,...i,children:r})},Q=({name:e,nodeData:t})=>{let{getStyles:n,icons:r}=de(),i=r[e],a=`icon${e[0].toUpperCase()}${e.slice(1)}`;return(0,u.jsx)(Z,{viewBox:i.viewBox,...i.svgProps,scale:i.scale,className:e===`collection`?void 0:`jer-icon`,style:n(a,t),children:i.content})},Ne=({startEdit:e,handleDelete:t,handleAdd:n,showClipboardButton:r,onCopy:i,type:a,customButtons:o,handleEdit:s,canEdit:c,nodeData:l,translate:f,keyboardControls:p,handleKeyboard:m,editConfirmRef:h,getNewKeyOptions:g,jsonStringify:_,showIconTooltips:v,Select:y})=>{let{getStyles:b}=de(),{open:x,cancel:C}=ge(),[T,E]=(0,d.useState)(``),[D,O]=(0,d.useState)(!1),{path:k,value:A}=l,j=G(e=>{let t=e.active;return t!==null&&t.op===`add`&&w(t.path,k)}),M=Array.isArray(D);I(()=>{if(!j)return O(!1),void E(``);let e=Object.keys(N(l.fullData,k)),t=g?g(l)?.filter(t=>!e.includes(t)):null;O(t??!0)},[j]);let P=()=>{n&&T&&n(a===`array`?``:T)};return(0,u.jsxs)(`div`,{className:`jer-edit-buttons`,style:{opacity:j?1:void 0},onClick:e=>e.stopPropagation(),children:[r&&(0,u.jsx)(`button`,{type:`button`,tabIndex:-1,onClick:e=>{e.stopPropagation();let t,n,a=`value`,o=``,s=null;if(r){let r=R(e);if(r&&p.clipboardModifier.includes(r)?(t=S(k),o=t,a=`path`):(t=A,o=typeof t==`object`?_(A):String(t)),!navigator.clipboard)return void i?.({...l,success:!1,stringValue:o,type:a,error:{code:`CLIPBOARD_ERROR`,message:`Can't access clipboard API`}});navigator.clipboard?.writeText(o).then(()=>n=!0).catch(e=>{n=!1,s=e.message}).finally(()=>{i?.({...l,success:n,stringValue:o,type:a,error:n?void 0:{code:`CLIPBOARD_ERROR`,message:s??`Copy failed`}})})}},className:`jer-copy-pulse`,"aria-label":f(`TOOLTIP_COPY`,l),title:v?f(`TOOLTIP_COPY`,l):``,children:(0,u.jsx)(Q,{name:`copy`,nodeData:l})}),e&&(0,u.jsx)(`button`,{type:`button`,tabIndex:-1,onClick:e,"aria-label":f(`TOOLTIP_EDIT`,l),title:v?f(`TOOLTIP_EDIT`,l):``,children:(0,u.jsx)(Q,{name:`edit`,nodeData:l})}),t&&(0,u.jsx)(`button`,{type:`button`,tabIndex:-1,onClick:t,"aria-label":f(`TOOLTIP_DELETE`,l),title:v?f(`TOOLTIP_DELETE`,l):``,children:(0,u.jsx)(Q,{name:`delete`,nodeData:l})}),n&&(0,u.jsx)(`button`,{type:`button`,tabIndex:-1,onClick:()=>{a===`object`?x(k,{op:`add`}):n(``)},"aria-label":f(`TOOLTIP_ADD`,l),title:v?f(`TOOLTIP_ADD`,l):``,children:(0,u.jsx)(Q,{name:`add`,nodeData:l})}),o?.map(({Element:e,onClick:t,label:n},r)=>{let i=e=>t?.(l,e,{handleEdit:s,canEdit:c});return n?(0,u.jsx)(`button`,{type:`button`,className:`jer-custom-button`,tabIndex:-1,onClick:i,"aria-label":n,title:v?n:``,children:(0,u.jsx)(e,{nodeData:l,canEdit:c,handleEdit:s})},r):(0,u.jsx)(`div`,{className:`jer-custom-button`,onClick:i,children:(0,u.jsx)(e,{nodeData:l,canEdit:c,handleEdit:s})},r)}),j&&n&&a===`object`&&(0,u.jsxs)(u.Fragment,{children:[M?(0,u.jsx)(y,{name:`new-key-select`,onChange:n,defaultValue:``,autoFocus:!0,onKeyDown:e=>m(e,{cancel:()=>C()}),placeholder:D.length>0?f(`KEY_SELECT`,l):f(`NO_KEY_OPTIONS`,l),options:D}):(0,u.jsx)(`input`,{className:`jer-input-text jer-input-new-key`,type:`text`,name:`new-object-key`,value:T,placeholder:f(`KEY_NEW`,l),onChange:e=>E(e.target.value),autoFocus:!0,onKeyDown:e=>{m(e,{stringConfirm:()=>P(),cancel:()=>C()})},style:b(`input`,l)}),(0,u.jsx)(Pe,{onOk:()=>P(),onCancel:()=>C(),nodeData:l,translate:f,showIconTooltips:v,editConfirmRef:h,hideOk:M})]})]})},Pe=({onOk:e,onCancel:t,nodeData:n,translate:r,showIconTooltips:i,editConfirmRef:a,hideOk:o=!1})=>(0,u.jsxs)(`div`,{className:`jer-confirm-buttons`,children:[!o&&(0,u.jsx)(`button`,{type:`button`,tabIndex:-1,onClick:e,"aria-label":r(`TOOLTIP_OK`,n),title:i?r(`TOOLTIP_OK`,n):``,ref:a,children:(0,u.jsx)(Q,{name:`ok`,nodeData:n})}),(0,u.jsx)(`button`,{type:`button`,tabIndex:-1,onClick:t,"aria-label":r(`TOOLTIP_CANCEL`,n),title:i?r(`TOOLTIP_CANCEL`,n):``,children:(0,u.jsx)(Q,{name:`cancel`,nodeData:n})})]}),Fe=[`string`,`number`,`boolean`,`null`],Ie=[`object`,`array`],Le=[...Fe,...Ie],Re=e=>{let{component:t,wrapperComponent:n,keyComponent:r,showKey:i=!0,showEditTools:a=!0,showOnEdit:o=!1,showOnView:s=!0,showCollectionWrapper:c=!0,...l}=e;return{CustomComponent:t,CustomWrapperComponent:n,CustomKeyComponent:r,showKey:i,showEditTools:a,showOnEdit:o,showOnView:s,showCollectionWrapper:c,...l}},ze=(e=[],t)=>{let n=e.find(({condition:e})=>e(t));return n?Re(n):{}},Be=({props:e,collapsed:t})=>{let{nodeData:n,parentData:r,onError:i,getLatestData:a,showErrorMessages:o,allowEditFilter:s,allowDeleteFilter:c,allowAddFilter:l,allowDragFilter:u,canAddHere:f,translate:p,errorDisplayTime:m,sort:h,arrayIndexStart:g,handleKeyboard:_,customNodeData:v}=e,{submit:y}=ge(),[b,x]=(0,d.useState)(null),S={...n,collapsed:t,visibleSize:we(n.path)},{path:T,key:E,size:D}=S,O=C(T),k=G(e=>{let t=e.active;return t!==null&&t.op===`edit`&&w(t.path,T)}),A=G(e=>{let t=e.active;return t!==null&&t.op===`rename`&&w(t.path,T)}),j=G(e=>O in e.settling),M=s(S),N=c(S),P=l(S),F=u(S),I=e=>{o&&(x(e),setTimeout(()=>x(null),m)),console.warn(`Error`,e)},L=(0,d.useRef)(S);L.current=S;let R=(0,d.useCallback)((e,t)=>{I(e.message),i&&i({...L.current,fullData:a(),error:e,errorValue:t})},[i,o,a,m]),z=Y(),B=(0,d.useCallback)(e=>(z===null||z.visiblePaths.has(C(e.path)))&&s(e),[z,s]),V=e=>ne(a(),T,e,h,B),ee=(e,t)=>{r&&(E!==e&&Object.keys(r).includes(e)?R({code:`KEY_EXISTS`,message:p(`ERROR_KEY_EXISTS`,S)},e):y({op:`rename`,path:T,newKey:e,onCommit:t}).then(t=>{t?.status===`error`&&R(t.error,e)}))},te=typeof T.slice(-1)[0]==`number`,re=r!==null&&!te&&N&&f,ie={isEditing:k,isEditingKey:A,isPending:j,isArray:te,canEditKey:re},ae=E===``&&T.length>0?p(`EMPTY_STRING`,S):null;return{pathString:O,nodeData:S,path:T,name:E,size:D,canEdit:M,canDelete:N,canAdd:P,canDrag:F,error:b,showError:I,onError:R,setError:x,handleEditKey:ee,derivedValues:ie,emptyStringKey:ae,getNextOrPreviousAtPath:V,buildKeyDisplayProps:({handleCancel:e,getStyles:t,keyValueArray:n,handleClick:r})=>({canEditKey:re,isEditingKey:A,pathString:O,path:T,name:E,arrayIndexStart:g,handleKeyboard:_,handleEditKey:ee,handleCancel:e,styles:t(`property`,S),getNextOrPrevious:V,emptyStringKey:ae,nodeData:S,customNodeData:v,getStyles:t,...n===void 0?{}:{keyValueArray:n},...r===void 0?{}:{handleClick:r}})}},Ve=({canDrag:e,canDelete:t,canDragOnto:n,canAddHere:r,path:i,nodeData:a,onError:o,translate:s})=>{let{getStyles:c}=de(),{dragSource:l,setDragSource:f,armed:p}=(()=>{let e=(0,d.useContext)(ye);if(!e)throw Error(`Missing DragSource Context Provider`);return e})(),m=ge(),[h,g]=(0,d.useState)(!1),_=()=>l.path!==null&&!T(i,l.path)&&(w(l.path.slice(0,-1),i.slice(0,-1))?n:l.canDelete&&r),v=(0,d.useMemo)(()=>e?{onMouseDown:e=>{e.button===0&&m.getSnapshot().active===null&&(p.current=!0)},onMouseUp:()=>{p.current=!1},onDragStart:e=>{if(!p.current||m.getSnapshot().active!==null)return e.preventDefault(),void e.stopPropagation();p.current=!1,e.stopPropagation(),f({path:i,canDelete:t})},onDragEnd:e=>{p.current=!1,e.stopPropagation(),f({path:null,canDelete:!1})}}:{},[e,t,i]),y=(0,d.useMemo)(()=>e=>n||r?{onDragOver:e=>{e.stopPropagation(),_()&&e.preventDefault()},onDrop:t=>{t.stopPropagation(),x(e),f({path:null,canDelete:!1}),g(!1)},onDragEnter:t=>{t.stopPropagation(),_()&&g(e)},onDragExit:e=>{e.stopPropagation(),g(!1)}}:{},[l,n,r,i]),b=(0,d.useMemo)(()=>l.path!==null&&_()?(0,u.jsx)(`div`,{className:`jer-drop-target-bottom`,style:{height:`50%`,position:`absolute`,width:`100%`,top:`50%`,zIndex:i.length},...y(`below`)}):null,[l,n,r,i.length]),x=e=>{if(l.path===null||!_())return;let t=l.path.slice(-1)[0],n=l.path.slice(0,-1),r=i.slice(0,-1),{parentData:c}=a;typeof t==`string`&&c&&!Array.isArray(c)&&Object.keys(c).includes(t)&&t in c&&!w(n,r)?o({code:`KEY_EXISTS`,message:s(`ERROR_KEY_EXISTS`,a)},t):m.submit({op:`move`,path:l.path,to:{path:i,position:e},instant:!0})};return{dragSourceProps:v,getDropTargetProps:y,BottomDropTarget:b,DropTargetPadding:({position:e,nodeData:t})=>h===e?(0,u.jsx)(`div`,{className:`jer-drag-n-drop-padding`,style:c(`dropZone`,t)}):null,handleDrop:x}},He=({isEditingKey:e,canEditKey:t,pathString:n,path:r,name:i,arrayIndexStart:a,handleKeyboard:o,handleEditKey:s,handleCancel:c,handleClick:l,keyValueArray:f,styles:p,getNextOrPrevious:m,emptyStringKey:h,nodeData:g,customNodeData:_,getStyles:v})=>{let{open:y,cancel:b}=ge(),x=d.useRef(null),S=e=>s(x.current?.value??String(i),e),C=typeof i==`number`?String(i+a):i;if(!e){let e={...p,minWidth:`${Math.min(C.length+1,5)}ch`,flexShrink:+(C.length>10)};if(_?.CustomKeyComponent&&g&&v){let{CustomKeyComponent:n,componentProps:i}=_;return(0,u.jsx)(n,{nodeData:g,name:h??C,path:r,canEditKey:t,handleEditKey:e=>{t&&s(e)},startEditingKey:()=>{t&&y(r,{op:`rename`,commitOp:S})},handleClick:l,styles:e,componentProps:i,getStyles:v})}return(0,u.jsxs)(`span`,{className:`jer-key-text`,style:e,onDoubleClick:()=>t&&y(r,{op:`rename`,commitOp:S}),onClick:l,children:[h?(0,u.jsx)(`span`,{className:`jer-empty-string`,children:h}):C,C!==``||h?(0,u.jsx)(`span`,{className:`jer-key-colon`,children:`:`}):null]})}return(0,u.jsx)(`input`,{ref:x,className:`jer-input-text jer-key-edit`,type:`text`,name:n,defaultValue:C,autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>o(e,{stringConfirm:()=>s(e.target.value),cancel:c,tabForward:()=>{let t=e.target.value;s(t,()=>{if(f){let e=f?.[0][0],t=e?[...r,e]:m(`next`);t?y(t):b()}else y(r)})},tabBack:()=>{let t=e.target.value;s(t,()=>{let e=m(`prev`);e?y(e):b()})}}),style:{width:C.length/1.5+.5+`em`}})},Ue=new Set([`nodeData`,`customNodeData`]),We=(e,t)=>{if(n=e.nodeData,r=t.nodeData,n.key!==r.key||n.index!==r.index||n.level!==r.level||n.size!==r.size||!w(n.path,r.path))return!1;var n,r;let i=Object.keys(t);if(i.length!==Object.keys(e).length)return!1;for(let n of i)if(!Ue.has(n)&&!Object.is(e[n],t[n]))return!1;return!0},Ge=d.memo(e=>{let{data:t,parentData:n,onChange:r,showClipboardButton:i,onCopy:a,canDragOnto:o,canAddHere:s,allowTypeSelection:c,showLabel:l,stringTruncateLength:p,showStringQuotes:h,indent:g,translate:y,customNodeDefinitions:b,customNodeData:x,Select:S,handleKeyboard:C,keyboardControls:T,editConfirmRef:E,jsonStringify:D,showIconTooltips:O,getLatestData:k}=e,{getStyles:A}=de(),{open:j,cancel:M,submit:N,getSnapshot:P}=ge(),{setCollapseState:F}=_e(),[I,L]=(0,d.useState)(typeof t==`function`?Te:t),{nodeData:R,path:z,name:B,canEdit:V,canDelete:ee,canDrag:te,error:ne,onError:re,setError:ie,derivedValues:ae,getNextOrPreviousAtPath:oe,buildKeyDisplayProps:se}=Be({props:e}),{dragSourceProps:ce,getDropTargetProps:H,BottomDropTarget:le,DropTargetPadding:ue}=Ve({canDrag:te,canDelete:ee,canDragOnto:o,canAddHere:s,path:z,nodeData:R,onError:re,translate:y}),[fe,U]=(0,d.useState)(qe(t,x)),W=(0,d.useRef)(I);W.current=I;let pe=(0,d.useRef)(R);pe.current=R;let me=(0,d.useCallback)(e=>{if(!r)return void L(e);let t=r({...pe.current,value:W.current,fullData:k(),newValue:e});L(t)},[r,k]),he=()=>{L(typeof t==`function`?Te:t),U(qe(t,x)),q(v(t,G))};(0,d.useEffect)(()=>{ae.isEditing||he()},[t]);let G=(0,d.useMemo)(()=>{let e=[...Le,...b.filter(({showInTypeSelector:e=!1,name:t})=>e&&!!t).map(({name:e})=>e)];if(typeof c==`boolean`)return c?e:[];if(Array.isArray(c))return c;let t=c(R);return typeof t==`boolean`?t?e:[]:t},[R,c,b]),[K,q]=(0,d.useState)(v(I,G)),{isEditing:ve,isPending:ye}=ae,be=Ce(z),J=(0,d.useRef)(f);if(!be)return null;let xe=ve&&fe!==qe(t,x),Se=xe?b.find(e=>e.name===fe&&Ke(e)):void 0,Y=Se?Re(Se):x,{CustomComponent:we,componentProps:Ee,showKey:De=!0,showEditTools:Oe=!0,showOnEdit:ke,showOnView:X,passOriginalNode:Ae}=Y,je=we&&(Se!==void 0||!xe&&(ve&&ke||!ve&&X)),Me=e=>{F(null);let t=xe&&!Se?void 0:Y,n=t?.toStandardType?t.toStandardType(I):I,r=b.find(t=>t.name===e);if(r){let t=typeof r.defaultValue==`function`?r.defaultValue(R):r.defaultValue;if(Ke(r)){let i=t;if(r.fromStandardType)try{i=r.fromStandardType(n,R,r.componentProps)}catch{}L(i),U(e),q(null);return}N({op:`edit`,path:z,value:t}).then(Z(t)),F({path:z,collapsed:!1,includeChildren:!1});return}let i=G.find(t=>t instanceof Object&&t.enum===e);if(i)return typeof I==`string`&&i.values.includes(I)||L(i.values[0]),q(i),void U(e);let a=Xe(n,e,y(`DEFAULT_NEW_KEY`,R));if(e===`object`||e===`array`||e===`null`)return N({op:`edit`,path:z,value:a}).then(Z(a)),void(e!==`null`&&F({path:z,collapsed:!1,includeChildren:!1}));L(a),U(e),q(null)},Z=e=>t=>{if(t?.status===`error`&&re(t.error,e),t?.status===`error`||t?.status===`cancel`){let e=P().active;e?.phase===`editing`&&w(e.path,z)||he()}},Q=(e,n)=>{let r=e!==void 0&&!_(e),i;if(r)i=e;else if(je&&Y.fromStandardType)try{i=Y.fromStandardType(I,R,Y.componentProps)}catch(e){re({code:`UPDATE_ERROR`,message:e instanceof Error?e.message:String(e)},I);return}else i=fe===`number`?Ye(I):I;ie(null),Se&&F({path:z,collapsed:!1,includeChildren:!1});let a=r&&m(i)&&!m(t);N({op:`edit`,path:z,value:i,onCommit:()=>{a&&F({path:z,collapsed:!1,includeChildren:!1}),n?.()}}).then(Z(i))};J.current=Q;let Fe=()=>{ie(null),he(),M()},{isEditingKey:Ie}=ae,ze=!!ne,Ue=ve&&G.length>1,We=(fe!==`invalid`||we)&&!ne&&Oe,Ge=l&&De,Ze=()=>j(z,{cancelOp:he,commitOp:e=>J.current(void 0,e)}),Qe=V?Ze:f,$e=e=>()=>{let t=oe(e);t&&Q(void 0,()=>j(t))},et={value:I,parentData:n,setValue:me,isEditing:ve,canEdit:V,setIsEditing:Qe,handleEdit:Q,handleCancel:Fe,path:z,stringTruncateLength:p,showStringQuotes:h,showIconTooltips:O,nodeData:R,enumType:K,translate:y,handleKeyboard:C,keyboardCommon:{cancel:Fe,tabForward:$e(`next`),tabBack:$e(`prev`)},Select:S},tt={...se({handleCancel:Fe,getStyles:A}),customNodeData:Y},nt=je?(0,u.jsx)(we,{...e,value:I,componentProps:Ee,setValue:me,handleEdit:Q,handleCancel:Fe,onKeyDown:e=>C(e,{stringConfirm:Q,cancel:Fe}),isEditing:ve,isPending:ye,setIsEditing:Qe,getStyles:A,originalNode:Ae?Je(t,fe,et):void 0,originalNodeKey:Ae?(0,u.jsx)(He,{...tt,customNodeData:void 0}):void 0,canEdit:V,keyboardCommon:et.keyboardCommon}):Je(t,fe,et);return(0,u.jsxs)(`div`,{className:`jer-component jer-value-component`,style:{marginLeft:n===null?0:g/2+`em`,position:`relative`},draggable:te&&!ve&&!Ie,...ce,...H(`above`),children:[le,(0,u.jsx)(ue,{position:`above`,nodeData:R}),(0,u.jsxs)(`div`,{className:`jer-value-main-row`,style:{...A(`valueRow`,R),flexWrap:B.length>10?`wrap`:`nowrap`},children:[Ge&&(0,u.jsx)(He,{...tt}),(0,u.jsxs)(`div`,{className:`jer-value-and-buttons`,children:[(0,u.jsx)(`div`,{className:`jer-input-component`,children:nt}),ve?(0,u.jsx)(Pe,{onOk:Q,onCancel:Fe,nodeData:R,translate:y,showIconTooltips:O,editConfirmRef:E}):We&&(0,u.jsx)(Ne,{startEdit:V?Ze:void 0,handleDelete:ee?()=>{N({op:`delete`,path:z,instant:!0}).then(e=>{e?.status===`error`&&re(e.error,I)})}:void 0,showClipboardButton:i,onCopy:a,translate:y,customButtons:e.customButtons,handleEdit:e=>Q(e),canEdit:V,nodeData:R,handleKeyboard:C,keyboardControls:T,editConfirmRef:E,jsonStringify:D,showIconTooltips:O,Select:S}),Ue&&(0,u.jsx)(S,{name:`${B}-type-select`,value:K?K.enum:fe,onChange:e=>Me(e),options:G.map(e=>e instanceof Object&&`enum`in e?e.enum:e)}),ze&&(0,u.jsx)(`span`,{className:`jer-error-slug`,style:A(`error`,R),children:ne})]})]}),(0,u.jsx)(ue,{position:`below`,nodeData:R})]})},We),Ke=e=>!!e.editOnTypeSwitch&&!!e.component&&!!e.showOnEdit,qe=(e,t)=>t?.CustomComponent&&t?.name&&t.showInTypeSelector?t.name:typeof e==`string`?`string`:typeof e==`number`?`number`:typeof e==`boolean`?`boolean`:e===null?`null`:`invalid`,Je=(e,t,n)=>{let r=Fe.includes(t)?t:typeof e==`function`?`invalid`:qe(n.value),{value:i}=n;switch(r){case`string`:return(0,u.jsx)(Oe,{...n,value:i});case`number`:return(0,u.jsx)(ke,{...n,value:i});case`boolean`:return(0,u.jsx)(X,{...n,value:i});case`null`:return(0,u.jsx)(je,{...n});default:return(0,u.jsx)(Me,{...n})}},Ye=e=>{if(typeof e==`symbol`)return 0;let t=Number(e);return isNaN(t)?0:t},Xe=(e,t,n)=>{switch(t){case`string`:return e==null?``:String(e);case`number`:return Ye(e);case`boolean`:return!!e;case`null`:return null;case`object`:return{[n]:e};case`array`:return[e];default:return String(e)}},Ze=d.memo(e=>{let{getStyles:t}=de(),{open:n,cancel:r,submit:i,areChildrenBeingEdited:a,getSnapshot:o}=ge(),{setCollapseState:s}=_e(),{mainContainerRef:c,data:l,nodeData:p,parentData:h,showCollectionCount:g,canDragOnto:v,canAddHere:y,collapseFilter:b,collapseAnimationTime:x,showClipboardButton:S,onCopy:C,showIconTooltips:E,indent:D,sort:O,showArrayIndexes:k,defaultValue:A,newKeyOptions:j,translate:M,customNodeDefinitions:N,customNodeData:P,jsonParse:F,jsonStringify:I,TextEditor:z,Select:B,keyboardControls:V,handleKeyboard:ee,insertAtTop:ne,onCollapse:re,editConfirmRef:ie,collapseClickZones:ae,getLatestData:oe}=e,[se,ce]=(0,d.useState)(null),{showCollectionWrapper:H=!0}=P,le=H&&b(p),{contentRef:ue,isAnimating:fe,maxHeight:U,collapsed:W,animateCollapse:pe,cssTransitionValue:me}=((e,t,n,r,i)=>{let[a,o]=(0,d.useState)(n?0:void 0),[s,c]=(0,d.useState)(n),l=(0,d.useRef)(!1),u=(0,d.useRef)(null),f=(0,d.useRef)(0),p=(0,d.useRef)(0),m=t/1e3+`s`,h=(0,d.useCallback)(n=>{if(s!==n){switch(window.clearTimeout(p.current),l.current=!0,n){case!0:{let e=u.current?.offsetHeight??0;f.current=e,o(e),setTimeout(()=>{o(0)},5);break}case!1:o(f.current||((e,t,n,r)=>{if(!t.current)return 0;let i=parseInt(getComputedStyle(n.current).getPropertyValue(`line-height`))||16,a=(t.current?.offsetWidth??0)/(.5*i),o=r(e).replace(/\\n/g,`
|
|
4
4
|
`).split(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./vendor-react-C1iE8mnY.js";import{l as r,t as i}from"./button-CvZ4_DFC.js";import{t as a}from"./external-link-C2aR4slL.js";import{L as o,d as s,f as c,ft as l,g as u,h as d,m as f,u as p,un as m}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./vendor-react-C1iE8mnY.js";import{l as r,t as i}from"./button-CvZ4_DFC.js";import{t as a}from"./external-link-C2aR4slL.js";import{L as o,d as s,f as c,ft as l,g as u,h as d,m as f,u as p,un as m}from"./index-BX4ymNYp.js";var h={name:`download`,size:24,node:[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]};h.node;var g=r(h),_={name:`maximize-2`,size:24,node:[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]};_.node;var v=r(_),y={name:`zoom-in`,size:24,node:[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`11`,x2:`11`,y1:`8`,y2:`14`,key:`1vmskp`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]};y.node;var b=r(y),x={name:`zoom-out`,size:24,node:[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]};x.node;var S=r(x),C=e(t(),1),w=/^(?:https?:\/\/|\/(?!\/))/i,T=/[^\x21-\x7e]|\\/;function E(e,t=[],n=globalThis.location?.href){if(e&&!T.test(e)&&w.test(e))try{let r=new URL(e,n);return r.username||r.password?void 0:l(e,n)||t.some(e=>e.toLowerCase()===r.hostname)?e:void 0}catch{return}}var D=n(),O=`no-referrer`,k=[1,1.5,2,3];function A({node:e}){let t=E(e.src,o()),[n,r]=(0,C.useState)(!1);if(!t)return null;let i=e.alt??``,a=i||`Image`;return n?(0,D.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[a,` couldn't be loaded.`,` `,(0,D.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,referrerPolicy:O,className:`underline underline-offset-4`,children:`Open it in a new tab`})]}):(0,D.jsxs)(p,{children:[(0,D.jsx)(u,{asChild:!0,children:(0,D.jsx)(`button`,{type:`button`,"aria-label":`View larger: ${a}`,className:`block max-w-full cursor-zoom-in self-start rounded-md focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,D.jsx)(`img`,{src:t,alt:i,width:e.width_px,height:e.height_px,loading:`lazy`,decoding:`async`,referrerPolicy:O,onError:()=>r(!0),className:`h-auto max-h-96 max-w-full rounded-md border object-contain`})})}),(0,D.jsx)(s,{className:`gap-3 sm:max-w-[min(64rem,calc(100%-2rem))]`,children:(0,D.jsx)(j,{src:t,alt:i,label:a})})]})}function j({src:e,alt:t,label:n}){let[r,o]=(0,C.useState)(null),[s,l]=(0,C.useState)(),u=e=>o(t=>{let n=(t==null?-1:k.indexOf(t))+e;return n<0?null:k[Math.min(n,k.length-1)]});return(0,D.jsxs)(`div`,{className:`grid gap-3`,onKeyDown:e=>{if(e.key===`+`||e.key===`=`)u(1);else if(e.key===`-`)u(-1);else if(e.key===`0`)o(null);else return;e.preventDefault()},children:[(0,D.jsxs)(f,{className:`flex-row items-center gap-2 pr-8`,children:[(0,D.jsx)(d,{className:`min-w-0 flex-1 truncate`,children:n}),(0,D.jsx)(c,{className:`sr-only`,children:`Use plus and minus to zoom, zero to fit the window.`}),(0,D.jsx)(i,{variant:`outline`,size:`icon-sm`,"aria-label":`Zoom out`,disabled:r==null,onClick:()=>u(-1),children:(0,D.jsx)(S,{})}),(0,D.jsx)(`span`,{"aria-live":`polite`,className:`w-12 text-center text-xs text-muted-foreground tabular-nums`,children:r==null?`Fit`:`${r*100}%`}),(0,D.jsx)(i,{variant:`outline`,size:`icon-sm`,"aria-label":`Zoom in`,disabled:r===k.at(-1),onClick:()=>u(1),children:(0,D.jsx)(b,{})}),(0,D.jsx)(i,{variant:`outline`,size:`icon-sm`,"aria-label":`Fit to window`,disabled:r==null,onClick:()=>o(null),children:(0,D.jsx)(v,{})}),(0,D.jsx)(i,{variant:`outline`,size:`icon-sm`,"aria-label":`Open in new tab`,asChild:!0,children:(0,D.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,referrerPolicy:O,children:(0,D.jsx)(a,{})})})]}),(0,D.jsx)(`div`,{tabIndex:0,role:`group`,"aria-label":`${n}, zoomable`,className:`max-h-[75vh] overflow-auto rounded-md bg-muted/40 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,D.jsx)(`img`,{src:e,alt:t,referrerPolicy:O,onLoad:e=>l(e.currentTarget.naturalWidth),style:r!=null&&s?{width:s*r,maxWidth:`none`}:void 0,className:r==null||!s?`mx-auto max-h-[75vh] max-w-full object-contain`:`mx-auto block h-auto`})})]})}function M({node:e}){let t=E(e.src,o());if(!t||e.mime!==`application/pdf`)return null;let n=e.title||`PDF document`;return(0,D.jsxs)(`section`,{"aria-label":n,className:`flex min-w-0 flex-col overflow-hidden rounded-lg border bg-card`,children:[(0,D.jsxs)(`header`,{className:`flex items-center gap-2 border-b px-3 py-1.5`,children:[(0,D.jsx)(m,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,D.jsx)(`h4`,{className:`min-w-0 flex-1 truncate text-sm font-medium`,children:n}),(0,D.jsx)(i,{variant:`ghost`,size:`sm`,asChild:!0,children:(0,D.jsxs)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,referrerPolicy:O,"aria-label":`Open in new tab`,children:[(0,D.jsx)(a,{}),` `,(0,D.jsx)(`span`,{className:`hidden sm:inline`,children:`Open in new tab`})]})}),(0,D.jsx)(i,{variant:`ghost`,size:`sm`,asChild:!0,children:(0,D.jsxs)(`a`,{href:t,download:!0,target:`_blank`,rel:`noopener noreferrer`,referrerPolicy:O,"aria-label":`Download`,children:[(0,D.jsx)(g,{}),` `,(0,D.jsx)(`span`,{className:`hidden sm:inline`,children:`Download`})]})})]}),(0,D.jsx)(`iframe`,{src:t,title:n,loading:`lazy`,referrerPolicy:O,className:`block h-[70vh] max-h-[56rem] min-h-96 w-full border-0 bg-muted/40`}),(0,D.jsxs)(`footer`,{className:`border-t px-3 py-1.5 text-xs text-muted-foreground`,children:[`Preview blank or blocked by your browser? `,(0,D.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,referrerPolicy:O,className:`underline underline-offset-4`,children:`Open the document`}),` instead.`]})]})}export{M as DocumentNode,A as ImageNode};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./vendor-react-C1iE8mnY.js";import{a as r,c as i,l as a}from"./button-CvZ4_DFC.js";import{t as o}from"./utils-DwBGbDkG.js";import{a as s,d as c,f as l,h as u,i as d,l as f,m as p,n as m,o as h,r as g,t as _,u as v}from"./dist-CqEI82S_.js";import{It as y,Lt as b,Qt as x,Rt as S,Xt as C,Zt as w,zt as T}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./vendor-react-C1iE8mnY.js";import{a as r,c as i,l as a}from"./button-CvZ4_DFC.js";import{t as o}from"./utils-DwBGbDkG.js";import{a as s,d as c,f as l,h as u,i as d,l as f,m as p,n as m,o as h,r as g,t as _,u as v}from"./dist-CqEI82S_.js";import{It as y,Lt as b,Qt as x,Rt as S,Xt as C,Zt as w,zt as T}from"./index-BX4ymNYp.js";var E={name:`chevron-left`,size:24,node:[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]};E.node;var D=a(E),O=e(t(),1),k=n(),A=Object.defineProperty,j=(e,t)=>A(e,`name`,{value:t,configurable:!0}),M=`Popover`,[N,ee]=p(M,[T]),P=T(),[F,I]=N(M),L=j(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=P(t),l=O.useRef(null),[u,d]=O.useState(!1),[p,m]=O.useState(0),[h,g]=O.useState(0),[_,v]=c({prop:r,defaultProp:i??!1,onChange:a,caller:M});return(0,k.jsx)(y,{...s,children:(0,k.jsx)(F,{scope:t,contentId:f(),titleId:f(),descriptionId:f(),titlePresent:p>0,descriptionPresent:h>0,setTitleCount:m,setDescriptionCount:g,triggerRef:l,open:_,onOpenChange:v,onOpenToggle:O.useCallback(()=>v(e=>!e),[v]),hasCustomAnchor:u,onCustomAnchorAdd:O.useCallback(()=>d(!0),[]),onCustomAnchorRemove:O.useCallback(()=>d(!1),[]),modal:o,children:n})})},`Popover`),R=`PopoverTrigger`,z=O.forwardRef(j(function(e,t){let{__scopePopover:n,...r}=e,a=I(R,n),o=P(n),s=i(t,a.triggerRef),c=(0,k.jsx)(u.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":X(a.open),...r,ref:s,onClick:l(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?c:(0,k.jsx)(b,{asChild:!0,...o,children:c})},`PopoverTrigger`)),B=`PopoverPortal`,[V,H]=N(B,{forceMount:void 0}),U=j(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=I(B,t);return(0,k.jsx)(V,{scope:t,forceMount:n,children:(0,k.jsx)(v,{present:n||a.open,children:(0,k.jsx)(_,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),W=`PopoverContent`,G=O.forwardRef(j(function(e,t){let n=H(W,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=I(W,e.__scopePopover);return(0,k.jsx)(v,{present:r||a.open,children:a.modal?(0,k.jsx)(q,{...i,ref:t}):(0,k.jsx)(J,{...i,ref:t})})},`PopoverContent`)),K=r(`PopoverContent.RemoveScroll`),q=O.forwardRef(j(function(e,t){let n=I(W,e.__scopePopover),r=O.useRef(null),a=i(t,r),o=O.useRef(!1),{nodes:c,registry:u}=s();return O.useEffect(()=>{let e=r.current;if(e)return C(e)},[]),(0,k.jsx)(w,{as:K,allowPinchZoom:!0,shards:O.useMemo(()=>[r,...c.map(e=>({current:e}))],[r,c]),children:(0,k.jsx)(Y,{...e,ref:a,branchNodes:c,branchRegistry:u,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:l(e.onCloseAutoFocus,e=>{e.preventDefault(),o.current||n.triggerRef.current?.focus()}),onPointerDownOutside:l(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;o.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:l(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),J=O.forwardRef(j(function(e,t){let n=I(W,e.__scopePopover),r=O.useRef(!1),i=O.useRef(!1);return(0,k.jsx)(Y,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`PopoverContentNonModal`)),Y=O.forwardRef(j(function(e,t){let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:f,"aria-describedby":p,branchNodes:_,branchRegistry:v,...y}=e,b=I(W,n),C=P(n),[w,T]=O.useState(null),E=i(t,T);return d(w),x(),(0,k.jsx)(g,{registry:v,children:(0,k.jsx)(m,{asChild:!0,loop:!0,trapped:r,branches:_,onMountAutoFocus:a,onUnmountAutoFocus:o,children:(0,k.jsx)(h,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:f,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:u,onDismiss:()=>b.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,k.jsx)(S,{"data-state":X(b.open),role:`dialog`,id:b.contentId,"aria-labelledby":b.titlePresent?b.titleId:void 0,"aria-describedby":b.descriptionPresent?Z(p,b.descriptionId):p,...C,...y,ref:E,style:{...y.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})})},`PopoverContentImpl`));function X(e){return e?`open`:`closed`}j(X,`getState`);function Z(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}j(Z,`concatAriaDescribedby`);function Q({...e}){return(0,k.jsx)(L,{"data-slot":`popover`,...e})}function $({...e}){return(0,k.jsx)(z,{"data-slot":`popover-trigger`,...e})}function te({className:e,align:t=`center`,sideOffset:n=4,...r}){return(0,k.jsx)(U,{children:(0,k.jsx)(G,{"data-slot":`popover-content`,align:t,sideOffset:n,className:o(`z-50 flex w-72 origin-(--radix-popover-content-transform-origin) flex-col gap-2.5 rounded-lg bg-popover p-2.5 text-sm text-popover-foreground border outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r})})}export{D as i,te as n,$ as r,Q as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./vendor-react-C1iE8mnY.js";import{L as r,ut as i}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./vendor-react-C1iE8mnY.js";import{L as r,ut as i}from"./index-BX4ymNYp.js";import{n as a}from"./purify-G7QKJyJq.js";import{V as o}from"./Node-BFhcTc_1.js";var s=e(t(),1),c=n();function l({node:e}){let{resource:t,id:n}=o(),l=r(),u=(0,s.useMemo)(()=>a(e.html??``,`display`,l),[e.html,l]);return(0,c.jsxs)(`div`,{className:`rounded-md border bg-muted/40 p-3 text-sm`,children:[(0,c.jsx)(`div`,{className:`max-w-none space-y-2 [&_a]:underline [&_ol]:list-decimal [&_ol]:pl-5 [&_ul]:list-disc [&_ul]:pl-5`,dangerouslySetInnerHTML:{__html:u}}),t&&n&&(0,c.jsx)(`a`,{href:i(t,n),className:`mt-2 inline-block text-xs text-muted-foreground underline-offset-4 hover:underline`,children:`Open in classic admin`})]})}export{l as Html};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,r as n,t as r}from"./vendor-react-C1iE8mnY.js";import{a as i,n as a,t as o}from"./vendor-query-DZ6APRNI.js";import{a as s,c,l}from"./button-CvZ4_DFC.js";import{t as u}from"./check-C5A3J16N.js";import{G as d,st as f}from"./Node-SQl61V4K.js";import{t as p}from"./utils-DwBGbDkG.js";import{c as m,d as h,f as g,h as _,l as v,m as y,n as b,o as x,p as S,t as C,u as w}from"./dist-CqEI82S_.js";import{$t as T,Bt as E,It as ee,Lt as D,Qt as te,Rt as O,Xt as k,Zt as ne,en as re,tn as ie,wt as A,xt as j,zt as ae}from"./index-B51aUaAY.js";import{a as M,i as N,o as P,r as F,s as I,t as L}from"./command-CMuk0oAt.js";var R={name:`arrow-down`,size:24,node:[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]};R.node;var z=l(R),oe={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]};oe.node;var se=l(oe),ce={name:`chevron-up`,size:24,node:[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]};ce.node;var le=l(ce),ue={name:`minus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]};ue.node;var de=l(ue),B=e(t(),1),V=r(),fe=Object.defineProperty,H=(e,t)=>fe(e,`name`,{value:t,configurable:!0}),pe=`Checkbox`,[me,he]=y(pe),[ge,_e]=me(pe);function ve(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=h({prop:n,defaultProp:i??!1,onChange:c,caller:pe}),[m,g]=B.useState(null),[_,v]=B.useState(null),[y,b]=B.useState(null),x=!m||!!o||!!m.closest(`form`),S={checked:f,disabled:a,setChecked:p,control:m,setControl:g,name:s,form:o,value:u,userClick:y,onUserClick:b,required:l,defaultChecked:!U(i)&&i,isFormControl:x,bubbleInput:_,setBubbleInput:v};return(0,V.jsx)(ge,{scope:t,...S,children:Ee(d)?d(S):r})}H(ve,`CheckboxProvider`);var ye=`CheckboxTrigger`,be=B.forwardRef(H(function({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i){let{control:a,value:o,disabled:s,checked:l,required:u,setControl:d,setChecked:f,onUserClick:p,isFormControl:m,bubbleInput:h}=_e(ye,e),v=c(i,d),y=B.useRef(l);return B.useEffect(()=>{let e=a?.form;if(e){let t=H(()=>f(y.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,f]),(0,V.jsx)(_.button,{type:`button`,role:`checkbox`,"aria-checked":U(l)?`mixed`:l,"aria-required":u,"data-state":De(l),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:v,onKeyDown:g(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:g(n,e=>{let t=e.isPropagationStopped();p({requestedChecked:U(l)?!0:!l,hasConsumerStoppedPropagation:t}),f(e=>U(e)?!0:!e),h&&m&&(t||e.stopPropagation())})})},`CheckboxTrigger`)),xe=B.forwardRef(H(function(e,t){let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,V.jsx)(ve,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(be,{...d,ref:t,__scopeCheckbox:n}),e&&(0,V.jsx)(Te,{__scopeCheckbox:n})]})})},`Checkbox`)),Se=`CheckboxIndicator`,Ce=B.forwardRef(H(function(e,t){let{__scopeCheckbox:n,forceMount:r,...i}=e,a=_e(Se,n);return(0,V.jsx)(w,{present:r||U(a.checked)||a.checked===!0,children:(0,V.jsx)(_.span,{"data-state":De(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})},`CheckboxIndicator`)),we=`CheckboxBubbleInput`,Te=B.forwardRef(H(function({__scopeCheckbox:e,onClick:t,...n},r){let{control:i,userClick:a,checked:o,defaultChecked:s,required:l,disabled:u,name:d,value:f,form:p,bubbleInput:m,setBubbleInput:h}=_e(we,e),v=c(r,h),y=E(i),b=B.useRef(!1),x=B.useRef(o),S=B.useRef(a),C=B.useRef(null);B.useEffect(()=>{let e=m;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set;if(!n)return;let r=x.current!==o;x.current=o;let i=a!==null&&a!==S.current;if(S.current=a,i)C.current=r?null:a,r&&(e.indeterminate=U(o),n.call(e,!U(o)&&o)),e.dispatchEvent(new Event(`click`,{bubbles:!a.hasConsumerStoppedPropagation}));else if(r){let t=C.current;C.current=null;let r=t?.requestedChecked===o;b.current=!0,e.indeterminate=U(o),n.call(e,!U(o)&&o),e.dispatchEvent(new Event(`click`,{bubbles:!(r&&t.hasConsumerStoppedPropagation)})),b.current=!1}},[m,o,a]);let w=B.useRef(!U(o)&&o);return(0,V.jsx)(_.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:s??w.current,required:l,disabled:u,name:d,value:f,form:p,...n,tabIndex:-1,ref:v,onClick:g(t,e=>{b.current&&e.stopPropagation()}),style:{...n.style,...y,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`CheckboxBubbleInput`));function Ee(e){return typeof e==`function`}H(Ee,`isFunction`);function U(e){return e===`indeterminate`}H(U,`isIndeterminate`);function De(e){return U(e)?`indeterminate`:e?`checked`:`unchecked`}H(De,`getState`);var Oe=e(n(),1),ke=Object.defineProperty,Ae=(e,t)=>ke(e,`name`,{value:t,configurable:!0});function je(e,[t,n]){return Math.min(n,Math.max(t,e))}Ae(je,`clamp`);var Me=Object.defineProperty,W=(e,t)=>Me(e,`name`,{value:t,configurable:!0}),Ne={ItemAligned:`item-aligned`,Popper:`popper`},Pe={LTR:`ltr`,RTL:`rtl`},Fe=[` `,`Enter`,`ArrowUp`,`ArrowDown`],Ie=[` `,`Enter`],G=`Select`,[K,q,Le]=re(G),[J,Re]=y(G,[Le,ae]),ze=ae(),[Be,Y]=J(G),[Ve,He]=J(G);function Ue(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m,internal_do_not_use_render:g}=e,_=ze(t),[y,b]=B.useState(null),[x,S]=B.useState(null),[C,w]=B.useState(!1),E=T(l),[D,te]=h({prop:r,defaultProp:i??!1,onChange:a,caller:G}),[O,k]=h({prop:o,defaultProp:s,onChange:c,caller:G}),ne=B.useRef(null),re=B.useRef(!1),[ie,A]=B.useState(null),j=W(e=>{A({value:e,hasConsumerStoppedPropagation:re.current}),k(e)},`handleUserSelect`),ae=B.useRef(O);B.useEffect(()=>{let e=m?y?.ownerDocument.getElementById(m):y?.form;if(e instanceof HTMLFormElement){let t=W(()=>k(ae.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[m,y,k]);let M=!y||!!m||!!y.closest(`form`),[N,P]=B.useState(new Set),F=v(),I=Array.from(N).map(e=>e.props.value).join(`;`),L=B.useCallback(e=>{P(t=>new Set(t).add(e))},[]),R=B.useCallback(e=>{P(t=>{let n=new Set(t);return n.delete(e),n})},[]),z={required:p,trigger:y,onTriggerChange:b,valueNode:x,onValueNodeChange:S,valueNodeHasChildren:C,onValueNodeHasChildrenChange:w,contentId:F,value:O,onValueChange:k,hasConsumerStoppedPropagationRef:re,userSelection:ie,onUserSelect:j,open:D,onOpenChange:te,dir:E,triggerPointerDownPosRef:ne,disabled:f,name:u,autoComplete:d,form:m,nativeOptions:N,nativeSelectKey:I,isFormControl:M};return(0,V.jsx)(ee,{..._,children:(0,V.jsx)(Be,{scope:t,...z,children:(0,V.jsx)(K.Provider,{scope:t,children:(0,V.jsx)(Ve,{scope:t,onNativeOptionAdd:L,onNativeOptionRemove:R,children:Dt(g)?g(z):n})})})})}W(Ue,`SelectProvider`);var We=W(e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,V.jsx)(Ue,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,V.jsxs)(V.Fragment,{children:[n,e?(0,V.jsx)(Et,{__scopeSelect:t}):null]})})},`Select`),Ge=`SelectTrigger`,Ke=B.forwardRef(W(function(e,t){let{__scopeSelect:n,disabled:r=!1,...i}=e,a=ze(n),o=Y(Ge,n),s=o.disabled||r,l=c(t,o.onTriggerChange),u=q(n),d=B.useRef(`touch`),[f,p,m]=Ot(e=>{let t=u().filter(e=>!e.disabled),n=kt(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onUserSelect(n.value)}),h=W(e=>{s||(o.onOpenChange(!0),m()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})},`handleOpen`);return(0,V.jsx)(D,{asChild:!0,...a,children:(0,V.jsx)(_.button,{type:`button`,role:`combobox`,"aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":$(o.value)?``:void 0,...i,ref:l,onClick:g(i.onClick,e=>{e.currentTarget.focus(),d.current!==`mouse`&&h(e)}),onPointerDown:g(i.onPointerDown,e=>{d.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(h(e),e.preventDefault())}),onKeyDown:g(i.onKeyDown,e=>{let t=f.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&(o.hasConsumerStoppedPropagationRef.current=e.isPropagationStopped(),p(e.key)),t&&e.key===` `||Fe.includes(e.key)&&(h(),e.preventDefault())})})})},`SelectTrigger`)),qe=`SelectValue`,Je=B.forwardRef(W(function(e,t){let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,l=Y(qe,n),{onValueNodeHasChildrenChange:u}=l,d=a!==void 0,f=c(t,l.onValueNodeChange);S(()=>{u(d)},[u,d]);let p=$(l.value);return(0,V.jsx)(_.span,{...s,asChild:!p&&s.asChild,ref:f,style:{pointerEvents:`none`},children:(0,V.jsx)(B.Fragment,{children:p?o:a},p?`placeholder`:`value`)})},`SelectValue`)),Ye=B.forwardRef(W(function(e,t){let{__scopeSelect:n,children:r,...i}=e;return(0,V.jsx)(_.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})},`SelectIcon`)),[Xe,Ze]=J(`SelectPortal`,{forceMount:void 0}),Qe=W(e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,V.jsx)(Xe,{scope:e.__scopeSelect,forceMount:n,children:(0,V.jsx)(C,{asChild:!0,...r})})},`SelectPortal`),X=`SelectContent`,$e=B.forwardRef(W(function(e,t){let n=Ze(X,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=Y(X,e.__scopeSelect),[o,s]=B.useState();return S(()=>{s(new DocumentFragment)},[]),(0,V.jsx)(w,{present:r||a.open,children:({present:e})=>e?(0,V.jsx)(rt,{...i,ref:t}):(0,V.jsx)(et,{...i,fragment:o})})},`SelectContent`)),et=B.forwardRef(W(function(e,t){let{__scopeSelect:n,children:r,fragment:i}=e;return i?Oe.createPortal((0,V.jsx)(tt,{scope:n,children:(0,V.jsx)(K.Slot,{scope:n,children:(0,V.jsx)(`div`,{ref:t,children:r})})}),i):null},`SelectContentFragment`)),Z=10,[tt,Q]=J(X),nt=s(`SelectContent.RemoveScroll`),rt=B.forwardRef(W(function(e,t){let{__scopeSelect:n}=e,{position:r=Ne.ItemAligned,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:p,collisionPadding:m,sticky:h,hideWhenDetached:_,avoidCollisions:v,...y}=e,S=Y(X,n),[C,w]=B.useState(null),[T,E]=B.useState(null),ee=c(t,w),[D,O]=B.useState(null),[re,ie]=B.useState(null),A=q(n),[j,ae]=B.useState(!1),M=B.useRef(!1),N=B.useRef(!1),P=B.useRef(!1);B.useEffect(()=>{if(C)return k(C)},[C]),te();let F=B.useCallback(e=>{let[t,...n]=A().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&T&&(T.scrollTop=0),n===r&&T&&(T.scrollTop=T.scrollHeight),n?.focus(),document.activeElement!==i))return},[A,T]),I=B.useCallback(()=>F([D,C]),[F,D,C]);B.useEffect(()=>{j&&I()},[j,I]);let{onOpenChange:L,triggerPointerDownPosRef:R}=S;B.useEffect(()=>{if(C){let e={x:0,y:0},t=W(t=>{e={x:Math.abs(Math.round(t.pageX)-(R.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(R.current?.y??0))}},`handlePointerMove`),n=W(n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(C)||L(!1),document.removeEventListener(`pointermove`,t),R.current=null},`handlePointerUp`);return R.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[C,L,R]),B.useEffect(()=>{let e=W(()=>L(!1),`close`);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[L]);let[z,oe]=Ot(e=>{let t=A().filter(e=>!e.disabled),n=kt(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),se=B.useCallback((e,t,n)=>{let r=!N.current;r&&(N.current=!0);let i=!M.current&&!n;S.value!==void 0&&S.value===t||i?(O(e),i&&(M.current=!0)):r&&O(e)},[S.value]),ce=B.useCallback(()=>C?.focus(),[C]),le=B.useCallback((e,t,n)=>{if(!e)return;let r=!P.current;r&&(P.current=!0);let i=!M.current&&!n;(S.value!==void 0&&S.value===t||i||r)&&ie(e)},[S.value]),ue=r===Ne.Popper?at:it,de=ue===at?{side:s,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:p,collisionPadding:m,sticky:h,hideWhenDetached:_,avoidCollisions:v}:{};return(0,V.jsx)(tt,{scope:n,content:C,viewport:T,onViewportChange:E,itemRefCallback:se,selectedItem:D,onItemLeave:ce,itemTextRefCallback:le,focusSelectedItem:I,selectedItemText:re,position:r,isPositioned:j,searchRef:z,children:(0,V.jsx)(ne,{as:nt,allowPinchZoom:!0,children:(0,V.jsx)(b,{asChild:!0,trapped:S.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:g(i,e=>{S.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,V.jsx)(x,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>S.onOpenChange(!1),children:(0,V.jsx)(ue,{role:`listbox`,id:S.contentId,"data-state":S.open?`open`:`closed`,dir:S.dir,onContextMenu:e=>e.preventDefault(),...y,...de,onPlaced:()=>ae(!0),ref:ee,style:{display:`flex`,flexDirection:`column`,outline:`none`,...y.style},onKeyDown:g(y.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&oe(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=A().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>F(t)),e.preventDefault()}})})})})})})},`SelectContentImpl`)),it=B.forwardRef(W(function(e,t){let{__scopeSelect:n,onPlaced:r,...i}=e,a=Y(X,n),o=Q(X,n),[s,l]=B.useState(null),[u,d]=B.useState(null),f=c(t,d),p=q(n),m=B.useRef(!1),h=B.useRef(!0),{viewport:g,selectedItem:v,selectedItemText:y,focusSelectedItem:b}=o,x=B.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&u&&g&&v&&y){let e=a.trigger.getBoundingClientRect(),t=u.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=y.getBoundingClientRect();if(a.dir!==Pe.RTL){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Z,d=je(a,[Z,Math.max(Z,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Z,d=je(a,[Z,Math.max(Z,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=p(),c=window.innerHeight-Z*2,l=g.scrollHeight,d=window.getComputedStyle(u),f=parseInt(d.borderTopWidth,10),h=parseInt(d.paddingTop,10),_=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=f+h+l+b+_,S=Math.min(v.offsetHeight*5,x),C=window.getComputedStyle(g),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-Z,ee=c-E,D=v.offsetHeight/2,te=v.offsetTop+D,O=f+h+te,k=x-O;if(O<=E){let e=o.length>0&&v===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=u.clientHeight-g.offsetTop-g.offsetHeight,n=O+Math.max(ee,D+(e?T:0)+t+_);s.style.height=n+`px`}else{let e=o.length>0&&v===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,f+g.offsetTop+(e?w:0)+D)+k;s.style.height=t+`px`,g.scrollTop=O-E+g.offsetTop}s.style.margin=`${Z}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>m.current=!0)}},[p,a.trigger,a.valueNode,s,u,g,v,y,a.dir,r]);S(()=>x(),[x]);let[C,w]=B.useState();S(()=>{u&&w(window.getComputedStyle(u).zIndex)},[u]);let T=B.useCallback(e=>{e&&h.current===!0&&(x(),b?.(),h.current=!1)},[x,b]);return(0,V.jsx)(ot,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:m,onScrollButtonChange:T,children:(0,V.jsx)(`div`,{ref:l,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:C},children:(0,V.jsx)(_.div,{...i,ref:f,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})},`SelectItemAlignedPosition`)),at=B.forwardRef(W(function(e,t){let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Z,...a}=e,o=ze(n);return(0,V.jsx)(O,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})},`SelectPopperPosition`)),[ot,st]=J(X,{}),ct=`SelectViewport`,lt=B.forwardRef(W(function(e,t){let{__scopeSelect:n,nonce:r,...i}=e,a=Q(ct,n),o=st(ct,n),s=c(t,a.onViewportChange),l=B.useRef(0);return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,V.jsx)(K.Slot,{scope:n,children:(0,V.jsx)(_.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:g(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(l.current-t.scrollTop);if(e>0){let r=window.innerHeight-Z*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}l.current=t.scrollTop})})})]})},`SelectViewport`)),[ut,dt]=J(`SelectGroup`),ft=`SelectItem`,[pt,mt]=J(ft),ht=B.forwardRef(W(function(e,t){let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=Y(ft,n),l=Q(ft,n),u=s.value===r,[d,f]=B.useState(a??``),[p,h]=B.useState(!1),y=m(e=>l.itemRefCallback?.(e,r,i)),b=c(t,y),x=v(),S=B.useRef(`touch`);function C(e){s.hasConsumerStoppedPropagationRef.current=e.isPropagationStopped(),s.onUserSelect(r),s.onOpenChange(!1)}return W(C,`handleSelect`),(0,V.jsx)(pt,{scope:n,value:r,disabled:i,textId:x,isSelected:u,onItemTextChange:B.useCallback(e=>{f(t=>t||(e?.textContent??``).trim())},[]),children:(0,V.jsx)(K.ItemSlot,{scope:n,value:r,disabled:i,textValue:d,children:(0,V.jsx)(_.div,{role:`option`,"aria-labelledby":x,"data-highlighted":p?``:void 0,"aria-selected":u&&p,"data-state":u?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:b,onFocus:g(o.onFocus,()=>h(!0)),onBlur:g(o.onBlur,()=>h(!1)),onClick:g(o.onClick,e=>{i||S.current!==`mouse`&&C(e)}),onPointerUp:g(o.onPointerUp,e=>{i||S.current===`mouse`&&C(e)}),onPointerDown:g(o.onPointerDown,e=>{S.current=e.pointerType}),onPointerMove:g(o.onPointerMove,e=>{S.current=e.pointerType,i?l.onItemLeave?.():S.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:g(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:g(o.onKeyDown,e=>{i||e.target!==e.currentTarget||(l.searchRef?.current===``||e.key!==` `)&&(Ie.includes(e.key)&&C(e),e.key===` `&&e.preventDefault())})})})})},`SelectItem`)),gt=`SelectItemText`,_t=B.forwardRef(W(function(e,t){let{__scopeSelect:n,className:r,style:i,...a}=e,o=Y(gt,n),s=Q(gt,n),l=mt(gt,n),u=He(gt,n),[d,f]=B.useState(null),p=m(e=>s.itemTextRefCallback?.(e,l.value,l.disabled)),h=c(t,f,l.onItemTextChange,p),g=d?.textContent,v=B.useMemo(()=>(0,V.jsx)(`option`,{value:l.value,disabled:l.disabled,children:g},l.value),[l.disabled,l.value,g]),{onNativeOptionAdd:y,onNativeOptionRemove:b}=u;return S(()=>(y(v),()=>b(v)),[y,b,v]),(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(_.span,{id:l.textId,...a,ref:h}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!$(o.value)?Oe.createPortal(a.children,o.valueNode):null]})},`SelectItemText`)),vt=`SelectItemIndicator`,yt=B.forwardRef(W(function(e,t){let{__scopeSelect:n,...r}=e;return mt(vt,n).isSelected?(0,V.jsx)(_.span,{"aria-hidden":!0,...r,ref:t}):null},`SelectItemIndicator`)),bt=`SelectScrollUpButton`,xt=B.forwardRef(W(function(e,t){let n=Q(bt,e.__scopeSelect),r=st(bt,e.__scopeSelect),[i,a]=B.useState(!1),o=c(t,r.onScrollButtonChange);return S(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;a(e)};W(e,`handleScroll`);let t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,V.jsx)(wt,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null},`SelectScrollUpButton`)),St=`SelectScrollDownButton`,Ct=B.forwardRef(W(function(e,t){let n=Q(St,e.__scopeSelect),r=st(St,e.__scopeSelect),[i,a]=B.useState(!1),o=c(t,r.onScrollButtonChange);return S(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;a(n)};W(e,`handleScroll`);let t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,V.jsx)(wt,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null},`SelectScrollDownButton`)),wt=B.forwardRef(W(function(e,t){let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=Q(`SelectScrollButton`,n),o=B.useRef(null),s=q(n),c=B.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return B.useEffect(()=>()=>c(),[c]),S(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,V.jsx)(_.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:g(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:g(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:g(i.onPointerLeave,()=>{c()})})},`SelectScrollButtonImpl`)),Tt=`SelectBubbleInput`,Et=B.forwardRef(W(function({__scopeSelect:e,...t},n){let r=Y(Tt,e),{value:i,onValueChange:a,required:o,disabled:s,name:l,autoComplete:u,form:d,userSelection:f}=r,{nativeOptions:p,nativeSelectKey:m}=r,h=B.useRef(null),g=c(n,h),v=i??``,y=B.useRef(v),b=B.useRef(f),x=B.useRef(!1),S=Array.from(p).some(e=>(e.props.value??``)===``);return B.useEffect(()=>{let e=h.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set,r=f!==null&&f!==b.current;b.current=f;let i=y.current!==v;y.current=v;let a=r&&i;if(r&&!i&&f.value!==v&&!f.hasConsumerStoppedPropagation&&n){x.current=!0;try{n.call(e,f.value),e.dispatchEvent(new Event(`change`,{bubbles:!0}))}finally{x.current=!1,n.call(e,v)}return}let o=a&&!f.hasConsumerStoppedPropagation;if(i&&n){let t=new Event(`change`,{bubbles:o});n.call(e,v),e.dispatchEvent(t)}},[v,f]),(0,V.jsxs)(_.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:l,autoComplete:u,disabled:s,form:d,onChange:e=>{x.current||a(e.target.value)},...t,style:{...ie,...t.style},ref:g,defaultValue:v,children:[$(i)&&!S?(0,V.jsx)(`option`,{value:``}):null,Array.from(p)]},m)},`SelectBubbleInput`));function Dt(e){return typeof e==`function`}W(Dt,`isFunction`);function $(e){return e===``||e===void 0}W($,`shouldShowPlaceholder`);function Ot(e){let t=m(e),n=B.useRef(``),r=B.useRef(0),i=B.useCallback(e=>{let i=n.current+e;t(i);function a(e){n.current=e,window.clearTimeout(r.current),e!==``&&(r.current=window.setTimeout(()=>a(``),1e3))}W(a,`updateSearch`),a(i)},[t]),a=B.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return B.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}W(Ot,`useTypeaheadSearch`);function kt(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=At(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}W(kt,`findNextItem`);function At(e,t){return e.map((n,r)=>e[(t+r)%e.length])}W(At,`wrapArray`);var jt=`__load_more__`;function Mt({option:e}){return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`truncate`,children:e.label}),e.hint&&(0,V.jsx)(`span`,{className:`min-w-0 truncate text-xs text-muted-foreground`,children:e.hint})]})}function Nt({source:e,inline:t,remote:n,selected:r,placeholder:i,onPick:a,onClear:o,clearLabel:s=`None`,freeText:c}){let{term:l,setTerm:u}=e,f=l.trim(),p=n?e.found:t,m=r.flatMap(t=>e.optionOf(t)??[]),h=new Set(m.map(e=>e.value)),g=n&&!f?e.recent.filter(e=>!h.has(e.value)):[];g.forEach(e=>h.add(e.value));let _=p.filter(e=>!h.has(e.value)),v=c&&f&&![...m,...p].some(e=>e.label.toLowerCase()===f.toLowerCase()),y=e=>r.includes(e.value),b=e=>(0,V.jsx)(P,{value:n?e.value:`${e.label} ${e.hint??``}`,onSelect:()=>a(e),"data-checked":y(e),children:(0,V.jsx)(Mt,{option:e})},e.value);return(0,V.jsxs)(L,{shouldFilter:!n,children:[(0,V.jsx)(M,{value:l,onValueChange:u,onPaste:t=>{let r=t.clipboardData.getData(`text`).trim();n&&d(r)&&(t.preventDefault(),u(r),e.lookup(r).then(e=>e&&a(e),()=>void 0))},placeholder:i}),(0,V.jsxs)(`div`,{role:`status`,className:`empty:hidden`,children:[n&&e.searching&&(0,V.jsx)(`p`,{className:`px-3 py-2 text-sm text-muted-foreground`,children:`Searching…`}),n&&e.rateLimited&&!e.searching&&(0,V.jsx)(`p`,{className:`px-3 py-2 text-sm text-muted-foreground`,children:`Searching too fast. Pause for a moment, then keep typing.`})]}),(0,V.jsxs)(I,{children:[!v&&!e.searching&&!(n&&e.rateLimited)&&(0,V.jsx)(F,{children:`No matches.`}),o&&r.length>0&&(0,V.jsx)(P,{value:`__none__`,onSelect:o,className:`text-muted-foreground`,children:s}),m.length>0&&(0,V.jsx)(N,{heading:r.length>1?`Selected`:void 0,children:m.map(b)}),g.length>0&&(0,V.jsx)(N,{heading:`Recent`,children:g.map(b)}),_.length>0&&(0,V.jsx)(N,{heading:m.length+g.length>0?f?`Matches`:`All`:void 0,children:_.map(b)}),v&&(0,V.jsxs)(P,{value:`__typed__${f}`,onSelect:()=>a({label:f,value:f}),forceMount:!0,children:[`Add “`,f,`” as typed`]}),n&&e.hasMore&&(0,V.jsx)(P,{value:jt,forceMount:!0,disabled:e.loadingMore,onSelect:e.loadMore,className:`justify-center text-muted-foreground`,children:e.loadingMore?`Loading…`:`Load more`}),n&&e.truncated&&(0,V.jsx)(Pt,{children:e.hasMore?`Showing ${e.found.length} matches so far.`:`Showing the first ${e.found.length} matches. Keep typing to narrow them.`})]})]})}var Pt=({children:e})=>(0,V.jsx)(`p`,{className:`px-3 py-2 text-xs text-muted-foreground`,children:e}),Ft=25,It=100,Lt=0,Rt=/^(.*\/_options)$/,zt=(e,t)=>Array.from({length:Math.ceil(e.length/t)},(n,r)=>e.slice(r*t,(r+1)*t)),Bt=e=>{let t=new URL(e,`http://local`),n=Rt.exec(t.pathname)?.[1],r=t.searchParams.get(`field`);if(!n||!r)return;let i=new URLSearchParams;for(let e of[`context`,`id`])t.searchParams.has(e)&&i.set(e,t.searchParams.get(e));return{group:`${n}/lookup?${i}`,field:r}};function Vt({cache:e=!0}={}){let t=new Map,n=new Map,r=(e,t,n)=>[e,t,n].join(`\0`),i=async(e,t)=>{let n=new URLSearchParams(e.split(`?`)[1]);for(let[e,r]of Object.entries(t))n.set(`fields[${e}]`,r.join(`,`));let{lookups:r}=await j(`${e.split(`?`)[0]}?${n}`);return r},a=async(n,a)=>{let o=[...a].flatMap(([e,t])=>zt([...t],Ft).map(t=>[e,t])),s=[],c=e=>Object.values(e).reduce((e,t)=>e+t.length,0);for(let[e,t]of o){let n=s.find(n=>!(e in n)&&c(n)+t.length<=It);n||s.push(n={}),n[e]=t}let l=new Map;for(let e of await Promise.all(s.map(e=>i(n,e))))for(let[t,i]of Object.entries(e))i.forEach(e=>l.set(r(n,t,e.value),e));if(e)for(let[e,i]of a)i.forEach(i=>t.set(r(n,e,i),l.get(r(n,e,i))??null));return l},o=(e,t,r)=>{let i=n.get(e);if(!i){let t=new Map,r=new Promise((r,i)=>{setTimeout(()=>{n.delete(e),a(e,t).then(r,i)},Lt)});r.catch(()=>void 0),i={fields:t,done:r},n.set(e,i)}return i.fields.set(t,new Set([...i.fields.get(t)??[],...r])),i.done},s=async(e,n)=>{let i=Bt(e);if(!i)return c(e,n);let{group:a,field:s}=i,l=n.filter(e=>!t.has(r(a,s,e))),u=l.length?await o(a,s,l):new Map;return n.flatMap(e=>t.get(r(a,s,e))??u.get(r(a,s,e))??[])},c=async(e,t)=>(await Promise.all(zt(t,Ft).map(t=>j(`${e}${e.includes(`?`)?`&`:`?`}${new URLSearchParams({value:t.join(`,`)})}`)))).flatMap(e=>e.options);return{load:s,reset:()=>{t.clear(),n=new Map}}}var Ht=Vt({cache:!1}),Ut=(0,B.createContext)(void 0),Wt=()=>(0,B.useContext)(Ut)??Ht;function Gt(e,t=250){let[n,r]=(0,B.useState)(e);return(0,B.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}var Kt=5;function qt(e){let t=new URL(e,`http://local`);return[t.pathname,t.searchParams.get(`field`),t.searchParams.get(`context`)].join(`|`)}var Jt=e=>`ra:options:${qt(e)}`;function Yt(e){try{let t=JSON.parse(localStorage.getItem(Jt(e))??`[]`);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}function Xt(e,t){try{localStorage.setItem(Jt(e),JSON.stringify([t,...Yt(e).filter(e=>e!==t)].slice(0,Kt)))}catch{}}var Zt=200,Qt=(e,t)=>{let n=new URLSearchParams(Object.entries(t).filter(e=>e[1]!==void 0));return`${e}${e.includes(`?`)?`&`:`?`}${n}`},$t=e=>[...new Map(e.map(e=>[e.value,e])).values()];function en({path:e,inline:t=[],selected:n,open:r}){let[s,c]=(0,B.useState)(``),[l,u]=(0,B.useState)({}),[d,f]=(0,B.useState)(()=>e?Yt(e):[]),p=Gt(s,Zt),m=Wt(),h=o({queryKey:[`options`,e,p],queryFn:({pageParam:t,signal:n})=>j(Qt(e,{term:p,limit:`30`,cursor:t}),{signal:n}),initialPageParam:void 0,getNextPageParam:e=>e.next_cursor??void 0,enabled:!!e&&r,placeholderData:i}),g=$t(h.data?.pages.flatMap(e=>e.options)??[]),_=h.data?.pages.at(-1),v=new Map([...t,...g,...Object.values(l)].map(e=>[e.value,e])),y=[...new Set([...n,...r?d:[]])].filter(e=>!v.has(e));return a({queryKey:[`options`,e,`values`,y],queryFn:()=>m.load(e,y),enabled:!!e&&y.length>0}).data?.forEach(e=>v.set(e.value,e)),{term:s,setTerm:c,found:g,searching:!!e&&h.isFetching&&!h.isFetchingNextPage,rateLimited:A(h.error),loadingMore:h.isFetchingNextPage,hasMore:!!h.hasNextPage,loadMore:()=>h.fetchNextPage(),truncated:!!_?.truncated,optionOf:e=>v.get(e),labelOf:e=>v.get(e)?.label??e,recent:d.flatMap(e=>v.get(e)??[]),remember:t=>{u(e=>({...e,[t.value]:t})),e&&(Xt(e,t.value),f(Yt(e)))},lookup:async t=>{if(e)return(await m.load(e,[t]))[0]}}}function tn({className:e,...t}){return(0,V.jsx)(xe,{"data-slot":`checkbox`,className:p(`peer flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input bg-transparent transition-colors outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=indeterminate]:border-primary data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground dark:bg-input/30`,e),...t,children:(0,V.jsx)(Ce,{className:`flex items-center justify-center text-current`,children:t.checked===`indeterminate`?(0,V.jsx)(de,{className:`size-3`}):(0,V.jsx)(u,{className:`size-3`})})})}function nn({...e}){return(0,V.jsx)(We,{"data-slot":`select`,...e})}function rn({...e}){return(0,V.jsx)(Je,{"data-slot":`select-value`,...e})}function an({className:e,size:t=`default`,children:n,...r}){return(0,V.jsxs)(Ke,{"data-slot":`select-trigger`,"data-size":t,className:p(`flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/40 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,V.jsx)(Ye,{asChild:!0,children:(0,V.jsx)(f,{className:`pointer-events-none size-4 text-muted-foreground`})})]})}function on({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...i}){return(0,V.jsx)(Qe,{children:(0,V.jsxs)($e,{"data-slot":`select-content`,"data-align-trigger":n===`item-aligned`,className:p(`relative z-50 max-h-(--radix-select-content-available-height) min-w-36 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground border duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...i,children:[(0,V.jsx)(cn,{}),(0,V.jsx)(lt,{"data-position":n,className:p(`data-[position=popper]:h-(--radix-select-trigger-height) data-[position=popper]:w-full data-[position=popper]:min-w-(--radix-select-trigger-width)`,n===`popper`&&``),children:t}),(0,V.jsx)(ln,{})]})})}function sn({className:e,children:t,...n}){return(0,V.jsxs)(ht,{"data-slot":`select-item`,className:p(`relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,V.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`,children:(0,V.jsx)(yt,{children:(0,V.jsx)(u,{className:`pointer-events-none`})})}),(0,V.jsx)(_t,{children:t})]})}function cn({className:e,...t}){return(0,V.jsx)(xt,{"data-slot":`select-scroll-up-button`,className:p(`z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,V.jsx)(le,{})})}function ln({className:e,...t}){return(0,V.jsx)(Ct,{"data-slot":`select-scroll-down-button`,className:p(`z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,V.jsx)(f,{})})}export{rn as a,Ut as c,se as d,z as f,an as i,Vt as l,on as n,tn as o,sn as r,en as s,nn as t,Nt as u};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,r as n,t as r}from"./vendor-react-C1iE8mnY.js";import{a as i,n as a,t as o}from"./vendor-query-DZ6APRNI.js";import{a as s,c,l}from"./button-CvZ4_DFC.js";import{t as u}from"./check-C5A3J16N.js";import{G as d,st as f}from"./Node-BFhcTc_1.js";import{t as p}from"./utils-DwBGbDkG.js";import{c as m,d as h,f as g,h as _,l as v,m as y,n as b,o as x,p as S,t as C,u as w}from"./dist-CqEI82S_.js";import{$t as T,Bt as E,It as ee,Lt as D,Qt as te,Rt as O,Xt as k,Zt as ne,en as re,tn as ie,wt as A,xt as j,zt as ae}from"./index-BX4ymNYp.js";import{a as M,i as N,o as P,r as F,s as I,t as L}from"./command-Cxg-I-G2.js";var R={name:`arrow-down`,size:24,node:[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]};R.node;var z=l(R),oe={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]};oe.node;var se=l(oe),ce={name:`chevron-up`,size:24,node:[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]};ce.node;var le=l(ce),ue={name:`minus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]};ue.node;var de=l(ue),B=e(t(),1),V=r(),fe=Object.defineProperty,H=(e,t)=>fe(e,`name`,{value:t,configurable:!0}),pe=`Checkbox`,[me,he]=y(pe),[ge,_e]=me(pe);function ve(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=h({prop:n,defaultProp:i??!1,onChange:c,caller:pe}),[m,g]=B.useState(null),[_,v]=B.useState(null),[y,b]=B.useState(null),x=!m||!!o||!!m.closest(`form`),S={checked:f,disabled:a,setChecked:p,control:m,setControl:g,name:s,form:o,value:u,userClick:y,onUserClick:b,required:l,defaultChecked:!U(i)&&i,isFormControl:x,bubbleInput:_,setBubbleInput:v};return(0,V.jsx)(ge,{scope:t,...S,children:Ee(d)?d(S):r})}H(ve,`CheckboxProvider`);var ye=`CheckboxTrigger`,be=B.forwardRef(H(function({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i){let{control:a,value:o,disabled:s,checked:l,required:u,setControl:d,setChecked:f,onUserClick:p,isFormControl:m,bubbleInput:h}=_e(ye,e),v=c(i,d),y=B.useRef(l);return B.useEffect(()=>{let e=a?.form;if(e){let t=H(()=>f(y.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,f]),(0,V.jsx)(_.button,{type:`button`,role:`checkbox`,"aria-checked":U(l)?`mixed`:l,"aria-required":u,"data-state":De(l),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:v,onKeyDown:g(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:g(n,e=>{let t=e.isPropagationStopped();p({requestedChecked:U(l)?!0:!l,hasConsumerStoppedPropagation:t}),f(e=>U(e)?!0:!e),h&&m&&(t||e.stopPropagation())})})},`CheckboxTrigger`)),xe=B.forwardRef(H(function(e,t){let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,V.jsx)(ve,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(be,{...d,ref:t,__scopeCheckbox:n}),e&&(0,V.jsx)(Te,{__scopeCheckbox:n})]})})},`Checkbox`)),Se=`CheckboxIndicator`,Ce=B.forwardRef(H(function(e,t){let{__scopeCheckbox:n,forceMount:r,...i}=e,a=_e(Se,n);return(0,V.jsx)(w,{present:r||U(a.checked)||a.checked===!0,children:(0,V.jsx)(_.span,{"data-state":De(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})},`CheckboxIndicator`)),we=`CheckboxBubbleInput`,Te=B.forwardRef(H(function({__scopeCheckbox:e,onClick:t,...n},r){let{control:i,userClick:a,checked:o,defaultChecked:s,required:l,disabled:u,name:d,value:f,form:p,bubbleInput:m,setBubbleInput:h}=_e(we,e),v=c(r,h),y=E(i),b=B.useRef(!1),x=B.useRef(o),S=B.useRef(a),C=B.useRef(null);B.useEffect(()=>{let e=m;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set;if(!n)return;let r=x.current!==o;x.current=o;let i=a!==null&&a!==S.current;if(S.current=a,i)C.current=r?null:a,r&&(e.indeterminate=U(o),n.call(e,!U(o)&&o)),e.dispatchEvent(new Event(`click`,{bubbles:!a.hasConsumerStoppedPropagation}));else if(r){let t=C.current;C.current=null;let r=t?.requestedChecked===o;b.current=!0,e.indeterminate=U(o),n.call(e,!U(o)&&o),e.dispatchEvent(new Event(`click`,{bubbles:!(r&&t.hasConsumerStoppedPropagation)})),b.current=!1}},[m,o,a]);let w=B.useRef(!U(o)&&o);return(0,V.jsx)(_.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:s??w.current,required:l,disabled:u,name:d,value:f,form:p,...n,tabIndex:-1,ref:v,onClick:g(t,e=>{b.current&&e.stopPropagation()}),style:{...n.style,...y,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`CheckboxBubbleInput`));function Ee(e){return typeof e==`function`}H(Ee,`isFunction`);function U(e){return e===`indeterminate`}H(U,`isIndeterminate`);function De(e){return U(e)?`indeterminate`:e?`checked`:`unchecked`}H(De,`getState`);var Oe=e(n(),1),ke=Object.defineProperty,Ae=(e,t)=>ke(e,`name`,{value:t,configurable:!0});function je(e,[t,n]){return Math.min(n,Math.max(t,e))}Ae(je,`clamp`);var Me=Object.defineProperty,W=(e,t)=>Me(e,`name`,{value:t,configurable:!0}),Ne={ItemAligned:`item-aligned`,Popper:`popper`},Pe={LTR:`ltr`,RTL:`rtl`},Fe=[` `,`Enter`,`ArrowUp`,`ArrowDown`],Ie=[` `,`Enter`],G=`Select`,[K,q,Le]=re(G),[J,Re]=y(G,[Le,ae]),ze=ae(),[Be,Y]=J(G),[Ve,He]=J(G);function Ue(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m,internal_do_not_use_render:g}=e,_=ze(t),[y,b]=B.useState(null),[x,S]=B.useState(null),[C,w]=B.useState(!1),E=T(l),[D,te]=h({prop:r,defaultProp:i??!1,onChange:a,caller:G}),[O,k]=h({prop:o,defaultProp:s,onChange:c,caller:G}),ne=B.useRef(null),re=B.useRef(!1),[ie,A]=B.useState(null),j=W(e=>{A({value:e,hasConsumerStoppedPropagation:re.current}),k(e)},`handleUserSelect`),ae=B.useRef(O);B.useEffect(()=>{let e=m?y?.ownerDocument.getElementById(m):y?.form;if(e instanceof HTMLFormElement){let t=W(()=>k(ae.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[m,y,k]);let M=!y||!!m||!!y.closest(`form`),[N,P]=B.useState(new Set),F=v(),I=Array.from(N).map(e=>e.props.value).join(`;`),L=B.useCallback(e=>{P(t=>new Set(t).add(e))},[]),R=B.useCallback(e=>{P(t=>{let n=new Set(t);return n.delete(e),n})},[]),z={required:p,trigger:y,onTriggerChange:b,valueNode:x,onValueNodeChange:S,valueNodeHasChildren:C,onValueNodeHasChildrenChange:w,contentId:F,value:O,onValueChange:k,hasConsumerStoppedPropagationRef:re,userSelection:ie,onUserSelect:j,open:D,onOpenChange:te,dir:E,triggerPointerDownPosRef:ne,disabled:f,name:u,autoComplete:d,form:m,nativeOptions:N,nativeSelectKey:I,isFormControl:M};return(0,V.jsx)(ee,{..._,children:(0,V.jsx)(Be,{scope:t,...z,children:(0,V.jsx)(K.Provider,{scope:t,children:(0,V.jsx)(Ve,{scope:t,onNativeOptionAdd:L,onNativeOptionRemove:R,children:Dt(g)?g(z):n})})})})}W(Ue,`SelectProvider`);var We=W(e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,V.jsx)(Ue,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,V.jsxs)(V.Fragment,{children:[n,e?(0,V.jsx)(Et,{__scopeSelect:t}):null]})})},`Select`),Ge=`SelectTrigger`,Ke=B.forwardRef(W(function(e,t){let{__scopeSelect:n,disabled:r=!1,...i}=e,a=ze(n),o=Y(Ge,n),s=o.disabled||r,l=c(t,o.onTriggerChange),u=q(n),d=B.useRef(`touch`),[f,p,m]=Ot(e=>{let t=u().filter(e=>!e.disabled),n=kt(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onUserSelect(n.value)}),h=W(e=>{s||(o.onOpenChange(!0),m()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})},`handleOpen`);return(0,V.jsx)(D,{asChild:!0,...a,children:(0,V.jsx)(_.button,{type:`button`,role:`combobox`,"aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":$(o.value)?``:void 0,...i,ref:l,onClick:g(i.onClick,e=>{e.currentTarget.focus(),d.current!==`mouse`&&h(e)}),onPointerDown:g(i.onPointerDown,e=>{d.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(h(e),e.preventDefault())}),onKeyDown:g(i.onKeyDown,e=>{let t=f.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&(o.hasConsumerStoppedPropagationRef.current=e.isPropagationStopped(),p(e.key)),t&&e.key===` `||Fe.includes(e.key)&&(h(),e.preventDefault())})})})},`SelectTrigger`)),qe=`SelectValue`,Je=B.forwardRef(W(function(e,t){let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,l=Y(qe,n),{onValueNodeHasChildrenChange:u}=l,d=a!==void 0,f=c(t,l.onValueNodeChange);S(()=>{u(d)},[u,d]);let p=$(l.value);return(0,V.jsx)(_.span,{...s,asChild:!p&&s.asChild,ref:f,style:{pointerEvents:`none`},children:(0,V.jsx)(B.Fragment,{children:p?o:a},p?`placeholder`:`value`)})},`SelectValue`)),Ye=B.forwardRef(W(function(e,t){let{__scopeSelect:n,children:r,...i}=e;return(0,V.jsx)(_.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})},`SelectIcon`)),[Xe,Ze]=J(`SelectPortal`,{forceMount:void 0}),Qe=W(e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,V.jsx)(Xe,{scope:e.__scopeSelect,forceMount:n,children:(0,V.jsx)(C,{asChild:!0,...r})})},`SelectPortal`),X=`SelectContent`,$e=B.forwardRef(W(function(e,t){let n=Ze(X,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=Y(X,e.__scopeSelect),[o,s]=B.useState();return S(()=>{s(new DocumentFragment)},[]),(0,V.jsx)(w,{present:r||a.open,children:({present:e})=>e?(0,V.jsx)(rt,{...i,ref:t}):(0,V.jsx)(et,{...i,fragment:o})})},`SelectContent`)),et=B.forwardRef(W(function(e,t){let{__scopeSelect:n,children:r,fragment:i}=e;return i?Oe.createPortal((0,V.jsx)(tt,{scope:n,children:(0,V.jsx)(K.Slot,{scope:n,children:(0,V.jsx)(`div`,{ref:t,children:r})})}),i):null},`SelectContentFragment`)),Z=10,[tt,Q]=J(X),nt=s(`SelectContent.RemoveScroll`),rt=B.forwardRef(W(function(e,t){let{__scopeSelect:n}=e,{position:r=Ne.ItemAligned,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:p,collisionPadding:m,sticky:h,hideWhenDetached:_,avoidCollisions:v,...y}=e,S=Y(X,n),[C,w]=B.useState(null),[T,E]=B.useState(null),ee=c(t,w),[D,O]=B.useState(null),[re,ie]=B.useState(null),A=q(n),[j,ae]=B.useState(!1),M=B.useRef(!1),N=B.useRef(!1),P=B.useRef(!1);B.useEffect(()=>{if(C)return k(C)},[C]),te();let F=B.useCallback(e=>{let[t,...n]=A().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&T&&(T.scrollTop=0),n===r&&T&&(T.scrollTop=T.scrollHeight),n?.focus(),document.activeElement!==i))return},[A,T]),I=B.useCallback(()=>F([D,C]),[F,D,C]);B.useEffect(()=>{j&&I()},[j,I]);let{onOpenChange:L,triggerPointerDownPosRef:R}=S;B.useEffect(()=>{if(C){let e={x:0,y:0},t=W(t=>{e={x:Math.abs(Math.round(t.pageX)-(R.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(R.current?.y??0))}},`handlePointerMove`),n=W(n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(C)||L(!1),document.removeEventListener(`pointermove`,t),R.current=null},`handlePointerUp`);return R.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[C,L,R]),B.useEffect(()=>{let e=W(()=>L(!1),`close`);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[L]);let[z,oe]=Ot(e=>{let t=A().filter(e=>!e.disabled),n=kt(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),se=B.useCallback((e,t,n)=>{let r=!N.current;r&&(N.current=!0);let i=!M.current&&!n;S.value!==void 0&&S.value===t||i?(O(e),i&&(M.current=!0)):r&&O(e)},[S.value]),ce=B.useCallback(()=>C?.focus(),[C]),le=B.useCallback((e,t,n)=>{if(!e)return;let r=!P.current;r&&(P.current=!0);let i=!M.current&&!n;(S.value!==void 0&&S.value===t||i||r)&&ie(e)},[S.value]),ue=r===Ne.Popper?at:it,de=ue===at?{side:s,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:p,collisionPadding:m,sticky:h,hideWhenDetached:_,avoidCollisions:v}:{};return(0,V.jsx)(tt,{scope:n,content:C,viewport:T,onViewportChange:E,itemRefCallback:se,selectedItem:D,onItemLeave:ce,itemTextRefCallback:le,focusSelectedItem:I,selectedItemText:re,position:r,isPositioned:j,searchRef:z,children:(0,V.jsx)(ne,{as:nt,allowPinchZoom:!0,children:(0,V.jsx)(b,{asChild:!0,trapped:S.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:g(i,e=>{S.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,V.jsx)(x,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>S.onOpenChange(!1),children:(0,V.jsx)(ue,{role:`listbox`,id:S.contentId,"data-state":S.open?`open`:`closed`,dir:S.dir,onContextMenu:e=>e.preventDefault(),...y,...de,onPlaced:()=>ae(!0),ref:ee,style:{display:`flex`,flexDirection:`column`,outline:`none`,...y.style},onKeyDown:g(y.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&oe(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=A().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>F(t)),e.preventDefault()}})})})})})})},`SelectContentImpl`)),it=B.forwardRef(W(function(e,t){let{__scopeSelect:n,onPlaced:r,...i}=e,a=Y(X,n),o=Q(X,n),[s,l]=B.useState(null),[u,d]=B.useState(null),f=c(t,d),p=q(n),m=B.useRef(!1),h=B.useRef(!0),{viewport:g,selectedItem:v,selectedItemText:y,focusSelectedItem:b}=o,x=B.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&u&&g&&v&&y){let e=a.trigger.getBoundingClientRect(),t=u.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=y.getBoundingClientRect();if(a.dir!==Pe.RTL){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Z,d=je(a,[Z,Math.max(Z,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Z,d=je(a,[Z,Math.max(Z,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=p(),c=window.innerHeight-Z*2,l=g.scrollHeight,d=window.getComputedStyle(u),f=parseInt(d.borderTopWidth,10),h=parseInt(d.paddingTop,10),_=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=f+h+l+b+_,S=Math.min(v.offsetHeight*5,x),C=window.getComputedStyle(g),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-Z,ee=c-E,D=v.offsetHeight/2,te=v.offsetTop+D,O=f+h+te,k=x-O;if(O<=E){let e=o.length>0&&v===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=u.clientHeight-g.offsetTop-g.offsetHeight,n=O+Math.max(ee,D+(e?T:0)+t+_);s.style.height=n+`px`}else{let e=o.length>0&&v===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,f+g.offsetTop+(e?w:0)+D)+k;s.style.height=t+`px`,g.scrollTop=O-E+g.offsetTop}s.style.margin=`${Z}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>m.current=!0)}},[p,a.trigger,a.valueNode,s,u,g,v,y,a.dir,r]);S(()=>x(),[x]);let[C,w]=B.useState();S(()=>{u&&w(window.getComputedStyle(u).zIndex)},[u]);let T=B.useCallback(e=>{e&&h.current===!0&&(x(),b?.(),h.current=!1)},[x,b]);return(0,V.jsx)(ot,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:m,onScrollButtonChange:T,children:(0,V.jsx)(`div`,{ref:l,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:C},children:(0,V.jsx)(_.div,{...i,ref:f,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})},`SelectItemAlignedPosition`)),at=B.forwardRef(W(function(e,t){let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Z,...a}=e,o=ze(n);return(0,V.jsx)(O,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})},`SelectPopperPosition`)),[ot,st]=J(X,{}),ct=`SelectViewport`,lt=B.forwardRef(W(function(e,t){let{__scopeSelect:n,nonce:r,...i}=e,a=Q(ct,n),o=st(ct,n),s=c(t,a.onViewportChange),l=B.useRef(0);return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,V.jsx)(K.Slot,{scope:n,children:(0,V.jsx)(_.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:g(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(l.current-t.scrollTop);if(e>0){let r=window.innerHeight-Z*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}l.current=t.scrollTop})})})]})},`SelectViewport`)),[ut,dt]=J(`SelectGroup`),ft=`SelectItem`,[pt,mt]=J(ft),ht=B.forwardRef(W(function(e,t){let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=Y(ft,n),l=Q(ft,n),u=s.value===r,[d,f]=B.useState(a??``),[p,h]=B.useState(!1),y=m(e=>l.itemRefCallback?.(e,r,i)),b=c(t,y),x=v(),S=B.useRef(`touch`);function C(e){s.hasConsumerStoppedPropagationRef.current=e.isPropagationStopped(),s.onUserSelect(r),s.onOpenChange(!1)}return W(C,`handleSelect`),(0,V.jsx)(pt,{scope:n,value:r,disabled:i,textId:x,isSelected:u,onItemTextChange:B.useCallback(e=>{f(t=>t||(e?.textContent??``).trim())},[]),children:(0,V.jsx)(K.ItemSlot,{scope:n,value:r,disabled:i,textValue:d,children:(0,V.jsx)(_.div,{role:`option`,"aria-labelledby":x,"data-highlighted":p?``:void 0,"aria-selected":u&&p,"data-state":u?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:b,onFocus:g(o.onFocus,()=>h(!0)),onBlur:g(o.onBlur,()=>h(!1)),onClick:g(o.onClick,e=>{i||S.current!==`mouse`&&C(e)}),onPointerUp:g(o.onPointerUp,e=>{i||S.current===`mouse`&&C(e)}),onPointerDown:g(o.onPointerDown,e=>{S.current=e.pointerType}),onPointerMove:g(o.onPointerMove,e=>{S.current=e.pointerType,i?l.onItemLeave?.():S.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:g(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:g(o.onKeyDown,e=>{i||e.target!==e.currentTarget||(l.searchRef?.current===``||e.key!==` `)&&(Ie.includes(e.key)&&C(e),e.key===` `&&e.preventDefault())})})})})},`SelectItem`)),gt=`SelectItemText`,_t=B.forwardRef(W(function(e,t){let{__scopeSelect:n,className:r,style:i,...a}=e,o=Y(gt,n),s=Q(gt,n),l=mt(gt,n),u=He(gt,n),[d,f]=B.useState(null),p=m(e=>s.itemTextRefCallback?.(e,l.value,l.disabled)),h=c(t,f,l.onItemTextChange,p),g=d?.textContent,v=B.useMemo(()=>(0,V.jsx)(`option`,{value:l.value,disabled:l.disabled,children:g},l.value),[l.disabled,l.value,g]),{onNativeOptionAdd:y,onNativeOptionRemove:b}=u;return S(()=>(y(v),()=>b(v)),[y,b,v]),(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(_.span,{id:l.textId,...a,ref:h}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!$(o.value)?Oe.createPortal(a.children,o.valueNode):null]})},`SelectItemText`)),vt=`SelectItemIndicator`,yt=B.forwardRef(W(function(e,t){let{__scopeSelect:n,...r}=e;return mt(vt,n).isSelected?(0,V.jsx)(_.span,{"aria-hidden":!0,...r,ref:t}):null},`SelectItemIndicator`)),bt=`SelectScrollUpButton`,xt=B.forwardRef(W(function(e,t){let n=Q(bt,e.__scopeSelect),r=st(bt,e.__scopeSelect),[i,a]=B.useState(!1),o=c(t,r.onScrollButtonChange);return S(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;a(e)};W(e,`handleScroll`);let t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,V.jsx)(wt,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null},`SelectScrollUpButton`)),St=`SelectScrollDownButton`,Ct=B.forwardRef(W(function(e,t){let n=Q(St,e.__scopeSelect),r=st(St,e.__scopeSelect),[i,a]=B.useState(!1),o=c(t,r.onScrollButtonChange);return S(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;a(n)};W(e,`handleScroll`);let t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,V.jsx)(wt,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null},`SelectScrollDownButton`)),wt=B.forwardRef(W(function(e,t){let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=Q(`SelectScrollButton`,n),o=B.useRef(null),s=q(n),c=B.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return B.useEffect(()=>()=>c(),[c]),S(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,V.jsx)(_.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:g(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:g(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:g(i.onPointerLeave,()=>{c()})})},`SelectScrollButtonImpl`)),Tt=`SelectBubbleInput`,Et=B.forwardRef(W(function({__scopeSelect:e,...t},n){let r=Y(Tt,e),{value:i,onValueChange:a,required:o,disabled:s,name:l,autoComplete:u,form:d,userSelection:f}=r,{nativeOptions:p,nativeSelectKey:m}=r,h=B.useRef(null),g=c(n,h),v=i??``,y=B.useRef(v),b=B.useRef(f),x=B.useRef(!1),S=Array.from(p).some(e=>(e.props.value??``)===``);return B.useEffect(()=>{let e=h.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set,r=f!==null&&f!==b.current;b.current=f;let i=y.current!==v;y.current=v;let a=r&&i;if(r&&!i&&f.value!==v&&!f.hasConsumerStoppedPropagation&&n){x.current=!0;try{n.call(e,f.value),e.dispatchEvent(new Event(`change`,{bubbles:!0}))}finally{x.current=!1,n.call(e,v)}return}let o=a&&!f.hasConsumerStoppedPropagation;if(i&&n){let t=new Event(`change`,{bubbles:o});n.call(e,v),e.dispatchEvent(t)}},[v,f]),(0,V.jsxs)(_.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:l,autoComplete:u,disabled:s,form:d,onChange:e=>{x.current||a(e.target.value)},...t,style:{...ie,...t.style},ref:g,defaultValue:v,children:[$(i)&&!S?(0,V.jsx)(`option`,{value:``}):null,Array.from(p)]},m)},`SelectBubbleInput`));function Dt(e){return typeof e==`function`}W(Dt,`isFunction`);function $(e){return e===``||e===void 0}W($,`shouldShowPlaceholder`);function Ot(e){let t=m(e),n=B.useRef(``),r=B.useRef(0),i=B.useCallback(e=>{let i=n.current+e;t(i);function a(e){n.current=e,window.clearTimeout(r.current),e!==``&&(r.current=window.setTimeout(()=>a(``),1e3))}W(a,`updateSearch`),a(i)},[t]),a=B.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return B.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}W(Ot,`useTypeaheadSearch`);function kt(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=At(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}W(kt,`findNextItem`);function At(e,t){return e.map((n,r)=>e[(t+r)%e.length])}W(At,`wrapArray`);var jt=`__load_more__`;function Mt({option:e}){return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`truncate`,children:e.label}),e.hint&&(0,V.jsx)(`span`,{className:`min-w-0 truncate text-xs text-muted-foreground`,children:e.hint})]})}function Nt({source:e,inline:t,remote:n,selected:r,placeholder:i,onPick:a,onClear:o,clearLabel:s=`None`,freeText:c}){let{term:l,setTerm:u}=e,f=l.trim(),p=n?e.found:t,m=r.flatMap(t=>e.optionOf(t)??[]),h=new Set(m.map(e=>e.value)),g=n&&!f?e.recent.filter(e=>!h.has(e.value)):[];g.forEach(e=>h.add(e.value));let _=p.filter(e=>!h.has(e.value)),v=c&&f&&![...m,...p].some(e=>e.label.toLowerCase()===f.toLowerCase()),y=e=>r.includes(e.value),b=e=>(0,V.jsx)(P,{value:n?e.value:`${e.label} ${e.hint??``}`,onSelect:()=>a(e),"data-checked":y(e),children:(0,V.jsx)(Mt,{option:e})},e.value);return(0,V.jsxs)(L,{shouldFilter:!n,children:[(0,V.jsx)(M,{value:l,onValueChange:u,onPaste:t=>{let r=t.clipboardData.getData(`text`).trim();n&&d(r)&&(t.preventDefault(),u(r),e.lookup(r).then(e=>e&&a(e),()=>void 0))},placeholder:i}),(0,V.jsxs)(`div`,{role:`status`,className:`empty:hidden`,children:[n&&e.searching&&(0,V.jsx)(`p`,{className:`px-3 py-2 text-sm text-muted-foreground`,children:`Searching…`}),n&&e.rateLimited&&!e.searching&&(0,V.jsx)(`p`,{className:`px-3 py-2 text-sm text-muted-foreground`,children:`Searching too fast. Pause for a moment, then keep typing.`})]}),(0,V.jsxs)(I,{children:[!v&&!e.searching&&!(n&&e.rateLimited)&&(0,V.jsx)(F,{children:`No matches.`}),o&&r.length>0&&(0,V.jsx)(P,{value:`__none__`,onSelect:o,className:`text-muted-foreground`,children:s}),m.length>0&&(0,V.jsx)(N,{heading:r.length>1?`Selected`:void 0,children:m.map(b)}),g.length>0&&(0,V.jsx)(N,{heading:`Recent`,children:g.map(b)}),_.length>0&&(0,V.jsx)(N,{heading:m.length+g.length>0?f?`Matches`:`All`:void 0,children:_.map(b)}),v&&(0,V.jsxs)(P,{value:`__typed__${f}`,onSelect:()=>a({label:f,value:f}),forceMount:!0,children:[`Add “`,f,`” as typed`]}),n&&e.hasMore&&(0,V.jsx)(P,{value:jt,forceMount:!0,disabled:e.loadingMore,onSelect:e.loadMore,className:`justify-center text-muted-foreground`,children:e.loadingMore?`Loading…`:`Load more`}),n&&e.truncated&&(0,V.jsx)(Pt,{children:e.hasMore?`Showing ${e.found.length} matches so far.`:`Showing the first ${e.found.length} matches. Keep typing to narrow them.`})]})]})}var Pt=({children:e})=>(0,V.jsx)(`p`,{className:`px-3 py-2 text-xs text-muted-foreground`,children:e}),Ft=25,It=100,Lt=0,Rt=/^(.*\/_options)$/,zt=(e,t)=>Array.from({length:Math.ceil(e.length/t)},(n,r)=>e.slice(r*t,(r+1)*t)),Bt=e=>{let t=new URL(e,`http://local`),n=Rt.exec(t.pathname)?.[1],r=t.searchParams.get(`field`);if(!n||!r)return;let i=new URLSearchParams;for(let e of[`context`,`id`])t.searchParams.has(e)&&i.set(e,t.searchParams.get(e));return{group:`${n}/lookup?${i}`,field:r}};function Vt({cache:e=!0}={}){let t=new Map,n=new Map,r=(e,t,n)=>[e,t,n].join(`\0`),i=async(e,t)=>{let n=new URLSearchParams(e.split(`?`)[1]);for(let[e,r]of Object.entries(t))n.set(`fields[${e}]`,r.join(`,`));let{lookups:r}=await j(`${e.split(`?`)[0]}?${n}`);return r},a=async(n,a)=>{let o=[...a].flatMap(([e,t])=>zt([...t],Ft).map(t=>[e,t])),s=[],c=e=>Object.values(e).reduce((e,t)=>e+t.length,0);for(let[e,t]of o){let n=s.find(n=>!(e in n)&&c(n)+t.length<=It);n||s.push(n={}),n[e]=t}let l=new Map;for(let e of await Promise.all(s.map(e=>i(n,e))))for(let[t,i]of Object.entries(e))i.forEach(e=>l.set(r(n,t,e.value),e));if(e)for(let[e,i]of a)i.forEach(i=>t.set(r(n,e,i),l.get(r(n,e,i))??null));return l},o=(e,t,r)=>{let i=n.get(e);if(!i){let t=new Map,r=new Promise((r,i)=>{setTimeout(()=>{n.delete(e),a(e,t).then(r,i)},Lt)});r.catch(()=>void 0),i={fields:t,done:r},n.set(e,i)}return i.fields.set(t,new Set([...i.fields.get(t)??[],...r])),i.done},s=async(e,n)=>{let i=Bt(e);if(!i)return c(e,n);let{group:a,field:s}=i,l=n.filter(e=>!t.has(r(a,s,e))),u=l.length?await o(a,s,l):new Map;return n.flatMap(e=>t.get(r(a,s,e))??u.get(r(a,s,e))??[])},c=async(e,t)=>(await Promise.all(zt(t,Ft).map(t=>j(`${e}${e.includes(`?`)?`&`:`?`}${new URLSearchParams({value:t.join(`,`)})}`)))).flatMap(e=>e.options);return{load:s,reset:()=>{t.clear(),n=new Map}}}var Ht=Vt({cache:!1}),Ut=(0,B.createContext)(void 0),Wt=()=>(0,B.useContext)(Ut)??Ht;function Gt(e,t=250){let[n,r]=(0,B.useState)(e);return(0,B.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}var Kt=5;function qt(e){let t=new URL(e,`http://local`);return[t.pathname,t.searchParams.get(`field`),t.searchParams.get(`context`)].join(`|`)}var Jt=e=>`ra:options:${qt(e)}`;function Yt(e){try{let t=JSON.parse(localStorage.getItem(Jt(e))??`[]`);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}function Xt(e,t){try{localStorage.setItem(Jt(e),JSON.stringify([t,...Yt(e).filter(e=>e!==t)].slice(0,Kt)))}catch{}}var Zt=200,Qt=(e,t)=>{let n=new URLSearchParams(Object.entries(t).filter(e=>e[1]!==void 0));return`${e}${e.includes(`?`)?`&`:`?`}${n}`},$t=e=>[...new Map(e.map(e=>[e.value,e])).values()];function en({path:e,inline:t=[],selected:n,open:r}){let[s,c]=(0,B.useState)(``),[l,u]=(0,B.useState)({}),[d,f]=(0,B.useState)(()=>e?Yt(e):[]),p=Gt(s,Zt),m=Wt(),h=o({queryKey:[`options`,e,p],queryFn:({pageParam:t,signal:n})=>j(Qt(e,{term:p,limit:`30`,cursor:t}),{signal:n}),initialPageParam:void 0,getNextPageParam:e=>e.next_cursor??void 0,enabled:!!e&&r,placeholderData:i}),g=$t(h.data?.pages.flatMap(e=>e.options)??[]),_=h.data?.pages.at(-1),v=new Map([...t,...g,...Object.values(l)].map(e=>[e.value,e])),y=[...new Set([...n,...r?d:[]])].filter(e=>!v.has(e));return a({queryKey:[`options`,e,`values`,y],queryFn:()=>m.load(e,y),enabled:!!e&&y.length>0}).data?.forEach(e=>v.set(e.value,e)),{term:s,setTerm:c,found:g,searching:!!e&&h.isFetching&&!h.isFetchingNextPage,rateLimited:A(h.error),loadingMore:h.isFetchingNextPage,hasMore:!!h.hasNextPage,loadMore:()=>h.fetchNextPage(),truncated:!!_?.truncated,optionOf:e=>v.get(e),labelOf:e=>v.get(e)?.label??e,recent:d.flatMap(e=>v.get(e)??[]),remember:t=>{u(e=>({...e,[t.value]:t})),e&&(Xt(e,t.value),f(Yt(e)))},lookup:async t=>{if(e)return(await m.load(e,[t]))[0]}}}function tn({className:e,...t}){return(0,V.jsx)(xe,{"data-slot":`checkbox`,className:p(`peer flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input bg-transparent transition-colors outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=indeterminate]:border-primary data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground dark:bg-input/30`,e),...t,children:(0,V.jsx)(Ce,{className:`flex items-center justify-center text-current`,children:t.checked===`indeterminate`?(0,V.jsx)(de,{className:`size-3`}):(0,V.jsx)(u,{className:`size-3`})})})}function nn({...e}){return(0,V.jsx)(We,{"data-slot":`select`,...e})}function rn({...e}){return(0,V.jsx)(Je,{"data-slot":`select-value`,...e})}function an({className:e,size:t=`default`,children:n,...r}){return(0,V.jsxs)(Ke,{"data-slot":`select-trigger`,"data-size":t,className:p(`flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/40 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,V.jsx)(Ye,{asChild:!0,children:(0,V.jsx)(f,{className:`pointer-events-none size-4 text-muted-foreground`})})]})}function on({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...i}){return(0,V.jsx)(Qe,{children:(0,V.jsxs)($e,{"data-slot":`select-content`,"data-align-trigger":n===`item-aligned`,className:p(`relative z-50 max-h-(--radix-select-content-available-height) min-w-36 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground border duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...i,children:[(0,V.jsx)(cn,{}),(0,V.jsx)(lt,{"data-position":n,className:p(`data-[position=popper]:h-(--radix-select-trigger-height) data-[position=popper]:w-full data-[position=popper]:min-w-(--radix-select-trigger-width)`,n===`popper`&&``),children:t}),(0,V.jsx)(ln,{})]})})}function sn({className:e,children:t,...n}){return(0,V.jsxs)(ht,{"data-slot":`select-item`,className:p(`relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,V.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`,children:(0,V.jsx)(yt,{children:(0,V.jsx)(u,{className:`pointer-events-none`})})}),(0,V.jsx)(_t,{children:t})]})}function cn({className:e,...t}){return(0,V.jsx)(xt,{"data-slot":`select-scroll-up-button`,className:p(`z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,V.jsx)(le,{})})}function ln({className:e,...t}){return(0,V.jsx)(Ct,{"data-slot":`select-scroll-down-button`,className:p(`z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,V.jsx)(f,{})})}export{rn as a,Ut as c,se as d,z as f,an as i,Vt as l,on as n,tn as o,sn as r,en as s,nn as t,Nt as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-XKyaHtl9.js";import{i as e,t}from"./vendor-react-C1iE8mnY.js";import{r as n,t as r}from"./button-CvZ4_DFC.js";import{Gt as i,Ht as a,Jt as o,Kt as s,Ut as c,Vt as l,Wt as u,nn as d,qt as f}from"./index-
|
|
1
|
+
import"./rolldown-runtime-XKyaHtl9.js";import{i as e,t}from"./vendor-react-C1iE8mnY.js";import{r as n,t as r}from"./button-CvZ4_DFC.js";import{Gt as i,Ht as a,Jt as o,Kt as s,Ut as c,Vt as l,Wt as u,nn as d,qt as f}from"./index-BX4ymNYp.js";import{t as p}from"./utils-DwBGbDkG.js";e();var m=t(),h=l,g=o,_=n(`fixed z-50 flex flex-col gap-4 bg-popover text-sm text-popover-foreground outline-none duration-200 data-open:animate-in data-closed:animate-out`,{variants:{side:{left:`inset-y-0 left-0 h-full w-[min(20rem,calc(100vw-3rem))] border-r data-open:slide-in-from-left data-closed:slide-out-to-left`,right:`inset-y-0 right-0 h-full w-[min(24rem,calc(100vw-3rem))] border-l data-open:slide-in-from-right data-closed:slide-out-to-right`}},defaultVariants:{side:`left`}});function v({side:e,className:t,children:n,...o}){return(0,m.jsxs)(s,{children:[(0,m.jsx)(i,{className:`fixed inset-0 z-50 bg-black/30 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`}),(0,m.jsxs)(c,{"data-slot":`sheet-content`,className:p(_({side:e}),t),...o,children:[n,(0,m.jsx)(a,{asChild:!0,children:(0,m.jsxs)(r,{variant:`ghost`,size:`icon-sm`,className:`absolute top-3 right-3`,children:[(0,m.jsx)(d,{}),(0,m.jsx)(`span`,{className:`sr-only`,children:`Close`})]})})]})]})}function y({className:e,...t}){return(0,m.jsx)(`div`,{className:p(`flex flex-col gap-1 border-b px-4 py-3 pr-12`,e),...t})}function b({className:e,...t}){return(0,m.jsx)(f,{className:p(`text-base font-semibold`,e),...t})}function x({className:e,...t}){return(0,m.jsx)(u,{className:p(`text-sm text-muted-foreground`,e),...t})}export{b as a,y as i,v as n,g as o,x as r,h as t};
|