import{_ as R}from"./BSvRi2v7.js";import{d as z,r as _,F as E,J as T,x as M,b as h,e as G,w as I,f as i,B as U,z as j,h as l,i as q,g as C,M as L,j as A,T as S,V as D,a2 as J}from"./entry.js";import{C as $}from"./D9Ut--P7.js";const H={class:"text-left w80per",style:{margin:"auto"}},K={class:"fw-b"},Q={key:0,class:"mt8"},W=i("span",null,"フォルダ",-1),X={class:"mt8"},Y=i("span",null,"Myフォルダ",-1),te=z({__name:"ModalCopyPrompt",props:{targetName:{},prompt:{},toFolderList:{},toMyFolderList:{},zIndex:{}},emits:["copy"],setup(k,{emit:B}){const o=k,w=B,b=_(null),x=_(null),g=E(),f=T().isCpr(),O=M(()=>f&&o.toMyFolderList?o.toMyFolderList.length>0:o.toFolderList.length>0),a=M(()=>f?g.getSelectOptionForCategory(o.toFolderList):g.getSelectOptionGroupsForCategory(o.toFolderList)),v=M(()=>o.toMyFolderList?[...g.getSelectOptionForCategory(o.toMyFolderList)]:[]),F=e=>e.length>0&&"options"in e[0],y=(e,t=!1)=>{var m,r,s,d,V;const n=t?o.prompt.promptBoxMyCategoryId:o.prompt.promptBoxCategoryId;return F(e)?((m=e.flatMap(c=>c.options).find(c=>n===c.value))==null?void 0:m.value)||((s=(r=e[0])==null?void 0:r.options[0])==null?void 0:s.value)||0:((d=e.find(c=>n===c.value))==null?void 0:d.value)||((V=e[0])==null?void 0:V.value)||0},p=_(y(a.value)),u=_(y(v.value,!0)),P=()=>{p.value=y(a.value),u.value=y(v.value,!0)},N=()=>{var r,s;const e=f?o.prompt.promptBoxCategoryId:p.value,t=(r=o.toFolderList)==null?void 0:r.find(d=>d.id===e),n=((s=o.toMyFolderList)==null?void 0:s.find(d=>d.id===u.value))||{id:0,name:"フォルダ外"};$([b,x])&&(w("copy",{toFolder:t,toMyFolder:n}),S.hideModal("ModalCopyPrompt"))};return(e,t)=>{const n=R,m=D,r=J;return h(),G(r,{name:"ModalCopyPrompt",title:"プロンプトを複製",width:580,"z-index":o.zIndex,onOpened:P},{body:I(()=>[i("div",H,[i("span",null,[i("span",K,"「"+U(e.targetName)+"」",1),j("を以下へ複製します。")]),!l(f)&&o.pageType!=="SharePrompt"?(h(),q("div",Q,[W,C(n,{ref_key:"folderRef",ref:b,modelValue:l(p),"onUpdate:modelValue":t[0]||(t[0]=s=>L(p)?p.value=s:null),required:"",class:"mt4","option-groups":F(l(a))?l(a):void 0,options:F(l(a))?void 0:l(a),style:{margin:"auto"}},null,8,["modelValue","option-groups","options"])])):A("",!0),i("div",X,[Y,C(n,{ref_key:"myFolderRef",ref:x,modelValue:l(u),"onUpdate:modelValue":t[1]||(t[1]=s=>L(u)?u.value=s:null),class:"mt4",options:l(v),style:{margin:"auto"}},null,8,["modelValue","options"])])])]),footer:I(()=>[C(m,{"section-class":"bgc-white pd0 mt16","submit-label":"複製する","cancel-label":"キャンセル",wide:"","submit-disabled":!l(O),onSubmit:N,onCancel:t[2]||(t[2]=s=>("Modal"in e?e.Modal:l(S)).hideModal("ModalCopyPrompt"))},null,8,["submit-disabled"])]),_:1},8,["z-index"])}}});export{te as _};
