@wpic/ui 0.3.15 → 0.3.16

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/wpic-ui.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),C=require("lucide-vue-next"),_=require("@floating-ui/vue"),X2=require("pinia");var D1=typeof document<"u"?document.currentScript:null;const G2={key:0,class:"absolute inset-0 flex items-center justify-center rounded-[inherit]","aria-hidden":"true"},P1=e.defineComponent({__name:"WButton",props:{variant:{},size:{},loading:{type:Boolean},disabled:{type:Boolean},active:{type:Boolean},icon:{type:[Object,Function]},href:{}},emits:["click"],setup(n,{emit:u}){const t=n,a=u;return(s,l)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.href?"a":"button"),{href:n.href,disabled:n.disabled||n.loading,"data-active":n.active?"true":void 0,onClick:l[0]||(l[0]=r=>!n.href&&a("click",r)),class:e.normalizeClass(["wpic-button","relative inline-flex items-center justify-center font-medium transition-all duration-150 cursor-pointer select-none","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500/50 focus-visible:ring-offset-1","active:scale-[0.98]",n.disabled||n.loading?"opacity-40 cursor-not-allowed pointer-events-none":"",n.active?"wpic-button--active":"",(t.size??"md")==="sm"?"h-8 touch-manipulation px-2.5 gap-1.5 rounded-md text-sm":"",(t.size??"md")==="md"?(t.variant==="subtle"?"h-11":"h-9")+" px-3.5 gap-2 rounded-lg":"",(t.size??"md")==="lg"?(t.variant==="subtle"?"h-12":"h-11")+" px-4 gap-2 rounded-lg":"",(t.size??"md")==="xs"?"h-5 w-5 p-0 rounded-full text-xs":"",(t.variant??"primary")==="primary"?"wpic-btn-primary text-white":"",(t.variant??"primary")==="secondary"?"bg-zinc-100 hover:bg-zinc-200 text-zinc-700 dark:bg-zinc-800 dark:hover:bg-zinc-700 dark:text-zinc-200":"",(t.variant??"primary")==="subtle"?"bg-zinc-100 border border-zinc-100 hover:bg-zinc-200/70 text-zinc-700 dark:bg-zinc-800 dark:border-zinc-800 dark:hover:bg-zinc-700 dark:text-zinc-200":"",(t.variant??"primary")==="destructive"?"bg-red-500 hover:bg-red-600 text-white":"",(t.variant??"primary")==="ghost"?"bg-transparent hover:bg-zinc-100 text-zinc-600 hover:text-zinc-900 dark:hover:bg-zinc-800 dark:text-zinc-400 dark:hover:text-zinc-100":"",(t.variant??"primary")==="outline"?"bg-transparent border border-zinc-200 hover:bg-zinc-50 text-zinc-700 dark:border-zinc-800 dark:hover:bg-zinc-800 dark:text-zinc-300":""])},{default:e.withCtx(()=>[e.createElementVNode("span",{class:e.normalizeClass(["inline-flex items-center justify-center gap-[inherit]",n.loading?"invisible":""])},[n.icon?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.icon),{key:0,size:(t.size??"md")==="xs"?10:(t.size??"md")==="sm"?12:((t.size??"md")==="lg",15)},null,8,["size"])):e.createCommentVNode("",!0),e.renderSlot(s.$slots,"default")],2),n.loading?(e.openBlock(),e.createElementBlock("span",G2,[e.createVNode(e.unref(C.Loader2),{size:(t.size??"md")==="xs"?10:(t.size??"md")==="sm"?13:(t.size??"md")==="lg"?17:15,class:e.normalizeClass(["animate-spin",["primary","destructive"].includes(t.variant??"primary")?"text-white":""])},null,8,["size","class"])])):e.createCommentVNode("",!0)]),_:3},8,["href","disabled","data-active","class"]))}}),_2={class:"wpic-button-group inline-flex"},e0=e.defineComponent({__name:"WButtonGroup",setup(n){return(u,t)=>(e.openBlock(),e.createElementBlock("div",_2,[e.renderSlot(u.$slots,"default")]))}}),n0={class:"wpic-filter flex items-center gap-1"},t0=["onClick"],l0=e.defineComponent({__name:"WFilter",props:{options:{},modelValue:{}},emits:["update:modelValue"],setup(n){return(u,t)=>(e.openBlock(),e.createElementBlock("div",n0,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.options,(a,s)=>(e.openBlock(),e.createElementBlock("button",{key:s,type:"button",onClick:l=>u.$emit("update:modelValue",a.value),class:e.normalizeClass(["px-2.5 py-1 text-base font-medium rounded-full transition-all duration-150 cursor-pointer whitespace-nowrap",n.modelValue===a.value?"bg-zinc-100 dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 border border-zinc-300 dark:border-zinc-600":"text-zinc-400 dark:text-zinc-500 hover:text-zinc-600 dark:hover:text-zinc-300 border border-transparent"])},e.toDisplayString(a.label),11,t0))),128))]))}}),c0={class:"wpic-form-label block mb-1 font-medium text-zinc-600 dark:text-zinc-400"},a0={key:0,class:"ml-0.5",style:{color:"#EF4444"}},z2=e.defineComponent({__name:"WFormLabel",props:{required:{type:Boolean}},setup(n){return(u,t)=>(e.openBlock(),e.createElementBlock("label",c0,[e.renderSlot(u.$slots,"default"),n.required?(e.openBlock(),e.createElementBlock("span",a0,"*")):e.createCommentVNode("",!0)]))}}),o0={class:"relative flex items-center w-full"},r0={key:1,class:"pointer-events-none absolute left-2.5 text-zinc-400 dark:text-zinc-500"},i0=["type","placeholder","disabled","required"],s0={key:2,class:"pointer-events-none absolute right-2.5 text-zinc-400 dark:text-zinc-500"},l2=e.defineComponent({inheritAttrs:!1,__name:"WInput",props:e.mergeModels({icon:{type:[Object,Function]},label:{},placeholder:{},required:{type:Boolean},type:{},disabled:{type:Boolean},size:{},clearable:{type:Boolean},loading:{type:Boolean},variant:{},prepend:{},append:{}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const u=e.useModel(n,"modelValue"),t=n,a=e.useSlots(),s=e.computed(()=>t.prepend!==void 0||!!a.prepend),l=e.computed(()=>t.append!==void 0||!!a.append),r=e.computed(()=>{if(t.icon)return t.icon;if(t.type==="date")return C.Calendar;if(t.type==="money")return C.DollarSign}),f=e.computed(()=>({sm:12,md:13,lg:14,xl:16})[t.size??"md"]),p=e.computed(()=>t.type==="money"?"number":t.type??"text"),h=e.ref();function c(){t.type==="date"&&h.value?.showPicker()}if(typeof document<"u"){const N="winput-date-no-picker";if(!document.getElementById(N)){const V=document.createElement("style");V.id=N,V.textContent='input[type="date"]::-webkit-calendar-picker-indicator { display: none; }',document.head.appendChild(V)}const B="winput-number-no-spinner";if(!document.getElementById(B)){const V=document.createElement("style");V.id=B,V.textContent="input.winput-number::-webkit-outer-spin-button, input.winput-number::-webkit-inner-spin-button { display: none; } input.winput-number { -moz-appearance: textfield; }",document.head.appendChild(V)}}return(N,B)=>(e.openBlock(),e.createElementBlock("div",e.mergeProps(N.$attrs,{class:"w-full"}),[t.label?(e.openBlock(),e.createBlock(z2,{key:0,required:t.required},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.label),1)]),_:1},8,["required"])):e.createCommentVNode("",!0),e.createElementVNode("div",o0,[r.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.value),{key:0,size:f.value,class:e.normalizeClass(["absolute shrink-0 text-zinc-400 dark:text-zinc-500",[t.size==="xl"?"left-4":"left-2.5",t.type==="date"?"cursor-pointer":"pointer-events-none"]]),onClick:c},null,8,["size","class"])):s.value?(e.openBlock(),e.createElementBlock("span",r0,[e.renderSlot(N.$slots,"prepend",{},()=>[e.createTextVNode(e.toDisplayString(t.prepend),1)])])):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",{ref_key:"inputRef",ref:h,"onUpdate:modelValue":B[0]||(B[0]=V=>u.value=V),type:p.value,placeholder:t.placeholder??"",disabled:t.disabled,required:t.required,class:e.normalizeClass(["w-full rounded-lg outline-none transition-colors",t.size==="sm"?"text-sm":"text-base",p.value==="number"?"winput-number":"",t.size==="sm"?"h-8":t.size==="lg"?"h-11":t.size==="xl"?"h-14":"h-9",r.value||s.value?t.size==="xl"?"pl-11":"pl-9":t.size==="xl"?"pl-4":"pl-2.5",l.value&&(t.clearable&&u.value||t.loading)?"pr-14":l.value?"pr-9":t.clearable&&u.value||t.loading?t.size==="xl"?"pr-10":"pr-7":t.size==="xl"?"pr-4":"pr-2.5",t.disabled?(t.variant??"default")==="subtle"?"bg-zinc-100 dark:bg-zinc-800 border border-zinc-100 dark:border-zinc-800 text-zinc-400 dark:text-zinc-500 cursor-not-allowed opacity-60":"bg-zinc-50 dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-800 text-zinc-400 dark:text-zinc-500 cursor-not-allowed opacity-60":(t.variant??"default")==="subtle"?"bg-zinc-100 dark:bg-zinc-800 border border-zinc-100 dark:border-zinc-800 text-zinc-900 dark:text-zinc-100 placeholder:text-zinc-400 dark:placeholder:text-zinc-500 cursor-text hover:bg-zinc-200/70 dark:hover:bg-zinc-700":"bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-800 text-zinc-900 dark:text-zinc-100 placeholder:text-zinc-400 dark:placeholder:text-zinc-500 wpic-input-field cursor-text"])},null,10,i0),[[e.vModelDynamic,u.value]]),l.value?(e.openBlock(),e.createElementBlock("span",s0,[e.renderSlot(N.$slots,"append",{},()=>[e.createTextVNode(e.toDisplayString(t.append),1)])])):e.createCommentVNode("",!0),t.loading?(e.openBlock(),e.createBlock(e.unref(C.Loader2),{key:3,size:t.size==="xl"?14:11,class:e.normalizeClass(["absolute animate-spin text-zinc-400 dark:text-zinc-500",l.value?"right-8":t.size==="xl"?"right-4":"right-2"])},null,8,["size","class"])):t.clearable&&u.value?(e.openBlock(),e.createElementBlock("button",{key:4,type:"button",onClick:B[1]||(B[1]=V=>u.value=""),class:e.normalizeClass(["absolute flex items-center justify-center text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-300 transition-colors cursor-pointer",l.value?"right-8":t.size==="xl"?"right-4":"right-2"])},[e.createVNode(e.unref(C.X),{size:t.size==="xl"?14:11},null,8,["size"])],2)):e.createCommentVNode("",!0)])],16))}}),d0=["disabled"],n2=e.defineComponent({__name:"WCheckbox",props:e.mergeModels({disabled:{type:Boolean}},{modelValue:{type:Boolean},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const u=e.useModel(n,"modelValue");return(t,a)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["wpic-checkbox relative inline-flex items-center gap-2 select-none",n.disabled?"cursor-not-allowed opacity-50":"cursor-pointer"])},[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":a[0]||(a[0]=s=>u.value=s),disabled:n.disabled,class:"peer sr-only"},null,8,d0),[[e.vModelCheckbox,u.value]]),e.createElementVNode("span",{class:e.normalizeClass(["flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px] border transition-all duration-150","peer-focus-visible:ring-2 peer-focus-visible:ring-zinc-400/40 peer-focus-visible:ring-offset-1 peer-focus-visible:ring-offset-white dark:peer-focus-visible:ring-offset-zinc-950",u.value?"border-zinc-900 bg-zinc-900 text-white dark:border-zinc-100 dark:bg-zinc-100 dark:text-zinc-950":"border-zinc-300 bg-white text-transparent shadow-sm hover:border-zinc-400 dark:border-zinc-700 dark:bg-zinc-900 dark:hover:border-zinc-500"])},[e.createVNode(e.unref(C.Check),{size:11,"stroke-width":"2.6"})],2),e.renderSlot(t.$slots,"default")],2))}}),K1=e.defineComponent({__name:"WSpinner",props:{size:{default:"md"},tone:{default:"muted"}},setup(n){const u=n,t={sm:"h-4 w-4 border-2",md:"h-5 w-5 border-2",lg:"h-7 w-7 border-[3px]"};return(a,s)=>(e.openBlock(),e.createElementBlock("span",{role:"status","aria-live":"polite","aria-label":"Loading",class:e.normalizeClass(["wpic-spinner","inline-block shrink-0 animate-spin rounded-full border-current border-t-transparent",t[u.size],u.tone==="muted"?"text-zinc-300 dark:text-zinc-700":"text-[var(--wpic-primary,#6366f1)]"])},null,2))}}),u0={class:"wpic-table"},m0={key:0,class:"text-zinc-400 dark:text-zinc-500 whitespace-nowrap shrink-0"},h0={key:1,class:"flex items-center justify-center py-20 gap-3 text-zinc-400 dark:text-zinc-500"},p0={style:{"overflow-x":"auto"}},v0={class:"w-full border-collapse"},f0={key:0,style:{width:"36px"}},C0={key:1,style:{width:"32px"}},z0={key:0},g0={class:"border-b border-zinc-100 dark:border-zinc-800"},k0=["onClick"],b0={key:1},y0={key:0,class:"border-b border-zinc-200 bg-zinc-50 font-medium dark:border-zinc-700 dark:bg-zinc-800/60"},x0={key:0},w0={key:1},M0=["onClick"],B0=["onClick"],V0={key:0,class:"border-b border-zinc-100 dark:border-zinc-800"},E0=["colspan"],N0={key:2},S0=["colspan"],L0={class:"flex flex-col items-center gap-2"},D0={class:"tabular-nums text-zinc-400 dark:text-zinc-500"},F0={key:0,class:"flex items-center gap-0.5"},$0=["disabled"],T0={key:0,class:"w-6 text-center text-base select-none text-zinc-400 dark:text-zinc-500"},A0=["onClick"],H0=["disabled"],P0=e.defineComponent({__name:"WTable",props:{data:{},columns:{},loading:{type:Boolean},emptyText:{},pageSize:{},serverTotal:{},serverPage:{},searchPlaceholder:{default:"Search…"},rowClickable:{type:Boolean,default:!1},showHeader:{type:Boolean,default:!0},expandable:{type:Boolean,default:!1},selectable:{type:Boolean,default:!1},selectedKeys:{},rowKey:{default:"id"},flushEdges:{type:Boolean,default:!1},rowClass:{},rowStyle:{},summaryRow:{},compact:{type:Boolean},showFooter:{type:Boolean,default:!0}},emits:["row-click","update:selectedKeys","row-select","update:serverPage"],setup(n,{expose:u,emit:t}){const a=n,s=t,l=e.ref(new Set);function r(M){l.value.has(M)?l.value.delete(M):l.value.add(M)}const f=e.useSlots(),p=e.computed(()=>a.pageSize??25),h=e.ref(null),c=e.ref("asc");function N(M){h.value===M?c.value=c.value==="asc"?"desc":"asc":(h.value=M,c.value="asc")}const B=e.ref(""),V=e.computed(()=>a.columns.some(M=>M.searchable)),b=e.computed(()=>{let M=a.data??[];const Q=B.value.trim().toLowerCase();if(Q){const $=a.columns.filter(k=>k.searchable).map(k=>k.field);M=M.filter(k=>$.some(T=>String(k[T]??"").toLowerCase().includes(Q)))}if(h.value){const $=h.value;M=[...M].sort((k,T)=>{const U=k[$]??"",a1=T[$]??"",r1=typeof U=="number"&&typeof a1=="number"?U-a1:String(U).toLowerCase().localeCompare(String(a1).toLowerCase());return c.value==="asc"?r1:-r1})}return M}),E=e.ref(1),v=e.computed(()=>a.serverTotal!==void 0),P=e.computed({get:()=>v.value?a.serverPage??1:E.value,set:M=>{v.value?s("update:serverPage",M):E.value=M}}),Z=e.computed(()=>v.value?a.serverTotal??0:b.value.length),n1=e.computed(()=>Math.max(1,Math.ceil(Z.value/p.value)));e.watch([B,()=>a.data],()=>{v.value||(P.value=1),l.value.clear()});const L=e.computed(()=>{if(v.value)return b.value;const M=(P.value-1)*p.value;return b.value.slice(M,M+p.value)});function D(M,Q){const $=M[a.rowKey];return typeof $=="string"||typeof $=="number"?$:`${P.value}:${Q}`}const g=e.computed(()=>new Set(a.selectedKeys??[])),x=e.computed(()=>L.value.map(D)),X=e.computed(()=>a.selectable&&x.value.length>0&&x.value.every(M=>g.value.has(M)));function I(M,Q,$){const k=D(M,Q),T=new Set(a.selectedKeys??[]),U=$===!0;U?T.add(k):T.delete(k),s("update:selectedKeys",[...T]),s("row-select",M,U)}function K(M){const Q=new Set(a.selectedKeys??[]),$=M===!0;for(const k of x.value)$?Q.add(k):Q.delete(k);s("update:selectedKeys",[...Q])}const q=e.computed(()=>Z.value===0?0:(P.value-1)*p.value+1),o1=e.computed(()=>Math.min(P.value*p.value,Z.value)),s1=e.computed(()=>{const M=n1.value;if(M<=7)return Array.from({length:M},(U,a1)=>a1+1);const Q=P.value,$=[],k=new Set([1,M,Q-1,Q,Q+1].filter(U=>U>=1&&U<=M));let T=0;for(const U of[...k].sort((a1,r1)=>a1-r1))U-T>1&&$.push("…"),$.push(U),T=U;return $}),d1=M=>M==="right"?"text-right":M==="center"?"text-center":"text-left",W=(M,Q)=>[Q,a.flushEdges&&M===0&&!a.expandable&&!a.selectable?"pl-0":"pl-3",a.flushEdges&&M===a.columns.length-1?"pr-0":"pr-3"],O=M=>({...M.width?{width:M.width}:{},...M.minWidth?{minWidth:M.minWidth}:{}});return u({filteredCount:e.computed(()=>b.value.length),searchQuery:B}),(M,Q)=>(e.openBlock(),e.createElementBlock("div",u0,[(V.value||e.unref(f).toolbar)&&!n.loading?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["flex items-center gap-2 px-3 border-b border-zinc-100 dark:border-zinc-800",n.compact?"py-1":"py-2"])},[V.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(l2,{modelValue:B.value,"onUpdate:modelValue":Q[0]||(Q[0]=$=>B.value=$),placeholder:n.searchPlaceholder,icon:e.unref(C.Search),class:"flex-1"},null,8,["modelValue","placeholder","icon"]),B.value?(e.openBlock(),e.createElementBlock("span",m0,e.toDisplayString(b.value.length)+" results ",1)):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0),e.renderSlot(M.$slots,"toolbar")],2)):e.createCommentVNode("",!0),n.loading?(e.openBlock(),e.createElementBlock("div",h0,[e.createVNode(K1,{tone:"muted"}),Q[5]||(Q[5]=e.createElementVNode("span",{class:""},"Loading…",-1))])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createElementVNode("div",p0,[e.createElementVNode("table",v0,[e.createElementVNode("colgroup",null,[n.selectable?(e.openBlock(),e.createElementBlock("col",f0)):e.createCommentVNode("",!0),n.expandable?(e.openBlock(),e.createElementBlock("col",C0)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.columns,$=>(e.openBlock(),e.createElementBlock("col",{key:$.field,style:e.normalizeStyle(O($))},null,4))),128))]),a.showHeader!==!1?(e.openBlock(),e.createElementBlock("thead",z0,[e.createElementVNode("tr",g0,[n.selectable?(e.openBlock(),e.createElementBlock("th",{key:0,class:e.normalizeClass(["w-9 pr-2",n.compact?"py-1":"py-2",n.flushEdges?"pl-0":"pl-2"])},[e.createVNode(n2,{"model-value":X.value,onClick:Q[1]||(Q[1]=e.withModifiers(()=>{},["stop"])),"onUpdate:modelValue":K},null,8,["model-value"])],2)):e.createCommentVNode("",!0),n.expandable?(e.openBlock(),e.createElementBlock("th",{key:1,class:e.normalizeClass(["w-8 pr-2",n.compact?"py-1":"py-2",n.flushEdges&&!n.selectable?"pl-0":"pl-2"])},null,2)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.columns,($,k)=>(e.openBlock(),e.createElementBlock("th",{key:$.field,class:e.normalizeClass([W(k,n.compact?"py-1":"py-2"),"whitespace-nowrap text-zinc-500 dark:text-zinc-300 font-medium",d1($.align),k===0&&!n.expandable&&!n.selectable?"sticky left-0 z-10":""]),style:e.normalizeStyle({...O($)})},[e.renderSlot(M.$slots,"th-"+$.field,{col:$,sortField:h.value,sortDir:c.value,toggleSort:N},()=>[$.sortable?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:T=>N($.field),class:e.normalizeClass(["inline-flex items-center gap-1 cursor-pointer transition-colors whitespace-nowrap",$.align==="right"?"ml-auto":""]),style:{color:"inherit"}},[e.createTextVNode(e.toDisplayString($.label)+" ",1),h.value===$.field&&c.value==="asc"?(e.openBlock(),e.createBlock(e.unref(C.ChevronUp),{key:0,size:11,style:{color:"#5E6AD2"}})):h.value===$.field&&c.value==="desc"?(e.openBlock(),e.createBlock(e.unref(C.ChevronDown),{key:1,size:11,style:{color:"#5E6AD2"}})):(e.openBlock(),e.createBlock(e.unref(C.ChevronsUpDown),{key:2,size:10,style:{opacity:"0.3"}}))],10,k0)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString($.label),1)],64))])],6))),128))])])):e.createCommentVNode("",!0),n.loading?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("tbody",b0,[n.summaryRow?(e.openBlock(),e.createElementBlock("tr",y0,[n.selectable?(e.openBlock(),e.createElementBlock("td",x0)):e.createCommentVNode("",!0),n.expandable?(e.openBlock(),e.createElementBlock("td",w0)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.columns,($,k)=>(e.openBlock(),e.createElementBlock("td",{key:$.field,class:e.normalizeClass([W(k,n.compact?"py-1":"py-2.5"),d1($.align),k===0?"sticky left-0 z-10 text-zinc-900 dark:text-zinc-100":"text-zinc-700 dark:text-zinc-200"]),style:e.normalizeStyle(k===0?{background:"inherit"}:{})},[e.renderSlot(M.$slots,"summary-"+$.field,{row:n.summaryRow,value:n.summaryRow[$.field]},()=>[e.createTextVNode(e.toDisplayString(n.summaryRow[$.field]??"—"),1)])],6))),128))])):e.createCommentVNode("",!0),L.value.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(L.value,($,k)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:k},[e.createElementVNode("tr",{class:e.normalizeClass(["group border-b border-zinc-100 dark:border-zinc-800 hover:bg-zinc-50 dark:hover:bg-zinc-800/50 transition-colors",[n.expandable&&l.value.has(k)?"border-b-0":"",n.rowClass?.($)]]),style:e.normalizeStyle({cursor:n.rowClickable||n.expandable?"pointer":"default",...n.rowStyle?.($)??{}}),onClick:T=>n.expandable?r(k):n.rowClickable&&s("row-click",$)},[n.selectable?(e.openBlock(),e.createElementBlock("td",{key:0,class:e.normalizeClass(["w-9 pr-2",n.compact?"py-1":"py-2.5",n.flushEdges?"pl-0":"pl-2"]),onClick:Q[2]||(Q[2]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(n2,{"model-value":g.value.has(D($,k)),"onUpdate:modelValue":T=>I($,k,T)},null,8,["model-value","onUpdate:modelValue"])],2)):e.createCommentVNode("",!0),n.expandable?(e.openBlock(),e.createElementBlock("td",{key:1,class:e.normalizeClass(["w-8 pr-1 text-zinc-400 dark:text-zinc-500",n.compact?"py-1":"py-2.5",n.flushEdges&&!n.selectable?"pl-0":"pl-3"])},[l.value.has(k)?(e.openBlock(),e.createBlock(e.unref(C.ChevronDown),{key:0,size:13,style:{transition:"transform .15s"}})):(e.openBlock(),e.createBlock(e.unref(C.ChevronRight),{key:1,size:13,style:{transition:"transform .15s"}}))],2)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.columns,(T,U)=>(e.openBlock(),e.createElementBlock("td",{key:T.field,class:e.normalizeClass([W(U,n.compact?"py-1":"py-2.5"),d1(T.align),U===0&&!n.expandable&&!n.selectable?"sticky left-0 text-zinc-900 dark:text-zinc-100 font-medium":"text-zinc-700 dark:text-zinc-200"]),style:e.normalizeStyle(U===0&&!n.expandable&&!n.selectable?{background:"inherit",zIndex:1}:{}),onClick:a1=>n.expandable?(n.rowClickable&&s("row-click",$),a1.stopPropagation()):void 0},[e.renderSlot(M.$slots,T.field,{row:$,value:$[T.field]},()=>[e.createTextVNode(e.toDisplayString($[T.field]??"—"),1)])],14,B0))),128))],14,M0),n.expandable&&l.value.has(k)?(e.openBlock(),e.createElementBlock("tr",V0,[e.createElementVNode("td",{colspan:n.columns.length+(n.expandable?1:0)+(n.selectable?1:0),class:"px-4 pb-3 pt-0"},[e.renderSlot(M.$slots,"expand",{row:$})],8,E0)])):e.createCommentVNode("",!0)],64))),128)):(e.openBlock(),e.createElementBlock("tr",N0,[e.createElementVNode("td",{colspan:n.columns.length+(n.expandable?1:0)+(n.selectable?1:0),class:"py-16 text-center text-zinc-400 dark:text-zinc-500"},[e.createElementVNode("div",L0,[e.renderSlot(M.$slots,"empty-icon"),e.createTextVNode(" "+e.toDisplayString(n.emptyText??"No data"),1)])],8,S0)]))]))])]),n.showFooter&&Z.value>0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["flex items-center justify-between px-4 border-t border-zinc-100 dark:border-zinc-800",n.compact?"py-1":"py-2.5"])},[e.createElementVNode("span",D0,[n1.value>1?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(q.value)+"–"+e.toDisplayString(o1.value)+" of "+e.toDisplayString(Z.value),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(Z.value)+" "+e.toDisplayString(Z.value===1?"item":"items"),1)],64))]),n1.value>1?(e.openBlock(),e.createElementBlock("div",F0,[e.createElementVNode("button",{onClick:Q[3]||(Q[3]=$=>P.value--),disabled:P.value===1,class:"h-7 w-7 flex items-center justify-center rounded-md transition-colors cursor-pointer disabled:opacity-30 hover:bg-zinc-50 dark:hover:bg-zinc-800/50 text-zinc-400"},[e.createVNode(e.unref(C.ChevronLeft),{size:13})],8,$0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s1.value,$=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:$},[$==="…"?(e.openBlock(),e.createElementBlock("span",T0,"…")):(e.openBlock(),e.createElementBlock("button",{key:1,onClick:k=>P.value=$,class:e.normalizeClass(["h-7 min-w-7 px-2 rounded-md text-sm font-medium transition-colors cursor-pointer",P.value===$?"":"text-zinc-700 dark:text-zinc-200 hover:bg-zinc-100 dark:hover:bg-zinc-700"]),style:e.normalizeStyle(P.value===$?"background:rgba(94,106,210,0.1);color:#5E6AD2":void 0)},e.toDisplayString($),15,A0))],64))),128)),e.createElementVNode("button",{onClick:Q[4]||(Q[4]=$=>P.value++),disabled:P.value===n1.value,class:"h-7 w-7 flex items-center justify-center rounded-md transition-colors cursor-pointer disabled:opacity-30 hover:bg-zinc-50 dark:hover:bg-zinc-800/50 text-zinc-400"},[e.createVNode(e.unref(C.ChevronRight),{size:13})],8,H0)])):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0)],64))]))}}),j0={class:"w-spreadsheet-frame__surface"},W0={key:0,class:"w-spreadsheet-frame__heading"},R0={key:1,class:"w-spreadsheet-frame__status"},I0=["title","aria-label"],Z0={key:1,class:"flex min-h-64 items-center justify-center gap-3 text-zinc-400 dark:text-zinc-500"},U0={key:0,class:"w-spreadsheet__row-axis-col"},K0={key:0},O0={key:0,class:"w-spreadsheet__corner"},Y0={key:0,class:"w-spreadsheet__axis"},q0=["colspan","title","tabindex","onClick","onKeydown","onPointerenter","onPointerdown"],Q0={key:0,class:"w-spreadsheet__editor"},J0=["type","value","min","placeholder","onInput"],X0=["onPointerdown"],G0=e.defineComponent({__name:"WSpreadsheet",props:{columns:{},rows:{},showAxes:{type:Boolean,default:!0},showColumnLetters:{type:Boolean,default:!0},showRowNumbers:{type:Boolean,default:!0},minWidth:{default:"960px"},maxHeight:{default:"68vh"},sortable:{type:Boolean},expandable:{type:Boolean},showExpandButton:{type:Boolean},actionsOnHover:{type:Boolean},downloadable:{type:Boolean},showDownloadButton:{type:Boolean},downloadFilename:{},fillHandle:{type:Boolean},expanded:{type:Boolean},downloadRequest:{},loading:{type:Boolean}},emits:["update:expanded","cell-change"],setup(n,{expose:u,emit:t}){const a=n,s=t,l=e.computed(()=>a.showAxes&&a.showColumnLetters),r=e.computed(()=>a.showAxes&&a.showRowNumbers),f=e.computed(()=>a.columns.some(w=>w.sticky)),p=e.ref(null),h=e.ref("asc"),c=e.ref(a.expanded??!1),N=e.ref(null),B=e.ref(null),V=e.ref(null),b=e.ref(null),E=e.ref(null);function v(){if(!a.downloadable)return;const w=S=>`"${String(S??"").replace(/"/g,'""')}"`,A=g.value.map(S=>a.columns.map(H=>w(L(S,H.key))).join(",")).join(`\r
2
- `),F=new Blob([`\uFEFF${A}`],{type:"text/csv;charset=utf-8"}),G=URL.createObjectURL(F),J=document.createElement("a");J.href=G,J.download=a.downloadFilename||"spreadsheet.csv",J.click(),URL.revokeObjectURL(G)}function P(w,A=!0){if(c.value===w)return;const F=performance.now();console.debug(`[WSpreadsheet] ${w?"expand":"minimize"} requested`),c.value=w,A&&s("update:expanded",w),requestAnimationFrame(()=>requestAnimationFrame(()=>{console.debug(`[WSpreadsheet] ${w?"expand":"minimize"} painted in ${(performance.now()-F).toFixed(1)}ms`)}))}e.watch(()=>a.expanded,w=>{w!=null&&P(w,!1)}),e.watch(()=>a.downloadRequest,(w,A)=>{w!=null&&w!==A&&v()}),u({expand:()=>{a.expandable&&P(!0)},collapse:()=>{P(!1)},toggleExpanded:()=>{a.expandable&&P(!c.value)},download:v});function Z(w){w.key==="Escape"&&c.value&&P(!1)}function n1(w){if(w.target?.closest(".w-spreadsheet__cell")?.querySelector(".w-spreadsheet__input"))return;b.value=null,E.value=null;const G=document.activeElement;G&&N.value?.contains(G)&&G.blur()}e.onMounted(()=>{document.addEventListener("keydown",Z),document.addEventListener("pointerdown",n1)}),e.onBeforeUnmount(()=>{document.removeEventListener("keydown",Z),document.removeEventListener("pointerdown",n1),window.removeEventListener("pointerup",T)});function L(w,A){return w.cells.find(F=>F.key===A)?.value??""}function D(w){if(typeof w=="number")return w;const A=String(w).trim().replace(/[\s,]/g,"");return A!==""&&/^-?\d+(\.\d+)?$/.test(A)?Number(A):String(w).toLocaleLowerCase()}const g=e.computed(()=>{if(!p.value)return a.rows;const w=a.rows.filter(G=>G.sortable!==!1),A=h.value==="asc"?1:-1;w.sort((G,J)=>{const S=D(L(G,p.value)),H=D(L(J,p.value));return typeof S=="number"&&typeof H=="number"?(S-H)*A:String(S).localeCompare(String(H),void 0,{numeric:!0})*A});let F=0;return a.rows.map(G=>G.sortable===!1?G:w[F++])});function x(w){const A=a.columns.find(F=>F.key===w.key);return!!(a.sortable&&w.variant==="header"&&A?.sortable!==!1)}function X(w){x(w)&&(p.value===w.key?h.value=h.value==="asc"?"desc":"asc":(p.value=w.key,h.value="asc"))}function I(w,A){return w.cells.slice(0,A).reduce((F,G)=>F+(G.colspan||1),0)}function K(w,A){return!!a.columns[I(w,A)]?.sticky}function q(w,A){const F=I(w,A);return!!(a.columns[F]?.sticky&&!a.columns.slice(0,F).some(G=>G.sticky))}function o1(w,A){const F=I(w,A);if(!a.columns[F]?.sticky)return;const G=a.columns.slice(0,F).map(J=>J.width||"0px");return{left:G.length?`calc(${G.join(" + ")})`:"0px"}}function s1(w,A){return`${w.key}\0${A.key}`}function d1(w,A){!A.editable||B.value||(b.value={rowKey:w.key,cellKey:A.key},E.value=null)}function W(w,A){return b.value?.rowKey===w.key&&b.value?.cellKey===A.key}function O(w,A,F){const G=g.value[w];!a.fillHandle||!F.editable||!G||!W(G,F)||(E.value=null,B.value={row:w,cell:A,value:String(F.value??"")},V.value={row:w,cell:A},window.addEventListener("pointerup",T,{once:!0}))}function M(w,A){B.value&&(V.value={row:w,cell:A})}function Q(w,A){if(!B.value||!V.value)return!1;const F=Math.min(B.value.row,V.value.row),G=Math.max(B.value.row,V.value.row),J=Math.min(B.value.cell,V.value.cell),S=Math.max(B.value.cell,V.value.cell);return w>=F&&w<=G&&A>=J&&A<=S}function $(w,A){if(!Q(w,A)||!B.value||!V.value)return{};const F=Math.min(B.value.row,V.value.row),G=Math.max(B.value.row,V.value.row),J=Math.min(B.value.cell,V.value.cell),S=Math.max(B.value.cell,V.value.cell);return{"w-spreadsheet__cell--fill-range":!0,"w-spreadsheet__cell--fill-top":w===F,"w-spreadsheet__cell--fill-bottom":w===G,"w-spreadsheet__cell--fill-left":A===J,"w-spreadsheet__cell--fill-right":A===S}}function k(w,A){const F=s1(w,A);return{"w-spreadsheet__cell--fill-completed":!!E.value?.cells.has(F),"w-spreadsheet__cell--fill-source":E.value?.source===F}}function T(){if(!B.value||!V.value)return;const w=B.value,A=V.value,F=Math.min(w.row,A.row),G=Math.max(w.row,A.row),J=Math.min(w.cell,A.cell),S=Math.max(w.cell,A.cell),H=new Set,j=g.value[w.row],t1=j?.cells[w.cell];for(let h1=F;h1<=G;h1++){const b1=g.value[h1];if(b1)for(let B1=J;B1<=S;B1++){const y1=b1.cells[B1];y1?.editable&&(H.add(s1(b1,y1)),s("cell-change",{rowKey:b1.key,cellKey:y1.key,value:w.value,row:b1,cell:y1}))}}B.value=null,V.value=null,E.value=j&&t1?{cells:H,source:s1(j,t1)}:null}function U(w){let A=w+1,F="";for(;A>0;)A-=1,F=String.fromCharCode(65+A%26)+F,A=Math.floor(A/26);return F}function a1(w){return[`w-spreadsheet__cell--${w.variant||"default"}`,`w-spreadsheet__cell--${w.align||"left"}`,`w-spreadsheet__cell--tone-${w.tone||"default"}`,{"w-spreadsheet__cell--wrap":!!w.wrap},w.class||""]}function r1(w,A,F){const G=F.target.value;s("cell-change",{rowKey:w.key,cellKey:A.key,value:G,row:w,cell:A})}function M1(w){const F=w.currentTarget.previousElementSibling;F?.focus(),F?.showPicker?.()}return(w,A)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"frameRef",ref:N,class:e.normalizeClass(["w-spreadsheet-frame",{"w-spreadsheet-frame--expanded":c.value}])},[c.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"w-spreadsheet-frame__backdrop","aria-label":"Restore spreadsheet",onClick:A[0]||(A[0]=F=>P(!1))})):e.createCommentVNode("",!0),e.createElementVNode("div",j0,[n.expandable&&(n.showExpandButton!==!1||c.value)||n.downloadable&&(n.showDownloadButton!==!1||c.value)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["w-spreadsheet-frame__toolbar",{"w-spreadsheet-frame__toolbar--hover":n.actionsOnHover&&!c.value}])},[c.value&&w.$slots["expanded-header"]?(e.openBlock(),e.createElementBlock("div",W0,[e.renderSlot(w.$slots,"expanded-header")])):e.createCommentVNode("",!0),w.$slots["toolbar-status"]?(e.openBlock(),e.createElementBlock("div",R0,[e.renderSlot(w.$slots,"toolbar-status")])):e.createCommentVNode("",!0),e.renderSlot(w.$slots,"toolbar"),n.downloadable&&(n.showDownloadButton!==!1||c.value)?(e.openBlock(),e.createElementBlock("button",{key:2,type:"button",class:"w-spreadsheet-frame__expand",title:"Download spreadsheet","aria-label":"Download spreadsheet",onClick:v},[e.createVNode(e.unref(C.Download),{size:16})])):e.createCommentVNode("",!0),n.expandable&&(n.showExpandButton!==!1||c.value)?(e.openBlock(),e.createElementBlock("button",{key:3,type:"button",class:"w-spreadsheet-frame__expand",title:c.value?"Restore spreadsheet":"Expand spreadsheet","aria-label":c.value?"Restore spreadsheet":"Expand spreadsheet",onClick:A[1]||(A[1]=F=>P(!c.value))},[c.value?(e.openBlock(),e.createBlock(e.unref(C.Minimize),{key:0,size:16})):(e.openBlock(),e.createBlock(e.unref(C.Expand),{key:1,size:16}))],8,I0)):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0),n.loading?(e.openBlock(),e.createElementBlock("div",Z0,[e.createVNode(K1),A[2]||(A[2]=e.createElementVNode("span",null,"Preparing sales estimate…",-1))])):(e.openBlock(),e.createElementBlock("div",{key:2,class:e.normalizeClass(["w-spreadsheet",{"w-spreadsheet--with-column-axis":l.value}]),style:e.normalizeStyle({maxHeight:c.value?"calc(100vh - 96px)":n.maxHeight})},[e.createElementVNode("table",{class:e.normalizeClass(["w-spreadsheet__table",{"w-spreadsheet__table--sticky-columns":f.value}]),style:e.normalizeStyle({minWidth:n.minWidth})},[e.createElementVNode("colgroup",null,[r.value?(e.openBlock(),e.createElementBlock("col",U0)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.columns,F=>(e.openBlock(),e.createElementBlock("col",{key:F.key,style:e.normalizeStyle({width:F.width})},null,4))),128))]),l.value?(e.openBlock(),e.createElementBlock("thead",K0,[e.createElementVNode("tr",null,[r.value?(e.openBlock(),e.createElementBlock("th",O0)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.columns,(F,G)=>(e.openBlock(),e.createElementBlock("th",{key:F.key,class:"w-spreadsheet__axis"},e.toDisplayString(F.label||U(G)),1))),128))])])):e.createCommentVNode("",!0),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.value,(F,G)=>(e.openBlock(),e.createElementBlock("tr",{key:F.key,class:e.normalizeClass({"w-spreadsheet__row--sticky":F.sticky})},[r.value?(e.openBlock(),e.createElementBlock("th",Y0,e.toDisplayString(G+1),1)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(F.cells,(J,S)=>(e.openBlock(),e.createElementBlock("td",{key:J.key,class:e.normalizeClass(["w-spreadsheet__cell",[a1(J),{"w-spreadsheet__cell--sortable":x(J),"w-spreadsheet__cell--sticky":K(F,S),"w-spreadsheet__cell--sticky-first":q(F,S),"w-spreadsheet__cell--active":W(F,J)},$(G,S),k(F,J)]]),colspan:J.colspan||1,title:J.title,style:e.normalizeStyle(o1(F,S)),tabindex:x(J)?0:void 0,onClick:H=>X(J),onKeydown:[e.withKeys(e.withModifiers(H=>X(J),["prevent"]),["enter"]),e.withKeys(e.withModifiers(H=>X(J),["prevent"]),["space"])],onPointerenter:H=>M(G,S),onPointerdown:H=>d1(F,J)},[e.renderSlot(w.$slots,`cell-${J.key}`,{row:F,cell:J,rowIndex:G},()=>[J.editable?(e.openBlock(),e.createElementBlock("div",Q0,[e.createElementVNode("input",{class:e.normalizeClass(["w-spreadsheet__input",{"w-spreadsheet__input--date":J.inputType==="date"}]),type:J.inputType||"text",value:J.value??"",min:J.min,placeholder:J.placeholder,onInput:H=>r1(F,J,H)},null,42,J0),J.inputType==="date"?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"w-spreadsheet__calendar","aria-label":"Choose date",title:"Choose date",onClick:M1},[e.createVNode(e.unref(C.CalendarDays),{size:16})])):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(J.value??""),1)],64))]),x(J)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(p.value===J.key?h.value==="asc"?e.unref(C.ChevronUp):e.unref(C.ChevronDown):e.unref(C.ChevronsUpDown)),{key:0,class:"w-spreadsheet__sort-icon",size:14})):e.createCommentVNode("",!0),n.fillHandle&&J.editable&&W(F,J)?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"w-spreadsheet__fill-handle","aria-label":"Fill adjacent cells",title:"Drag to fill adjacent cells",onPointerdown:e.withModifiers(H=>O(G,S,J),["stop","prevent"])},null,40,X0)):e.createCommentVNode("",!0)],46,q0))),128))],2))),128))])],6)],6))])],2))}}),k1=(n,u)=>{const t=n.__vccOpts||n;for(const[a,s]of u)t[a]=s;return t},_0={},e3={class:"min-w-40 rounded-lg bg-white p-1.5 shadow-md shadow-zinc-900/5 dark:bg-zinc-700 dark:shadow-black/20"};function n3(n,u){return e.openBlock(),e.createElementBlock("div",e3,[e.renderSlot(n.$slots,"default")])}const t2=k1(_0,[["render",n3]]),t3=["disabled"],F1=e.defineComponent({__name:"WActionMenuItem",props:{danger:{type:Boolean},disabled:{type:Boolean}},emits:["click"],setup(n,{emit:u}){const t=u;return(a,s)=>(e.openBlock(),e.createElementBlock("button",{type:"button",disabled:n.disabled,onClick:s[0]||(s[0]=l=>t("click",l)),class:e.normalizeClass(["flex h-8 w-full items-center gap-2 rounded-md px-2 text-left font-medium transition disabled:cursor-not-allowed disabled:opacity-40",n.danger?"text-red-500 hover:bg-red-50 dark:hover:bg-red-950/30":"text-zinc-600 hover:bg-zinc-100 hover:text-zinc-900 dark:text-zinc-100 dark:hover:bg-zinc-600 dark:hover:text-white"])},[e.renderSlot(a.$slots,"default")],10,t3))}}),$1=e.defineComponent({__name:"WPopover",props:{open:{type:Boolean},anchor:{},placement:{},width:{},minWidth:{},height:{},minHeight:{},maxHeight:{},panelScroll:{type:Boolean,default:!0},offset:{},matchAnchorWidth:{type:Boolean},freezePositionOnOpen:{type:Boolean,default:!0},flip:{type:Boolean,default:!0},zIndex:{default:9999},extraPanels:{}},emits:["close"],setup(n,{emit:u}){const t=n,a=u,s=Symbol.for("wpic-ui-popover-descendants"),l=e.inject(s,null),r=new Set;e.provide(s,{add(g){r.add(g),l?.add(g)},remove(g){r.delete(g),l?.remove(g)}});const f=e.computed(()=>{const g=t.anchor;return g?e.isRef(g)?g.value:g:null}),p=e.ref(null),h=e.ref(null),c=e.computed(()=>h.value??t.placement??"bottom-start"),N=e.computed(()=>{const g=[_.offset(t.offset??6)];return t.flip&&!h.value&&g.push(_.flip()),g.push(_.shift({padding:4})),g.push(_.size({padding:8,apply({availableHeight:x,rects:X,elements:I}){const K=Math.max(x-8,50),o1={maxHeight:t.maxHeight?`min(${t.maxHeight}, ${K}px)`:`${K}px`,overflowY:t.panelScroll?"auto":"hidden"};if(t.height&&(o1.height=`min(${t.height}, ${K}px)`),t.minHeight&&(o1.minHeight=`min(${t.minHeight}, ${K}px)`),t.matchAnchorWidth){const s1=`${X.reference.width}px`;o1.width=s1,o1.minWidth=s1}Object.assign(I.floating.style,o1)}})),g}),{floatingStyles:B,placement:V,update:b,isPositioned:E}=_.useFloating(f,p,{placement:c,strategy:"fixed",open:e.computed(()=>t.open),whileElementsMounted:_.autoUpdate,middleware:N}),v=e.computed(()=>{const g=V.value;return g.startsWith("top")?"bottom":g.startsWith("bottom")?"top":g.startsWith("left")?"right":g.startsWith("right")?"left":"top"}),P=g=>{const x=g.target,X=f.value,I=p.value;I&&I.contains(x)||[...r].some(K=>K.contains(x))||X&&X.contains(x)||t.extraPanels?.some(K=>K?.contains(x))||a("close")};let Z=!1;function n1(){Z||(document.addEventListener("pointerdown",P,!0),Z=!0)}function L(){Z&&(document.removeEventListener("pointerdown",P,!0),Z=!1)}e.watch(()=>t.open,g=>{g?e.nextTick(()=>{b(),n1()}):(h.value=null,L())}),e.watch(p,(g,x)=>{x&&l?.remove(x),g&&l?.add(g)}),e.watch(E,g=>{g&&t.open&&t.freezePositionOnOpen&&!h.value&&(h.value=V.value)}),e.onBeforeUnmount(()=>{L(),p.value&&l?.remove(p.value)});const D=e.computed(()=>({width:t.matchAnchorWidth?void 0:t.width??"auto",minWidth:t.minWidth,transformOrigin:v.value,zIndex:t.zIndex}));return(g,x)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body",class:"wpic-popover"},[e.withDirectives(e.createElementVNode("div",{ref_key:"floatingEl",ref:p,class:"flex flex-col bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-800 rounded-xl shadow-xl dark:shadow-black/40 overflow-hidden",style:e.normalizeStyle([e.unref(B),D.value])},[e.renderSlot(g.$slots,"default")],4),[[e.vShow,n.open]])]))}}),l3={key:0,class:"fixed right-0 top-0 z-[9997] flex h-full w-20 items-center justify-center border-l-2 border-[var(--wpic-primary)] bg-[var(--wpic-primary)]/10 text-[var(--wpic-primary)] pointer-events-none"},c3=["data-variant","data-maximized"],a3=["title"],o3={class:"min-w-0 flex-1 px-2 text-center"},r3={class:"truncate font-medium text-zinc-700 dark:text-zinc-200"},i3={key:0,class:"truncate text-zinc-500 dark:text-zinc-400"},s3={class:"flex shrink-0 items-center gap-1"},d3=["title"],u3=["title"],m3=["title"],h3=["title"],p3={class:"flex h-11 shrink-0 items-center justify-between px-3"},v3={class:"font-medium text-zinc-700 dark:text-zinc-200"},f3=["title"],C3={class:"space-y-2 px-3 pb-3"},z3={class:"truncate"},g3={class:"flex-1 overflow-y-auto overflow-x-visible px-2 pb-3"},k3={class:"mb-2 flex h-7 items-center justify-between px-2 font-medium text-zinc-500 dark:text-zinc-400"},b3={class:"truncate"},y3=["title"],x3={class:"space-y-0.5"},w3={key:0,class:"rounded-lg border border-dashed border-zinc-200 px-2 py-2 text-zinc-500 dark:border-zinc-700 dark:text-zinc-400"},M3=["onMouseenter"],B3=["onClick"],V3={class:"min-w-0 flex-1 truncate"},E3={key:0,class:"shrink-0 text-zinc-400"},N3={key:0,class:"px-3 py-2 text-zinc-400 dark:text-zinc-500"},S3=["onPointerdown","onClick"],L3={class:"min-w-0 flex-1 truncate"},D3={class:"shrink-0 text-zinc-400"},F3={class:"mt-4"},$3={class:"flex h-7 items-center px-2 font-medium text-zinc-500 dark:text-zinc-400"},T3={class:"truncate"},A3={class:"space-y-0.5"},H3={key:0,class:"rounded-lg border border-dashed border-zinc-200 px-2 py-2 text-zinc-500 dark:border-zinc-700 dark:text-zinc-400"},P3=["onPointerdown","onClick"],j3={class:"block truncate"},W3={class:"shrink-0 text-zinc-400"},R3=["onClick"],I3=["onPointerenter","onMouseenter"],Z3={class:"truncate"},U3={class:"flex min-h-0 flex-1"},K3={class:"flex min-w-0 flex-1 flex-col"},O3={key:0,class:"flex h-full flex-col items-center justify-center px-5 text-center text-zinc-500 dark:text-zinc-400"},Y3={class:"font-medium"},q3={key:1,class:"flex h-full flex-col items-center justify-center px-5 text-center"},Q3={class:"mb-3 flex h-11 w-11 items-center justify-center rounded-xl bg-zinc-100 text-zinc-500 dark:bg-zinc-700 dark:text-zinc-300"},J3={class:"font-semibold text-zinc-800 dark:text-zinc-100"},X3={key:0,class:"mt-1 max-w-xs text-zinc-500 dark:text-zinc-400"},G3={key:2,class:"space-y-4"},_3={class:"max-w-[82%]"},e4=["src","alt"],n4={class:"max-w-40 truncate"},t4={key:0,class:"shrink-0 text-zinc-400"},l4={key:0,class:"flex items-center gap-2 text-zinc-500 dark:text-zinc-400"},c4={key:1,class:"wpic-chat-loading-card",role:"status","aria-label":"Generating image"},a4=["innerHTML","onClick"],o4=["href","onClick"],r4=["src"],i4=["title","aria-label","onClick"],s4=["title","aria-label","onClick"],d4=["title","onClick"],u4=["onClick"],m4=["title","onClick"],h4={key:0,class:"mb-2 flex flex-wrap justify-end gap-1.5"},p4=["src","alt"],v4={class:"max-w-40 truncate"},f4={key:0,class:"shrink-0 text-zinc-400"},C4={key:1,class:"shrink-0 text-zinc-400"},z4=["title","onClick"],g4={class:"wpic-chat-panel__composer rounded-xl border border-zinc-200 bg-zinc-50 transition-colors focus-within:border-[var(--wpic-primary)]/50 dark:border-zinc-700 dark:bg-zinc-700"},k4={key:0,class:"mx-2 mt-2 overflow-hidden rounded-lg bg-white shadow-sm ring-1 ring-zinc-200 dark:bg-zinc-800 dark:ring-zinc-600"},b4=["onMousedown"],y4={class:"min-w-0 truncate font-medium text-zinc-900 dark:text-zinc-100"},x4={key:0,class:"max-w-32 shrink-0 truncate text-xs text-zinc-500 dark:text-zinc-400"},w4=["accept"],M4=["value","placeholder","disabled"],B4={class:"flex items-center justify-between px-2 pb-2"},V4=["disabled","title"],E4=["title"],N4=["disabled","title"],C2=80,S4=e.defineComponent({__name:"WChatPanel",props:{open:{type:Boolean},messages:{},mentionItems:{default:()=>[]},projects:{default:()=>[]},sessions:{default:()=>[]},modelValue:{default:""},title:{default:"Chat"},subtitle:{default:""},selectedProjectId:{default:null},selectedSessionId:{default:null},placeholder:{default:"Ask anything..."},emptyTitle:{default:"How can I help?"},emptyDescription:{default:""},noProjectsLabel:{default:"No projects yet"},noConversationsLabel:{default:"No conversations yet"},allLabel:{default:"All"},recentLabel:{default:"Recent"},projectsLabel:{default:"Projects"},conversationsLabel:{default:"Conversations"},sendLabel:{default:"Send"},newLabel:{default:"New chat"},newProjectLabel:{default:"New project"},newConversationLabel:{default:"New conversation"},renameProjectLabel:{default:"Rename project"},renameConversationLabel:{default:"Rename conversation"},deleteProjectLabel:{default:"Delete project"},deleteConversationLabel:{default:"Delete conversation"},clearLabel:{default:"Clear"},copyLabel:{default:"Copy"},copiedLabel:{default:"Copied"},newChatFromMessageLabel:{default:"Start new chat from this message"},attachFilesLabel:{default:"Attach files"},removeAttachmentLabel:{default:"Remove attachment"},stopLabel:{default:"Stop"},applyPromptLabel:{default:"Apply prompt"},applyAllLabel:{default:"Apply all"},applySettingLabel:{default:"Apply setting"},thinkingLabel:{default:"Thinking..."},dockLabel:{default:"Dock"},undockLabel:{default:"Undock"},closeLabel:{default:"Close"},helpfulLabel:{default:"Helpful"},notHelpfulLabel:{default:"Not helpful"},attachments:{default:()=>[]},accept:{default:""},customAttachmentPicker:{type:Boolean,default:!1},showNavigator:{type:Boolean,default:!0},hideNewConversation:{type:Boolean,default:!1},hideClear:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},cancellable:{type:Boolean,default:!1},docked:{type:Boolean,default:!1},maximized:{type:Boolean,default:!1},maximizedMargin:{default:20},width:{default:420},height:{default:560},x:{default:-1},y:{default:-1},topOffset:{default:0},minWidth:{default:340},minHeight:{default:400},zIndex:{default:80},variant:{default:"default"}},emits:["close","send","clear","new","new-project","new-conversation","select-project","select-session","rename-project","rename-session","delete-project","delete-session","move-session","edit-message","new-chat-from-message","message-feedback","apply-message-proposal","navigate","cancel","attach","files-selected","remove-attachment","update:modelValue","update:docked","update:maximized","update:width","update:height","update:x","update:y"],setup(n,{emit:u}){const t=n,a=u,s=e.useSlots(),l=e.ref(null),r=e.ref(null),f=e.ref(null),p=e.ref(null),h=e.ref(null),c=e.ref(null),N=e.ref(0),B=e.ref(0),V=e.ref(!1),b=e.ref(null),E=e.ref(null);let v=null;const P=e.ref(!1),Z=e.ref(!1),n1=e.ref(!1);e.ref(new Set);const L=e.ref(null),D=e.ref(null),g=e.ref({}),x=e.ref(null);let X=null,I=null;function K(){I?.disconnect(),I=null;const o=r.value,i=h.value;if(!o||!i||typeof ResizeObserver>"u")return;const d=()=>i.style.setProperty("--wpic-chat-footer-height",`${o.getBoundingClientRect().height}px`);d(),I=new ResizeObserver(d),I.observe(o)}const q=e.computed(()=>x.value?[]:t.messages.filter(o=>o.role!=="system")),o1=e.computed(()=>t.loading||x.value!==null),s1=e.computed(()=>t.modelValue.trim().length>0&&!t.loading),d1=e.computed(()=>t.attachments.length>0),W=e.computed(()=>{const o=t.modelValue.slice(0,B.value),i=o.match(/(?:^|\s)@([^\s@]*)$/);return i?{start:o.length-i[0].length+(i[0].startsWith(" ")?1:0),query:i[1].toLowerCase()}:null}),O=e.computed(()=>{const o=W.value;if(!o)return[];const i=o.query;return t.mentionItems.filter(d=>d.label.toLowerCase().includes(i)).slice(0,6)}),M=e.computed(()=>t.showNavigator&&V.value),Q=e.computed(()=>t.selectedProjectId??null),$=e.computed(()=>t.sessions.filter(o=>!o.projectId)),k=e.computed(()=>{const o=new Map;for(const i of t.projects)o.set(i.id,[]);for(const i of t.sessions){if(!i.projectId)continue;const d=o.get(i.projectId);d&&d.push(i)}return o});function T(o){const i=o.toLowerCase();if(i.includes("doubao-seedance-1-5-pro-251215")||i.includes("doubao seedance 1.5")||i.includes("seedance 1.5")||i.includes("seedance video"))return"jimeng:doubao-seedance-1-5-pro-251215";if(i.includes("imagen 4")||i.includes("imagen-4"))return"google:imagen-4.0-generate-001";if(i.includes("gpt-image-1")||i.includes("gpt image 1"))return"openai:gpt-image-1";if(i.includes("gpt-image-2")||i.includes("gpt image 2"))return"openai:gpt-image-2";if(i.includes("doubao-seedream-4-5-251128"))return"jimeng:doubao-seedream-4-5-251128";if(i.includes("doubao-seedream-4-0-250828"))return"jimeng:doubao-seedream-4-0-250828";if(i.includes("doubao seedream 5")||i.includes("seedream 5")||i.includes("doubao seedream 4.5")||i.includes("seedream 4.5"))return"jimeng:doubao-seedream-4-5-251128";if(i.includes("doubao seedream 4")||i.includes("seedream 4"))return"jimeng:doubao-seedream-4-0-250828";if(i.includes("auto"))return"auto";const d=o.match(/\b([a-z][a-z0-9_-]+):([a-z0-9._-]+)\b/i);if(d)return`${d[1].toLowerCase()}:${d[2]}`}function U(o){if(o!=="auto"){if(o.includes("seedance"))return"video";if(o.includes("gpt-image")||o.includes("imagen")||o.includes("seedream")||o.includes("jimeng:"))return"image"}}function a1(o){const i=[],d=new Set,z=/\b(gpt[-\s]?image[-\s]?[12]|imagen\s*4|doubao\s+seedance\s+1\.5(?:\s+pro)?|seedance\s+1\.5(?:\s+pro)?|doubao\s+seedream\s+(?:5(?:\.0)?|4\.5|4)|seedream\s+(?:5(?:\.0)?|4\.5|4)|[a-z][a-z0-9_-]+:[a-z0-9._-]+|auto)\b/gi;for(const m of o.matchAll(z)){const y=m[1],R=T(y);!R||d.has(R)||(d.add(R),i.push({label:y,value:R}))}return i}function r1(o,i){return o.match(new RegExp(`${i}=["']([^"']+)["']`,"i"))?.[1]}function M1(o){const i={};for(const z of o.matchAll(/\[SETTING\s+([^\]]+)\]([\s\S]*?)\[\/SETTING\]/gi)){const m=z[1]??"",y=r1(m,"key"),R=r1(m,"value")??z[2]?.trim();if(!(!y||!R))if(y==="duration"||y==="fps"||y==="count"){const Y=Number(R);Number.isFinite(Y)&&(i[y]=Y)}else if(y==="model"){const Y=T(R)??T(z[2]?.trim()??"");Y&&(i.model=Y)}else(y==="aspect"||y==="resolution"||y==="format")&&(i[y]=R)}const d=o.split(/\r?\n/).map(z=>z.replace(/^[\s>*-]+/,"").trim()).filter(Boolean);for(const z of d){const m=z.toLowerCase();if(/(supporte|supports?|disponible|available|dur[eé]es?\s*:|ratios?\s*:|jusqu['’]?à|up to)/i.test(m))continue;const y=z.split(":").slice(1).join(":").trim()||z,R=y.match(/\b(\d{1,2}:\d{1,2})\b/);(m.includes("format")||m.includes("aspect")||m.includes("ratio"))&&R&&(i.aspect=R[1]);const Y=y.match(/\b([1248]K)\b/i);(m.includes("résolution")||m.includes("resolution"))&&Y&&(i.resolution=Y[1].toUpperCase());const e1=y.match(/\b(\d{1,3})\s*(?:s|sec|secondes?|seconds?)\b/i);(m.includes("durée")||m.includes("duration"))&&e1&&(i.duration=Number(e1[1]));const l1=y.match(/\b(\d{1,3})\s*fps\b/i);m.includes("fps")&&l1&&(i.fps=Number(l1[1]));const c1=y.match(/\b(\d{1,2})\b/);if((m.includes("count")||m.includes("nombre")||m.includes("variantes"))&&c1&&(i.count=Number(c1[1])),m.includes("modèle")||m.includes("modele")||m.includes("model")){const p1=T(y);p1&&(i.model=p1)}m.includes("jpg")||m.includes("jpeg")?i.format="jpg":m.includes("png")?i.format="png":m.includes("webp")&&(i.format="webp")}return Object.keys(i).length?i:void 0}function w(o){const i=o.match(/\[TASK(?:\s+([^\]]+))?\](?:([\s\S]*?)\[\/TASK\])?/i);if(i){const z=(r1(i[1]??"","value")??i[2]?.trim())?.toLowerCase();if(["image","video","audio","text"].includes(String(z)))return z}const d=o.split(/\r?\n/).map(z=>z.replace(/^[\s>*-]+/,"").trim()).filter(Boolean);for(const z of d){const m=z.toLowerCase(),y=z.split(":").slice(1).join(":").trim().toLowerCase()||m;if(/(task|type|mode|surface|format|réglage|reglage|setting)/i.test(m)){if(/\baudio\b|subtitles?|sous-titres?|transcri|tts|voice|voix/.test(y))return"audio";if(/\bvid[eé]o\b|\bvideo\b|\bfps\b|duration|dur[eé]e/.test(y))return"video";if(/\bimage\b|photo|visuel|illustration|aspect|ratio|resolution|résolution/.test(y))return"image";if(/\btext\b|texte|copy|caption|script/.test(y))return"text"}}}function A(o){const i=o.match(/\[PROMPT\]([\s\S]*?)\[\/PROMPT\]/i)?.[1];if(i){const e1=B1(i).trim().replace(/^["“]|["”]$/g,"");if(e1)return e1}const d=o.replace(/\r\n/g,`
2
+ `),F=new Blob([`\uFEFF${A}`],{type:"text/csv;charset=utf-8"}),G=URL.createObjectURL(F),J=document.createElement("a");J.href=G,J.download=a.downloadFilename||"spreadsheet.csv",J.click(),URL.revokeObjectURL(G)}function P(w,A=!0){if(c.value===w)return;const F=performance.now();console.debug(`[WSpreadsheet] ${w?"expand":"minimize"} requested`),c.value=w,A&&s("update:expanded",w),requestAnimationFrame(()=>requestAnimationFrame(()=>{console.debug(`[WSpreadsheet] ${w?"expand":"minimize"} painted in ${(performance.now()-F).toFixed(1)}ms`)}))}e.watch(()=>a.expanded,w=>{w!=null&&P(w,!1)}),e.watch(()=>a.downloadRequest,(w,A)=>{w!=null&&w!==A&&v()}),u({expand:()=>{a.expandable&&P(!0)},collapse:()=>{P(!1)},toggleExpanded:()=>{a.expandable&&P(!c.value)},download:v});function Z(w){w.key==="Escape"&&c.value&&P(!1)}function n1(w){if(w.target?.closest(".w-spreadsheet__cell")?.querySelector(".w-spreadsheet__input"))return;b.value=null,E.value=null;const G=document.activeElement;G&&N.value?.contains(G)&&G.blur()}e.onMounted(()=>{document.addEventListener("keydown",Z),document.addEventListener("pointerdown",n1)}),e.onBeforeUnmount(()=>{document.removeEventListener("keydown",Z),document.removeEventListener("pointerdown",n1),window.removeEventListener("pointerup",T)});function L(w,A){return w.cells.find(F=>F.key===A)?.value??""}function D(w){if(typeof w=="number")return w;const A=String(w).trim().replace(/[\s,]/g,"");return A!==""&&/^-?\d+(\.\d+)?$/.test(A)?Number(A):String(w).toLocaleLowerCase()}const g=e.computed(()=>{if(!p.value)return a.rows;const w=a.rows.filter(G=>G.sortable!==!1),A=h.value==="asc"?1:-1;w.sort((G,J)=>{const S=D(L(G,p.value)),H=D(L(J,p.value));return typeof S=="number"&&typeof H=="number"?(S-H)*A:String(S).localeCompare(String(H),void 0,{numeric:!0})*A});let F=0;return a.rows.map(G=>G.sortable===!1?G:w[F++])});function x(w){const A=a.columns.find(F=>F.key===w.key);return!!(a.sortable&&w.variant==="header"&&A?.sortable!==!1)}function X(w){x(w)&&(p.value===w.key?h.value=h.value==="asc"?"desc":"asc":(p.value=w.key,h.value="asc"))}function I(w,A){return w.cells.slice(0,A).reduce((F,G)=>F+(G.colspan||1),0)}function K(w,A){return!!a.columns[I(w,A)]?.sticky}function q(w,A){const F=I(w,A);return!!(a.columns[F]?.sticky&&!a.columns.slice(0,F).some(G=>G.sticky))}function o1(w,A){const F=I(w,A);if(!a.columns[F]?.sticky)return;const G=a.columns.slice(0,F).map(J=>J.width||"0px");return{left:G.length?`calc(${G.join(" + ")})`:"0px"}}function s1(w,A){return`${w.key}\0${A.key}`}function d1(w,A){!A.editable||B.value||(b.value={rowKey:w.key,cellKey:A.key},E.value=null)}function W(w,A){return b.value?.rowKey===w.key&&b.value?.cellKey===A.key}function O(w,A,F){const G=g.value[w];!a.fillHandle||!F.editable||!G||!W(G,F)||(E.value=null,B.value={row:w,cell:A,value:String(F.value??"")},V.value={row:w,cell:A},window.addEventListener("pointerup",T,{once:!0}))}function M(w,A){B.value&&(V.value={row:w,cell:A})}function Q(w,A){if(!B.value||!V.value)return!1;const F=Math.min(B.value.row,V.value.row),G=Math.max(B.value.row,V.value.row),J=Math.min(B.value.cell,V.value.cell),S=Math.max(B.value.cell,V.value.cell);return w>=F&&w<=G&&A>=J&&A<=S}function $(w,A){if(!Q(w,A)||!B.value||!V.value)return{};const F=Math.min(B.value.row,V.value.row),G=Math.max(B.value.row,V.value.row),J=Math.min(B.value.cell,V.value.cell),S=Math.max(B.value.cell,V.value.cell);return{"w-spreadsheet__cell--fill-range":!0,"w-spreadsheet__cell--fill-top":w===F,"w-spreadsheet__cell--fill-bottom":w===G,"w-spreadsheet__cell--fill-left":A===J,"w-spreadsheet__cell--fill-right":A===S}}function k(w,A){const F=s1(w,A);return{"w-spreadsheet__cell--fill-completed":!!E.value?.cells.has(F),"w-spreadsheet__cell--fill-source":E.value?.source===F}}function T(){if(!B.value||!V.value)return;const w=B.value,A=V.value,F=Math.min(w.row,A.row),G=Math.max(w.row,A.row),J=Math.min(w.cell,A.cell),S=Math.max(w.cell,A.cell),H=new Set,j=g.value[w.row],t1=j?.cells[w.cell];for(let h1=F;h1<=G;h1++){const b1=g.value[h1];if(b1)for(let B1=J;B1<=S;B1++){const y1=b1.cells[B1];y1?.editable&&(H.add(s1(b1,y1)),s("cell-change",{rowKey:b1.key,cellKey:y1.key,value:w.value,row:b1,cell:y1}))}}B.value=null,V.value=null,E.value=j&&t1?{cells:H,source:s1(j,t1)}:null}function U(w){let A=w+1,F="";for(;A>0;)A-=1,F=String.fromCharCode(65+A%26)+F,A=Math.floor(A/26);return F}function a1(w){return[`w-spreadsheet__cell--${w.variant||"default"}`,`w-spreadsheet__cell--${w.align||"left"}`,`w-spreadsheet__cell--tone-${w.tone||"default"}`,{"w-spreadsheet__cell--wrap":!!w.wrap},w.class||""]}function r1(w,A,F){const G=F.target.value;s("cell-change",{rowKey:w.key,cellKey:A.key,value:G,row:w,cell:A})}function M1(w){const F=w.currentTarget.previousElementSibling;F?.focus(),F?.showPicker?.()}return(w,A)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"frameRef",ref:N,class:e.normalizeClass(["w-spreadsheet-frame",{"w-spreadsheet-frame--expanded":c.value}])},[c.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"w-spreadsheet-frame__backdrop","aria-label":"Restore spreadsheet",onClick:A[0]||(A[0]=F=>P(!1))})):e.createCommentVNode("",!0),e.createElementVNode("div",j0,[n.expandable&&(n.showExpandButton!==!1||c.value)||n.downloadable&&(n.showDownloadButton!==!1||c.value)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["w-spreadsheet-frame__toolbar",{"w-spreadsheet-frame__toolbar--hover":n.actionsOnHover&&!c.value}])},[c.value&&w.$slots["expanded-header"]?(e.openBlock(),e.createElementBlock("div",W0,[e.renderSlot(w.$slots,"expanded-header")])):e.createCommentVNode("",!0),w.$slots["toolbar-status"]?(e.openBlock(),e.createElementBlock("div",R0,[e.renderSlot(w.$slots,"toolbar-status")])):e.createCommentVNode("",!0),e.renderSlot(w.$slots,"toolbar"),n.downloadable&&(n.showDownloadButton!==!1||c.value)?(e.openBlock(),e.createElementBlock("button",{key:2,type:"button",class:"w-spreadsheet-frame__expand",title:"Download spreadsheet","aria-label":"Download spreadsheet",onClick:v},[e.createVNode(e.unref(C.Download),{size:16})])):e.createCommentVNode("",!0),n.expandable&&(n.showExpandButton!==!1||c.value)?(e.openBlock(),e.createElementBlock("button",{key:3,type:"button",class:"w-spreadsheet-frame__expand",title:c.value?"Restore spreadsheet":"Expand spreadsheet","aria-label":c.value?"Restore spreadsheet":"Expand spreadsheet",onClick:A[1]||(A[1]=F=>P(!c.value))},[c.value?(e.openBlock(),e.createBlock(e.unref(C.Minimize),{key:0,size:16})):(e.openBlock(),e.createBlock(e.unref(C.Expand),{key:1,size:16}))],8,I0)):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0),n.loading?(e.openBlock(),e.createElementBlock("div",Z0,[e.createVNode(K1),A[2]||(A[2]=e.createElementVNode("span",null,"Preparing sales estimate…",-1))])):(e.openBlock(),e.createElementBlock("div",{key:2,class:e.normalizeClass(["w-spreadsheet",{"w-spreadsheet--with-column-axis":l.value}]),style:e.normalizeStyle({maxHeight:c.value?"calc(100vh - 96px)":n.maxHeight})},[e.createElementVNode("table",{class:e.normalizeClass(["w-spreadsheet__table",{"w-spreadsheet__table--sticky-columns":f.value}]),style:e.normalizeStyle({minWidth:n.minWidth})},[e.createElementVNode("colgroup",null,[r.value?(e.openBlock(),e.createElementBlock("col",U0)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.columns,F=>(e.openBlock(),e.createElementBlock("col",{key:F.key,style:e.normalizeStyle({width:F.width})},null,4))),128))]),l.value?(e.openBlock(),e.createElementBlock("thead",K0,[e.createElementVNode("tr",null,[r.value?(e.openBlock(),e.createElementBlock("th",O0)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.columns,(F,G)=>(e.openBlock(),e.createElementBlock("th",{key:F.key,class:"w-spreadsheet__axis"},e.toDisplayString(F.label||U(G)),1))),128))])])):e.createCommentVNode("",!0),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.value,(F,G)=>(e.openBlock(),e.createElementBlock("tr",{key:F.key,class:e.normalizeClass({"w-spreadsheet__row--sticky":F.sticky})},[r.value?(e.openBlock(),e.createElementBlock("th",Y0,e.toDisplayString(G+1),1)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(F.cells,(J,S)=>(e.openBlock(),e.createElementBlock("td",{key:J.key,class:e.normalizeClass(["w-spreadsheet__cell",[a1(J),{"w-spreadsheet__cell--sortable":x(J),"w-spreadsheet__cell--sticky":K(F,S),"w-spreadsheet__cell--sticky-first":q(F,S),"w-spreadsheet__cell--active":W(F,J)},$(G,S),k(F,J)]]),colspan:J.colspan||1,title:J.title,style:e.normalizeStyle(o1(F,S)),tabindex:x(J)?0:void 0,onClick:H=>X(J),onKeydown:[e.withKeys(e.withModifiers(H=>X(J),["prevent"]),["enter"]),e.withKeys(e.withModifiers(H=>X(J),["prevent"]),["space"])],onPointerenter:H=>M(G,S),onPointerdown:H=>d1(F,J)},[e.renderSlot(w.$slots,`cell-${J.key}`,{row:F,cell:J,rowIndex:G},()=>[J.editable?(e.openBlock(),e.createElementBlock("div",Q0,[e.createElementVNode("input",{class:e.normalizeClass(["w-spreadsheet__input",{"w-spreadsheet__input--date":J.inputType==="date"}]),type:J.inputType||"text",value:J.value??"",min:J.min,placeholder:J.placeholder,onInput:H=>r1(F,J,H)},null,42,J0),J.inputType==="date"?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"w-spreadsheet__calendar","aria-label":"Choose date",title:"Choose date",onClick:M1},[e.createVNode(e.unref(C.CalendarDays),{size:16})])):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(J.value??""),1)],64))]),x(J)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(p.value===J.key?h.value==="asc"?e.unref(C.ChevronUp):e.unref(C.ChevronDown):e.unref(C.ChevronsUpDown)),{key:0,class:"w-spreadsheet__sort-icon",size:14})):e.createCommentVNode("",!0),n.fillHandle&&J.editable&&W(F,J)?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"w-spreadsheet__fill-handle","aria-label":"Fill adjacent cells",title:"Drag to fill adjacent cells",onPointerdown:e.withModifiers(H=>O(G,S,J),["stop","prevent"])},null,40,X0)):e.createCommentVNode("",!0)],46,q0))),128))],2))),128))])],6)],6))])],2))}}),k1=(n,u)=>{const t=n.__vccOpts||n;for(const[a,s]of u)t[a]=s;return t},_0={},e3={class:"min-w-40 rounded-lg bg-white p-1.5 shadow-md shadow-zinc-900/5 dark:bg-zinc-700 dark:shadow-black/20"};function n3(n,u){return e.openBlock(),e.createElementBlock("div",e3,[e.renderSlot(n.$slots,"default")])}const t2=k1(_0,[["render",n3]]),t3=["disabled"],F1=e.defineComponent({__name:"WActionMenuItem",props:{danger:{type:Boolean},disabled:{type:Boolean}},emits:["click"],setup(n,{emit:u}){const t=u;return(a,s)=>(e.openBlock(),e.createElementBlock("button",{type:"button",disabled:n.disabled,onClick:s[0]||(s[0]=l=>t("click",l)),class:e.normalizeClass(["flex h-8 w-full items-center gap-2 rounded-md px-2 text-left font-medium transition disabled:cursor-not-allowed disabled:opacity-40",n.danger?"text-red-500 hover:bg-red-50 dark:hover:bg-red-950/30":"text-zinc-600 hover:bg-zinc-100 hover:text-zinc-900 dark:text-zinc-100 dark:hover:bg-zinc-600 dark:hover:text-white"])},[e.renderSlot(a.$slots,"default")],10,t3))}}),$1=e.defineComponent({__name:"WPopover",props:{open:{type:Boolean},anchor:{},placement:{},width:{},minWidth:{},height:{},minHeight:{},maxHeight:{},panelScroll:{type:Boolean,default:!0},offset:{},matchAnchorWidth:{type:Boolean},freezePositionOnOpen:{type:Boolean,default:!0},flip:{type:Boolean,default:!0},zIndex:{default:9999},extraPanels:{}},emits:["close"],setup(n,{emit:u}){const t=n,a=u,s=Symbol.for("wpic-ui-popover-descendants"),l=e.inject(s,null),r=new Set;e.provide(s,{add(g){r.add(g),l?.add(g)},remove(g){r.delete(g),l?.remove(g)}});const f=e.computed(()=>{const g=t.anchor;return g?e.isRef(g)?g.value:g:null}),p=e.ref(null),h=e.ref(null),c=e.computed(()=>h.value??t.placement??"bottom-start"),N=e.computed(()=>{const g=[_.offset(t.offset??6)];return t.flip&&!h.value&&g.push(_.flip()),g.push(_.shift({padding:4})),g.push(_.size({padding:8,apply({availableHeight:x,rects:X,elements:I}){const K=Math.max(x-8,50),o1={maxHeight:t.maxHeight?`min(${t.maxHeight}, ${K}px)`:`${K}px`,overflowY:t.panelScroll?"auto":"hidden"};if(t.height&&(o1.height=`min(${t.height}, ${K}px)`),t.minHeight&&(o1.minHeight=`min(${t.minHeight}, ${K}px)`),t.matchAnchorWidth){const s1=`${X.reference.width}px`;o1.width=s1,o1.minWidth=s1}Object.assign(I.floating.style,o1)}})),g}),{floatingStyles:B,placement:V,update:b,isPositioned:E}=_.useFloating(f,p,{placement:c,strategy:"fixed",open:e.computed(()=>t.open),whileElementsMounted:_.autoUpdate,middleware:N}),v=e.computed(()=>{const g=V.value;return g.startsWith("top")?"bottom":g.startsWith("bottom")?"top":g.startsWith("left")?"right":g.startsWith("right")?"left":"top"}),P=g=>{const x=g.target,X=f.value,I=p.value;I&&I.contains(x)||[...r].some(K=>K.contains(x))||X&&X.contains(x)||t.extraPanels?.some(K=>K?.contains(x))||a("close")};let Z=!1;function n1(){Z||(document.addEventListener("pointerdown",P,!0),Z=!0)}function L(){Z&&(document.removeEventListener("pointerdown",P,!0),Z=!1)}e.watch(()=>t.open,g=>{g?e.nextTick(()=>{b(),n1()}):(h.value=null,L())}),e.watch(p,(g,x)=>{x&&l?.remove(x),g&&l?.add(g)}),e.watch(E,g=>{g&&t.open&&t.freezePositionOnOpen&&!h.value&&(h.value=V.value)}),e.onBeforeUnmount(()=>{L(),p.value&&l?.remove(p.value)});const D=e.computed(()=>({...t.matchAnchorWidth?{}:{width:t.width??"auto"},...t.minWidth?{minWidth:t.minWidth}:{},transformOrigin:v.value,zIndex:t.zIndex}));return(g,x)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body",class:"wpic-popover"},[e.withDirectives(e.createElementVNode("div",{ref_key:"floatingEl",ref:p,class:"flex flex-col bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-800 rounded-xl shadow-xl dark:shadow-black/40 overflow-hidden",style:e.normalizeStyle([e.unref(B),D.value])},[e.renderSlot(g.$slots,"default")],4),[[e.vShow,n.open]])]))}}),l3={key:0,class:"fixed right-0 top-0 z-[9997] flex h-full w-20 items-center justify-center border-l-2 border-[var(--wpic-primary)] bg-[var(--wpic-primary)]/10 text-[var(--wpic-primary)] pointer-events-none"},c3=["data-variant","data-maximized"],a3=["title"],o3={class:"min-w-0 flex-1 px-2 text-center"},r3={class:"truncate font-medium text-zinc-700 dark:text-zinc-200"},i3={key:0,class:"truncate text-zinc-500 dark:text-zinc-400"},s3={class:"flex shrink-0 items-center gap-1"},d3=["title"],u3=["title"],m3=["title"],h3=["title"],p3={class:"flex h-11 shrink-0 items-center justify-between px-3"},v3={class:"font-medium text-zinc-700 dark:text-zinc-200"},f3=["title"],C3={class:"space-y-2 px-3 pb-3"},z3={class:"truncate"},g3={class:"flex-1 overflow-y-auto overflow-x-visible px-2 pb-3"},k3={class:"mb-2 flex h-7 items-center justify-between px-2 font-medium text-zinc-500 dark:text-zinc-400"},b3={class:"truncate"},y3=["title"],x3={class:"space-y-0.5"},w3={key:0,class:"rounded-lg border border-dashed border-zinc-200 px-2 py-2 text-zinc-500 dark:border-zinc-700 dark:text-zinc-400"},M3=["onMouseenter"],B3=["onClick"],V3={class:"min-w-0 flex-1 truncate"},E3={key:0,class:"shrink-0 text-zinc-400"},N3={key:0,class:"px-3 py-2 text-zinc-400 dark:text-zinc-500"},S3=["onPointerdown","onClick"],L3={class:"min-w-0 flex-1 truncate"},D3={class:"shrink-0 text-zinc-400"},F3={class:"mt-4"},$3={class:"flex h-7 items-center px-2 font-medium text-zinc-500 dark:text-zinc-400"},T3={class:"truncate"},A3={class:"space-y-0.5"},H3={key:0,class:"rounded-lg border border-dashed border-zinc-200 px-2 py-2 text-zinc-500 dark:border-zinc-700 dark:text-zinc-400"},P3=["onPointerdown","onClick"],j3={class:"block truncate"},W3={class:"shrink-0 text-zinc-400"},R3=["onClick"],I3=["onPointerenter","onMouseenter"],Z3={class:"truncate"},U3={class:"flex min-h-0 flex-1"},K3={class:"flex min-w-0 flex-1 flex-col"},O3={key:0,class:"flex h-full flex-col items-center justify-center px-5 text-center text-zinc-500 dark:text-zinc-400"},Y3={class:"font-medium"},q3={key:1,class:"flex h-full flex-col items-center justify-center px-5 text-center"},Q3={class:"mb-3 flex h-11 w-11 items-center justify-center rounded-xl bg-zinc-100 text-zinc-500 dark:bg-zinc-700 dark:text-zinc-300"},J3={class:"font-semibold text-zinc-800 dark:text-zinc-100"},X3={key:0,class:"mt-1 max-w-xs text-zinc-500 dark:text-zinc-400"},G3={key:2,class:"space-y-4"},_3={class:"max-w-[82%]"},e4=["src","alt"],n4={class:"max-w-40 truncate"},t4={key:0,class:"shrink-0 text-zinc-400"},l4={key:0,class:"flex items-center gap-2 text-zinc-500 dark:text-zinc-400"},c4={key:1,class:"wpic-chat-loading-card",role:"status","aria-label":"Generating image"},a4=["innerHTML","onClick"],o4=["href","onClick"],r4=["src"],i4=["title","aria-label","onClick"],s4=["title","aria-label","onClick"],d4=["title","onClick"],u4=["onClick"],m4=["title","onClick"],h4={key:0,class:"mb-2 flex flex-wrap justify-end gap-1.5"},p4=["src","alt"],v4={class:"max-w-40 truncate"},f4={key:0,class:"shrink-0 text-zinc-400"},C4={key:1,class:"shrink-0 text-zinc-400"},z4=["title","onClick"],g4={class:"wpic-chat-panel__composer rounded-xl border border-zinc-200 bg-zinc-50 transition-colors focus-within:border-[var(--wpic-primary)]/50 dark:border-zinc-700 dark:bg-zinc-700"},k4={key:0,class:"mx-2 mt-2 overflow-hidden rounded-lg bg-white shadow-sm ring-1 ring-zinc-200 dark:bg-zinc-800 dark:ring-zinc-600"},b4=["onMousedown"],y4={class:"min-w-0 truncate font-medium text-zinc-900 dark:text-zinc-100"},x4={key:0,class:"max-w-32 shrink-0 truncate text-xs text-zinc-500 dark:text-zinc-400"},w4=["accept"],M4=["value","placeholder","disabled"],B4={class:"flex items-center justify-between px-2 pb-2"},V4=["disabled","title"],E4=["title"],N4=["disabled","title"],C2=80,S4=e.defineComponent({__name:"WChatPanel",props:{open:{type:Boolean},messages:{},mentionItems:{default:()=>[]},projects:{default:()=>[]},sessions:{default:()=>[]},modelValue:{default:""},title:{default:"Chat"},subtitle:{default:""},selectedProjectId:{default:null},selectedSessionId:{default:null},placeholder:{default:"Ask anything..."},emptyTitle:{default:"How can I help?"},emptyDescription:{default:""},noProjectsLabel:{default:"No projects yet"},noConversationsLabel:{default:"No conversations yet"},allLabel:{default:"All"},recentLabel:{default:"Recent"},projectsLabel:{default:"Projects"},conversationsLabel:{default:"Conversations"},sendLabel:{default:"Send"},newLabel:{default:"New chat"},newProjectLabel:{default:"New project"},newConversationLabel:{default:"New conversation"},renameProjectLabel:{default:"Rename project"},renameConversationLabel:{default:"Rename conversation"},deleteProjectLabel:{default:"Delete project"},deleteConversationLabel:{default:"Delete conversation"},clearLabel:{default:"Clear"},copyLabel:{default:"Copy"},copiedLabel:{default:"Copied"},newChatFromMessageLabel:{default:"Start new chat from this message"},attachFilesLabel:{default:"Attach files"},removeAttachmentLabel:{default:"Remove attachment"},stopLabel:{default:"Stop"},applyPromptLabel:{default:"Apply prompt"},applyAllLabel:{default:"Apply all"},applySettingLabel:{default:"Apply setting"},thinkingLabel:{default:"Thinking..."},dockLabel:{default:"Dock"},undockLabel:{default:"Undock"},closeLabel:{default:"Close"},helpfulLabel:{default:"Helpful"},notHelpfulLabel:{default:"Not helpful"},attachments:{default:()=>[]},accept:{default:""},customAttachmentPicker:{type:Boolean,default:!1},showNavigator:{type:Boolean,default:!0},hideNewConversation:{type:Boolean,default:!1},hideClear:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},cancellable:{type:Boolean,default:!1},docked:{type:Boolean,default:!1},maximized:{type:Boolean,default:!1},maximizedMargin:{default:20},width:{default:420},height:{default:560},x:{default:-1},y:{default:-1},topOffset:{default:0},minWidth:{default:340},minHeight:{default:400},zIndex:{default:80},variant:{default:"default"}},emits:["close","send","clear","new","new-project","new-conversation","select-project","select-session","rename-project","rename-session","delete-project","delete-session","move-session","edit-message","new-chat-from-message","message-feedback","apply-message-proposal","navigate","cancel","attach","files-selected","remove-attachment","update:modelValue","update:docked","update:maximized","update:width","update:height","update:x","update:y"],setup(n,{emit:u}){const t=n,a=u,s=e.useSlots(),l=e.ref(null),r=e.ref(null),f=e.ref(null),p=e.ref(null),h=e.ref(null),c=e.ref(null),N=e.ref(0),B=e.ref(0),V=e.ref(!1),b=e.ref(null),E=e.ref(null);let v=null;const P=e.ref(!1),Z=e.ref(!1),n1=e.ref(!1);e.ref(new Set);const L=e.ref(null),D=e.ref(null),g=e.ref({}),x=e.ref(null);let X=null,I=null;function K(){I?.disconnect(),I=null;const o=r.value,i=h.value;if(!o||!i||typeof ResizeObserver>"u")return;const d=()=>i.style.setProperty("--wpic-chat-footer-height",`${o.getBoundingClientRect().height}px`);d(),I=new ResizeObserver(d),I.observe(o)}const q=e.computed(()=>x.value?[]:t.messages.filter(o=>o.role!=="system")),o1=e.computed(()=>t.loading||x.value!==null),s1=e.computed(()=>t.modelValue.trim().length>0&&!t.loading),d1=e.computed(()=>t.attachments.length>0),W=e.computed(()=>{const o=t.modelValue.slice(0,B.value),i=o.match(/(?:^|\s)@([^\s@]*)$/);return i?{start:o.length-i[0].length+(i[0].startsWith(" ")?1:0),query:i[1].toLowerCase()}:null}),O=e.computed(()=>{const o=W.value;if(!o)return[];const i=o.query;return t.mentionItems.filter(d=>d.label.toLowerCase().includes(i)).slice(0,6)}),M=e.computed(()=>t.showNavigator&&V.value),Q=e.computed(()=>t.selectedProjectId??null),$=e.computed(()=>t.sessions.filter(o=>!o.projectId)),k=e.computed(()=>{const o=new Map;for(const i of t.projects)o.set(i.id,[]);for(const i of t.sessions){if(!i.projectId)continue;const d=o.get(i.projectId);d&&d.push(i)}return o});function T(o){const i=o.toLowerCase();if(i.includes("doubao-seedance-1-5-pro-251215")||i.includes("doubao seedance 1.5")||i.includes("seedance 1.5")||i.includes("seedance video"))return"jimeng:doubao-seedance-1-5-pro-251215";if(i.includes("imagen 4")||i.includes("imagen-4"))return"google:imagen-4.0-generate-001";if(i.includes("gpt-image-1")||i.includes("gpt image 1"))return"openai:gpt-image-1";if(i.includes("gpt-image-2")||i.includes("gpt image 2"))return"openai:gpt-image-2";if(i.includes("doubao-seedream-4-5-251128"))return"jimeng:doubao-seedream-4-5-251128";if(i.includes("doubao-seedream-4-0-250828"))return"jimeng:doubao-seedream-4-0-250828";if(i.includes("doubao seedream 5")||i.includes("seedream 5")||i.includes("doubao seedream 4.5")||i.includes("seedream 4.5"))return"jimeng:doubao-seedream-4-5-251128";if(i.includes("doubao seedream 4")||i.includes("seedream 4"))return"jimeng:doubao-seedream-4-0-250828";if(i.includes("auto"))return"auto";const d=o.match(/\b([a-z][a-z0-9_-]+):([a-z0-9._-]+)\b/i);if(d)return`${d[1].toLowerCase()}:${d[2]}`}function U(o){if(o!=="auto"){if(o.includes("seedance"))return"video";if(o.includes("gpt-image")||o.includes("imagen")||o.includes("seedream")||o.includes("jimeng:"))return"image"}}function a1(o){const i=[],d=new Set,z=/\b(gpt[-\s]?image[-\s]?[12]|imagen\s*4|doubao\s+seedance\s+1\.5(?:\s+pro)?|seedance\s+1\.5(?:\s+pro)?|doubao\s+seedream\s+(?:5(?:\.0)?|4\.5|4)|seedream\s+(?:5(?:\.0)?|4\.5|4)|[a-z][a-z0-9_-]+:[a-z0-9._-]+|auto)\b/gi;for(const m of o.matchAll(z)){const y=m[1],R=T(y);!R||d.has(R)||(d.add(R),i.push({label:y,value:R}))}return i}function r1(o,i){return o.match(new RegExp(`${i}=["']([^"']+)["']`,"i"))?.[1]}function M1(o){const i={};for(const z of o.matchAll(/\[SETTING\s+([^\]]+)\]([\s\S]*?)\[\/SETTING\]/gi)){const m=z[1]??"",y=r1(m,"key"),R=r1(m,"value")??z[2]?.trim();if(!(!y||!R))if(y==="duration"||y==="fps"||y==="count"){const Y=Number(R);Number.isFinite(Y)&&(i[y]=Y)}else if(y==="model"){const Y=T(R)??T(z[2]?.trim()??"");Y&&(i.model=Y)}else(y==="aspect"||y==="resolution"||y==="format")&&(i[y]=R)}const d=o.split(/\r?\n/).map(z=>z.replace(/^[\s>*-]+/,"").trim()).filter(Boolean);for(const z of d){const m=z.toLowerCase();if(/(supporte|supports?|disponible|available|dur[eé]es?\s*:|ratios?\s*:|jusqu['’]?à|up to)/i.test(m))continue;const y=z.split(":").slice(1).join(":").trim()||z,R=y.match(/\b(\d{1,2}:\d{1,2})\b/);(m.includes("format")||m.includes("aspect")||m.includes("ratio"))&&R&&(i.aspect=R[1]);const Y=y.match(/\b([1248]K)\b/i);(m.includes("résolution")||m.includes("resolution"))&&Y&&(i.resolution=Y[1].toUpperCase());const e1=y.match(/\b(\d{1,3})\s*(?:s|sec|secondes?|seconds?)\b/i);(m.includes("durée")||m.includes("duration"))&&e1&&(i.duration=Number(e1[1]));const l1=y.match(/\b(\d{1,3})\s*fps\b/i);m.includes("fps")&&l1&&(i.fps=Number(l1[1]));const c1=y.match(/\b(\d{1,2})\b/);if((m.includes("count")||m.includes("nombre")||m.includes("variantes"))&&c1&&(i.count=Number(c1[1])),m.includes("modèle")||m.includes("modele")||m.includes("model")){const p1=T(y);p1&&(i.model=p1)}m.includes("jpg")||m.includes("jpeg")?i.format="jpg":m.includes("png")?i.format="png":m.includes("webp")&&(i.format="webp")}return Object.keys(i).length?i:void 0}function w(o){const i=o.match(/\[TASK(?:\s+([^\]]+))?\](?:([\s\S]*?)\[\/TASK\])?/i);if(i){const z=(r1(i[1]??"","value")??i[2]?.trim())?.toLowerCase();if(["image","video","audio","text"].includes(String(z)))return z}const d=o.split(/\r?\n/).map(z=>z.replace(/^[\s>*-]+/,"").trim()).filter(Boolean);for(const z of d){const m=z.toLowerCase(),y=z.split(":").slice(1).join(":").trim().toLowerCase()||m;if(/(task|type|mode|surface|format|réglage|reglage|setting)/i.test(m)){if(/\baudio\b|subtitles?|sous-titres?|transcri|tts|voice|voix/.test(y))return"audio";if(/\bvid[eé]o\b|\bvideo\b|\bfps\b|duration|dur[eé]e/.test(y))return"video";if(/\bimage\b|photo|visuel|illustration|aspect|ratio|resolution|résolution/.test(y))return"image";if(/\btext\b|texte|copy|caption|script/.test(y))return"text"}}}function A(o){const i=o.match(/\[PROMPT\]([\s\S]*?)\[\/PROMPT\]/i)?.[1];if(i){const e1=B1(i).trim().replace(/^["“]|["”]$/g,"");if(e1)return e1}const d=o.replace(/\r\n/g,`
3
3
  `).split(`
4
4
  `),z=[];let m=!1,y=!1,R=!1;for(const e1 of d){const l1=e1.trim().replace(/^[\s>*-]+/,"").replace(/^#{1,6}\s+/,"").replace(/^\*\*|\*\*$/g,"").trim();if(y){if(/^```/.test(l1))break;z.push(e1);continue}if(!m){const c1=l1.match(/^(?:(?:voici|essayez|utilisez|use|try)\s+(?:ce\s+)?(?:prompt)|prompt\s+(?:modifi[eé]|am[eé]lior[eé]|propos[eé]|recommand[eé])|prompt)\s*:\s*(.*)$/i);if(!c1){R||=/\bprompt\b/i.test(l1),R&&/^```/.test(l1)&&(m=!0,y=!0);continue}m=!0,c1[1]?.trim()&&z.push(c1[1].trim());continue}if(/^(?:r[eé]glages?(?:\s+recommand[eé]s?)?|settings?|mod[eè]le|model)\s*:/i.test(l1))break;z.push(e1)}return B1(z.join(`
5
5
  `)).trim().replace(/^["“]|["”]$/g,"")||void 0}function F(o){return/\[PROMPT\]([\s\S]*?)\[\/PROMPT\]/i.test(o)}function G(o){return/\[TASK(?:\s+[^\]]+)?\]/i.test(o)}function J(o){const i=o.match(/\[TASK(?:\s+([^\]]+))?\]([\s\S]*?)\[\/TASK\]/i),d=`${i?.[1]??""} ${i?.[2]??""}`.toLowerCase();return F(o)&&(/\bimage\b/.test(d)||!G(o))}function S(o){return/\[(?:TASK|PROMPT|SETTING)\b/i.test(o)}function H(o){const i=z=>Array.isArray(z)?z.flatMap(m=>{if(!m||typeof m!="object")return[];const y=m,R=typeof y.url=="string"?y.url:null;return R?[{type:typeof y.type=="string"?y.type:"image",url:R,posterUrl:typeof y.posterUrl=="string"?y.posterUrl:null,width:typeof y.width=="number"?y.width:null,height:typeof y.height=="number"?y.height:null,generationId:typeof y.generationId=="string"?y.generationId:null,href:typeof y.href=="string"?y.href:null}]:[]}):[],d=o.metadata?.generatedMedia;return i(d).filter(z=>z.type==="image"||!z.type)}function j(o){const i=o.metadata?.attachments;return Array.isArray(i)?i.flatMap((d,z)=>{if(!d||typeof d!="object")return[];const m=d,y=m.metadata&&typeof m.metadata=="object"?m.metadata:{},R=typeof m.name=="string"&&m.name.trim()?m.name.trim():`Attachment ${z+1}`;return[{id:typeof m.id=="string"?m.id:`${o.id??"message"}-attachment-${z}`,name:R,mimeType:typeof m.mimeType=="string"?m.mimeType:null,bytes:typeof m.bytes=="number"?m.bytes:null,status:"ready",displayUrl:typeof m.displayUrl=="string"?m.displayUrl:typeof y.displayUrl=="string"?y.displayUrl:null,publicUrl:typeof m.publicUrl=="string"?m.publicUrl:typeof y.publicUrl=="string"?y.publicUrl:null,assetId:typeof m.assetId=="string"?m.assetId:null,mediaItemId:typeof m.mediaItemId=="string"?m.mediaItemId:null,metadata:y}]}):[]}function t1(o){const i=o.metadata&&typeof o.metadata=="object"?o.metadata:{},d=o.mimeType??"",z=typeof i.kind=="string"?i.kind:"",m=o.displayUrl??(typeof i.displayUrl=="string"?i.displayUrl:null);return!m||!d.startsWith("image/")&&z!=="image"?null:m}function h1(o){if(o.role!=="assistant"||!o.streaming)return!1;const i=o.content.trim();return i==="Generating image..."||S(i)}function b1(o){return o.replace(/\[PROMPT\]([\s\S]*?)\[\/PROMPT\]/gi,"$1").replace(/\[SETTING\s+[^\]]*\]([\s\S]*?)\[\/SETTING\]/gi,"$1").replace(/\[TASK(?:\s+[^\]]*)?\]([\s\S]*?)\[\/TASK\]/gi,"").replace(/^\s*\[TASK(?:\s+[^\]]*)?\]\s*$/gim,"")}function B1(o){return o.replace(/\[PROMPT\]|\[\/PROMPT\]/gi,"").replace(/\[SETTING\s+[^\]]*\]|\[\/SETTING\]/gi,"").replace(/\[TASK\s+[^\]]*\]|\[\/TASK\]/gi,"").split(`
package/dist/wpic-ui.js CHANGED
@@ -1082,10 +1082,11 @@ const h0 = /* @__PURE__ */ U1(k4, [["render", y4]]), w4 = ["disabled"], C2 = /*
1082
1082
  I(), b.value && a?.remove(b.value);
1083
1083
  });
1084
1084
  const R = L(() => ({
1085
- // When matching the anchor, Floating UI's size middleware owns width.
1086
- // Do not overwrite it with `auto` during scroll/resize recalculations.
1087
- width: c.matchAnchorWidth ? void 0 : c.width ?? "auto",
1088
- minWidth: c.minWidth,
1085
+ // Omit width properties entirely when the size middleware owns them.
1086
+ // Binding `undefined` still makes Vue remove the middleware's inline style
1087
+ // during an autoUpdate render (notably while scrolling).
1088
+ ...c.matchAnchorWidth ? {} : { width: c.width ?? "auto" },
1089
+ ...c.minWidth ? { minWidth: c.minWidth } : {},
1089
1090
  transformOrigin: k.value,
1090
1091
  zIndex: c.zIndex
1091
1092
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wpic/ui",
3
- "version": "0.3.15",
3
+ "version": "0.3.16",
4
4
  "type": "module",
5
5
  "description": "WPIC shared Vue 3 component library",
6
6
  "publishConfig": {