@lateralus-ai/shipping-ui 2.0.0-dev.19 → 2.0.0-dev.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Tabs.d.ts +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.esm.js +2 -2
- package/package.json +1 -1
- package/src/components/Tabs.tsx +3 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
2
2
|
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
3
3
|
export type TabsType = "tabs" | "pills";
|
|
4
|
-
/** Soft = search filters (filled idle). Solid =
|
|
4
|
+
/** Soft = search filters (filled idle, light accent active). Solid = list filters (grey-100 idle, blue-600 active). */
|
|
5
5
|
export type TabsAppearance = "soft" | "solid";
|
|
6
6
|
export type TabsProps = ComponentPropsWithoutRef<typeof TabsPrimitive.Root> & {
|
|
7
7
|
type?: TabsType;
|
package/dist/index.cjs
CHANGED
|
@@ -77,7 +77,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
77
77
|
66.67% { opacity: 1; transform: scale(1.25); }
|
|
78
78
|
83.33% { opacity: 0.3; transform: scale(1); }
|
|
79
79
|
}
|
|
80
|
-
`})]}),kt=({value:e,className:t})=>a.jsx("span",{className:O("inline-flex min-w-5 items-center justify-center rounded-full bg-blue-600 px-1.5 py-0.5 text-footnote-em text-white",t),"aria-label":`Count: ${e}`,children:e>99?"99+":e}),Ri=({checked:e,onChange:t,disabled:r=!1,className:n,...c})=>a.jsx("button",{type:"button",role:"switch","aria-checked":e,disabled:r,onClick:()=>t(!e),className:O("relative inline-flex h-6 w-10 shrink-0 items-center rounded-full transition-colors disabled:cursor-not-allowed",e?"bg-blue-600":"bg-grey-200",r&&"opacity-50",n),...c,children:a.jsx("span",{className:O("inline-block size-5 rounded-full bg-white shadow-raise1 transition-transform",e?"translate-x-[18px]":"translate-x-0.5")})}),Fi={blue:"bg-meta-blue text-meta-onBlue",green:"bg-meta-green text-meta-onGreen",red:"bg-meta-red text-meta-onRed",orange:"bg-meta-orange text-meta-onOrange",purple:"bg-meta-purple text-meta-onPurple",grey:"bg-grey-100 text-display-on-light-secondary"},xe=({color:e,type:t="label",children:r,className:n})=>a.jsx("span",{className:O("inline-flex shrink-0 items-center justify-center text-footnote-em leading-none",t==="label"&&"rounded-full px-1.5 py-0.5",t==="icon"&&"size-5 rounded-full [&>svg]:size-3",Fi[e],n),children:r}),Gi=({children:e,icon:t,className:r})=>a.jsxs("div",{className:O("flex items-start gap-2 rounded-control bg-meta-blue px-3 py-2 text-caption-2 text-meta-on-blue",r),role:"note",children:[t&&a.jsx("span",{className:"shrink-0 pt-0.5 [&>svg]:size-4",children:t}),a.jsx("span",{children:e})]}),q1=({name:e,children:t})=>{const r=({className:n,...c})=>a.jsx("svg",{width:120,height:120,viewBox:"0 0 120 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":e,className:O("shrink-0",n),...c,children:t});return r.displayName=e,r},Di=q1({name:"Workflows",children:a.jsxs(a.Fragment,{children:[a.jsx("rect",{x:"20",y:"24",width:"32",height:"24",rx:"6",fill:"var(--blue-50)",stroke:"var(--blue-600)",strokeWidth:"1.5"}),a.jsx("rect",{x:"68",y:"24",width:"32",height:"24",rx:"6",fill:"var(--blue-50)",stroke:"var(--blue-600)",strokeWidth:"1.5"}),a.jsx("rect",{x:"44",y:"72",width:"32",height:"24",rx:"6",fill:"var(--blue-100)",stroke:"var(--blue-600)",strokeWidth:"1.5"}),a.jsx("path",{d:"M52 48v12M68 48v12M52 60h16",stroke:"var(--blue-400)",strokeWidth:"1.5",strokeLinecap:"round"})]})}),Bi=q1({name:"Upload",children:a.jsxs(a.Fragment,{children:[a.jsx("rect",{x:"28",y:"36",width:"64",height:"48",rx:"8",fill:"var(--grey-100)",stroke:"var(--grey-300)",strokeWidth:"1.5"}),a.jsx("path",{d:"M60 52v20M52 60l8-8 8 8",stroke:"var(--blue-600)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("rect",{x:"36",y:"28",width:"48",height:"8",rx:"4",fill:"var(--grey-200)"})]})}),Xi=q1({name:"Processing",children:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"60",cy:"60",r:"28",fill:"var(--blue-50)",stroke:"var(--blue-100)",strokeWidth:"1.5"}),a.jsx("path",{d:"M60 36a24 24 0 0 1 20.78 12",stroke:"var(--blue-600)",strokeWidth:"3",strokeLinecap:"round"}),a.jsx("circle",{cx:"60",cy:"60",r:"4",fill:"var(--blue-600)"})]})}),Zi=q1({name:"Invite",children:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"48",cy:"52",r:"16",fill:"var(--green-100)",stroke:"var(--green-700)",strokeWidth:"1.5"}),a.jsx("circle",{cx:"76",cy:"52",r:"12",fill:"var(--blue-100)",stroke:"var(--blue-600)",strokeWidth:"1.5"}),a.jsx("path",{d:"M64 52h8M68 48v8",stroke:"var(--grey-700)",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("rect",{x:"32",y:"76",width:"56",height:"20",rx:"6",fill:"var(--grey-100)",stroke:"var(--grey-200)",strokeWidth:"1.5"})]})}),Yi=q1({name:"Creation",children:a.jsxs(a.Fragment,{children:[a.jsx("rect",{x:"32",y:"28",width:"56",height:"64",rx:"8",fill:"var(--grey-50)",stroke:"var(--grey-300)",strokeWidth:"1.5"}),a.jsx("path",{d:"M44 48h32M44 60h24M44 72h28",stroke:"var(--grey-300)",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("circle",{cx:"84",cy:"36",r:"12",fill:"var(--blue-600)"}),a.jsx("path",{d:"M84 30v12M78 36h12",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]})}),Li=q1({name:"Completed tasks",children:a.jsxs(a.Fragment,{children:[a.jsx("rect",{x:"28",y:"32",width:"64",height:"12",rx:"4",fill:"var(--green-100)"}),a.jsx("rect",{x:"28",y:"52",width:"64",height:"12",rx:"4",fill:"var(--green-100)"}),a.jsx("rect",{x:"28",y:"72",width:"48",height:"12",rx:"4",fill:"var(--grey-100)"}),a.jsx("circle",{cx:"36",cy:"38",r:"4",fill:"var(--green-700)"}),a.jsx("circle",{cx:"36",cy:"58",r:"4",fill:"var(--green-700)"}),a.jsx("circle",{cx:"36",cy:"78",r:"4",fill:"var(--grey-300)"}),a.jsx("path",{d:"M34 38l1.5 1.5 3-3M34 58l1.5 1.5 3-3",stroke:"white",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}),Ji=q1({name:"Workflow created",children:a.jsxs(a.Fragment,{children:[a.jsx("rect",{x:"24",y:"40",width:"72",height:"40",rx:"8",fill:"var(--blue-50)",stroke:"var(--blue-600)",strokeWidth:"1.5"}),a.jsx("path",{d:"M40 60h40M52 48v24",stroke:"var(--blue-400)",strokeWidth:"1.5",strokeLinecap:"round"}),a.jsx("circle",{cx:"84",cy:"32",r:"14",fill:"var(--green-100)",stroke:"var(--green-700)",strokeWidth:"1.5"}),a.jsx("path",{d:"M79 32l3 3 6-6",stroke:"var(--green-700)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}),Qi=q1({name:"Audit preparation",children:a.jsxs(a.Fragment,{children:[a.jsx("rect",{x:"36",y:"24",width:"48",height:"64",rx:"6",fill:"var(--grey-50)",stroke:"var(--grey-300)",strokeWidth:"1.5"}),a.jsx("rect",{x:"44",y:"36",width:"32",height:"4",rx:"2",fill:"var(--orange-50)"}),a.jsx("rect",{x:"44",y:"48",width:"24",height:"4",rx:"2",fill:"var(--grey-200)"}),a.jsx("rect",{x:"44",y:"60",width:"28",height:"4",rx:"2",fill:"var(--grey-200)"}),a.jsx("path",{d:"M28 88h64",stroke:"var(--grey-300)",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M52 76v12M68 76v12",stroke:"var(--grey-400)",strokeWidth:"2",strokeLinecap:"round"})]})}),Ei=q1({name:"Port state control",children:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M24 80h72",stroke:"var(--blue-400)",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M36 80V52l24-16 24 16v28",fill:"var(--blue-50)",stroke:"var(--blue-600)",strokeWidth:"1.5",strokeLinejoin:"round"}),a.jsx("rect",{x:"52",y:"60",width:"16",height:"20",rx:"2",fill:"var(--blue-100)",stroke:"var(--blue-600)",strokeWidth:"1.5"}),a.jsx("circle",{cx:"72",cy:"44",r:"8",fill:"var(--orange-50)",stroke:"var(--orange-700)",strokeWidth:"1.5"})]})}),_i=q1({name:"RightShip inspection",children:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M30 72c0-16 13.5-28 30-28s30 12 30 28",fill:"var(--blue-50)",stroke:"var(--blue-600)",strokeWidth:"1.5"}),a.jsx("rect",{x:"46",y:"44",width:"28",height:"16",rx:"4",fill:"var(--blue-100)",stroke:"var(--blue-600)",strokeWidth:"1.5"}),a.jsx("path",{d:"M42 72h36",stroke:"var(--grey-400)",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("circle",{cx:"78",cy:"36",r:"6",fill:"var(--green-700)"})]})}),$i=q1({name:"Internal audit",children:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"60",cy:"52",r:"24",fill:"var(--purple-100)",stroke:"var(--purple-700)",strokeWidth:"1.5"}),a.jsx("path",{d:"M60 40v16M52 52h16",stroke:"var(--purple-700)",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("rect",{x:"32",y:"80",width:"56",height:"8",rx:"4",fill:"var(--grey-200)"}),a.jsx("rect",{x:"40",y:"72",width:"40",height:"4",rx:"2",fill:"var(--grey-300)"})]})}),es=q1({name:"Questions done",children:a.jsxs(a.Fragment,{children:[a.jsx("rect",{x:"32",y:"28",width:"56",height:"64",rx:"8",fill:"var(--grey-50)",stroke:"var(--grey-300)",strokeWidth:"1.5"}),a.jsx("circle",{cx:"44",cy:"48",r:"6",fill:"var(--green-100)",stroke:"var(--green-700)",strokeWidth:"1.5"}),a.jsx("path",{d:"M42 48l1.5 1.5 3-3",stroke:"var(--green-700)",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("rect",{x:"56",y:"44",width:"24",height:"4",rx:"2",fill:"var(--grey-200)"}),a.jsx("circle",{cx:"44",cy:"68",r:"6",fill:"var(--green-100)",stroke:"var(--green-700)",strokeWidth:"1.5"}),a.jsx("path",{d:"M42 68l1.5 1.5 3-3",stroke:"var(--green-700)",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("rect",{x:"56",y:"64",width:"20",height:"4",rx:"2",fill:"var(--grey-200)"})]})}),ts={idle:"border-divider-primary bg-white",hover:"border-grey-300 bg-white",disabled:"border-divider-primary bg-grey-50 text-display-on-light-quaternary cursor-not-allowed",edit:"border-accent-on-light bg-white ring-1 ring-accent-on-light"},rs=({label:e,value:t="",placeholder:r,error:n,state:c="idle",onChange:o,disabled:i,className:s,id:A,...d})=>{const u=U.useId(),p=A??u,g=i??c==="disabled",C=g?"disabled":c,x=!!n;return a.jsxs("div",{className:O("flex w-full flex-col gap-1",s),children:[e&&a.jsx("label",{htmlFor:p,className:"text-caption-2-em text-display-on-light-secondary",children:e}),a.jsx("input",{id:p,type:"text",value:t,placeholder:r,disabled:g,"data-state":C,onChange:m=>o==null?void 0:o(m.target.value),className:O("h-10 w-full rounded-control border px-3 text-body text-display-on-light-primary outline-none transition-colors placeholder:text-display-on-light-quaternary","hover:border-grey-300 focus:border-accent-on-light focus:ring-1 focus:ring-accent-on-light","data-[state=hover]:border-grey-300","data-[state=edit]:border-accent-on-light data-[state=edit]:ring-1 data-[state=edit]:ring-accent-on-light","data-[state=disabled]:border-divider-primary data-[state=disabled]:bg-grey-50 data-[state=disabled]:text-display-on-light-quaternary",x&&"border-red-500 ring-1 ring-red-500",!x&&ts[C]),...d}),n&&a.jsx("span",{className:"text-footnote text-red-500",children:n})]})},ns={idle:"border-divider-primary bg-white",hover:"border-grey-300 bg-white",edit:"border-accent-on-light bg-white ring-1 ring-accent-on-light"},as=({label:e,value:t="",placeholder:r,state:n="idle",onChange:c,disabled:o,className:i,id:s,rows:A=4,...d})=>{const u=U.useId(),p=s??u;return a.jsxs("div",{className:O("flex w-full flex-col gap-1",i),children:[e&&a.jsx("label",{htmlFor:p,className:"text-caption-2-em text-display-on-light-secondary",children:e}),a.jsx("textarea",{id:p,value:t,placeholder:r,disabled:o,rows:A,"data-state":n,onChange:g=>c==null?void 0:c(g.target.value),className:O("min-h-[96px] w-full resize-y rounded-control border px-3 py-2 text-body text-display-on-light-primary outline-none transition-colors placeholder:text-display-on-light-quaternary","hover:border-grey-300 focus:border-accent-on-light focus:ring-1 focus:ring-accent-on-light","data-[state=hover]:border-grey-300","data-[state=edit]:border-accent-on-light data-[state=edit]:ring-1 data-[state=edit]:ring-accent-on-light",o&&"cursor-not-allowed border-divider-primary bg-grey-50 text-display-on-light-quaternary",!o&&ns[n]),...d})]})},cs={text:{on:"On",off:"Off"},binary:{on:"Yes",off:"No"}},os=({type:e,state:t,onChange:r,disabled:n=!1,className:c})=>{const o=t==="on",{on:i,off:s}=cs[e],A=d=>{n||r==null||r(d)};return a.jsxs("div",{role:"group","aria-label":`${e} input type`,"data-type":e,"data-state":t,className:O("inline-flex rounded-control border border-divider-primary bg-white p-0.5",n&&"opacity-50",c),children:[a.jsx("button",{type:"button",disabled:n,"aria-pressed":!o,onClick:()=>A("off"),className:O("min-w-12 rounded-[6px] px-3 py-1.5 text-caption-2 transition-colors",o?"text-display-on-light-secondary hover:bg-grey-100":"bg-grey-900 text-display-on-dark-primary"),children:s}),a.jsx("button",{type:"button",disabled:n,"aria-pressed":o,onClick:()=>A("on"),className:O("min-w-12 rounded-[6px] px-3 py-1.5 text-caption-2 transition-colors",o?"bg-grey-900 text-display-on-dark-primary":"text-display-on-light-secondary hover:bg-grey-100"),children:i})]})},is={blue:"bg-meta-blue",green:"bg-meta-green",red:"bg-meta-red",orange:"bg-meta-orange",purple:"bg-meta-purple",grey:"bg-grey-400"},ss=({variant:e,label:t,avatar:r,icon:n,dotColor:c="blue",onRemove:o,className:i})=>a.jsxs("span",{"data-variant":e,className:O("inline-flex h-8 max-w-full items-center gap-1.5 rounded-control border border-divider-primary bg-white px-2 text-caption-2 text-display-on-light-primary",i),children:[e==="avatar"&&r&&a.jsx(N1,{chief:r.chief,initials:r.initials,size:18}),e==="multiple"&&a.jsx(t5,{count:2}),e==="icon"&&n&&a.jsx("span",{className:"shrink-0 text-display-on-light-secondary [&>svg]:size-4",children:n}),e==="dot"&&a.jsx("span",{className:O("size-2 shrink-0 rounded-full",is[c])}),a.jsx("span",{className:"truncate",children:t}),o&&a.jsx(k1,{hierarchy:"quaternary",size:"small","aria-label":`Remove ${t}`,onClick:o,className:"size-6 [&>svg]:size-3",children:a.jsx(pt,{size:"xs"})})]}),As=({checked:e=!1,indeterminate:t=!1,disabled:r=!1,label:n,onChange:c,className:o,id:i,...s})=>{const A=U.useId(),d=i??A,u=U.useRef(null);U.useEffect(()=>{u.current&&(u.current.indeterminate=t)},[t]);const p=e||t;return a.jsxs("label",{htmlFor:d,"data-checked":e,"data-indeterminate":t,"data-disabled":r,className:O("inline-flex cursor-pointer items-center gap-2",r&&"cursor-not-allowed opacity-50",o),children:[a.jsxs("span",{className:"relative inline-flex shrink-0",children:[a.jsx("input",{ref:u,id:d,type:"checkbox",checked:e,disabled:r,onChange:g=>c==null?void 0:c(g.target.checked),className:"peer sr-only",...s}),a.jsxs("span",{"aria-hidden":!0,className:O("flex size-4 items-center justify-center rounded-sm border transition-colors","border-divider-secondary bg-white","peer-hover:border-grey-400 peer-hover:bg-grey-50",p&&"border-blue-600 bg-blue-600","peer-focus-visible:ring-2 peer-focus-visible:ring-accent-on-light peer-focus-visible:ring-offset-1","peer-disabled:border-divider-primary peer-disabled:bg-grey-50"),children:[e&&!t&&a.jsx(xt,{size:"xs",className:"text-white"}),t&&a.jsx(ut,{size:"small",className:"text-white"})]})]}),n&&a.jsx("span",{className:"text-body text-display-on-light-primary",children:n})]})},ls=({label:e,state:t="idle",className:r,...n})=>a.jsxs("button",{type:"button",role:"tab","aria-selected":t==="active","data-state":t,className:O("relative inline-flex items-center px-3 py-2 text-caption-2 transition-colors","text-display-on-light-secondary hover:text-display-on-light-primary","data-[state=active]:text-display-on-light-primary data-[state=active]:text-caption-2-em",r),...n,children:[e,t==="active"&&a.jsx("span",{"aria-hidden":!0,className:"absolute inset-x-0 -bottom-px h-0.5 rounded-full bg-grey-900"})]});var Sr="Tabs",[us]=fe(Sr,[yr]),I0=yr(),[ds,A5]=us(Sr),z0=l.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,onValueChange:c,defaultValue:o,orientation:i="horizontal",dir:s,activationMode:A="automatic",...d}=e,u=N2(s),[p,g]=mr({prop:n,onChange:c,defaultProp:o??"",caller:Sr});return a.jsx(ds,{scope:r,baseId:pe(),value:p,onValueChange:g,orientation:i,dir:u,activationMode:A,children:a.jsx(l1.div,{dir:u,"data-orientation":i,...d,ref:t})})});z0.displayName=Sr;var H0="TabsList",k0=l.forwardRef((e,t)=>{const{__scopeTabs:r,loop:n=!0,...c}=e,o=A5(H0,r),i=I0(r);return a.jsx(oa,{asChild:!0,...i,orientation:o.orientation,dir:o.dir,loop:n,children:a.jsx(l1.div,{role:"tablist","aria-orientation":o.orientation,...c,ref:t})})});k0.displayName=H0;var b0="TabsTrigger",P0=l.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,disabled:c=!1,...o}=e,i=A5(b0,r),s=I0(r),A=K0(i.baseId,n),d=S0(i.baseId,n),u=n===i.value;return a.jsx(ia,{asChild:!0,...s,focusable:!c,active:u,children:a.jsx(l1.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":d,"data-state":u?"active":"inactive","data-disabled":c?"":void 0,disabled:c,id:A,...o,ref:t,onMouseDown:Z(e.onMouseDown,p=>{!c&&p.button===0&&p.ctrlKey===!1?i.onValueChange(n):p.preventDefault()}),onKeyDown:Z(e.onKeyDown,p=>{c||p.target!==p.currentTarget||[" ","Enter"].includes(p.key)&&i.onValueChange(n)}),onFocus:Z(e.onFocus,()=>{const p=i.activationMode!=="manual";!u&&!c&&p&&i.onValueChange(n)})})})});P0.displayName=b0;var v0="TabsContent",M0=l.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,forceMount:c,children:o,...i}=e,s=A5(v0,r),A=K0(s.baseId,n),d=S0(s.baseId,n),u=n===s.value,p=l.useRef(u);return l.useEffect(()=>{const g=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(g)},[]),a.jsx(ne,{present:c||u,children:({present:g})=>a.jsx(l1.div,{"data-state":u?"active":"inactive","data-orientation":s.orientation,role:"tabpanel","aria-labelledby":A,hidden:!g,id:d,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:p.current?"0s":void 0},children:g&&o})})});M0.displayName=v0;function K0(e,t){return`${e}-trigger-${t}`}function S0(e,t){return`${e}-content-${t}`}var ps=z0,N0=k0,q0=P0,U0=M0;const l5=U.createContext({type:"tabs",appearance:"soft"}),h0=({type:e="tabs",appearance:t="soft",className:r,children:n,...c})=>a.jsx(l5.Provider,{value:{type:e,appearance:t},children:a.jsx(ps,{className:O("flex flex-col",r),"data-type":e,"data-appearance":e==="pills"?t:void 0,...c,children:n})}),u5=U.forwardRef(({className:e,...t},r)=>{const{type:n}=U.useContext(l5);return a.jsx(N0,{ref:r,className:O("flex items-center",n==="tabs"&&"gap-6 border-b border-divider-primary",n==="pills"&&"gap-2",e),...t})});u5.displayName=N0.displayName;const d5=U.forwardRef(({className:e,children:t,...r},n)=>{const{type:c,appearance:o}=U.useContext(l5);return a.jsx(q0,{ref:n,className:O("inline-flex items-center justify-center gap-2.5 transition-colors outline-none","disabled:pointer-events-none disabled:opacity-50",c==="tabs"&&["relative h-12 gap-2 px-0 py-0 text-caption-2 text-display-on-light-secondary","hover:text-display-on-light-primary","data-[state=active]:text-caption-2-em data-[state=active]:text-display-on-light-primary","data-[state=active]:after:absolute data-[state=active]:after:inset-x-0 data-[state=active]:after:-bottom-px","data-[state=active]:after:h-0.5 data-[state=active]:after:rounded-full data-[state=active]:after:bg-grey-900"],c==="pills"&&o==="soft"&&["min-h-9 rounded-full px-3 py-1 text-caption-2-em","bg-grey-100 text-display-on-light-secondary","hover:bg-grey-200","data-[state=active]:bg-accent-bg-light data-[state=active]:text-display-on-light-primary"],c==="pills"&&o==="solid"&&["min-h-9 rounded-full px-3 py-1 text-caption-2-em","bg-transparent text-display-on-light-tertiary","hover:bg-grey-900/[0.04] hover:text-display-on-light-primary","data-[state=active]:bg-blue-600 data-[state=active]:text-white","data-[state=active]:hover:bg-blue-600"],e),...r,children:t})});d5.displayName=q0.displayName;const p5=U.forwardRef(({className:e,...t},r)=>a.jsx(U0,{ref:r,className:O("outline-none",e),...t}));p5.displayName=U0.displayName;const gs=({variant:e="standard",title:t,actions:r,className:n})=>a.jsxs("header",{"data-variant":e,className:O("flex w-full items-center justify-between gap-4",e==="standard"&&"border-b border-divider-primary px-6 py-4",e==="nested"&&"px-4 py-3",n),children:[a.jsx("h2",{className:O("text-display-on-light-primary",e==="standard"&&"font-heading text-heading",e==="nested"&&"text-subheader-em"),children:t}),r&&a.jsx("div",{className:"flex shrink-0 items-center gap-2",children:r})]});function Cs({icon:e,title:t,crumbs:r,actions:n,className:c}){const o=!!(r!=null&&r.length);return a.jsxs("div",{"data-variant":o?"nested":"standard",className:O("flex w-full shrink-0 items-center justify-between gap-4","min-h-10",c),children:[a.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[e!=null&&a.jsx("span",{className:"inline-flex size-6 shrink-0 items-center justify-center [&>svg]:size-6",children:e}),o?a.jsx("nav",{"aria-label":"Breadcrumb",className:"min-w-0",children:a.jsxs("ol",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[r.map(i=>a.jsxs("li",{className:"contents",children:[a.jsx("a",{href:i.href,onClick:i.onClick,className:"truncate text-caption-1-em text-display-on-light-secondary transition-colors hover:text-display-on-light-primary",children:i.label}),a.jsx("span",{"aria-hidden":!0,className:"text-caption-1-em text-display-on-light-secondary",children:"/"})]},`${i.href}-${i.label}`)),a.jsx("li",{"aria-current":"page",className:"min-w-0 truncate text-caption-1-em text-display-on-light-primary",children:t})]})}):a.jsx("h1",{className:"min-w-0 truncate text-caption-1-em text-display-on-light-primary",children:t})]}),n!=null&&a.jsx("div",{className:"flex shrink-0 items-center gap-2",children:n})]})}function xs({className:e,...t}){return a.jsx("div",{className:O("flex h-full min-h-0 flex-col",e),...t})}function ms({className:e,...t}){return a.jsx("div",{className:O("min-h-0 flex-1 overflow-y-auto",e),...t})}const js=Object.assign(Cs,{Shell:xs,Body:ms});function fs({className:e,...t}){return a.jsx("div",{className:O("flex min-h-0 flex-1 flex-col gap-2 overflow-hidden rounded-lg bg-grey-100 p-1",e),...t})}function Os({className:e,...t}){return a.jsx("div",{className:O("flex shrink-0 items-start gap-8 pl-10 pr-2 py-1","text-caption-2-em text-display-on-light-secondary",e),...t})}function Vs({className:e,...t}){return a.jsx("div",{className:O("flex min-h-0 flex-1 flex-col gap-1 overflow-y-auto rounded bg-grey-50 p-1",e),...t})}const ys=Object.assign(fs,{Header:Os,Body:Vs}),Is={chat:a.jsx(gt,{className:"size-4"}),issue:a.jsx(Se,{className:"size-4"}),report:a.jsx(Ar,{className:"size-4"})},w0=({variant:e,type:t,state:r="idle",title:n="Title",subtitle:c,count:o,trailing:i,icon:s,onClick:A,className:d,meta:u})=>{const p=e??t??"chat",g=typeof A=="function",C=x=>{A&&(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),A())};return a.jsxs("div",{role:g?"button":void 0,tabIndex:g?0:void 0,"data-variant":p,"data-state":r,onClick:A,onKeyDown:C,className:O("group flex w-full items-center gap-4 rounded-control p-2 text-left transition-colors","hover:bg-[rgba(38,36,32,0.04)]",r==="active"&&"bg-[rgba(38,36,32,0.04)]",g&&"cursor-pointer",d),children:[a.jsx("span",{className:"shrink-0 text-display-on-light-secondary",children:s??Is[p]??a.jsx(lr,{className:"size-4"})}),a.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[a.jsxs("span",{className:"flex min-h-6 w-full items-center gap-4",children:[a.jsx("span",{className:"min-w-0 flex-1 truncate text-caption-1-em text-display-on-light-primary",children:n}),typeof o=="number"&&o>0&&a.jsx("span",{className:"inline-flex min-h-5 min-w-5 shrink-0 items-center justify-center rounded-full bg-red-600 px-0.5 text-footnote-em text-white","aria-label":`${o} unread`,children:o>99?"99+":o}),u!=null&&typeof o!="number"&&a.jsx("span",{className:"shrink-0 text-footnote text-display-on-light-quaternary",children:u})]}),c!=null&&c!==!1||i?a.jsxs("span",{className:"flex min-h-6 w-full items-center gap-4",children:[c!=null&&c!==!1?a.jsx("span",{className:"min-w-0 flex-1 truncate text-caption-2 text-display-on-light-secondary",children:c}):a.jsx("span",{className:"min-w-0 flex-1"}),i!=null&&a.jsx("span",{className:"inline-flex size-5 shrink-0 items-center justify-center",onClick:x=>x.stopPropagation(),onKeyDown:x=>x.stopPropagation(),children:i})]}):null]})]})},zs=({illustration:e,title:t,description:r,action:n,className:c})=>a.jsxs("div",{className:O("flex max-w-sm flex-col items-center gap-4 px-6 py-10 text-center",c),children:[e&&a.jsx("div",{className:"shrink-0",children:e}),a.jsxs("div",{className:"flex flex-col gap-1",children:[a.jsx("h3",{className:"text-subheader-em text-display-on-light-primary",children:t}),r&&a.jsx("p",{className:"text-body text-display-on-light-secondary",children:r})]}),n&&a.jsx(qe,{hierarchy:n.hierarchy??"primary",onClick:n.onClick,icon:n.icon,startIcon:n.startIcon,children:n.children})]});var Nr="Dialog",[T0]=fe(Nr),[Hs,B1]=T0(Nr),W0=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:c,onOpenChange:o,modal:i=!0}=e,s=l.useRef(null),A=l.useRef(null),[d,u]=mr({prop:n,defaultProp:c??!1,onChange:o,caller:Nr});return a.jsx(Hs,{scope:t,triggerRef:s,contentRef:A,contentId:pe(),titleId:pe(),descriptionId:pe(),open:d,onOpenChange:u,onOpenToggle:l.useCallback(()=>u(p=>!p),[u]),modal:i,children:r})};W0.displayName=Nr;var R0="DialogTrigger",F0=l.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,c=B1(R0,r),o=j1(t,c.triggerRef);return a.jsx(l1.button,{type:"button","aria-haspopup":"dialog","aria-expanded":c.open,"aria-controls":c.open?c.contentId:void 0,"data-state":f5(c.open),...n,ref:o,onClick:Z(e.onClick,c.onOpenToggle)})});F0.displayName=R0;var g5="DialogPortal",[ks,G0]=T0(g5,{forceMount:void 0}),D0=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:c}=e,o=B1(g5,t);return a.jsx(ks,{scope:t,forceMount:r,children:l.Children.map(n,i=>a.jsx(ne,{present:r||o.open,children:a.jsx(Z2,{asChild:!0,container:c,children:i})}))})};D0.displayName=g5;var er="DialogOverlay",C5=l.forwardRef((e,t)=>{const r=G0(er,e.__scopeDialog),{forceMount:n=r.forceMount,...c}=e,o=B1(er,e.__scopeDialog);return o.modal?a.jsx(ne,{present:n||o.open,children:a.jsx(Ps,{...c,ref:t})}):null});C5.displayName=er;var bs=at("DialogOverlay.RemoveScroll"),Ps=l.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,c=B1(er,r),o=Ac(),i=j1(t,o);return a.jsx(Y2,{as:bs,allowPinchZoom:!0,shards:[c.contentRef],children:a.jsx(l1.div,{"data-state":f5(c.open),...n,ref:i,style:{pointerEvents:"auto",...n.style}})})}),he="DialogContent",x5=l.forwardRef((e,t)=>{const r=G0(he,e.__scopeDialog),{forceMount:n=r.forceMount,...c}=e,o=B1(he,e.__scopeDialog);return a.jsx(ne,{present:n||o.open,children:o.modal?a.jsx(vs,{...c,ref:t}):a.jsx(Ms,{...c,ref:t})})});x5.displayName=he;var vs=l.forwardRef((e,t)=>{const r=B1(he,e.__scopeDialog),n=l.useRef(null),c=j1(t,r.contentRef,n);return l.useEffect(()=>{const o=n.current;if(o)return Aa(o)},[]),a.jsx(B0,{...e,ref:c,trapFocus:r.open,disableOutsidePointerEvents:r.open,onCloseAutoFocus:Z(e.onCloseAutoFocus,o=>{var i;o.preventDefault(),(i=r.triggerRef.current)==null||i.focus()}),onPointerDownOutside:Z(e.onPointerDownOutside,o=>{const i=o.detail.originalEvent,s=i.button===0&&i.ctrlKey===!0;(i.button===2||s)&&o.preventDefault()}),onFocusOutside:Z(e.onFocusOutside,o=>o.preventDefault())})}),Ms=l.forwardRef((e,t)=>{const r=B1(he,e.__scopeDialog),n=l.useRef(!1),c=l.useRef(!1);return a.jsx(B0,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var i,s;(i=e.onCloseAutoFocus)==null||i.call(e,o),o.defaultPrevented||(n.current||(s=r.triggerRef.current)==null||s.focus(),o.preventDefault()),n.current=!1,c.current=!1},onInteractOutside:o=>{var A,d;(A=e.onInteractOutside)==null||A.call(e,o),o.defaultPrevented||(n.current=!0,o.detail.originalEvent.type==="pointerdown"&&(c.current=!0));const i=o.target;((d=r.triggerRef.current)==null?void 0:d.contains(i))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&c.current&&o.preventDefault()}})}),B0=l.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:c,onCloseAutoFocus:o,...i}=e,s=B1(he,r);return y4(),a.jsx(a.Fragment,{children:a.jsx(h2,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:c,onUnmountAutoFocus:o,children:a.jsx(U2,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":f5(s.open),...i,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})}),X0="DialogTitle",m5=l.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,c=B1(X0,r);return a.jsx(l1.h2,{id:c.titleId,...n,ref:t})});m5.displayName=X0;var Z0="DialogDescription",j5=l.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,c=B1(Z0,r);return a.jsx(l1.p,{id:c.descriptionId,...n,ref:t})});j5.displayName=Z0;var Y0="DialogClose",L0=l.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,c=B1(Y0,r);return a.jsx(l1.button,{type:"button",...n,ref:t,onClick:Z(e.onClick,()=>c.onOpenChange(!1))})});L0.displayName=Y0;function f5(e){return e?"open":"closed"}const J0=W0,Ks=F0,Ss=L0,Q0=D0,O5=U.forwardRef(({className:e,...t},r)=>a.jsx(C5,{ref:r,className:O("fixed inset-0 z-[999] bg-grey-900/65 transition-opacity","data-[state=open]:animate-in data-[state=open]:fade-in","data-[state=closed]:animate-out data-[state=closed]:fade-out",e),...t}));O5.displayName=C5.displayName;const V5=U.forwardRef(({className:e,children:t,showOverlay:r=!0,overlayClassName:n,...c},o)=>a.jsxs(Q0,{children:[r&&a.jsx(O5,{className:n}),a.jsx(x5,{ref:o,className:O("fixed left-1/2 top-1/2 z-[999] w-full max-w-xl -translate-x-1/2 -translate-y-1/2","overflow-hidden rounded-xl border border-divider-primary bg-background-primary shadow-raise3","outline-none","data-[state=open]:animate-in data-[state=open]:fade-in-90","data-[state=closed]:animate-out data-[state=closed]:fade-out",e),...c,children:t})]}));V5.displayName=x5.displayName;const y5=U.forwardRef(({className:e,...t},r)=>a.jsx(m5,{ref:r,className:O("text-subheader-em text-display-on-light-primary",e),...t}));y5.displayName=m5.displayName;const I5=U.forwardRef(({className:e,...t},r)=>a.jsx(j5,{ref:r,className:O("text-caption-2 text-display-on-light-secondary",e),...t}));I5.displayName=j5.displayName;const Ns=({children:e,className:t})=>a.jsx("div",{className:O("shrink-0",t),children:e}),E0=({children:e,className:t})=>a.jsx("div",{className:O("min-h-0 overflow-auto",t),children:e}),qs=({onClose:e,right:t,children:r})=>a.jsxs("div",{className:"flex items-center gap-2 rounded-t-xl bg-background-secondary px-2 py-3",children:[a.jsx("div",{className:"grow text-subheader-em text-display-on-light-primary",children:r}),a.jsxs("div",{className:"flex items-center gap-4",children:[t,a.jsx(k1,{hierarchy:"quaternary",size:"small","aria-label":"Close",onClick:e,children:a.jsx(pt,{size:"small"})})]})]}),Us=({children:e,className:t})=>a.jsx("div",{className:O("w-full overflow-auto",t),children:e}),z5={Header:qs,Body:Us},_0=(e=100,t=50,r=990,n=10)=>{const[c,o]=U.useState(e);return[c,{...{zoomIn:()=>o(A=>Math.min(A+n,r)),zoomOut:()=>o(A=>Math.max(A-n,t)),reset:()=>o(e),zoomToValue:A=>o(Math.max(t,Math.min(A,r)))},handleWheel:A=>{A.preventDefault();const d=A.deltaY>0?-n:n;o(u=>Math.max(t,Math.min(u+d,r)))}}]},$0=()=>{const[e,t]=U.useState(0);return[e,{rotateClockwise:()=>t(n=>(n+90)%360),rotateCounterClockwise:()=>t(n=>(n-90+360)%360)}]},e8=()=>{const[e,t]=U.useState({x:0,y:0}),[r,n]=U.useState(!1),[c,o]=U.useState({x:0,y:0});return[{pan:e,isDragging:r},{handleMouseDown:u=>{n(!0),o({x:u.clientX-e.x,y:u.clientY-e.y})},handleMouseMove:u=>{r&&t({x:u.clientX-c.x,y:u.clientY-c.y})},handleMouseUp:()=>{n(!1)},reset:()=>t({x:0,y:0})}]},t8=(e=0,t=1)=>{const[r,n]=U.useState(t),[c,o]=U.useState(e),i={nextPage:U.useCallback(()=>{n(s=>s<c?s+1:s)},[c]),prevPage:U.useCallback(()=>{n(s=>Math.max(s-1,1))},[]),goToPage:U.useCallback(s=>{n(()=>Math.max(1,Math.min(s,c)))},[c]),setTotalPages:U.useCallback(s=>{o(s),n(A=>Math.min(A,s))},[])};return[{currentPage:r,totalPages:c},i]},$e="flex h-8 w-8 items-center justify-center rounded-control border border-divider-primary bg-white text-display-on-light-secondary hover:bg-background-secondary disabled:opacity-50",hs=({className:e,canvasClassName:t,mainCanvasClassname:r,initialPage:n=1,onClose:c,totalPages:o,getImageSrc:i,documentUrl:s,title:A="PDF Viewer"})=>{const[d,u]=_0(),[p,g]=$0(),[{pan:C,isDragging:x},m]=e8(),[{currentPage:f},V]=t8(o,n),[y,z]=U.useState("");U.useEffect(()=>{(async()=>{const P=await i(f);z(P)})()},[f,i]);const I=()=>{s&&window.open(s,"_blank","noopener,noreferrer")};return a.jsxs("div",{className:O("flex h-full flex-col rounded-t-lg shadow-raise2",e),children:[a.jsx(z5.Header,{onClose:c,right:s?a.jsx(k1,{hierarchy:"quaternary",size:"small","aria-label":"Open",onClick:I,children:a.jsx(sr,{size:"small"})}):void 0,children:A}),a.jsxs("div",{className:O("grid h-full grow overflow-hidden",t),children:[a.jsx("div",{className:O("col-start-1 row-start-1 flex items-center justify-center overflow-hidden bg-background-tertiary p-8",x?"cursor-grabbing":"cursor-grab",r),onMouseDown:m.handleMouseDown,onMouseMove:m.handleMouseMove,onMouseUp:m.handleMouseUp,onMouseLeave:m.handleMouseUp,children:y&&a.jsx("img",{src:y,alt:`Page ${f}`,style:{transform:`translate(${C.x}px, ${C.y}px) rotate(${p}deg) scale(${d/100})`},className:"max-w-full",draggable:!1})}),a.jsxs("div",{className:"z-10 col-start-1 row-start-1 flex items-center justify-between gap-3 self-start bg-background-secondary p-2 shadow",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{type:"button",className:$e,onClick:V.prevPage,disabled:f===1,"aria-label":"Previous page",children:a.jsx(y1,{direction:"left",size:"small"})}),a.jsx("input",{className:"h-8 w-14 rounded-control border border-divider-primary bg-white text-center text-caption-2",value:f,onChange:H=>{const P=parseInt(H.target.value,10);isNaN(P)||V.goToPage(P)},type:"number",min:1,max:o}),a.jsxs("span",{className:"px-2 text-caption-2",children:["of ",o]}),a.jsx("button",{type:"button",className:$e,onClick:V.nextPage,disabled:f===o,"aria-label":"Next page",children:a.jsx(y1,{direction:"right",size:"small"})})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{type:"button",className:$e,onClick:u.zoomOut,"aria-label":"Zoom out",children:a.jsx(ut,{size:"small"})}),a.jsxs("span",{className:"w-14 text-center text-caption-2",children:[d,"%"]}),a.jsx("button",{type:"button",className:$e,onClick:u.zoomIn,"aria-label":"Zoom in",children:a.jsx(we,{size:"small"})}),a.jsx("button",{type:"button",className:$e,onClick:g.rotateCounterClockwise,"aria-label":"Rotate",children:a.jsx(y1,{direction:"left",size:"small"})})]})]})]})]})};Zt.pdfjs.GlobalWorkerOptions.workerSrc=`//unpkg.com/pdfjs-dist@${Zt.pdfjs.version}/build/pdf.worker.min.mjs`;const et="flex h-8 w-8 items-center justify-center rounded-control border border-divider-primary bg-white text-display-on-light-secondary hover:bg-background-secondary disabled:opacity-50",ws=({onClose:e,src:t,title:r="PDF Viewer",className:n,onOpen:c})=>{const[o,i]=_0(),[s,A]=$0(),[{currentPage:d,totalPages:u},p]=t8(),[{pan:g,isDragging:C},x]=e8(),[m,f]=U.useState(1),V=U.useRef(null);U.useEffect(()=>{const I=()=>{if(!V.current)return;const P=V.current.offsetWidth/612;f(P*(o/100))};return I(),window.addEventListener("resize",I),()=>window.removeEventListener("resize",I)},[o]);const y=I=>{if(c==null||c(I),I.defaultPrevented||!t){I.preventDefault();return}window.open(t,"_blank","noopener,noreferrer")},z=a.jsx(k1,{hierarchy:"quaternary",size:"small","aria-label":"Open in new tab",onClick:y,children:a.jsx(sr,{size:"small"})});return a.jsxs("div",{className:O("flex h-full flex-col rounded-t-lg shadow-raise2",n),ref:V,children:[a.jsx(z5.Header,{onClose:e,right:z,children:r}),a.jsxs("div",{className:"grid h-full grow overflow-hidden shadow",children:[a.jsx("div",{className:O("col-start-1 row-start-1 mt-8 flex h-full items-center justify-center overflow-hidden bg-background-tertiary p-8 select-none",C?"cursor-grabbing":"cursor-grab"),onMouseDown:x.handleMouseDown,onMouseMove:x.handleMouseMove,onMouseUp:x.handleMouseUp,onMouseLeave:x.handleMouseUp,style:{userSelect:"none"},children:a.jsx("div",{style:{transform:`translate(${g.x}px, ${g.y}px)`,transition:C?"none":"transform 0.1s",pointerEvents:"none",maxWidth:"650px"},children:a.jsx(Zt.Document,{externalLinkRel:"noopener noreferrer",externalLinkTarget:"_blank",file:t,onLoadSuccess:({numPages:I})=>p.setTotalPages(I),scale:m,rotate:s,children:a.jsx(Zt.Page,{pageNumber:d,renderTextLayer:!0,renderAnnotationLayer:!0})})})}),a.jsxs("div",{className:"z-10 col-start-1 row-start-1 flex w-full flex-wrap items-center justify-between gap-3 self-start bg-background-secondary p-2 shadow",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{type:"button",className:et,onClick:p.prevPage,disabled:d===1,"aria-label":"Previous page",children:a.jsx(y1,{direction:"left",size:"small"})}),a.jsx("input",{className:"h-8 w-14 rounded-control border border-divider-primary bg-white px-1 py-1 text-center text-caption-2 text-display-on-light-primary",value:d,onChange:I=>{const H=parseInt(I.target.value,10);isNaN(H)||p.goToPage(H)},type:"number",min:"1",max:u}),a.jsxs("span",{className:"px-2 text-caption-2 text-display-on-light-secondary",children:["of ",u]}),a.jsx("button",{type:"button",className:et,onClick:p.nextPage,disabled:d===u,"aria-label":"Next page",children:a.jsx(y1,{direction:"right",size:"small"})})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{type:"button",className:et,onClick:i.zoomOut,"aria-label":"Zoom out",children:a.jsx(ut,{size:"small"})}),a.jsxs("button",{type:"button",className:"h-8 w-14 rounded-control border border-divider-primary bg-white text-center text-caption-2 text-display-on-light-primary hover:bg-background-secondary",onClick:()=>{i.reset(),x.reset()},children:[o,"%"]}),a.jsx("button",{type:"button",className:et,onClick:i.zoomIn,"aria-label":"Zoom in",children:a.jsx(we,{size:"small"})})]}),a.jsx("div",{className:"h-6 w-px bg-divider-primary"}),a.jsx("button",{type:"button",className:et,onClick:A.rotateCounterClockwise,"aria-label":"Rotate counter-clockwise",children:a.jsx(y1,{direction:"left",size:"small"})})]})]})]})]})};class Ts{constructor(t={}){Ye(this,"checkboxData");Ye(this,"schema");Ye(this,"finalGeneration");Ye(this,"name","CheckboxModule");this.checkboxData=t.checkboxData||{},this.schema=t.schema,this.finalGeneration=t.finalGeneration||!1}parse(t){return null}postparse(t){return t}render(t,r){return t}postrender(t,r){return!!(r&&r.contentType&&r.contentType==="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml")?(()=>{try{const c=t.map(i=>{const s=typeof i=="string",A=i&&typeof i=="object"&&i.value,d=()=>s&&i,u=()=>!s&&A&&i.value,p=()=>!s&&!A&&String(i);return d()||u()||p()}).join("");return[this.processCheckboxPatterns(c)]}catch{return t}})():t}processCheckboxPatterns(t){try{const r=/<w:bookmarkStart[^>]*w:name="(Check\d+)"[^>]*\/>/gi;r.lastIndex=0;const n=[];let c;for(;(c=r.exec(t))!==null;)n.push(c[1]);return n.length>0?(()=>{const i=()=>(n.forEach(u=>{const g=this.getCheckboxState(u)?"1":"0",C=new RegExp(`(<w:fldChar w:fldCharType="begin">.*?<w:name w:val="${u}".*?<w:default w:val=")([01])(".*?</w:fldChar>)`,"gs");t=t.replace(C,`$1${g}$3`)}),t),s=()=>(r.lastIndex=0,t.replace(r,(u,p)=>{try{return`<w:r><w:t>${`|||${this.getCheckboxState(p)?"☑":"☐"}|||checkbox:${p}|||`}</w:t></w:r><w:bookmarkStart w:name="${p}" w:id="0"/>`}catch{return u}})),A=()=>this.finalGeneration&&i(),d=()=>!this.finalGeneration&&s();return A()||d()})():t}catch{return t}}getCheckboxState(t){const r=!!this.schema,n=()=>!r&&(this.checkboxData[t]||!1),c=()=>r&&(()=>{const o=Object.entries(this.schema.properties||{}).find(([i,s])=>{const d=s.docx_mapping,u=d&&d.type==="checkbox",p=d&&d.type==="radio"&&d.mapping,g=u&&d.name===t,C=u&&d.true_name===t,x=u&&d.false_name===t,m=p&&d.mapping.find(f=>f.name===t);return g||C||x||!!m});return o?(()=>{const[i,s]=o,d=s.docx_mapping,u=d&&d.type==="checkbox"&&d.name===t,p=d&&d.type==="checkbox"&&d.true_name===t,g=d&&d.type==="checkbox"&&d.false_name===t,C=d&&d.type==="radio"&&d.mapping&&d.mapping.find(V=>V.name===t),x=()=>(u||p)&&this.checkboxData[i]===!0,m=()=>g&&this.checkboxData[i]===!1,f=()=>C&&this.checkboxData[i]===C.value;return x()||m()||f()||!1})():this.checkboxData[t]||!1})();return n()||c()||!1}updateCheckboxData(t){this.checkboxData={...this.checkboxData,...t}}}let H1={},Pn={};const Ws=({docxUrl:e,schema:t,onDataChange:r,initialData:n,onSaveRef:c,readonly:o=!1})=>{const[i,s]=U.useState([]),[A,d]=U.useState(!0),[u,p]=U.useState(null),[g,C]=U.useState(0),x=U.useRef(null),m=U.useCallback(b=>{const k=/\{([^}]+)\}/g,S=[];let R;for(;(R=k.exec(b))!==null;)S.push(R[1]);return[...new Set(S)]},[]),f=U.useCallback((b,k)=>{H1={...H1,[b]:k},z(b,k),r==null||r(H1)},[r]),V=U.useCallback((b,k)=>{!Object.entries(t.properties||{}).find(([R,D])=>{var t1;const J=D.docx_mapping,u1=(J==null?void 0:J.type)==="checkbox"&&J.name===b;u1&&f(R,k);const o1=(J==null?void 0:J.type)==="checkbox"&&J.true_name===b,_=(J==null?void 0:J.type)==="checkbox"&&J.false_name===b;o1&&f(R,k),_&&f(R,!k);const L=(J==null?void 0:J.type)==="radio"&&((t1=J.mapping)==null?void 0:t1.find(s1=>s1.name===b));return L&&f(R,L.value),u1||o1||_||!!L})&&f(b,k)},[f,t]),y=U.useCallback((b,k)=>{const S=Pn[b];return!(k===S||k===""&&S==null||S===""&&k==null)},[]),z=U.useCallback((b,k)=>{const S=!!x.current,R=y(b,k);S&&x.current.querySelectorAll(`[data-field-path="${b}"]`).forEach(a1=>{const J=R?"field-edited":"field-original",u1=R?"field-original":"field-edited";a1.classList.remove(u1),a1.classList.add(J)})},[y]),I=U.useCallback(()=>{!!x.current&&Object.entries(H1).forEach(([k,S])=>{z(k,S)})},[z]),H=U.useCallback(async()=>{r==null||r(H1),C(b=>b+1)},[r]);U.useEffect(()=>{c&&(c.current=H)},[H,c]);const P=U.useCallback(async b=>{try{const S=await(await fetch(e)).arrayBuffer(),R=new T5(S),D={};Object.entries(b).forEach(([_,L])=>{(typeof L=="boolean"||L==="true"||L==="false")&&(D[_]=L===!0||L==="true")});const a1=new w5(R,{paragraphLoop:!0,linebreaks:!0,nullGetter:_=>`||| |||${_.value||"unknown_field"}|||`,modules:[new Ts({checkboxData:D,schema:t,finalGeneration:!1})]}),J={},u1="__NEWLINE__";return Object.entries(b).forEach(([_,L])=>{if(L!=null&&L!==""){let t1=L;typeof L=="string"&&(t1=L.replace(/\n/g,u1)),J[_]=`|||${t1}|||${_}|||`}else J[_]=null}),a1.render(J),a1.getZip().generate({type:"blob",mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"})}catch(k){throw console.error("Error processing document:",k),new Error(k instanceof Error?k.message:"Failed to process document")}},[e,t]),M=U.useCallback((b,k,S,R)=>{const D=document.createElement("span");D.className="inline-field-container",D.setAttribute("data-field-path",b);const a1=o,J=k||H1[b]||"",u1=()=>{const d1=S.type==="boolean"?(()=>{const E=document.createElement("span");return E.textContent=J==="true"||H1[b]===!0?"☑":"☐",E.className="inline-checkbox-readonly",E})():(()=>{const E="__NEWLINE__",f1=String(J).replace(new RegExp(E,"g"),`
|
|
80
|
+
`})]}),kt=({value:e,className:t})=>a.jsx("span",{className:O("inline-flex min-w-5 items-center justify-center rounded-full bg-blue-600 px-1.5 py-0.5 text-footnote-em text-white",t),"aria-label":`Count: ${e}`,children:e>99?"99+":e}),Ri=({checked:e,onChange:t,disabled:r=!1,className:n,...c})=>a.jsx("button",{type:"button",role:"switch","aria-checked":e,disabled:r,onClick:()=>t(!e),className:O("relative inline-flex h-6 w-10 shrink-0 items-center rounded-full transition-colors disabled:cursor-not-allowed",e?"bg-blue-600":"bg-grey-200",r&&"opacity-50",n),...c,children:a.jsx("span",{className:O("inline-block size-5 rounded-full bg-white shadow-raise1 transition-transform",e?"translate-x-[18px]":"translate-x-0.5")})}),Fi={blue:"bg-meta-blue text-meta-onBlue",green:"bg-meta-green text-meta-onGreen",red:"bg-meta-red text-meta-onRed",orange:"bg-meta-orange text-meta-onOrange",purple:"bg-meta-purple text-meta-onPurple",grey:"bg-grey-100 text-display-on-light-secondary"},xe=({color:e,type:t="label",children:r,className:n})=>a.jsx("span",{className:O("inline-flex shrink-0 items-center justify-center text-footnote-em leading-none",t==="label"&&"rounded-full px-1.5 py-0.5",t==="icon"&&"size-5 rounded-full [&>svg]:size-3",Fi[e],n),children:r}),Gi=({children:e,icon:t,className:r})=>a.jsxs("div",{className:O("flex items-start gap-2 rounded-control bg-meta-blue px-3 py-2 text-caption-2 text-meta-on-blue",r),role:"note",children:[t&&a.jsx("span",{className:"shrink-0 pt-0.5 [&>svg]:size-4",children:t}),a.jsx("span",{children:e})]}),q1=({name:e,children:t})=>{const r=({className:n,...c})=>a.jsx("svg",{width:120,height:120,viewBox:"0 0 120 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":e,className:O("shrink-0",n),...c,children:t});return r.displayName=e,r},Di=q1({name:"Workflows",children:a.jsxs(a.Fragment,{children:[a.jsx("rect",{x:"20",y:"24",width:"32",height:"24",rx:"6",fill:"var(--blue-50)",stroke:"var(--blue-600)",strokeWidth:"1.5"}),a.jsx("rect",{x:"68",y:"24",width:"32",height:"24",rx:"6",fill:"var(--blue-50)",stroke:"var(--blue-600)",strokeWidth:"1.5"}),a.jsx("rect",{x:"44",y:"72",width:"32",height:"24",rx:"6",fill:"var(--blue-100)",stroke:"var(--blue-600)",strokeWidth:"1.5"}),a.jsx("path",{d:"M52 48v12M68 48v12M52 60h16",stroke:"var(--blue-400)",strokeWidth:"1.5",strokeLinecap:"round"})]})}),Bi=q1({name:"Upload",children:a.jsxs(a.Fragment,{children:[a.jsx("rect",{x:"28",y:"36",width:"64",height:"48",rx:"8",fill:"var(--grey-100)",stroke:"var(--grey-300)",strokeWidth:"1.5"}),a.jsx("path",{d:"M60 52v20M52 60l8-8 8 8",stroke:"var(--blue-600)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("rect",{x:"36",y:"28",width:"48",height:"8",rx:"4",fill:"var(--grey-200)"})]})}),Xi=q1({name:"Processing",children:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"60",cy:"60",r:"28",fill:"var(--blue-50)",stroke:"var(--blue-100)",strokeWidth:"1.5"}),a.jsx("path",{d:"M60 36a24 24 0 0 1 20.78 12",stroke:"var(--blue-600)",strokeWidth:"3",strokeLinecap:"round"}),a.jsx("circle",{cx:"60",cy:"60",r:"4",fill:"var(--blue-600)"})]})}),Zi=q1({name:"Invite",children:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"48",cy:"52",r:"16",fill:"var(--green-100)",stroke:"var(--green-700)",strokeWidth:"1.5"}),a.jsx("circle",{cx:"76",cy:"52",r:"12",fill:"var(--blue-100)",stroke:"var(--blue-600)",strokeWidth:"1.5"}),a.jsx("path",{d:"M64 52h8M68 48v8",stroke:"var(--grey-700)",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("rect",{x:"32",y:"76",width:"56",height:"20",rx:"6",fill:"var(--grey-100)",stroke:"var(--grey-200)",strokeWidth:"1.5"})]})}),Yi=q1({name:"Creation",children:a.jsxs(a.Fragment,{children:[a.jsx("rect",{x:"32",y:"28",width:"56",height:"64",rx:"8",fill:"var(--grey-50)",stroke:"var(--grey-300)",strokeWidth:"1.5"}),a.jsx("path",{d:"M44 48h32M44 60h24M44 72h28",stroke:"var(--grey-300)",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("circle",{cx:"84",cy:"36",r:"12",fill:"var(--blue-600)"}),a.jsx("path",{d:"M84 30v12M78 36h12",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]})}),Li=q1({name:"Completed tasks",children:a.jsxs(a.Fragment,{children:[a.jsx("rect",{x:"28",y:"32",width:"64",height:"12",rx:"4",fill:"var(--green-100)"}),a.jsx("rect",{x:"28",y:"52",width:"64",height:"12",rx:"4",fill:"var(--green-100)"}),a.jsx("rect",{x:"28",y:"72",width:"48",height:"12",rx:"4",fill:"var(--grey-100)"}),a.jsx("circle",{cx:"36",cy:"38",r:"4",fill:"var(--green-700)"}),a.jsx("circle",{cx:"36",cy:"58",r:"4",fill:"var(--green-700)"}),a.jsx("circle",{cx:"36",cy:"78",r:"4",fill:"var(--grey-300)"}),a.jsx("path",{d:"M34 38l1.5 1.5 3-3M34 58l1.5 1.5 3-3",stroke:"white",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}),Ji=q1({name:"Workflow created",children:a.jsxs(a.Fragment,{children:[a.jsx("rect",{x:"24",y:"40",width:"72",height:"40",rx:"8",fill:"var(--blue-50)",stroke:"var(--blue-600)",strokeWidth:"1.5"}),a.jsx("path",{d:"M40 60h40M52 48v24",stroke:"var(--blue-400)",strokeWidth:"1.5",strokeLinecap:"round"}),a.jsx("circle",{cx:"84",cy:"32",r:"14",fill:"var(--green-100)",stroke:"var(--green-700)",strokeWidth:"1.5"}),a.jsx("path",{d:"M79 32l3 3 6-6",stroke:"var(--green-700)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}),Qi=q1({name:"Audit preparation",children:a.jsxs(a.Fragment,{children:[a.jsx("rect",{x:"36",y:"24",width:"48",height:"64",rx:"6",fill:"var(--grey-50)",stroke:"var(--grey-300)",strokeWidth:"1.5"}),a.jsx("rect",{x:"44",y:"36",width:"32",height:"4",rx:"2",fill:"var(--orange-50)"}),a.jsx("rect",{x:"44",y:"48",width:"24",height:"4",rx:"2",fill:"var(--grey-200)"}),a.jsx("rect",{x:"44",y:"60",width:"28",height:"4",rx:"2",fill:"var(--grey-200)"}),a.jsx("path",{d:"M28 88h64",stroke:"var(--grey-300)",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M52 76v12M68 76v12",stroke:"var(--grey-400)",strokeWidth:"2",strokeLinecap:"round"})]})}),Ei=q1({name:"Port state control",children:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M24 80h72",stroke:"var(--blue-400)",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M36 80V52l24-16 24 16v28",fill:"var(--blue-50)",stroke:"var(--blue-600)",strokeWidth:"1.5",strokeLinejoin:"round"}),a.jsx("rect",{x:"52",y:"60",width:"16",height:"20",rx:"2",fill:"var(--blue-100)",stroke:"var(--blue-600)",strokeWidth:"1.5"}),a.jsx("circle",{cx:"72",cy:"44",r:"8",fill:"var(--orange-50)",stroke:"var(--orange-700)",strokeWidth:"1.5"})]})}),_i=q1({name:"RightShip inspection",children:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M30 72c0-16 13.5-28 30-28s30 12 30 28",fill:"var(--blue-50)",stroke:"var(--blue-600)",strokeWidth:"1.5"}),a.jsx("rect",{x:"46",y:"44",width:"28",height:"16",rx:"4",fill:"var(--blue-100)",stroke:"var(--blue-600)",strokeWidth:"1.5"}),a.jsx("path",{d:"M42 72h36",stroke:"var(--grey-400)",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("circle",{cx:"78",cy:"36",r:"6",fill:"var(--green-700)"})]})}),$i=q1({name:"Internal audit",children:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"60",cy:"52",r:"24",fill:"var(--purple-100)",stroke:"var(--purple-700)",strokeWidth:"1.5"}),a.jsx("path",{d:"M60 40v16M52 52h16",stroke:"var(--purple-700)",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("rect",{x:"32",y:"80",width:"56",height:"8",rx:"4",fill:"var(--grey-200)"}),a.jsx("rect",{x:"40",y:"72",width:"40",height:"4",rx:"2",fill:"var(--grey-300)"})]})}),es=q1({name:"Questions done",children:a.jsxs(a.Fragment,{children:[a.jsx("rect",{x:"32",y:"28",width:"56",height:"64",rx:"8",fill:"var(--grey-50)",stroke:"var(--grey-300)",strokeWidth:"1.5"}),a.jsx("circle",{cx:"44",cy:"48",r:"6",fill:"var(--green-100)",stroke:"var(--green-700)",strokeWidth:"1.5"}),a.jsx("path",{d:"M42 48l1.5 1.5 3-3",stroke:"var(--green-700)",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("rect",{x:"56",y:"44",width:"24",height:"4",rx:"2",fill:"var(--grey-200)"}),a.jsx("circle",{cx:"44",cy:"68",r:"6",fill:"var(--green-100)",stroke:"var(--green-700)",strokeWidth:"1.5"}),a.jsx("path",{d:"M42 68l1.5 1.5 3-3",stroke:"var(--green-700)",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("rect",{x:"56",y:"64",width:"20",height:"4",rx:"2",fill:"var(--grey-200)"})]})}),ts={idle:"border-divider-primary bg-white",hover:"border-grey-300 bg-white",disabled:"border-divider-primary bg-grey-50 text-display-on-light-quaternary cursor-not-allowed",edit:"border-accent-on-light bg-white ring-1 ring-accent-on-light"},rs=({label:e,value:t="",placeholder:r,error:n,state:c="idle",onChange:o,disabled:i,className:s,id:A,...d})=>{const u=U.useId(),p=A??u,g=i??c==="disabled",C=g?"disabled":c,x=!!n;return a.jsxs("div",{className:O("flex w-full flex-col gap-1",s),children:[e&&a.jsx("label",{htmlFor:p,className:"text-caption-2-em text-display-on-light-secondary",children:e}),a.jsx("input",{id:p,type:"text",value:t,placeholder:r,disabled:g,"data-state":C,onChange:m=>o==null?void 0:o(m.target.value),className:O("h-10 w-full rounded-control border px-3 text-body text-display-on-light-primary outline-none transition-colors placeholder:text-display-on-light-quaternary","hover:border-grey-300 focus:border-accent-on-light focus:ring-1 focus:ring-accent-on-light","data-[state=hover]:border-grey-300","data-[state=edit]:border-accent-on-light data-[state=edit]:ring-1 data-[state=edit]:ring-accent-on-light","data-[state=disabled]:border-divider-primary data-[state=disabled]:bg-grey-50 data-[state=disabled]:text-display-on-light-quaternary",x&&"border-red-500 ring-1 ring-red-500",!x&&ts[C]),...d}),n&&a.jsx("span",{className:"text-footnote text-red-500",children:n})]})},ns={idle:"border-divider-primary bg-white",hover:"border-grey-300 bg-white",edit:"border-accent-on-light bg-white ring-1 ring-accent-on-light"},as=({label:e,value:t="",placeholder:r,state:n="idle",onChange:c,disabled:o,className:i,id:s,rows:A=4,...d})=>{const u=U.useId(),p=s??u;return a.jsxs("div",{className:O("flex w-full flex-col gap-1",i),children:[e&&a.jsx("label",{htmlFor:p,className:"text-caption-2-em text-display-on-light-secondary",children:e}),a.jsx("textarea",{id:p,value:t,placeholder:r,disabled:o,rows:A,"data-state":n,onChange:g=>c==null?void 0:c(g.target.value),className:O("min-h-[96px] w-full resize-y rounded-control border px-3 py-2 text-body text-display-on-light-primary outline-none transition-colors placeholder:text-display-on-light-quaternary","hover:border-grey-300 focus:border-accent-on-light focus:ring-1 focus:ring-accent-on-light","data-[state=hover]:border-grey-300","data-[state=edit]:border-accent-on-light data-[state=edit]:ring-1 data-[state=edit]:ring-accent-on-light",o&&"cursor-not-allowed border-divider-primary bg-grey-50 text-display-on-light-quaternary",!o&&ns[n]),...d})]})},cs={text:{on:"On",off:"Off"},binary:{on:"Yes",off:"No"}},os=({type:e,state:t,onChange:r,disabled:n=!1,className:c})=>{const o=t==="on",{on:i,off:s}=cs[e],A=d=>{n||r==null||r(d)};return a.jsxs("div",{role:"group","aria-label":`${e} input type`,"data-type":e,"data-state":t,className:O("inline-flex rounded-control border border-divider-primary bg-white p-0.5",n&&"opacity-50",c),children:[a.jsx("button",{type:"button",disabled:n,"aria-pressed":!o,onClick:()=>A("off"),className:O("min-w-12 rounded-[6px] px-3 py-1.5 text-caption-2 transition-colors",o?"text-display-on-light-secondary hover:bg-grey-100":"bg-grey-900 text-display-on-dark-primary"),children:s}),a.jsx("button",{type:"button",disabled:n,"aria-pressed":o,onClick:()=>A("on"),className:O("min-w-12 rounded-[6px] px-3 py-1.5 text-caption-2 transition-colors",o?"bg-grey-900 text-display-on-dark-primary":"text-display-on-light-secondary hover:bg-grey-100"),children:i})]})},is={blue:"bg-meta-blue",green:"bg-meta-green",red:"bg-meta-red",orange:"bg-meta-orange",purple:"bg-meta-purple",grey:"bg-grey-400"},ss=({variant:e,label:t,avatar:r,icon:n,dotColor:c="blue",onRemove:o,className:i})=>a.jsxs("span",{"data-variant":e,className:O("inline-flex h-8 max-w-full items-center gap-1.5 rounded-control border border-divider-primary bg-white px-2 text-caption-2 text-display-on-light-primary",i),children:[e==="avatar"&&r&&a.jsx(N1,{chief:r.chief,initials:r.initials,size:18}),e==="multiple"&&a.jsx(t5,{count:2}),e==="icon"&&n&&a.jsx("span",{className:"shrink-0 text-display-on-light-secondary [&>svg]:size-4",children:n}),e==="dot"&&a.jsx("span",{className:O("size-2 shrink-0 rounded-full",is[c])}),a.jsx("span",{className:"truncate",children:t}),o&&a.jsx(k1,{hierarchy:"quaternary",size:"small","aria-label":`Remove ${t}`,onClick:o,className:"size-6 [&>svg]:size-3",children:a.jsx(pt,{size:"xs"})})]}),As=({checked:e=!1,indeterminate:t=!1,disabled:r=!1,label:n,onChange:c,className:o,id:i,...s})=>{const A=U.useId(),d=i??A,u=U.useRef(null);U.useEffect(()=>{u.current&&(u.current.indeterminate=t)},[t]);const p=e||t;return a.jsxs("label",{htmlFor:d,"data-checked":e,"data-indeterminate":t,"data-disabled":r,className:O("inline-flex cursor-pointer items-center gap-2",r&&"cursor-not-allowed opacity-50",o),children:[a.jsxs("span",{className:"relative inline-flex shrink-0",children:[a.jsx("input",{ref:u,id:d,type:"checkbox",checked:e,disabled:r,onChange:g=>c==null?void 0:c(g.target.checked),className:"peer sr-only",...s}),a.jsxs("span",{"aria-hidden":!0,className:O("flex size-4 items-center justify-center rounded-sm border transition-colors","border-divider-secondary bg-white","peer-hover:border-grey-400 peer-hover:bg-grey-50",p&&"border-blue-600 bg-blue-600","peer-focus-visible:ring-2 peer-focus-visible:ring-accent-on-light peer-focus-visible:ring-offset-1","peer-disabled:border-divider-primary peer-disabled:bg-grey-50"),children:[e&&!t&&a.jsx(xt,{size:"xs",className:"text-white"}),t&&a.jsx(ut,{size:"small",className:"text-white"})]})]}),n&&a.jsx("span",{className:"text-body text-display-on-light-primary",children:n})]})},ls=({label:e,state:t="idle",className:r,...n})=>a.jsxs("button",{type:"button",role:"tab","aria-selected":t==="active","data-state":t,className:O("relative inline-flex items-center px-3 py-2 text-caption-2 transition-colors","text-display-on-light-secondary hover:text-display-on-light-primary","data-[state=active]:text-display-on-light-primary data-[state=active]:text-caption-2-em",r),...n,children:[e,t==="active"&&a.jsx("span",{"aria-hidden":!0,className:"absolute inset-x-0 -bottom-px h-0.5 rounded-full bg-grey-900"})]});var Sr="Tabs",[us]=fe(Sr,[yr]),I0=yr(),[ds,A5]=us(Sr),z0=l.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,onValueChange:c,defaultValue:o,orientation:i="horizontal",dir:s,activationMode:A="automatic",...d}=e,u=N2(s),[p,g]=mr({prop:n,onChange:c,defaultProp:o??"",caller:Sr});return a.jsx(ds,{scope:r,baseId:pe(),value:p,onValueChange:g,orientation:i,dir:u,activationMode:A,children:a.jsx(l1.div,{dir:u,"data-orientation":i,...d,ref:t})})});z0.displayName=Sr;var H0="TabsList",k0=l.forwardRef((e,t)=>{const{__scopeTabs:r,loop:n=!0,...c}=e,o=A5(H0,r),i=I0(r);return a.jsx(oa,{asChild:!0,...i,orientation:o.orientation,dir:o.dir,loop:n,children:a.jsx(l1.div,{role:"tablist","aria-orientation":o.orientation,...c,ref:t})})});k0.displayName=H0;var b0="TabsTrigger",P0=l.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,disabled:c=!1,...o}=e,i=A5(b0,r),s=I0(r),A=K0(i.baseId,n),d=S0(i.baseId,n),u=n===i.value;return a.jsx(ia,{asChild:!0,...s,focusable:!c,active:u,children:a.jsx(l1.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":d,"data-state":u?"active":"inactive","data-disabled":c?"":void 0,disabled:c,id:A,...o,ref:t,onMouseDown:Z(e.onMouseDown,p=>{!c&&p.button===0&&p.ctrlKey===!1?i.onValueChange(n):p.preventDefault()}),onKeyDown:Z(e.onKeyDown,p=>{c||p.target!==p.currentTarget||[" ","Enter"].includes(p.key)&&i.onValueChange(n)}),onFocus:Z(e.onFocus,()=>{const p=i.activationMode!=="manual";!u&&!c&&p&&i.onValueChange(n)})})})});P0.displayName=b0;var v0="TabsContent",M0=l.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,forceMount:c,children:o,...i}=e,s=A5(v0,r),A=K0(s.baseId,n),d=S0(s.baseId,n),u=n===s.value,p=l.useRef(u);return l.useEffect(()=>{const g=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(g)},[]),a.jsx(ne,{present:c||u,children:({present:g})=>a.jsx(l1.div,{"data-state":u?"active":"inactive","data-orientation":s.orientation,role:"tabpanel","aria-labelledby":A,hidden:!g,id:d,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:p.current?"0s":void 0},children:g&&o})})});M0.displayName=v0;function K0(e,t){return`${e}-trigger-${t}`}function S0(e,t){return`${e}-content-${t}`}var ps=z0,N0=k0,q0=P0,U0=M0;const l5=U.createContext({type:"tabs",appearance:"soft"}),h0=({type:e="tabs",appearance:t="soft",className:r,children:n,...c})=>a.jsx(l5.Provider,{value:{type:e,appearance:t},children:a.jsx(ps,{className:O("flex flex-col",r),"data-type":e,"data-appearance":e==="pills"?t:void 0,...c,children:n})}),u5=U.forwardRef(({className:e,...t},r)=>{const{type:n}=U.useContext(l5);return a.jsx(N0,{ref:r,className:O("flex items-center",n==="tabs"&&"gap-6 border-b border-divider-primary",n==="pills"&&"gap-2",e),...t})});u5.displayName=N0.displayName;const d5=U.forwardRef(({className:e,children:t,...r},n)=>{const{type:c,appearance:o}=U.useContext(l5);return a.jsx(q0,{ref:n,className:O("inline-flex items-center justify-center gap-2.5 transition-colors outline-none","disabled:pointer-events-none disabled:opacity-50",c==="tabs"&&["relative h-12 gap-2 px-0 py-0 text-caption-2 text-display-on-light-secondary","hover:text-display-on-light-primary","data-[state=active]:text-caption-2-em data-[state=active]:text-display-on-light-primary","data-[state=active]:after:absolute data-[state=active]:after:inset-x-0 data-[state=active]:after:-bottom-px","data-[state=active]:after:h-0.5 data-[state=active]:after:rounded-full data-[state=active]:after:bg-grey-900"],c==="pills"&&o==="soft"&&["min-h-9 rounded-full px-3 py-1 text-caption-2-em","bg-grey-100 text-display-on-light-secondary","hover:bg-grey-200","data-[state=active]:bg-accent-bg-light data-[state=active]:text-display-on-light-primary"],c==="pills"&&o==="solid"&&["min-h-9 rounded-full px-3 py-1 text-caption-2-em","bg-grey-100 text-display-on-light-tertiary","hover:bg-grey-200 hover:text-display-on-light-primary","data-[state=active]:bg-blue-600 data-[state=active]:text-white","data-[state=active]:hover:bg-blue-600"],e),...r,children:t})});d5.displayName=q0.displayName;const p5=U.forwardRef(({className:e,...t},r)=>a.jsx(U0,{ref:r,className:O("outline-none",e),...t}));p5.displayName=U0.displayName;const gs=({variant:e="standard",title:t,actions:r,className:n})=>a.jsxs("header",{"data-variant":e,className:O("flex w-full items-center justify-between gap-4",e==="standard"&&"border-b border-divider-primary px-6 py-4",e==="nested"&&"px-4 py-3",n),children:[a.jsx("h2",{className:O("text-display-on-light-primary",e==="standard"&&"font-heading text-heading",e==="nested"&&"text-subheader-em"),children:t}),r&&a.jsx("div",{className:"flex shrink-0 items-center gap-2",children:r})]});function Cs({icon:e,title:t,crumbs:r,actions:n,className:c}){const o=!!(r!=null&&r.length);return a.jsxs("div",{"data-variant":o?"nested":"standard",className:O("flex w-full shrink-0 items-center justify-between gap-4","min-h-10",c),children:[a.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[e!=null&&a.jsx("span",{className:"inline-flex size-6 shrink-0 items-center justify-center [&>svg]:size-6",children:e}),o?a.jsx("nav",{"aria-label":"Breadcrumb",className:"min-w-0",children:a.jsxs("ol",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[r.map(i=>a.jsxs("li",{className:"contents",children:[a.jsx("a",{href:i.href,onClick:i.onClick,className:"truncate text-caption-1-em text-display-on-light-secondary transition-colors hover:text-display-on-light-primary",children:i.label}),a.jsx("span",{"aria-hidden":!0,className:"text-caption-1-em text-display-on-light-secondary",children:"/"})]},`${i.href}-${i.label}`)),a.jsx("li",{"aria-current":"page",className:"min-w-0 truncate text-caption-1-em text-display-on-light-primary",children:t})]})}):a.jsx("h1",{className:"min-w-0 truncate text-caption-1-em text-display-on-light-primary",children:t})]}),n!=null&&a.jsx("div",{className:"flex shrink-0 items-center gap-2",children:n})]})}function xs({className:e,...t}){return a.jsx("div",{className:O("flex h-full min-h-0 flex-col",e),...t})}function ms({className:e,...t}){return a.jsx("div",{className:O("min-h-0 flex-1 overflow-y-auto",e),...t})}const js=Object.assign(Cs,{Shell:xs,Body:ms});function fs({className:e,...t}){return a.jsx("div",{className:O("flex min-h-0 flex-1 flex-col gap-2 overflow-hidden rounded-lg bg-grey-100 p-1",e),...t})}function Os({className:e,...t}){return a.jsx("div",{className:O("flex shrink-0 items-start gap-8 pl-10 pr-2 py-1","text-caption-2-em text-display-on-light-secondary",e),...t})}function Vs({className:e,...t}){return a.jsx("div",{className:O("flex min-h-0 flex-1 flex-col gap-1 overflow-y-auto rounded bg-grey-50 p-1",e),...t})}const ys=Object.assign(fs,{Header:Os,Body:Vs}),Is={chat:a.jsx(gt,{className:"size-4"}),issue:a.jsx(Se,{className:"size-4"}),report:a.jsx(Ar,{className:"size-4"})},w0=({variant:e,type:t,state:r="idle",title:n="Title",subtitle:c,count:o,trailing:i,icon:s,onClick:A,className:d,meta:u})=>{const p=e??t??"chat",g=typeof A=="function",C=x=>{A&&(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),A())};return a.jsxs("div",{role:g?"button":void 0,tabIndex:g?0:void 0,"data-variant":p,"data-state":r,onClick:A,onKeyDown:C,className:O("group flex w-full items-center gap-4 rounded-control p-2 text-left transition-colors","hover:bg-[rgba(38,36,32,0.04)]",r==="active"&&"bg-[rgba(38,36,32,0.04)]",g&&"cursor-pointer",d),children:[a.jsx("span",{className:"shrink-0 text-display-on-light-secondary",children:s??Is[p]??a.jsx(lr,{className:"size-4"})}),a.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[a.jsxs("span",{className:"flex min-h-6 w-full items-center gap-4",children:[a.jsx("span",{className:"min-w-0 flex-1 truncate text-caption-1-em text-display-on-light-primary",children:n}),typeof o=="number"&&o>0&&a.jsx("span",{className:"inline-flex min-h-5 min-w-5 shrink-0 items-center justify-center rounded-full bg-red-600 px-0.5 text-footnote-em text-white","aria-label":`${o} unread`,children:o>99?"99+":o}),u!=null&&typeof o!="number"&&a.jsx("span",{className:"shrink-0 text-footnote text-display-on-light-quaternary",children:u})]}),c!=null&&c!==!1||i?a.jsxs("span",{className:"flex min-h-6 w-full items-center gap-4",children:[c!=null&&c!==!1?a.jsx("span",{className:"min-w-0 flex-1 truncate text-caption-2 text-display-on-light-secondary",children:c}):a.jsx("span",{className:"min-w-0 flex-1"}),i!=null&&a.jsx("span",{className:"inline-flex size-5 shrink-0 items-center justify-center",onClick:x=>x.stopPropagation(),onKeyDown:x=>x.stopPropagation(),children:i})]}):null]})]})},zs=({illustration:e,title:t,description:r,action:n,className:c})=>a.jsxs("div",{className:O("flex max-w-sm flex-col items-center gap-4 px-6 py-10 text-center",c),children:[e&&a.jsx("div",{className:"shrink-0",children:e}),a.jsxs("div",{className:"flex flex-col gap-1",children:[a.jsx("h3",{className:"text-subheader-em text-display-on-light-primary",children:t}),r&&a.jsx("p",{className:"text-body text-display-on-light-secondary",children:r})]}),n&&a.jsx(qe,{hierarchy:n.hierarchy??"primary",onClick:n.onClick,icon:n.icon,startIcon:n.startIcon,children:n.children})]});var Nr="Dialog",[T0]=fe(Nr),[Hs,B1]=T0(Nr),W0=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:c,onOpenChange:o,modal:i=!0}=e,s=l.useRef(null),A=l.useRef(null),[d,u]=mr({prop:n,defaultProp:c??!1,onChange:o,caller:Nr});return a.jsx(Hs,{scope:t,triggerRef:s,contentRef:A,contentId:pe(),titleId:pe(),descriptionId:pe(),open:d,onOpenChange:u,onOpenToggle:l.useCallback(()=>u(p=>!p),[u]),modal:i,children:r})};W0.displayName=Nr;var R0="DialogTrigger",F0=l.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,c=B1(R0,r),o=j1(t,c.triggerRef);return a.jsx(l1.button,{type:"button","aria-haspopup":"dialog","aria-expanded":c.open,"aria-controls":c.open?c.contentId:void 0,"data-state":f5(c.open),...n,ref:o,onClick:Z(e.onClick,c.onOpenToggle)})});F0.displayName=R0;var g5="DialogPortal",[ks,G0]=T0(g5,{forceMount:void 0}),D0=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:c}=e,o=B1(g5,t);return a.jsx(ks,{scope:t,forceMount:r,children:l.Children.map(n,i=>a.jsx(ne,{present:r||o.open,children:a.jsx(Z2,{asChild:!0,container:c,children:i})}))})};D0.displayName=g5;var er="DialogOverlay",C5=l.forwardRef((e,t)=>{const r=G0(er,e.__scopeDialog),{forceMount:n=r.forceMount,...c}=e,o=B1(er,e.__scopeDialog);return o.modal?a.jsx(ne,{present:n||o.open,children:a.jsx(Ps,{...c,ref:t})}):null});C5.displayName=er;var bs=at("DialogOverlay.RemoveScroll"),Ps=l.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,c=B1(er,r),o=Ac(),i=j1(t,o);return a.jsx(Y2,{as:bs,allowPinchZoom:!0,shards:[c.contentRef],children:a.jsx(l1.div,{"data-state":f5(c.open),...n,ref:i,style:{pointerEvents:"auto",...n.style}})})}),he="DialogContent",x5=l.forwardRef((e,t)=>{const r=G0(he,e.__scopeDialog),{forceMount:n=r.forceMount,...c}=e,o=B1(he,e.__scopeDialog);return a.jsx(ne,{present:n||o.open,children:o.modal?a.jsx(vs,{...c,ref:t}):a.jsx(Ms,{...c,ref:t})})});x5.displayName=he;var vs=l.forwardRef((e,t)=>{const r=B1(he,e.__scopeDialog),n=l.useRef(null),c=j1(t,r.contentRef,n);return l.useEffect(()=>{const o=n.current;if(o)return Aa(o)},[]),a.jsx(B0,{...e,ref:c,trapFocus:r.open,disableOutsidePointerEvents:r.open,onCloseAutoFocus:Z(e.onCloseAutoFocus,o=>{var i;o.preventDefault(),(i=r.triggerRef.current)==null||i.focus()}),onPointerDownOutside:Z(e.onPointerDownOutside,o=>{const i=o.detail.originalEvent,s=i.button===0&&i.ctrlKey===!0;(i.button===2||s)&&o.preventDefault()}),onFocusOutside:Z(e.onFocusOutside,o=>o.preventDefault())})}),Ms=l.forwardRef((e,t)=>{const r=B1(he,e.__scopeDialog),n=l.useRef(!1),c=l.useRef(!1);return a.jsx(B0,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var i,s;(i=e.onCloseAutoFocus)==null||i.call(e,o),o.defaultPrevented||(n.current||(s=r.triggerRef.current)==null||s.focus(),o.preventDefault()),n.current=!1,c.current=!1},onInteractOutside:o=>{var A,d;(A=e.onInteractOutside)==null||A.call(e,o),o.defaultPrevented||(n.current=!0,o.detail.originalEvent.type==="pointerdown"&&(c.current=!0));const i=o.target;((d=r.triggerRef.current)==null?void 0:d.contains(i))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&c.current&&o.preventDefault()}})}),B0=l.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:c,onCloseAutoFocus:o,...i}=e,s=B1(he,r);return y4(),a.jsx(a.Fragment,{children:a.jsx(h2,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:c,onUnmountAutoFocus:o,children:a.jsx(U2,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":f5(s.open),...i,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})}),X0="DialogTitle",m5=l.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,c=B1(X0,r);return a.jsx(l1.h2,{id:c.titleId,...n,ref:t})});m5.displayName=X0;var Z0="DialogDescription",j5=l.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,c=B1(Z0,r);return a.jsx(l1.p,{id:c.descriptionId,...n,ref:t})});j5.displayName=Z0;var Y0="DialogClose",L0=l.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,c=B1(Y0,r);return a.jsx(l1.button,{type:"button",...n,ref:t,onClick:Z(e.onClick,()=>c.onOpenChange(!1))})});L0.displayName=Y0;function f5(e){return e?"open":"closed"}const J0=W0,Ks=F0,Ss=L0,Q0=D0,O5=U.forwardRef(({className:e,...t},r)=>a.jsx(C5,{ref:r,className:O("fixed inset-0 z-[999] bg-grey-900/65 transition-opacity","data-[state=open]:animate-in data-[state=open]:fade-in","data-[state=closed]:animate-out data-[state=closed]:fade-out",e),...t}));O5.displayName=C5.displayName;const V5=U.forwardRef(({className:e,children:t,showOverlay:r=!0,overlayClassName:n,...c},o)=>a.jsxs(Q0,{children:[r&&a.jsx(O5,{className:n}),a.jsx(x5,{ref:o,className:O("fixed left-1/2 top-1/2 z-[999] w-full max-w-xl -translate-x-1/2 -translate-y-1/2","overflow-hidden rounded-xl border border-divider-primary bg-background-primary shadow-raise3","outline-none","data-[state=open]:animate-in data-[state=open]:fade-in-90","data-[state=closed]:animate-out data-[state=closed]:fade-out",e),...c,children:t})]}));V5.displayName=x5.displayName;const y5=U.forwardRef(({className:e,...t},r)=>a.jsx(m5,{ref:r,className:O("text-subheader-em text-display-on-light-primary",e),...t}));y5.displayName=m5.displayName;const I5=U.forwardRef(({className:e,...t},r)=>a.jsx(j5,{ref:r,className:O("text-caption-2 text-display-on-light-secondary",e),...t}));I5.displayName=j5.displayName;const Ns=({children:e,className:t})=>a.jsx("div",{className:O("shrink-0",t),children:e}),E0=({children:e,className:t})=>a.jsx("div",{className:O("min-h-0 overflow-auto",t),children:e}),qs=({onClose:e,right:t,children:r})=>a.jsxs("div",{className:"flex items-center gap-2 rounded-t-xl bg-background-secondary px-2 py-3",children:[a.jsx("div",{className:"grow text-subheader-em text-display-on-light-primary",children:r}),a.jsxs("div",{className:"flex items-center gap-4",children:[t,a.jsx(k1,{hierarchy:"quaternary",size:"small","aria-label":"Close",onClick:e,children:a.jsx(pt,{size:"small"})})]})]}),Us=({children:e,className:t})=>a.jsx("div",{className:O("w-full overflow-auto",t),children:e}),z5={Header:qs,Body:Us},_0=(e=100,t=50,r=990,n=10)=>{const[c,o]=U.useState(e);return[c,{...{zoomIn:()=>o(A=>Math.min(A+n,r)),zoomOut:()=>o(A=>Math.max(A-n,t)),reset:()=>o(e),zoomToValue:A=>o(Math.max(t,Math.min(A,r)))},handleWheel:A=>{A.preventDefault();const d=A.deltaY>0?-n:n;o(u=>Math.max(t,Math.min(u+d,r)))}}]},$0=()=>{const[e,t]=U.useState(0);return[e,{rotateClockwise:()=>t(n=>(n+90)%360),rotateCounterClockwise:()=>t(n=>(n-90+360)%360)}]},e8=()=>{const[e,t]=U.useState({x:0,y:0}),[r,n]=U.useState(!1),[c,o]=U.useState({x:0,y:0});return[{pan:e,isDragging:r},{handleMouseDown:u=>{n(!0),o({x:u.clientX-e.x,y:u.clientY-e.y})},handleMouseMove:u=>{r&&t({x:u.clientX-c.x,y:u.clientY-c.y})},handleMouseUp:()=>{n(!1)},reset:()=>t({x:0,y:0})}]},t8=(e=0,t=1)=>{const[r,n]=U.useState(t),[c,o]=U.useState(e),i={nextPage:U.useCallback(()=>{n(s=>s<c?s+1:s)},[c]),prevPage:U.useCallback(()=>{n(s=>Math.max(s-1,1))},[]),goToPage:U.useCallback(s=>{n(()=>Math.max(1,Math.min(s,c)))},[c]),setTotalPages:U.useCallback(s=>{o(s),n(A=>Math.min(A,s))},[])};return[{currentPage:r,totalPages:c},i]},$e="flex h-8 w-8 items-center justify-center rounded-control border border-divider-primary bg-white text-display-on-light-secondary hover:bg-background-secondary disabled:opacity-50",hs=({className:e,canvasClassName:t,mainCanvasClassname:r,initialPage:n=1,onClose:c,totalPages:o,getImageSrc:i,documentUrl:s,title:A="PDF Viewer"})=>{const[d,u]=_0(),[p,g]=$0(),[{pan:C,isDragging:x},m]=e8(),[{currentPage:f},V]=t8(o,n),[y,z]=U.useState("");U.useEffect(()=>{(async()=>{const P=await i(f);z(P)})()},[f,i]);const I=()=>{s&&window.open(s,"_blank","noopener,noreferrer")};return a.jsxs("div",{className:O("flex h-full flex-col rounded-t-lg shadow-raise2",e),children:[a.jsx(z5.Header,{onClose:c,right:s?a.jsx(k1,{hierarchy:"quaternary",size:"small","aria-label":"Open",onClick:I,children:a.jsx(sr,{size:"small"})}):void 0,children:A}),a.jsxs("div",{className:O("grid h-full grow overflow-hidden",t),children:[a.jsx("div",{className:O("col-start-1 row-start-1 flex items-center justify-center overflow-hidden bg-background-tertiary p-8",x?"cursor-grabbing":"cursor-grab",r),onMouseDown:m.handleMouseDown,onMouseMove:m.handleMouseMove,onMouseUp:m.handleMouseUp,onMouseLeave:m.handleMouseUp,children:y&&a.jsx("img",{src:y,alt:`Page ${f}`,style:{transform:`translate(${C.x}px, ${C.y}px) rotate(${p}deg) scale(${d/100})`},className:"max-w-full",draggable:!1})}),a.jsxs("div",{className:"z-10 col-start-1 row-start-1 flex items-center justify-between gap-3 self-start bg-background-secondary p-2 shadow",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{type:"button",className:$e,onClick:V.prevPage,disabled:f===1,"aria-label":"Previous page",children:a.jsx(y1,{direction:"left",size:"small"})}),a.jsx("input",{className:"h-8 w-14 rounded-control border border-divider-primary bg-white text-center text-caption-2",value:f,onChange:H=>{const P=parseInt(H.target.value,10);isNaN(P)||V.goToPage(P)},type:"number",min:1,max:o}),a.jsxs("span",{className:"px-2 text-caption-2",children:["of ",o]}),a.jsx("button",{type:"button",className:$e,onClick:V.nextPage,disabled:f===o,"aria-label":"Next page",children:a.jsx(y1,{direction:"right",size:"small"})})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{type:"button",className:$e,onClick:u.zoomOut,"aria-label":"Zoom out",children:a.jsx(ut,{size:"small"})}),a.jsxs("span",{className:"w-14 text-center text-caption-2",children:[d,"%"]}),a.jsx("button",{type:"button",className:$e,onClick:u.zoomIn,"aria-label":"Zoom in",children:a.jsx(we,{size:"small"})}),a.jsx("button",{type:"button",className:$e,onClick:g.rotateCounterClockwise,"aria-label":"Rotate",children:a.jsx(y1,{direction:"left",size:"small"})})]})]})]})]})};Zt.pdfjs.GlobalWorkerOptions.workerSrc=`//unpkg.com/pdfjs-dist@${Zt.pdfjs.version}/build/pdf.worker.min.mjs`;const et="flex h-8 w-8 items-center justify-center rounded-control border border-divider-primary bg-white text-display-on-light-secondary hover:bg-background-secondary disabled:opacity-50",ws=({onClose:e,src:t,title:r="PDF Viewer",className:n,onOpen:c})=>{const[o,i]=_0(),[s,A]=$0(),[{currentPage:d,totalPages:u},p]=t8(),[{pan:g,isDragging:C},x]=e8(),[m,f]=U.useState(1),V=U.useRef(null);U.useEffect(()=>{const I=()=>{if(!V.current)return;const P=V.current.offsetWidth/612;f(P*(o/100))};return I(),window.addEventListener("resize",I),()=>window.removeEventListener("resize",I)},[o]);const y=I=>{if(c==null||c(I),I.defaultPrevented||!t){I.preventDefault();return}window.open(t,"_blank","noopener,noreferrer")},z=a.jsx(k1,{hierarchy:"quaternary",size:"small","aria-label":"Open in new tab",onClick:y,children:a.jsx(sr,{size:"small"})});return a.jsxs("div",{className:O("flex h-full flex-col rounded-t-lg shadow-raise2",n),ref:V,children:[a.jsx(z5.Header,{onClose:e,right:z,children:r}),a.jsxs("div",{className:"grid h-full grow overflow-hidden shadow",children:[a.jsx("div",{className:O("col-start-1 row-start-1 mt-8 flex h-full items-center justify-center overflow-hidden bg-background-tertiary p-8 select-none",C?"cursor-grabbing":"cursor-grab"),onMouseDown:x.handleMouseDown,onMouseMove:x.handleMouseMove,onMouseUp:x.handleMouseUp,onMouseLeave:x.handleMouseUp,style:{userSelect:"none"},children:a.jsx("div",{style:{transform:`translate(${g.x}px, ${g.y}px)`,transition:C?"none":"transform 0.1s",pointerEvents:"none",maxWidth:"650px"},children:a.jsx(Zt.Document,{externalLinkRel:"noopener noreferrer",externalLinkTarget:"_blank",file:t,onLoadSuccess:({numPages:I})=>p.setTotalPages(I),scale:m,rotate:s,children:a.jsx(Zt.Page,{pageNumber:d,renderTextLayer:!0,renderAnnotationLayer:!0})})})}),a.jsxs("div",{className:"z-10 col-start-1 row-start-1 flex w-full flex-wrap items-center justify-between gap-3 self-start bg-background-secondary p-2 shadow",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{type:"button",className:et,onClick:p.prevPage,disabled:d===1,"aria-label":"Previous page",children:a.jsx(y1,{direction:"left",size:"small"})}),a.jsx("input",{className:"h-8 w-14 rounded-control border border-divider-primary bg-white px-1 py-1 text-center text-caption-2 text-display-on-light-primary",value:d,onChange:I=>{const H=parseInt(I.target.value,10);isNaN(H)||p.goToPage(H)},type:"number",min:"1",max:u}),a.jsxs("span",{className:"px-2 text-caption-2 text-display-on-light-secondary",children:["of ",u]}),a.jsx("button",{type:"button",className:et,onClick:p.nextPage,disabled:d===u,"aria-label":"Next page",children:a.jsx(y1,{direction:"right",size:"small"})})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{type:"button",className:et,onClick:i.zoomOut,"aria-label":"Zoom out",children:a.jsx(ut,{size:"small"})}),a.jsxs("button",{type:"button",className:"h-8 w-14 rounded-control border border-divider-primary bg-white text-center text-caption-2 text-display-on-light-primary hover:bg-background-secondary",onClick:()=>{i.reset(),x.reset()},children:[o,"%"]}),a.jsx("button",{type:"button",className:et,onClick:i.zoomIn,"aria-label":"Zoom in",children:a.jsx(we,{size:"small"})})]}),a.jsx("div",{className:"h-6 w-px bg-divider-primary"}),a.jsx("button",{type:"button",className:et,onClick:A.rotateCounterClockwise,"aria-label":"Rotate counter-clockwise",children:a.jsx(y1,{direction:"left",size:"small"})})]})]})]})]})};class Ts{constructor(t={}){Ye(this,"checkboxData");Ye(this,"schema");Ye(this,"finalGeneration");Ye(this,"name","CheckboxModule");this.checkboxData=t.checkboxData||{},this.schema=t.schema,this.finalGeneration=t.finalGeneration||!1}parse(t){return null}postparse(t){return t}render(t,r){return t}postrender(t,r){return!!(r&&r.contentType&&r.contentType==="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml")?(()=>{try{const c=t.map(i=>{const s=typeof i=="string",A=i&&typeof i=="object"&&i.value,d=()=>s&&i,u=()=>!s&&A&&i.value,p=()=>!s&&!A&&String(i);return d()||u()||p()}).join("");return[this.processCheckboxPatterns(c)]}catch{return t}})():t}processCheckboxPatterns(t){try{const r=/<w:bookmarkStart[^>]*w:name="(Check\d+)"[^>]*\/>/gi;r.lastIndex=0;const n=[];let c;for(;(c=r.exec(t))!==null;)n.push(c[1]);return n.length>0?(()=>{const i=()=>(n.forEach(u=>{const g=this.getCheckboxState(u)?"1":"0",C=new RegExp(`(<w:fldChar w:fldCharType="begin">.*?<w:name w:val="${u}".*?<w:default w:val=")([01])(".*?</w:fldChar>)`,"gs");t=t.replace(C,`$1${g}$3`)}),t),s=()=>(r.lastIndex=0,t.replace(r,(u,p)=>{try{return`<w:r><w:t>${`|||${this.getCheckboxState(p)?"☑":"☐"}|||checkbox:${p}|||`}</w:t></w:r><w:bookmarkStart w:name="${p}" w:id="0"/>`}catch{return u}})),A=()=>this.finalGeneration&&i(),d=()=>!this.finalGeneration&&s();return A()||d()})():t}catch{return t}}getCheckboxState(t){const r=!!this.schema,n=()=>!r&&(this.checkboxData[t]||!1),c=()=>r&&(()=>{const o=Object.entries(this.schema.properties||{}).find(([i,s])=>{const d=s.docx_mapping,u=d&&d.type==="checkbox",p=d&&d.type==="radio"&&d.mapping,g=u&&d.name===t,C=u&&d.true_name===t,x=u&&d.false_name===t,m=p&&d.mapping.find(f=>f.name===t);return g||C||x||!!m});return o?(()=>{const[i,s]=o,d=s.docx_mapping,u=d&&d.type==="checkbox"&&d.name===t,p=d&&d.type==="checkbox"&&d.true_name===t,g=d&&d.type==="checkbox"&&d.false_name===t,C=d&&d.type==="radio"&&d.mapping&&d.mapping.find(V=>V.name===t),x=()=>(u||p)&&this.checkboxData[i]===!0,m=()=>g&&this.checkboxData[i]===!1,f=()=>C&&this.checkboxData[i]===C.value;return x()||m()||f()||!1})():this.checkboxData[t]||!1})();return n()||c()||!1}updateCheckboxData(t){this.checkboxData={...this.checkboxData,...t}}}let H1={},Pn={};const Ws=({docxUrl:e,schema:t,onDataChange:r,initialData:n,onSaveRef:c,readonly:o=!1})=>{const[i,s]=U.useState([]),[A,d]=U.useState(!0),[u,p]=U.useState(null),[g,C]=U.useState(0),x=U.useRef(null),m=U.useCallback(b=>{const k=/\{([^}]+)\}/g,S=[];let R;for(;(R=k.exec(b))!==null;)S.push(R[1]);return[...new Set(S)]},[]),f=U.useCallback((b,k)=>{H1={...H1,[b]:k},z(b,k),r==null||r(H1)},[r]),V=U.useCallback((b,k)=>{!Object.entries(t.properties||{}).find(([R,D])=>{var t1;const J=D.docx_mapping,u1=(J==null?void 0:J.type)==="checkbox"&&J.name===b;u1&&f(R,k);const o1=(J==null?void 0:J.type)==="checkbox"&&J.true_name===b,_=(J==null?void 0:J.type)==="checkbox"&&J.false_name===b;o1&&f(R,k),_&&f(R,!k);const L=(J==null?void 0:J.type)==="radio"&&((t1=J.mapping)==null?void 0:t1.find(s1=>s1.name===b));return L&&f(R,L.value),u1||o1||_||!!L})&&f(b,k)},[f,t]),y=U.useCallback((b,k)=>{const S=Pn[b];return!(k===S||k===""&&S==null||S===""&&k==null)},[]),z=U.useCallback((b,k)=>{const S=!!x.current,R=y(b,k);S&&x.current.querySelectorAll(`[data-field-path="${b}"]`).forEach(a1=>{const J=R?"field-edited":"field-original",u1=R?"field-original":"field-edited";a1.classList.remove(u1),a1.classList.add(J)})},[y]),I=U.useCallback(()=>{!!x.current&&Object.entries(H1).forEach(([k,S])=>{z(k,S)})},[z]),H=U.useCallback(async()=>{r==null||r(H1),C(b=>b+1)},[r]);U.useEffect(()=>{c&&(c.current=H)},[H,c]);const P=U.useCallback(async b=>{try{const S=await(await fetch(e)).arrayBuffer(),R=new T5(S),D={};Object.entries(b).forEach(([_,L])=>{(typeof L=="boolean"||L==="true"||L==="false")&&(D[_]=L===!0||L==="true")});const a1=new w5(R,{paragraphLoop:!0,linebreaks:!0,nullGetter:_=>`||| |||${_.value||"unknown_field"}|||`,modules:[new Ts({checkboxData:D,schema:t,finalGeneration:!1})]}),J={},u1="__NEWLINE__";return Object.entries(b).forEach(([_,L])=>{if(L!=null&&L!==""){let t1=L;typeof L=="string"&&(t1=L.replace(/\n/g,u1)),J[_]=`|||${t1}|||${_}|||`}else J[_]=null}),a1.render(J),a1.getZip().generate({type:"blob",mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"})}catch(k){throw console.error("Error processing document:",k),new Error(k instanceof Error?k.message:"Failed to process document")}},[e,t]),M=U.useCallback((b,k,S,R)=>{const D=document.createElement("span");D.className="inline-field-container",D.setAttribute("data-field-path",b);const a1=o,J=k||H1[b]||"",u1=()=>{const d1=S.type==="boolean"?(()=>{const E=document.createElement("span");return E.textContent=J==="true"||H1[b]===!0?"☑":"☐",E.className="inline-checkbox-readonly",E})():(()=>{const E="__NEWLINE__",f1=String(J).replace(new RegExp(E,"g"),`
|
|
81
81
|
`),O1=document.createElement("span");return O1.textContent=f1,O1.className="inline-field-readonly",O1.style.whiteSpace="pre-wrap",O1})();return D.appendChild(d1),D},o1=()=>{const Q=document.createElement("input");return Q.type="checkbox",Q.checked=k==="true"||H1[b]===!0,Q.className="inline-checkbox rounded border-gray-300 text-green-600 focus:ring-green-500",Q.setAttribute("data-field-path",b),Q.addEventListener("change",d1=>{f(b,d1.target.checked)}),D.appendChild(Q),D},_=()=>{const Q=document.createElement("select");Q.className="inline-select border border-gray-300 rounded px-2 py-1 text-sm focus:outline-none focus:ring-2 focus:ring-500",Q.setAttribute("data-field-path",b);const d1=document.createElement("option");return d1.value="",d1.textContent="Select...",Q.appendChild(d1),S.enum.forEach(E=>{const f1=document.createElement("option");f1.value=String(E),f1.textContent=String(E),f1.selected=k===E||H1[b]===E,Q.appendChild(f1)}),Q.addEventListener("change",E=>{f(b,E.target.value)}),D.appendChild(Q),D},L=()=>{const Q=document.createElement("input");return Q.type=S.format==="date"?"date":"datetime-local",Q.value=String(k||H1[b]||""),Q.className="inline-date-input text-sm focus:outline-none",Q.setAttribute("data-field-path",b),Q.style.width="100%",Q.style.maxWidth="200px",Q.placeholder=String(S.description||b),Q.addEventListener("input",d1=>{f(b,d1.target.value)}),D.appendChild(Q),D},t1=()=>{const Q="__NEWLINE__",d1=String(k||H1[b]||"").replace(new RegExp(Q,"g"),`
|
|
82
82
|
`),E=document.createElement("textarea");E.value=d1,E.className="inline-textarea text-sm focus:outline-none resize-none",E.setAttribute("data-field-path",b),E.style.width="100%",E.style.minHeight="17px",E.style.overflow="hidden",E.placeholder=String(S.description||b),E.rows=1;const f1=()=>{E.style.height="auto";const O1=E.value.includes(`
|
|
83
83
|
`)||E.scrollHeight>25;E.style.height=O1?Math.max(17,E.scrollHeight)+"px":"17px"};return E.addEventListener("input",O1=>{f(b,O1.target.value),f1()}),setTimeout(f1,0),D.appendChild(E),D},s1=()=>a1&&u1(),P1=()=>!a1&&S.type==="boolean"&&o1(),I1=()=>!a1&&S.enum&&_(),C1=()=>!a1&&(S.format==="date"||S.format==="date-time")&&L();return s1()||P1()||I1()||C1()||t1()},[f,o]),w=U.useCallback((b,k)=>{const S=document.createTreeWalker(b,NodeFilter.SHOW_TEXT,null,!1),R=[];let D;for(;D=S.nextNode();)R.push(D);R.forEach(a1=>{const J=!!a1.textContent,u1=/\|\|\|([^|]*)\|\|\|([^|]+)\|\|\|/g,o1=a1.textContent||"",_=u1.test(o1),L=a1.parentNode;J&&_&&L&&(()=>{let t1=0;const s1=document.createDocumentFragment();a1.textContent.replace(u1,(P1,I1,C1,Q)=>{Q>t1&&s1.appendChild(document.createTextNode(o1.slice(t1,Q)));const O1=C1.startsWith("checkbox:")?(()=>{const p1=C1.replace("checkbox:",""),U1=Object.entries(t.properties||{}).find(([V1,v1])=>{const W1=v1.docx_mapping;return(W1==null?void 0:W1.type)==="checkbox"&&W1.true_name&&W1.false_name&&(W1.true_name===p1||W1.false_name===p1)}),[bt,Ge]=U1||[],De=Ge,Be=De==null?void 0:De.docx_mapping,Xe=!!U1,Ze=(Be==null?void 0:Be.true_name)===p1,Pt=()=>{const V1=document.createElement("span");return V1.textContent=I1,V1.className="inline-checkbox-readonly",V1},qr=()=>{const V1=document.createElement("span");V1.className="inline-radio-container";const v1=document.createElement("input");v1.type="radio",v1.name=`radio-group-${bt}`,v1.value=Ze?"true":"false";const Ae=k[bt];return v1.checked=Ze?Ae===!0||Ae==="true":Ae===!1||Ae==="false",v1.className="text-green-600 focus:ring-green-500 border-gray-300",v1.setAttribute("data-field-path",p1),v1.addEventListener("change",W1=>{W1.target.checked&&V(p1,!0)}),V1.appendChild(v1),V1},vt=()=>{const V1=document.createElement("input");return V1.type="checkbox",V1.checked=I1==="☑",V1.className="inline-checkbox rounded border-gray-300 text-green-600 focus:ring-green-500",V1.setAttribute("data-field-path",p1),V1.addEventListener("change",v1=>{V(p1,v1.target.checked)}),V1},Mt=()=>o&&Pt(),Ur=()=>!o&&Xe&&qr(),hr=()=>!o&&!Xe&&vt();return Mt()||Ur()||hr()})():(()=>{var U1;const p1=((U1=t.properties)==null?void 0:U1[C1])||{};return M(C1,I1,p1,k)})();return s1.appendChild(O1),t1=Q+P1.length,P1}),t1<o1.length&&s1.appendChild(document.createTextNode(o1.slice(t1))),L.replaceChild(s1,a1)})()})},[t,M,V,o]),h=U.useCallback(async b=>{!!x.current&&await(async()=>{try{const S=await P(b);for(;x.current.firstChild;)x.current.removeChild(x.current.firstChild);await E8.renderAsync(S,x.current,void 0,{className:"docx-preview",inWrapper:!0,hideWrapperOnPrint:!0,ignoreWidth:!1,ignoreHeight:!1,ignoreFonts:!1,breakPages:!0,debug:!1,experimental:!0,trimXmlDeclaration:!0,renderHeaders:!1,renderFooters:!1,renderFootnotes:!0,renderEndnotes:!0,ignoreLastRenderedPageBreak:!0,useBase64URL:!1,renderChanges:!1,renderComments:!1}),setTimeout(()=>{!!x.current&&(w(x.current,b),I())},100)}catch(S){console.error("Error updating preview:",S),!!x.current&&(()=>{for(;x.current.firstChild;)x.current.removeChild(x.current.firstChild);const D=document.createElement("div");D.className="p-4 text-red-600",D.textContent=`Error updating preview: ${S instanceof Error?S.message:"Unknown error"}`,x.current.appendChild(D)})()}})()},[P,w,I]),W=U.useCallback(async()=>{try{d(!0);const k=await(await fetch(e)).arrayBuffer(),S=new T5(k),D=new w5(S).getFullText(),a1=m(D);s(a1);const J={};a1.forEach(o1=>{var C1;const _=(C1=t.properties)==null?void 0:C1[o1],L=!!_,t1=()=>L&&_.type==="boolean"&&!1,s1=()=>L&&_.type==="string"&&_.format==="date"&&"",P1=()=>L&&_.type!=="boolean"&&!(_.type==="string"&&_.format==="date")&&"",I1=()=>!L&&"";J[o1]=t1()||s1()||P1()||""});const u1={...J,...n};H1=u1,Pn={...u1},p(null)}catch(b){p(`Failed to load document: ${b instanceof Error?b.message:"Unknown error"}`)}finally{d(!1)}},[e,t,m,n]);U.useEffect(()=>{W()},[W]),U.useEffect(()=>{!A&&Object.keys(H1).length>0&&!!x.current&&h(H1)},[A,h]),U.useEffect(()=>{g>0&&!!x.current&&h(H1)},[g,h]);const T=()=>a.jsx("div",{className:"flex items-center justify-center p-8",children:a.jsx("div",{className:"text-body",children:"Loading document..."})}),Y=()=>a.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-md p-4",children:[a.jsx("div",{className:"text-red-800 text-body-em",children:"Error"}),a.jsx("div",{className:"text-red-700 text-body mt-1",children:u})]}),F=A,G=!A&&!!u,n1=()=>F&&a.jsx(T,{}),X=()=>G&&a.jsx(Y,{}),$=()=>!F&&!G&&a.jsxs("div",{children:[a.jsx("style",{children:`
|
package/dist/index.esm.js
CHANGED
|
@@ -9773,8 +9773,8 @@ const t0 = B1(({ className: e, children: r, ...t }, n) => {
|
|
|
9773
9773
|
],
|
|
9774
9774
|
c === "pills" && o === "solid" && [
|
|
9775
9775
|
"min-h-9 rounded-full px-3 py-1 text-caption-2-em",
|
|
9776
|
-
"bg-
|
|
9777
|
-
"hover:bg-grey-
|
|
9776
|
+
"bg-grey-100 text-display-on-light-tertiary",
|
|
9777
|
+
"hover:bg-grey-200 hover:text-display-on-light-primary",
|
|
9778
9778
|
"data-[state=active]:bg-blue-600 data-[state=active]:text-white",
|
|
9779
9779
|
"data-[state=active]:hover:bg-blue-600"
|
|
9780
9780
|
],
|
package/package.json
CHANGED
package/src/components/Tabs.tsx
CHANGED
|
@@ -11,7 +11,7 @@ import { cn } from "../utils/cn";
|
|
|
11
11
|
|
|
12
12
|
export type TabsType = "tabs" | "pills";
|
|
13
13
|
|
|
14
|
-
/** Soft = search filters (filled idle). Solid =
|
|
14
|
+
/** Soft = search filters (filled idle, light accent active). Solid = list filters (grey-100 idle, blue-600 active). */
|
|
15
15
|
export type TabsAppearance = "soft" | "solid";
|
|
16
16
|
|
|
17
17
|
type TabsContextValue = {
|
|
@@ -107,8 +107,8 @@ export const TabsTrigger = forwardRef<
|
|
|
107
107
|
type === "pills" &&
|
|
108
108
|
appearance === "solid" && [
|
|
109
109
|
"min-h-9 rounded-full px-3 py-1 text-caption-2-em",
|
|
110
|
-
"bg-
|
|
111
|
-
"hover:bg-grey-
|
|
110
|
+
"bg-grey-100 text-display-on-light-tertiary",
|
|
111
|
+
"hover:bg-grey-200 hover:text-display-on-light-primary",
|
|
112
112
|
"data-[state=active]:bg-blue-600 data-[state=active]:text-white",
|
|
113
113
|
"data-[state=active]:hover:bg-blue-600",
|
|
114
114
|
],
|