1import{d as G,r as c,c as g,w as I,o as J,n as X,i as ge}from"./vue.esm.BEjpSGgv.js";import{p as he,x as ye,b as be,g as _e}from"./composables.OBORGBxC.js";import{e as V}from"./useCached.BL_eh1As.js";import{u as we}from"./InfiniteScrollLoader.BKyW79dT.js";import{n as Ae,s as Ce}from"./approximation.jMiuPdMm.js";import{c as Ie}from"./concatUniqueById.CvvqxyDE.js";import{a as Re,b as Te,c as De}from"./index.BCKO9z9v.js";import{D as Ee}from"./context.C-234Rrl.js";import{n as Z}from"./_plugin-vue2_normalizer.C0BxeC5J.js";import{A as Se}from"./ApproximationCell.Ccs9H_4I.js";import{g as Fe,p as ke,k as z,j as Be}from"./index.UD-xrm6N.js";import{r as Ve}from"./remove.Ch95DPLM.js";(function(){try{var o=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};o.SENTRY_RELEASE={id:"mhs-fe_legacy@a14929fe"};var a=new o.Error().stack;a&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[a]="008e118d-e5ae-4fe4-810c-44f744004137",o._sentryDebugIdIdentifier="sentry-dbid-008e118d-e5ae-4fe4-810c-44f744004137")}catch{}})();const je=G({__name:"ApproximationDrawTypeFilter",props:{userId:null,value:null},emits:["input","confirm"],setup(o,{emit:a}){const t=o,e=c(!1),r=c(!1),n=c(!1),l=c([]),x=c(t.value??null),A=g(()=>l.value.find(p=>p.id===t.value)),C=g(()=>t.value!==null&&t.value!==void 0),w=g(()=>n.value&&!r.value&&l.value.length===0),b=g(()=>{var p;return((p=A.value)==null?void 0:p.title)??"æä»·ç®è¡¨ç±»åçé"});I(()=>t.value,p=>{x.value=p??null}),I(()=>t.userId,()=>{l.value=[],n.value=!1,e.value=!1,y()});const y=async()=>{if(!(!t.userId||r.value||l.value.length||n.value)){r.value=!0;try{const p=[];let _,D=!0;for(;D;){const d=await Ae(t.userId,{pagination:"keyset",cursor:_,per:10});p.push(...d.drawTypes),_=d.endCursor??void 0,D=d.hasNextPage&&!!_}l.value=p,n.value=!0,l.value.length===0&&(e.value=!1)}catch{V.Message.error("å 载价ç®è¡¨ç±»å失败ï¼è¯·éè¯")}finally{r.value=!1}}},f=()=>{if(w.value){e.value=!1;return}x.value=t.value??null,y()},h=()=>{x.value=null,e.value=!1,a("input",null),a("confirm",null)},E=()=>{e.value=!1,a("input",x.value),a("confirm",x.value)},i=()=>{x.value=null,e.value=!1,a("input",null),a("confirm",null)};return J(y),{__sfc:!0,props:t,emit:a,visible:e,loading:r,hasLoaded:n,options:l,draftValue:x,selectedOption:A,hasSelectedValue:C,isDisabled:w,label:b,loadOptions:y,onShow:f,reset:h,confirm:E,clearSelection:i}}});var Me=function(){var a=this,t=a._self._c,e=a._self._setupProxy;return t("el-popover",{attrs:{placement:"bottom-start",trigger:"click","visible-arrow":!1,width:620,"popper-class":"w-[620px] !p-0 rounded-[8px] border-line-90 box-border shadow-lg"},on:{show:e.onShow},model:{value:e.visible,callback:function(r){e.visible=r},expression:"visible"}},[t("section",{staticClass:"w-[620px] p-[15px] box-border flex flex-col"},[t("div",{directives:[{name:"mhs-loading",rawName:"v-mhs-loading",value:{visible:e.loading,propsData:{text:"æ£å¨å 载价ç®è¡¨ç±»å",indie:!1}},expression:` 2 { 3 visible: loading, 4 propsData: { 5 text: 'æ£å¨å 载价ç®è¡¨ç±»å', 6 indie: false, 7 }, 8 } 9 `}],staticClass:"max-h-[260px] min-h-[24px] overflow-y-auto grid grid-cols-5 gap-x-[30px] gap-y-[26px] content-start pb-[15px] cursor-default",on:{click:function(r){if(r.target!==r.currentTarget)return null;e.visible=!1}}},a._l(e.options,function(r){return t("button",{key:r.id,staticClass:"p-0 border-0 bg-transparent text-[14px] leading-[20px] text-left cursor-pointer overflow-hidden text-ellipsis whitespace-nowrap hover:text-primary-80",class:{"text-primary-80 font-semibold":e.draftValue===r.id,"text-text-70 font-normal":e.draftValue!==r.id},attrs:{type:"button"},on:{click:function(n){e.draftValue=r.id}}},[a._v(" "+a._s(r.title)+" ")])}),0),t("div",{staticClass:"flex-none pt-[15px] border-0 border-t border-solid border-line-90 flex justify-end gap-[10px]"},[t("mhs-button",{staticClass:"!rounded-[8px] !h-[44px] !py-[11px] !px-[22px] !leading-[20px]",attrs:{plain:"",type:"primary"},on:{click:e.reset}}
9,[a._v(" éç½® ")]),t("mhs-button",{staticClass:"!rounded-[8px] !h-[44px] !py-[11px] !px-[22px] !leading-[20px]",attrs:{type:"primary"},on:{click:e.confirm}},[a._v(" ç¡®å® ")])],1)]),t("button",{staticClass:"group w-[200px] h-[44px] py-0 pl-[20px] pr-[16px] border border-solid rounded-[8px] text-[14px] leading-[20px] flex items-center justify-between gap-[10px]",class:[e.visible?"border-primary-80":"border-line-90",e.isDisabled?"bg-fill-40 text-text-60 cursor-not-allowed":e.hasSelectedValue?"bg-white text-text-80 cursor-pointer":"bg-white text-text-60 cursor-pointer"],attrs:{slot:"reference",type:"button",disabled:e.isDisabled},slot:"reference"},[t("span",{staticClass:"min-w-0 overflow-hidden text-ellipsis whitespace-nowrap"},[a._v(a._s(e.label))]),t("i",{staticClass:"el-icon-arrow-down flex-none text-text-60 transition-transform duration-200",class:[e.visible?"rotate-180":"rotate-0",e.hasSelectedValue?"group-hover:hidden":""]}),e.hasSelectedValue?t("i",{staticClass:"icon-close hidden flex-none text-text-60 hover:text-primary-80 group-hover:block",on:{click:function(r){return r.stopPropagation(),r.preventDefault(),e.clearSelection.apply(null,arguments)}}}):a._e()])])},Oe=[],Ne=Z(je,Me,Oe,!1,null,null);const $e=Ne.exports,qe=o=>{try{return localStorage.getItem(o)}catch(a){return console.error("Failed to read one-time tooltip state:",a),null}},Pe=(o,a)=>{try{localStorage.setItem(o,a)}catch(t){console.error("Failed to save one-time tooltip state:",t)}},Ke=o=>{const a=c(!1);let t=!1;const e=()=>{var i;return((i=o.canShow)==null?void 0:i.call(o))??!0},r=()=>{var i;return((i=o.isReady)==null?void 0:i.call(o))??!0},n=i=>qe(i)==="true",l=i=>Pe(i,"true"),{width:x,height:A,update:C}=Fe(o.referenceRef),w=g(()=>e()&&r()&&x.value>0&&A.value>0),b=()=>{f.stop(),a.value=!1},y=()=>{t=!1,b()},f=ke(b,o.duration??5e3,{immediate:!1}),h=()=>a.value&&b();return z(document,"pointerdown",h,{capture:!0,passive:!0}),z(document,"keydown",h,{capture:!0}),{visible:a,show:async()=>{var p,_;const i=o.seenKey();a.value||t||!e()||n(i)||(t=!0,await X(),C(),await Be(w).toBe(!0,{timeout:o.maxWait??5e3,throwOnTimeout:!1}),!(!w.value||!e()||i!==o.seenKey()||n(i))&&(l(i),a.value=!0,await X(),(_=(p=o.tooltipRef.value)==null?void 0:p.updatePopper)==null||_.call(p),f.start()))},dismiss:b,reset:y}},Le=G({__name:"ApproximationList",setup(o){const a=he(),t=ye(),e=be(),r=ge(Ee),{currentUser:n}=_e(e),l="approximation_pending_order",x="approximation_pending_view_mode_v1",A="approximation_pending_view_tip_seen_v1",C=()=>`${x}_${n.value.id??"guest"}`,w=()=>`${A}_${n.value.id??"guest"}`,b=()=>{try{const s=localStorage.getItem(l);if(s&&["created_desc","created_asc","price_desc","deadline_desc"].includes(s))return s}catch(s){console.error("Failed to read order from localStorage:",s)}return"created_desc"},y=()=>{try{const s=localStorage.getItem(C());return s===null||s==="image"?!0:s!=="text"}catch(s){return console.error("Failed to read image view from localStorage:",s),!0}},f=c(a.currentRoute.query.state||"pending"),h=c(b()),E=[{label:"ææ°åé",value:"created_desc"},{label:"ææ©åé",value:"created_asc"},{label:"æç¨¿é
¬éåº",value:"price_desc"},{label:"ææªç¨¿æ¶é´éåº",value:"deadline_desc"}],i=c(!1),p=c(y()),_=c(null),D=c(null),d=c([]),M=c(!1),O=g(()=>{const s=t.query.onlyAlternative;return typeof s=="boolean"?s:s==="true"}),S=c(!1),R=c(1),N=c(0),F=c(0),v=c([]),$=c("received"),ee=g(()=>p.value?"image":"text"),q=s=>(Array.isArray(s)?s:[s]).flatMap(m=>typeof m=="string"?m.split(","):m).map(m=>Number(m)).filter(m=>Number.isFinite(m)&&m>0),k=g(()=>q(t.query.drawTypeIds??t.query.drawTypeId)),P=g(()=>k.value[0]??null),te=g(()=>d.value.length>0&&d.value.length<v.value.length),ae=g(()=>f.value==="pending"?"ææ å¾
å¤çé请":f.value==="accepted"?"ç®åè¿æ²¡ææ¥åçæ°é请":"ç®åè¿æ²¡æå·²æç»çé请"),se=g(()=>i.value?"flex items-start mx-[20px] p-[10px] mb-[10px] rounded-[8px]":"");I(f,()=>{a.push({name:"dashboard-approximations",query:{...t.query,state:f.value}});const s=h.value;h.value="created_desc",v.value=[],R.value=1,s==="created_desc"&&T(),B()}),I(()=>t.query.onlyAlternative,()=>{v.value=[],R.value=1,T()}),I(()=>`${t.query.drawTypeIds??""}|${t.query.drawTypeId??""}`,()=>{v.value=[],R.value=1,T()}),I(h,()=>{if(f.value==="pending")try{localStorage.setItem(l,h.value)}catch(s){console.error("Failed to save order to localStorage:",s)}v.value=[],R.value=1,T()});const T=async()=>{const s=++F.value;S.value=!0;try{const u=await Ce(n.value.id,{type:$.value,state:f.value,page:R.value,order:h.value,...O.value?{isAlternative:!0}:{},...k.value.length?{drawTypeIds:k.value}:{}});if(s!==F.value)return;
9v.value=Ie(v.value,u.approximationRelationships),N.value=u.totalPages}finally{s===F.value&&(S.value=!1)}},re=(s,u)=>{a.push({name:"dashboard-approximations",query:{...t.query,[s]:u?"true":void 0}})},{visible:oe,show:B,dismiss:K,reset:L}=Ke({seenKey:w,tooltipRef:_,referenceRef:D,canShow:()=>f.value==="pending",isReady:()=>!S.value,duration:5e3}),le=s=>{p.value=s,K();try{localStorage.setItem(C(),s?"image":"text")}catch(u){console.error("Failed to save image view to localStorage:",u)}};I(()=>n.value.id,()=>{L(),p.value=y(),B()});const ie=s=>{s!==P.value&&a.push({name:"dashboard-approximations",query:{...t.query,drawTypeId:void 0,drawTypeIds:s?[`${s}`]:void 0}})},{approximationRefuseModal:U}=Re(),ne=async()=>{if(!v.value.length){V.Message.error("没æå¾
å¤ççé请");return}if(!d.value.length){V.Message.error("è¯·éæ©è¦æç»çé请");return}await U({isBatchReject:!0,batchRejectIds:d.value}),d.value.forEach(s=>W({id:s})),d.value=[]},W=s=>{Ve(v.value,{id:s.id}),j()},ue=(s,u)=>{const m=v.value[s];m&&(v.value.splice(s,1,{...m,...u}),j())},ce=(s,u)=>{const m=v.value[s];m&&v.value.splice(s,1,{...m,isAlternative:u.isAlternative})},j=()=>{e.updateApproximationsCount(Math.max((n.value.approximationsCount??0)-1,0))},{approximationAcceptTypeModal:Y}=Te(),pe=async()=>{try{const s=await Y({user:n.value});e.updateCurrentUser(s)}catch{}},{invitationWhitelists:H}=De(),de=async()=>{await H({})},ve=()=>{if(!v.value.some(u=>u.state==="pending")){V.Message.error("没æå¾
å¤ççé请");return}Q()},Q=()=>{var u;const s=(u=r==null?void 0:r.dashboardSidebarRef.value)==null?void 0:u.$el;i.value=!i.value,s.className+=" sticky top-[60px]",i.value||(d.value=[],s.className="dashboard-sidebar__wrapper")},me=s=>{d.value=s?v.value.map(u=>u.id):[]},fe=s=>{if(i.value){const u=d.value.indexOf(s);u>-1?d.value.splice(u,1):d.value.push(s),M.value=d.value.length===v.value.length}},xe=s=>d.value.includes(s);return J(()=>{T(),B()}),{__sfc:!0,router:a,route:t,userStore:e,dashboardContext:r,currentUser:n,APPROXIMATION_ORDER_CACHE_KEY:l,APPROXIMATION_VIEW_MODE_CACHE_KEY:x,APPROXIMATION_VIEW_TIP_SEEN_CACHE_KEY:A,getImageViewCacheKey:C,getImageViewTipSeenCacheKey:w,getCachedOrder:b,getCachedImageView:y,state:f,order:h,orderOptions:E,isBatchReject:i,isImageView:p,imageViewTooltipRef:_,imageViewTooltipReferenceRef:D,selectedApproximations:d,isAllSelected:M,onlyAlternative:O,loading:S,page:R,pageCount:N,loadEpoch:F,approximations:v,type:$,approximationViewMode:ee,parseQueryNumbers:q,selectedDrawTypeIds:k,selectedDrawTypeId:P,isIndeterminate:te,emptyTips:ae,batchRejectClasses:se,loadApproximations:T,changeQuery:re,showImageViewTip:oe,showInitialImageViewTip:B,dismissImageViewTip:K,resetImageViewTip:L,changeImageView:le,confirmDrawTypeFilter:ie,approximationRefuseModal:U,bathReject:ne,removeApproximation:W,updateApproximation:ue,toggleAlternative:ce,finishApproximation:j,approximationAcceptTypeModal:Y,setType:pe,invitationWhitelists:H,setInvitationWhitelist:de,changeBatchReject:ve,resetBatchReject:Q,toggleSelectAll:me,toggleCheckbox:fe,isSelected:xe,InfiniteScrollLoader:we,ApproximationDrawTypeFilter:$e,ApproximationCell:Se}}});var Ue=function(){var a=this,t=a._self._c,e=a._self._setupProxy;return t("article",{staticClass:"approximation-list rounded-b rounded-t-[var(--dashboard-with-bar)]"},[e.isBatchReject?t("header",{staticClass:"sticky top-[80px] bg-white z-[100] flex items-center justify-between px-[30px] py-[15px] border-solid border-t-0 border-x-0 border-line-90 mb-[20px]"},[t("el-checkbox",{attrs:{indeterminate:e.isIndeterminate},on:{change:e.toggleSelectAll},model:{value:e.isAllSelected,callback:function(r){e.isAllSelected=r},expression:"isAllSelected"}},[a._v(" å
¨é ")]),t("div",[t("mhs-button",{staticClass:"!rounded-[8px] !w-[108px]",attrs:{plain:"",type:"primary"},on:{click:e.resetBatchReject}},[a._v(" åæ¶ ")]),t("mhs-button",{staticClass:"!rounded-[8px] !w-[108px]",attrs:{type:"primary"},on:{click:e.bathReject}},[a._v(" æç» "),e.selectedApproximations.length?t("span",[a._v("("+a._s(e.selectedApproximations.length)+")")]):a._e()])],1)],1):t("header",{staticClass:"dashboard__header"},[t("div",[t("span",{staticClass:"dashboard__title"},[a._v("ææ¶å°çé请")]),t("a",{staticClass:"approximation-list__set-type",on:{click:e.setType}},[t("i",{staticClass:"icon-settings"}),a._v(" 设置éè¯·ç¶æ")]),t("a",{staticClass:"approximation-list__set-type",on:{click:e.setInvitationWhitelist}},[t("i",{staticClass:"icon-approximation"}),a._v(" 管çé请ç½åå")])]),t("el-tabs",{staticClass:"approximation-list__tabs",model:{value:e.state,callback:function(r){e.state=r},expression:"state"}},[t("el-tab-pane",{attrs:{name:"pending"}},[t("div",{attrs:{slot:"label"},slot:"label"},[a._v(" æªå¤ç ")])]),t("el-tab-pane",{attrs:{label:"å·²æ¥å",name:"accepted"}}),t("el-tab-pane",{attrs:{label:"å·²æç»",name:"rejected"}})],1)],1),!e.isBatchReject&&e.state==="pending"?t("section",{staticClass:"py-[15p
9x] px-[30px] flex items-center justify-between"},[t("div",{staticClass:"flex items-center"},[t("el-select",{staticClass:"approximation-list__order-select",model:{value:e.order,callback:function(r){e.order=r},expression:"order"}},a._l(e.orderOptions,function(r){return t("el-option",{key:r.value,attrs:{label:r.label,value:r.value}})}),1),t("div",{staticClass:"ml-[20px]"},[t(e.ApproximationDrawTypeFilter,{attrs:{value:e.selectedDrawTypeId,"user-id":e.currentUser.id},on:{confirm:e.confirmDrawTypeFilter}})],1),t("div",{staticClass:"ml-[20px] flex items-center gap-[10px]"},[t("label",{staticClass:"cursor-pointer text-text-60 text-[14px] leading-[20px]",attrs:{for:"approximation-alternative-switch"}},[a._v("ä» çå¤é")]),t("ElSwitch",{attrs:{id:"approximation-alternative-switch",value:e.onlyAlternative},on:{input:function(r){return e.changeQuery("onlyAlternative",r)}}})],1),t("div",{staticClass:"ml-[20px] flex items-center gap-[10px]"},[t("label",{staticClass:"cursor-pointer text-text-60 text-[14px] leading-[20px]",attrs:{for:"approximation-image-view-switch"}},[a._v("å¾çè§å¾")]),t("ElTooltip",{ref:"imageViewTooltipRef",attrs:{value:e.showImageViewTip,manual:!0,effect:"dark",placement:"top","popper-class":"approximation-image-view-tooltip"},scopedSlots:a._u([{key:"content",fn:function(){return[t("span",[a._v("ç¹å»è¿é忢æ§çè§å¾")])]},proxy:!0}],null,!1,3071744554)},[t("span",{ref:"imageViewTooltipReferenceRef",staticClass:"inline-flex items-center"},[t("ElSwitch",{attrs:{id:"approximation-image-view-switch",value:e.isImageView},on:{input:e.changeImageView}})],1)])],1)],1),t("mhs-button",{staticClass:"!py-[8px] !px-[16px] !rounded-[8px]",on:{click:e.changeBatchReject}},[t("i",{staticClass:"icon-dismiss"}),a._v(" æ¹éæç» ")])],1):a._e(),t("el-checkbox-group",{class:{"block flex-1 bg-white px-[30px] py-[15px]":!e.isBatchReject},model:{value:e.selectedApproximations,callback:function(r){e.selectedApproximations=r},expression:"selectedApproximations"}},[t(e.InfiniteScrollLoader,{directives:[{name:"mhs-loading",rawName:"v-mhs-loading",value:{visible:e.loading&&e.page===1,propsData:{text:"æ£å¨å è½½é请信æ¯",indie:!1}},expression:` 10 { 11 visible: loading && page === 1, 12 propsData: { text: 'æ£å¨å è½½é请信æ¯', indie: false }, 13 } 14 `}],attrs:{page:e.page,"page-count":e.pageCount,loading:e.loading,"load-method":e.loadApproximations,contents:e.approximations,"loading-insert-type":"embed","loading-type":"tips"},on:{"update:page":function(r){e.page=r}}},[a._l(e.approximations,function(r,n){return t("div",{key:r.id,class:{"mb-[15px] last:mb-0":!e.isBatchReject},on:{click:function(l){return e.toggleCheckbox(r.id)}}},[e.isBatchReject&&r.state!=="accepted"?t("section",{class:e.batchRejectClasses},[t("el-checkbox",{staticClass:"approximation-checkbox",attrs:{label:r.id,checked:e.isSelected(r.id)},on:{change:function(l){return e.toggleCheckbox(r.id)}}}),t(e.ApproximationCell,{attrs:{"is-batch-reject":e.isBatchReject,approximation:r,"user-id":e.currentUser.id,"view-mode":e.approximationViewMode},on:{remove:function(l){return e.removeApproximation(r)},update:function(l){return e.updateApproximation(n,l)},"toggle-alternative":function(l){return e.toggleAlternative(n,l)}}})],1):a._e(),e.isBatchReject?a._e():t("section",[t(e.ApproximationCell,{attrs:{approximation:r,"user-id":e.currentUser.id,"view-mode":e.approximationViewMode},on:{remove:function(l){return e.removeApproximation(r)},update:function(l){return e.updateApproximation(n,l)},"toggle-alternative":function(l){return e.toggleAlternative(n,l)}}})],1)])}),t("empty-tip",{staticClass:"py-[50px]",attrs:{slot:"empty",type:"touchfish",tip:e.emptyTips},slot:"empty"}),t("div",{staticClass:"dashboard__loaded-all-tips",attrs:{slot:"loadedAll"},slot:"loadedAll"},[a._v(" æ²¡ææ´å¤è®°å½äº ")])],2)],1)],1)},We=[],Ye=Z(Le,Ue,We,!1,null,"8b80a0b7");const ot=Ye.exports;export{ot as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.