@lateralus-ai/shipping-ui 2.0.0-dev.6 → 2.0.0-dev.8
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/Entry.d.ts +3 -0
- package/dist/index.cjs +1 -1
- package/dist/index.esm.js +999 -994
- package/package.json +1 -1
- package/src/components/Entry.tsx +27 -7
- package/src/components/Tabs.tsx +1 -1
|
@@ -26,5 +26,8 @@ export type EntryProps = {
|
|
|
26
26
|
/**
|
|
27
27
|
* List entry row — Figma `Entry` (389:10001).
|
|
28
28
|
* Shared by search results and activity lists.
|
|
29
|
+
*
|
|
30
|
+
* Renders a `div` (not `<button>`) so trailing controls can be real buttons
|
|
31
|
+
* without nested-button issues. Whole-row click uses `onClick` + keyboard.
|
|
29
32
|
*/
|
|
30
33
|
export declare const Entry: ({ variant, type, state, title, subtitle, count, trailing, icon, onClick, className, meta, }: EntryProps) => import("react/jsx-runtime").JSX.Element;
|
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:V("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}),qi=({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:V("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:V("inline-block size-5 rounded-full bg-white shadow-raise1 transition-transform",e?"translate-x-[18px]":"translate-x-0.5")})}),Ui={blue:"bg-meta-blue text-meta-on-blue",green:"bg-meta-green text-meta-on-green",red:"bg-meta-red text-meta-on-red",orange:"bg-meta-orange text-meta-on-orange",purple:"bg-meta-purple text-meta-on-purple",grey:"bg-grey-100 text-display-on-light-secondary"},Ue=({color:e,type:t="label",children:r,className:n})=>a.jsx("span",{className:V("inline-flex shrink-0 items-center justify-center text-footnote-em",t==="label"?"rounded-control px-2 py-0.5":"size-6 rounded-full",Ui[e],n),children:r}),hi=({children:e,icon:t,className:r})=>a.jsxs("div",{className:V("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:V("shrink-0",n),...c,children:t});return r.displayName=e,r},wi=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"})]})}),Ti=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)"})]})}),Wi=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)"})]})}),Ri=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"})]})}),Fi=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"})]})}),Gi=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"})]})}),Di=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"})]})}),Xi=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"})]})}),Bi=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"})]})}),Zi=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)"})]})}),Yi=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)"})]})}),Li=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)"})]})}),Ji={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"},Qi=({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,C=i??c==="disabled",g=C?"disabled":c,x=!!n;return a.jsxs("div",{className:V("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:C,"data-state":g,onChange:m=>o==null?void 0:o(m.target.value),className:V("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&&Ji[g]),...d}),n&&a.jsx("span",{className:"text-footnote text-red-500",children:n})]})},Ei={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"},_i=({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:V("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:C=>c==null?void 0:c(C.target.value),className:V("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&&Ei[n]),...d})]})},$i={text:{on:"On",off:"Off"},binary:{on:"Yes",off:"No"}},es=({type:e,state:t,onChange:r,disabled:n=!1,className:c})=>{const o=t==="on",{on:i,off:s}=$i[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:V("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:V("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:V("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})]})},ts={blue:"bg-meta-blue",green:"bg-meta-green",red:"bg-meta-red",orange:"bg-meta-orange",purple:"bg-meta-purple",grey:"bg-grey-400"},rs=({variant:e,label:t,avatar:r,icon:n,dotColor:c="blue",onRemove:o,className:i})=>a.jsxs("span",{"data-variant":e,className:V("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:V("size-2 shrink-0 rounded-full",ts[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"})})]}),ns=({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:V("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:C=>c==null?void 0:c(C.target.checked),className:"peer sr-only",...s}),a.jsxs("span",{"aria-hidden":!0,className:V("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})]})},as=({label:e,state:t="idle",className:r,...n})=>a.jsxs("button",{type:"button",role:"tab","aria-selected":t==="active","data-state":t,className:V("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 vr="Tabs",[cs]=je(vr,[Vr]),f0=Vr(),[os,A5]=cs(vr),V0=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,C]=gr({prop:n,onChange:c,defaultProp:o??"",caller:vr});return a.jsx(os,{scope:r,baseId:pe(),value:p,onValueChange:C,orientation:i,dir:u,activationMode:A,children:a.jsx(l1.div,{dir:u,"data-orientation":i,...d,ref:t})})});V0.displayName=vr;var O0="TabsList",y0=l.forwardRef((e,t)=>{const{__scopeTabs:r,loop:n=!0,...c}=e,o=A5(O0,r),i=f0(r);return a.jsx(ra,{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})})});y0.displayName=O0;var I0="TabsTrigger",z0=l.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,disabled:c=!1,...o}=e,i=A5(I0,r),s=f0(r),A=b0(i.baseId,n),d=M0(i.baseId,n),u=n===i.value;return a.jsx(na,{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)})})})});z0.displayName=I0;var H0="TabsContent",k0=l.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,forceMount:c,children:o,...i}=e,s=A5(H0,r),A=b0(s.baseId,n),d=M0(s.baseId,n),u=n===s.value,p=l.useRef(u);return l.useEffect(()=>{const C=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(C)},[]),a.jsx(ne,{present:c||u,children:({present:C})=>a.jsx(l1.div,{"data-state":u?"active":"inactive","data-orientation":s.orientation,role:"tabpanel","aria-labelledby":A,hidden:!C,id:d,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:p.current?"0s":void 0},children:C&&o})})});k0.displayName=H0;function b0(e,t){return`${e}-trigger-${t}`}function M0(e,t){return`${e}-content-${t}`}var is=V0,P0=y0,v0=z0,K0=k0;const l5=U.createContext({type:"tabs"}),S0=({type:e="tabs",className:t,children:r,...n})=>a.jsx(l5.Provider,{value:{type:e},children:a.jsx(is,{className:V("flex flex-col",t),"data-type":e,...n,children:r})}),u5=U.forwardRef(({className:e,...t},r)=>{const{type:n}=U.useContext(l5);return a.jsx(P0,{ref:r,className:V("flex items-center",n==="tabs"&&"gap-6 border-b border-divider-primary",n==="pills"&&"gap-2",e),...t})});u5.displayName=P0.displayName;const d5=U.forwardRef(({className:e,count:t,children:r,...n},c)=>{const{type:o}=U.useContext(l5);return a.jsxs(v0,{ref:c,className:V("inline-flex items-center justify-center transition-colors outline-none","disabled:pointer-events-none disabled:opacity-50",o==="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"],o==="pills"&&["group min-h-9 gap-2.5 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"],e),...n,children:[r,typeof t=="number"&&(o==="pills"?a.jsx("span",{className:V("inline-flex size-6 shrink-0 items-center justify-center rounded-full text-footnote-em","bg-accent-bg-light text-display-on-light-secondary","group-data-[state=active]:text-display-on-light-tertiary"),"aria-label":`Count: ${t}`,children:t>99?"99+":t}):a.jsx("span",{className:"px-1 text-caption-2 text-display-on-light-secondary","aria-label":`Count: ${t}`,children:t>99?"99+":t}))]})});d5.displayName=v0.displayName;const p5=U.forwardRef(({className:e,...t},r)=>a.jsx(K0,{ref:r,className:V("outline-none",e),...t}));p5.displayName=K0.displayName;const ss=({variant:e="standard",title:t,actions:r,className:n})=>a.jsxs("header",{"data-variant":e,className:V("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:V("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})]}),As={chat:a.jsx(Ct,{className:"size-4"}),issue:a.jsx(Ke,{className:"size-4"}),report:a.jsx(ir,{className:"size-4"})},N0=({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",C=typeof A=="function",g=C?"button":"div";return a.jsxs(g,{...C?{type:"button"}:{},"data-variant":p,"data-state":r,onClick:A,className:V("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)]",d),children:[a.jsx("span",{className:"shrink-0 text-display-on-light-secondary",children:s??As[p]??a.jsx(sr,{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}),i!=null&&a.jsx("span",{className:"shrink-0",onClick:x=>x.stopPropagation(),onKeyDown:x=>x.stopPropagation(),children:i})]}):null]})]})},ls=({illustration:e,title:t,description:r,action:n,className:c})=>a.jsxs("div",{className:V("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(Ne,{hierarchy:n.hierarchy??"primary",onClick:n.onClick,icon:n.icon,startIcon:n.startIcon,children:n.children})]});var Kr="Dialog",[q0]=je(Kr),[us,X1]=q0(Kr),U0=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]=gr({prop:n,defaultProp:c??!1,onChange:o,caller:Kr});return a.jsx(us,{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})};U0.displayName=Kr;var h0="DialogTrigger",w0=l.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,c=X1(h0,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)})});w0.displayName=h0;var C5="DialogPortal",[ds,T0]=q0(C5,{forceMount:void 0}),W0=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:c}=e,o=X1(C5,t);return a.jsx(ds,{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})}))})};W0.displayName=C5;var er="DialogOverlay",g5=l.forwardRef((e,t)=>{const r=T0(er,e.__scopeDialog),{forceMount:n=r.forceMount,...c}=e,o=X1(er,e.__scopeDialog);return o.modal?a.jsx(ne,{present:n||o.open,children:a.jsx(Cs,{...c,ref:t})}):null});g5.displayName=er;var ps=at("DialogOverlay.RemoveScroll"),Cs=l.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,c=X1(er,r),o=nc(),i=j1(t,o);return a.jsx(Y2,{as:ps,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=T0(he,e.__scopeDialog),{forceMount:n=r.forceMount,...c}=e,o=X1(he,e.__scopeDialog);return a.jsx(ne,{present:n||o.open,children:o.modal?a.jsx(gs,{...c,ref:t}):a.jsx(xs,{...c,ref:t})})});x5.displayName=he;var gs=l.forwardRef((e,t)=>{const r=X1(he,e.__scopeDialog),n=l.useRef(null),c=j1(t,r.contentRef,n);return l.useEffect(()=>{const o=n.current;if(o)return ca(o)},[]),a.jsx(R0,{...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())})}),xs=l.forwardRef((e,t)=>{const r=X1(he,e.__scopeDialog),n=l.useRef(!1),c=l.useRef(!1);return a.jsx(R0,{...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()}})}),R0=l.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:c,onCloseAutoFocus:o,...i}=e,s=X1(he,r);return j4(),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)})})})}),F0="DialogTitle",m5=l.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,c=X1(F0,r);return a.jsx(l1.h2,{id:c.titleId,...n,ref:t})});m5.displayName=F0;var G0="DialogDescription",j5=l.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,c=X1(G0,r);return a.jsx(l1.p,{id:c.descriptionId,...n,ref:t})});j5.displayName=G0;var D0="DialogClose",X0=l.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,c=X1(D0,r);return a.jsx(l1.button,{type:"button",...n,ref:t,onClick:Z(e.onClick,()=>c.onOpenChange(!1))})});X0.displayName=D0;function f5(e){return e?"open":"closed"}const B0=U0,ms=w0,js=X0,Z0=W0,V5=U.forwardRef(({className:e,...t},r)=>a.jsx(g5,{ref:r,className:V("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}));V5.displayName=g5.displayName;const O5=U.forwardRef(({className:e,children:t,showOverlay:r=!0,overlayClassName:n,...c},o)=>a.jsxs(Z0,{children:[r&&a.jsx(V5,{className:n}),a.jsx(x5,{ref:o,className:V("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})]}));O5.displayName=x5.displayName;const y5=U.forwardRef(({className:e,...t},r)=>a.jsx(m5,{ref:r,className:V("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:V("text-caption-2 text-display-on-light-secondary",e),...t}));I5.displayName=j5.displayName;const fs=({children:e,className:t})=>a.jsx("div",{className:V("shrink-0",t),children:e}),Y0=({children:e,className:t})=>a.jsx("div",{className:V("min-h-0 overflow-auto",t),children:e}),Vs=({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"})})]})]}),Os=({children:e,className:t})=>a.jsx("div",{className:V("w-full overflow-auto",t),children:e}),z5={Header:Vs,Body:Os},L0=(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)))}}]},J0=()=>{const[e,t]=U.useState(0);return[e,{rotateClockwise:()=>t(n=>(n+90)%360),rotateCounterClockwise:()=>t(n=>(n-90+360)%360)}]},Q0=()=>{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})}]},E0=(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",ys=({className:e,canvasClassName:t,mainCanvasClassname:r,initialPage:n=1,onClose:c,totalPages:o,getImageSrc:i,documentUrl:s,title:A="PDF Viewer"})=>{const[d,u]=L0(),[p,C]=J0(),[{pan:g,isDragging:x},m]=Q0(),[{currentPage:f},O]=E0(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:V("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(or,{size:"small"})}):void 0,children:A}),a.jsxs("div",{className:V("grid h-full grow overflow-hidden",t),children:[a.jsx("div",{className:V("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(${g.x}px, ${g.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:O.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)||O.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:O.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:C.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",Is=({onClose:e,src:t,title:r="PDF Viewer",className:n,onOpen:c})=>{const[o,i]=L0(),[s,A]=J0(),[{currentPage:d,totalPages:u},p]=E0(),[{pan:C,isDragging:g},x]=Q0(),[m,f]=U.useState(1),O=U.useRef(null);U.useEffect(()=>{const I=()=>{if(!O.current)return;const P=O.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(or,{size:"small"})});return a.jsxs("div",{className:V("flex h-full flex-col rounded-t-lg shadow-raise2",n),ref:O,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:V("col-start-1 row-start-1 mt-8 flex h-full items-center justify-center overflow-hidden bg-background-tertiary p-8 select-none",g?"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(${C.x}px, ${C.y}px)`,transition:g?"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 zs{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 C=this.getCheckboxState(u)?"1":"0",g=new RegExp(`(<w:fldChar w:fldCharType="begin">.*?<w:name w:val="${u}".*?<w:default w:val=")([01])(".*?</w:fldChar>)`,"gs");t=t.replace(g,`$1${C}$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,C=u&&d.name===t,g=u&&d.true_name===t,x=u&&d.false_name===t,m=p&&d.mapping.find(f=>f.name===t);return C||g||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,C=d&&d.type==="checkbox"&&d.false_name===t,g=d&&d.type==="radio"&&d.mapping&&d.mapping.find(O=>O.name===t),x=()=>(u||p)&&this.checkboxData[i]===!0,m=()=>C&&this.checkboxData[i]===!1,f=()=>g&&this.checkboxData[i]===g.value;return x()||m()||f()||!1})():this.checkboxData[t]||!1})();return n()||c()||!1}updateCheckboxData(t){this.checkboxData={...this.checkboxData,...t}}}let H1={},Hn={};const Hs=({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),[C,g]=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]),O=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=Hn[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),g(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 w5(S),D={};Object.entries(b).forEach(([_,L])=>{(typeof L=="boolean"||L==="true"||L==="false")&&(D[_]=L===!0||L==="true")});const a1=new h5(R,{paragraphLoop:!0,linebreaks:!0,nullGetter:_=>`||| |||${_.value||"unknown_field"}|||`,modules:[new zs({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]),v=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:V("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}),qi=({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:V("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:V("inline-block size-5 rounded-full bg-white shadow-raise1 transition-transform",e?"translate-x-[18px]":"translate-x-0.5")})}),Ui={blue:"bg-meta-blue text-meta-on-blue",green:"bg-meta-green text-meta-on-green",red:"bg-meta-red text-meta-on-red",orange:"bg-meta-orange text-meta-on-orange",purple:"bg-meta-purple text-meta-on-purple",grey:"bg-grey-100 text-display-on-light-secondary"},Ue=({color:e,type:t="label",children:r,className:n})=>a.jsx("span",{className:V("inline-flex shrink-0 items-center justify-center text-footnote-em",t==="label"?"rounded-control px-2 py-0.5":"size-6 rounded-full",Ui[e],n),children:r}),hi=({children:e,icon:t,className:r})=>a.jsxs("div",{className:V("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:V("shrink-0",n),...c,children:t});return r.displayName=e,r},wi=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"})]})}),Ti=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)"})]})}),Wi=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)"})]})}),Ri=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"})]})}),Fi=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"})]})}),Gi=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"})]})}),Di=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"})]})}),Xi=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"})]})}),Bi=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"})]})}),Zi=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)"})]})}),Yi=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)"})]})}),Li=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)"})]})}),Ji={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"},Qi=({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,C=i??c==="disabled",g=C?"disabled":c,x=!!n;return a.jsxs("div",{className:V("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:C,"data-state":g,onChange:m=>o==null?void 0:o(m.target.value),className:V("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&&Ji[g]),...d}),n&&a.jsx("span",{className:"text-footnote text-red-500",children:n})]})},Ei={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"},_i=({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:V("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:C=>c==null?void 0:c(C.target.value),className:V("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&&Ei[n]),...d})]})},$i={text:{on:"On",off:"Off"},binary:{on:"Yes",off:"No"}},es=({type:e,state:t,onChange:r,disabled:n=!1,className:c})=>{const o=t==="on",{on:i,off:s}=$i[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:V("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:V("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:V("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})]})},ts={blue:"bg-meta-blue",green:"bg-meta-green",red:"bg-meta-red",orange:"bg-meta-orange",purple:"bg-meta-purple",grey:"bg-grey-400"},rs=({variant:e,label:t,avatar:r,icon:n,dotColor:c="blue",onRemove:o,className:i})=>a.jsxs("span",{"data-variant":e,className:V("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:V("size-2 shrink-0 rounded-full",ts[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"})})]}),ns=({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:V("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:C=>c==null?void 0:c(C.target.checked),className:"peer sr-only",...s}),a.jsxs("span",{"aria-hidden":!0,className:V("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})]})},as=({label:e,state:t="idle",className:r,...n})=>a.jsxs("button",{type:"button",role:"tab","aria-selected":t==="active","data-state":t,className:V("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 vr="Tabs",[cs]=je(vr,[Vr]),f0=Vr(),[os,A5]=cs(vr),V0=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,C]=gr({prop:n,onChange:c,defaultProp:o??"",caller:vr});return a.jsx(os,{scope:r,baseId:pe(),value:p,onValueChange:C,orientation:i,dir:u,activationMode:A,children:a.jsx(l1.div,{dir:u,"data-orientation":i,...d,ref:t})})});V0.displayName=vr;var O0="TabsList",y0=l.forwardRef((e,t)=>{const{__scopeTabs:r,loop:n=!0,...c}=e,o=A5(O0,r),i=f0(r);return a.jsx(ra,{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})})});y0.displayName=O0;var I0="TabsTrigger",z0=l.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,disabled:c=!1,...o}=e,i=A5(I0,r),s=f0(r),A=b0(i.baseId,n),d=M0(i.baseId,n),u=n===i.value;return a.jsx(na,{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)})})})});z0.displayName=I0;var H0="TabsContent",k0=l.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,forceMount:c,children:o,...i}=e,s=A5(H0,r),A=b0(s.baseId,n),d=M0(s.baseId,n),u=n===s.value,p=l.useRef(u);return l.useEffect(()=>{const C=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(C)},[]),a.jsx(ne,{present:c||u,children:({present:C})=>a.jsx(l1.div,{"data-state":u?"active":"inactive","data-orientation":s.orientation,role:"tabpanel","aria-labelledby":A,hidden:!C,id:d,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:p.current?"0s":void 0},children:C&&o})})});k0.displayName=H0;function b0(e,t){return`${e}-trigger-${t}`}function M0(e,t){return`${e}-content-${t}`}var is=V0,P0=y0,v0=z0,K0=k0;const l5=U.createContext({type:"tabs"}),S0=({type:e="tabs",className:t,children:r,...n})=>a.jsx(l5.Provider,{value:{type:e},children:a.jsx(is,{className:V("flex flex-col",t),"data-type":e,...n,children:r})}),u5=U.forwardRef(({className:e,...t},r)=>{const{type:n}=U.useContext(l5);return a.jsx(P0,{ref:r,className:V("flex items-center",n==="tabs"&&"gap-6 border-b border-divider-primary",n==="pills"&&"gap-2",e),...t})});u5.displayName=P0.displayName;const d5=U.forwardRef(({className:e,count:t,children:r,...n},c)=>{const{type:o}=U.useContext(l5);return a.jsxs(v0,{ref:c,className:V("inline-flex items-center justify-center transition-colors outline-none","disabled:pointer-events-none disabled:opacity-50",o==="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"],o==="pills"&&["group min-h-9 gap-2.5 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"],e),...n,children:[r,typeof t=="number"&&(o==="pills"?a.jsx("span",{className:V("inline-flex shrink-0 items-center justify-center rounded-full px-1.5 py-0.5 text-footnote-em leading-none","bg-accent-bg-light text-display-on-light-secondary","group-data-[state=active]:text-display-on-light-tertiary"),"aria-label":`Count: ${t}`,children:t>99?"99+":t}):a.jsx("span",{className:"px-1 text-caption-2 text-display-on-light-secondary","aria-label":`Count: ${t}`,children:t>99?"99+":t}))]})});d5.displayName=v0.displayName;const p5=U.forwardRef(({className:e,...t},r)=>a.jsx(K0,{ref:r,className:V("outline-none",e),...t}));p5.displayName=K0.displayName;const ss=({variant:e="standard",title:t,actions:r,className:n})=>a.jsxs("header",{"data-variant":e,className:V("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:V("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})]}),As={chat:a.jsx(Ct,{className:"size-4"}),issue:a.jsx(Ke,{className:"size-4"}),report:a.jsx(ir,{className:"size-4"})},N0=({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",C=typeof A=="function",g=x=>{A&&(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),A())};return a.jsxs("div",{role:C?"button":void 0,tabIndex:C?0:void 0,"data-variant":p,"data-state":r,onClick:A,onKeyDown:g,className:V("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)]",C&&"cursor-pointer",d),children:[a.jsx("span",{className:"shrink-0 text-display-on-light-secondary",children:s??As[p]??a.jsx(sr,{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]})]})},ls=({illustration:e,title:t,description:r,action:n,className:c})=>a.jsxs("div",{className:V("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(Ne,{hierarchy:n.hierarchy??"primary",onClick:n.onClick,icon:n.icon,startIcon:n.startIcon,children:n.children})]});var Kr="Dialog",[q0]=je(Kr),[us,X1]=q0(Kr),U0=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]=gr({prop:n,defaultProp:c??!1,onChange:o,caller:Kr});return a.jsx(us,{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})};U0.displayName=Kr;var h0="DialogTrigger",w0=l.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,c=X1(h0,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)})});w0.displayName=h0;var C5="DialogPortal",[ds,T0]=q0(C5,{forceMount:void 0}),W0=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:c}=e,o=X1(C5,t);return a.jsx(ds,{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})}))})};W0.displayName=C5;var er="DialogOverlay",g5=l.forwardRef((e,t)=>{const r=T0(er,e.__scopeDialog),{forceMount:n=r.forceMount,...c}=e,o=X1(er,e.__scopeDialog);return o.modal?a.jsx(ne,{present:n||o.open,children:a.jsx(Cs,{...c,ref:t})}):null});g5.displayName=er;var ps=at("DialogOverlay.RemoveScroll"),Cs=l.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,c=X1(er,r),o=nc(),i=j1(t,o);return a.jsx(Y2,{as:ps,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=T0(he,e.__scopeDialog),{forceMount:n=r.forceMount,...c}=e,o=X1(he,e.__scopeDialog);return a.jsx(ne,{present:n||o.open,children:o.modal?a.jsx(gs,{...c,ref:t}):a.jsx(xs,{...c,ref:t})})});x5.displayName=he;var gs=l.forwardRef((e,t)=>{const r=X1(he,e.__scopeDialog),n=l.useRef(null),c=j1(t,r.contentRef,n);return l.useEffect(()=>{const o=n.current;if(o)return ca(o)},[]),a.jsx(R0,{...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())})}),xs=l.forwardRef((e,t)=>{const r=X1(he,e.__scopeDialog),n=l.useRef(!1),c=l.useRef(!1);return a.jsx(R0,{...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()}})}),R0=l.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:c,onCloseAutoFocus:o,...i}=e,s=X1(he,r);return j4(),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)})})})}),F0="DialogTitle",m5=l.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,c=X1(F0,r);return a.jsx(l1.h2,{id:c.titleId,...n,ref:t})});m5.displayName=F0;var G0="DialogDescription",j5=l.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,c=X1(G0,r);return a.jsx(l1.p,{id:c.descriptionId,...n,ref:t})});j5.displayName=G0;var D0="DialogClose",X0=l.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,c=X1(D0,r);return a.jsx(l1.button,{type:"button",...n,ref:t,onClick:Z(e.onClick,()=>c.onOpenChange(!1))})});X0.displayName=D0;function f5(e){return e?"open":"closed"}const B0=U0,ms=w0,js=X0,Z0=W0,V5=U.forwardRef(({className:e,...t},r)=>a.jsx(g5,{ref:r,className:V("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}));V5.displayName=g5.displayName;const O5=U.forwardRef(({className:e,children:t,showOverlay:r=!0,overlayClassName:n,...c},o)=>a.jsxs(Z0,{children:[r&&a.jsx(V5,{className:n}),a.jsx(x5,{ref:o,className:V("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})]}));O5.displayName=x5.displayName;const y5=U.forwardRef(({className:e,...t},r)=>a.jsx(m5,{ref:r,className:V("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:V("text-caption-2 text-display-on-light-secondary",e),...t}));I5.displayName=j5.displayName;const fs=({children:e,className:t})=>a.jsx("div",{className:V("shrink-0",t),children:e}),Y0=({children:e,className:t})=>a.jsx("div",{className:V("min-h-0 overflow-auto",t),children:e}),Vs=({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"})})]})]}),Os=({children:e,className:t})=>a.jsx("div",{className:V("w-full overflow-auto",t),children:e}),z5={Header:Vs,Body:Os},L0=(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)))}}]},J0=()=>{const[e,t]=U.useState(0);return[e,{rotateClockwise:()=>t(n=>(n+90)%360),rotateCounterClockwise:()=>t(n=>(n-90+360)%360)}]},Q0=()=>{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})}]},E0=(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",ys=({className:e,canvasClassName:t,mainCanvasClassname:r,initialPage:n=1,onClose:c,totalPages:o,getImageSrc:i,documentUrl:s,title:A="PDF Viewer"})=>{const[d,u]=L0(),[p,C]=J0(),[{pan:g,isDragging:x},m]=Q0(),[{currentPage:f},O]=E0(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:V("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(or,{size:"small"})}):void 0,children:A}),a.jsxs("div",{className:V("grid h-full grow overflow-hidden",t),children:[a.jsx("div",{className:V("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(${g.x}px, ${g.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:O.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)||O.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:O.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:C.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",Is=({onClose:e,src:t,title:r="PDF Viewer",className:n,onOpen:c})=>{const[o,i]=L0(),[s,A]=J0(),[{currentPage:d,totalPages:u},p]=E0(),[{pan:C,isDragging:g},x]=Q0(),[m,f]=U.useState(1),O=U.useRef(null);U.useEffect(()=>{const I=()=>{if(!O.current)return;const P=O.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(or,{size:"small"})});return a.jsxs("div",{className:V("flex h-full flex-col rounded-t-lg shadow-raise2",n),ref:O,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:V("col-start-1 row-start-1 mt-8 flex h-full items-center justify-center overflow-hidden bg-background-tertiary p-8 select-none",g?"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(${C.x}px, ${C.y}px)`,transition:g?"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 zs{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 C=this.getCheckboxState(u)?"1":"0",g=new RegExp(`(<w:fldChar w:fldCharType="begin">.*?<w:name w:val="${u}".*?<w:default w:val=")([01])(".*?</w:fldChar>)`,"gs");t=t.replace(g,`$1${C}$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,C=u&&d.name===t,g=u&&d.true_name===t,x=u&&d.false_name===t,m=p&&d.mapping.find(f=>f.name===t);return C||g||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,C=d&&d.type==="checkbox"&&d.false_name===t,g=d&&d.type==="radio"&&d.mapping&&d.mapping.find(O=>O.name===t),x=()=>(u||p)&&this.checkboxData[i]===!0,m=()=>C&&this.checkboxData[i]===!1,f=()=>g&&this.checkboxData[i]===g.value;return x()||m()||f()||!1})():this.checkboxData[t]||!1})();return n()||c()||!1}updateCheckboxData(t){this.checkboxData={...this.checkboxData,...t}}}let H1={},Hn={};const Hs=({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),[C,g]=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]),O=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=Hn[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),g(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 w5(S),D={};Object.entries(b).forEach(([_,L])=>{(typeof L=="boolean"||L==="true"||L==="false")&&(D[_]=L===!0||L==="true")});const a1=new h5(R,{paragraphLoop:!0,linebreaks:!0,nullGetter:_=>`||| |||${_.value||"unknown_field"}|||`,modules:[new zs({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]),v=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
|
`),V1=document.createElement("span");return V1.textContent=f1,V1.className="inline-field-readonly",V1.style.whiteSpace="pre-wrap",V1})();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 V1=E.value.includes(`
|
|
83
83
|
`)||E.scrollHeight>25;E.style.height=V1?Math.max(17,E.scrollHeight)+"px":"17px"};return E.addEventListener("input",V1=>{f(b,V1.target.value),f1()}),setTimeout(f1,0),D.appendChild(E),D},s1=()=>a1&&u1(),M1=()=>!a1&&S.type==="boolean"&&o1(),I1=()=>!a1&&S.enum&&_(),g1=()=>!a1&&(S.format==="date"||S.format==="date-time")&&L();return s1()||M1()||I1()||g1()||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,(M1,I1,g1,Q)=>{Q>t1&&s1.appendChild(document.createTextNode(o1.slice(t1,Q)));const V1=g1.startsWith("checkbox:")?(()=>{const p1=g1.replace("checkbox:",""),U1=Object.entries(t.properties||{}).find(([O1,P1])=>{const W1=P1.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,Xe=De==null?void 0:De.docx_mapping,Be=!!U1,Ze=(Xe==null?void 0:Xe.true_name)===p1,Mt=()=>{const O1=document.createElement("span");return O1.textContent=I1,O1.className="inline-checkbox-readonly",O1},Sr=()=>{const O1=document.createElement("span");O1.className="inline-radio-container";const P1=document.createElement("input");P1.type="radio",P1.name=`radio-group-${bt}`,P1.value=Ze?"true":"false";const Ae=k[bt];return P1.checked=Ze?Ae===!0||Ae==="true":Ae===!1||Ae==="false",P1.className="text-green-600 focus:ring-green-500 border-gray-300",P1.setAttribute("data-field-path",p1),P1.addEventListener("change",W1=>{W1.target.checked&&O(p1,!0)}),O1.appendChild(P1),O1},Pt=()=>{const O1=document.createElement("input");return O1.type="checkbox",O1.checked=I1==="☑",O1.className="inline-checkbox rounded border-gray-300 text-green-600 focus:ring-green-500",O1.setAttribute("data-field-path",p1),O1.addEventListener("change",P1=>{O(p1,P1.target.checked)}),O1},vt=()=>o&&Mt(),Nr=()=>!o&&Be&&Sr(),qr=()=>!o&&!Be&&Pt();return vt()||Nr()||qr()})():(()=>{var U1;const p1=((U1=t.properties)==null?void 0:U1[g1])||{};return v(g1,I1,p1,k)})();return s1.appendChild(V1),t1=Q+M1.length,M1}),t1<o1.length&&s1.appendChild(document.createTextNode(o1.slice(t1))),L.replaceChild(s1,a1)})()})},[t,v,O,o]),W=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 L8.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]),T=U.useCallback(async()=>{try{d(!0);const k=await(await fetch(e)).arrayBuffer(),S=new w5(k),D=new h5(S).getFullText(),a1=m(D);s(a1);const J={};a1.forEach(o1=>{var g1;const _=(g1=t.properties)==null?void 0:g1[o1],L=!!_,t1=()=>L&&_.type==="boolean"&&!1,s1=()=>L&&_.type==="string"&&_.format==="date"&&"",M1=()=>L&&_.type!=="boolean"&&!(_.type==="string"&&_.format==="date")&&"",I1=()=>!L&&"";J[o1]=t1()||s1()||M1()||""});const u1={...J,...n};H1=u1,Hn={...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(()=>{T()},[T]),U.useEffect(()=>{!A&&Object.keys(H1).length>0&&!!x.current&&W(H1)},[A,W]),U.useEffect(()=>{C>0&&!!x.current&&W(H1)},[C,W]);const h=()=>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(h,{}),B=()=>G&&a.jsx(Y,{}),$=()=>!F&&!G&&a.jsxs("div",{children:[a.jsx("style",{children:`
|