airi / assets /CardCreationDialog-BYY8X8ME.js
nekomeowww's picture
release: build 389ee0a57c1117111067eecd17bf4207ebd8a52d
ff2d1d3
import{b as e}from"./DialogTitle-4J3ZFQI8.js";import{A as t,cL as n,cO as r,cQ as i,cU as a,cW as o,cX as s,cY as c,cj as l,d$ as u,dS as ee,dU as d,dV as f,dW as p,dX as m,dY as h,dZ as g,d_ as _,e2 as v,e7 as y,e8 as te,ec as ne,ef as b,eh as x,ei as S,ek as C,em as w,en as T,eq as E,er as D,ev as O,u as re}from"./index-B9WIljdS.js";var k=D(((exports,t)=>{function n(e){return e.toLowerCase()}t.exports=n})),A=D(((exports,t)=>{var n=k();t.exports=n})),j=D(((exports,t)=>{function n(e,t,n){return e.replace(t,n)}t.exports=n})),M=D(((exports,t)=>{var n=j();t.exports=n})),N=D(((exports,t)=>{var n=String.prototype.trim!==void 0;t.exports=n})),P=D(((exports,t)=>{var n=String.prototype.trim;t.exports=n})),F=D(((exports,t)=>{var n=P(),r=`
\r
\f\v            \u2028\u2029   `,i=`᠎`;function a(){return n.call(r)===``&&n.call(i)===i}t.exports=a})),I=D(((exports,t)=>{var n=M(),r=/^[\u0020\f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]*([\S\s]*?)[\u0020\f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]*$/;function i(e){return n(e,r,`$1`)}t.exports=i})),L=D(((exports,t)=>{var n=P();function r(e){return n.call(e)}t.exports=r})),R=D(((exports,t)=>{var n=N(),r=F(),i=I(),a=L(),o;o=n&&r()?a:i,t.exports=o})),z=D(((exports,t)=>{var n=A(),r=M(),i=R(),a=/\s+/g,o=/[!"'(),–.:;<>?`{}|~\/\\\[\]_#$*&^@%]+/g,s=/([a-z0-9])([A-Z])/g;function c(e){return e=r(e,o,` `),e=r(e,s,`$1 $2`),e=i(e),e=r(e,a,`-`),n(e)}t.exports=c})),B=D(((exports,t)=>{var n=z();t.exports=n})),V=O(B());const H={class:`w-full flex flex-col gap-5`},U={class:`mt-4`},W={class:`border-b border-neutral-200 dark:border-neutral-700`},G={class:`flex justify-center -mb-px sm:justify-start space-x-1`},K=[`onClick`],ie={class:`flex items-center gap-1`},ae={key:0,class:`w-full rounded-xl bg-red900`},oe={class:`w-full p-4`},se={key:1,class:`tab-content ml-auto mr-auto w-95%`},ce={class:`mb-3`},le={class:`input-list ml-auto mr-auto w-90% flex flex-row flex-wrap justify-center gap-8`},ue={key:2,class:`tab-content ml-auto mr-auto w-95%`},de={class:`input-list ml-auto mr-auto w-90% flex flex-row flex-wrap justify-center gap-8`},fe={key:3,class:`tab-content ml-auto mr-auto w-95%`},pe={class:`input-list ml-auto mr-auto w-90% flex flex-row flex-wrap justify-center gap-8`},me={class:`ml-auto mr-1 flex flex-row gap-2`};var q=u({__name:`CardCreationDialog`,props:v({modelValue:{type:Boolean}},{modelValue:{type:Boolean},modelModifiers:{}}),emits:v([`update:modelValue`],[`update:modelValue`]),setup(r,{emit:u}){let v=u,D=ne(r,`modelValue`),{t:O}=t(),k=re(),A=S(``),j=[{id:`identity`,label:O(`settings.pages.card.creation.identity`),icon:`i-solar:emoji-funny-square-bold-duotone`},{id:`behavior`,label:O(`settings.pages.card.creation.behavior`),icon:`i-solar:chat-round-line-bold-duotone`},{id:`settings`,label:O(`settings.pages.card.creation.settings`),icon:`i-solar:settings-bold-duotone`}],M=d({get:()=>j.find(e=>e.id===A.value)?A.value:j[0]?.id||``,set:e=>{A.value=e}}),N=S(!1),P=S(``);function F(e){let t=C(e);if(t.name.length>0)if(/^(?:\d+\.)+\d+$/.test(t.version))if(t.description.length>0)if(t.personality.length>0)if(t.scenario.length>0)if(t.systemPrompt.length>0){if(!(t.postHistoryInstructions.length>0))return N.value=!0,P.value=O(`settings.pages.card.creation.errors.posthistoryinstructions`),!1}else return N.value=!0,P.value=O(`settings.pages.card.creation.errors.systemprompt`),!1;else return N.value=!0,P.value=O(`settings.pages.card.creation.errors.scenario`),!1;else return N.value=!0,P.value=O(`settings.pages.card.creation.errors.personality`),!1;else return N.value=!0,P.value=O(`settings.pages.card.creation.errors.description`),!1;else return N.value=!0,P.value=O(`settings.pages.card.creation.errors.version`),!1;else return N.value=!0,P.value=O(`settings.pages.card.creation.errors.name`),!1;return N.value=!1,k.addCard(t),D.value=!1,!0}let I=S({name:O(`settings.pages.card.creation.defaults.name`),nickname:void 0,version:`1.0`,description:``,notes:void 0,personality:O(`settings.pages.card.creation.defaults.personality`),scenario:O(`settings.pages.card.creation.defaults.scenario`),systemPrompt:O(`settings.pages.card.creation.defaults.systemprompt`),postHistoryInstructions:O(`settings.pages.card.creation.defaults.posthistoryinstructions`),greetings:[],messageExample:[]});function L(e,t){return d({get:()=>I.value[e]??``,set:n=>{let r=n.trim();I.value[e]=r.length>0?t?t(r):r:``}})}let R=L(`name`,e=>(0,V.default)(e)),z=L(`nickname`),B=L(`description`),q=L(`notes`),J=L(`personality`),Y=L(`scenario`),X=d({get:()=>I.value.greetings??[],set:e=>{I.value.greetings=e||[]}}),Z=L(`version`),Q=L(`systemPrompt`),$=L(`postHistoryInstructions`);return(t,r)=>(y(),p(w(c),{open:D.value,"onUpdate:open":r[12]||=e=>v(`update:modelValue`,e)},{default:b(()=>[_(w(a),null,{default:b(()=>[_(w(o),{class:`data-[state=open]:animate-fadeIn data-[state=closed]:animate-fadeOut fixed inset-0 z-100 bg-black/50 backdrop-blur-sm`}),_(w(s),{class:`data-[state=open]:animate-contentShow data-[state=closed]:animate-contentHide fixed left-1/2 top-1/2 z-100 m-0 max-h-[90vh] max-w-6xl w-[92vw] flex flex-col overflow-auto border border-neutral-200 rounded-xl bg-white p-5 shadow-xl 2xl:w-[60vw] lg:w-[80vw] md:w-[85vw] xl:w-[70vw] -translate-x-1/2 -translate-y-1/2 dark:border-neutral-700 dark:bg-neutral-800 sm:p-6`},{default:b(()=>[f(`div`,H,[_(w(e),{"text-2xl":``,"font-normal":``,class:`from-primary-500 to-primary-400 bg-gradient-to-r bg-clip-text text-transparent`},{default:b(()=>[g(E(w(O)(`settings.pages.card.create_card`)),1)]),_:1}),f(`div`,U,[f(`div`,W,[f(`div`,G,[(y(),h(ee,null,te(j,e=>f(`button`,{key:e.id,class:T([`px-4 py-2 text-sm font-medium`,[M.value===e.id?`text-primary-600 dark:text-primary-400 border-b-2 border-primary-500 dark:border-primary-400`:`text-neutral-500 dark:text-neutral-400 hover:text-neutral-700 dark:hover:text-neutral-300`]]),onClick:t=>M.value=e.id},[f(`div`,ie,[f(`div`,{class:T(e.icon)},null,2),g(` `+E(e.label),1)])],10,K)),64))])])]),N.value?(y(),h(`div`,ae,[f(`p`,oe,E(P.value),1)])):m(``,!0),M.value===`identity`?(y(),h(`div`,se,[f(`p`,ce,E(w(O)(`settings.pages.card.creation.fields_info.subtitle`)),1),f(`div`,le,[_(w(i),{modelValue:w(R),"onUpdate:modelValue":r[0]||=e=>x(R)?R.value=e:null,label:w(O)(`settings.pages.card.creation.name`),description:w(O)(`settings.pages.card.creation.fields_info.name`),required:!0},null,8,[`modelValue`,`label`,`description`]),_(w(i),{modelValue:w(z),"onUpdate:modelValue":r[1]||=e=>x(z)?z.value=e:null,label:w(O)(`settings.pages.card.creation.nickname`),description:w(O)(`settings.pages.card.creation.fields_info.nickname`)},null,8,[`modelValue`,`label`,`description`]),_(w(i),{modelValue:w(B),"onUpdate:modelValue":r[2]||=e=>x(B)?B.value=e:null,label:w(O)(`settings.pages.card.creation.description`),"single-line":!1,required:!0,description:w(O)(`settings.pages.card.creation.fields_info.description`)},null,8,[`modelValue`,`label`,`description`]),_(w(i),{modelValue:w(q),"onUpdate:modelValue":r[3]||=e=>x(q)?q.value=e:null,label:w(O)(`settings.pages.card.creator_notes`),"single-line":!1,description:w(O)(`settings.pages.card.creation.fields_info.notes`)},null,8,[`modelValue`,`label`,`description`])])])):M.value===`behavior`?(y(),h(`div`,ue,[f(`div`,de,[_(w(i),{modelValue:w(J),"onUpdate:modelValue":r[4]||=e=>x(J)?J.value=e:null,label:w(O)(`settings.pages.card.personality`),"single-line":!1,required:!0,description:w(O)(`settings.pages.card.creation.fields_info.personality`)},null,8,[`modelValue`,`label`,`description`]),_(w(i),{modelValue:w(Y),"onUpdate:modelValue":r[5]||=e=>x(Y)?Y.value=e:null,label:w(O)(`settings.pages.card.scenario`),"single-line":!1,required:!0,description:w(O)(`settings.pages.card.creation.fields_info.scenario`)},null,8,[`modelValue`,`label`,`description`]),_(w(n),{modelValue:X.value,"onUpdate:modelValue":r[6]||=e=>X.value=e,label:w(O)(`settings.pages.card.creation.greetings`),description:w(O)(`settings.pages.card.creation.fields_info.greetings`)},null,8,[`modelValue`,`label`,`description`])])])):M.value===`settings`?(y(),h(`div`,fe,[f(`div`,pe,[_(w(i),{modelValue:w(Q),"onUpdate:modelValue":r[7]||=e=>x(Q)?Q.value=e:null,label:w(O)(`settings.pages.card.systemprompt`),"single-line":!1,required:!0,description:w(O)(`settings.pages.card.creation.fields_info.systemprompt`)},null,8,[`modelValue`,`label`,`description`]),_(w(i),{modelValue:w($),"onUpdate:modelValue":r[8]||=e=>x($)?$.value=e:null,label:w(O)(`settings.pages.card.posthistoryinstructions`),"single-line":!1,required:!0,description:w(O)(`settings.pages.card.creation.fields_info.posthistoryinstructions`)},null,8,[`modelValue`,`label`,`description`]),_(w(i),{modelValue:w(Z),"onUpdate:modelValue":r[9]||=e=>x(Z)?Z.value=e:null,label:w(O)(`settings.pages.card.creation.version`),required:!0,description:w(O)(`settings.pages.card.creation.fields_info.version`)},null,8,[`modelValue`,`label`,`description`])])])):m(``,!0),f(`div`,me,[_(w(l),{variant:`secondary`,icon:`i-solar:undo-left-bold-duotone`,label:w(O)(`settings.pages.card.cancel`),disabled:!1,onClick:r[10]||=e=>D.value=!1},null,8,[`label`]),_(w(l),{variant:`primary`,icon:`i-solar:check-circle-bold-duotone`,label:w(O)(`settings.pages.card.creation.create`),disabled:!1,onClick:r[11]||=e=>F(I.value)},null,8,[`label`])])])]),_:1})]),_:1})]),_:1},8,[`open`]))}}),J=r(q,[[`__scopeId`,`data-v-71e6e2f1`]]);export{J as b};