PageSourceSearch

https://ximeng.ai/_nuxt/StyleReferencePanel.e535d7b9.js

js ximeng.ai collected 2026-10-05 14:25:02 UTC 13,605 bytes, 1 lines download raw bytes

1import{E as e,a as l,b as t}from"./el-dropdown.611d7290.js";import{q as a,O as r,k as o,ao as s,w as i,o as n,n as u,B as d,A as c,K as v,L as p,I as y,P as m,Q as f,U as h,J as g,z as b,a8 as R,a9 as C,W as k,M as w,aj as S,l as x,bm as I,E,T as F,_ as L}from"./entry.877ca4ca.js";import"./el-scrollbar.fd7e9da8.js";import{s as _,a as A,f as N}from"./styleReferenceFeed.d2b10c28.js";import"./el-switch.24616f25.js";import"./validator.b522f35e.js";import"./castArray.6fd37ac0.js";const O={class:"srp-root"},K={class:"srp-top"},M={class:"srp-segment"},P=["onClick"],V={class:"srp-search"},T=["placeholder"],z=["title"],U=["title"],j={class:"srp-toolbar"},B={class:"srp-cats-wrap"},G={class:"srp-cats"},J=["onClick"],$={class:"srp-toolbar-right"},D={key:0,class:"srp-model-pill"},Z={type:"button",class:"srp-sort-btn"},H={key:0,class:"srp-feed-error"},q={key:1,class:"srp-feed-loading"},Q={key:2,class:"srp-empty"},W={key:3,class:"srp-grid"},Y=["onClick"],X={class:"srp-thumb"},ee=["src","alt"],le={key:1,class:"srp-thumb-placeholder","aria-hidden":"true"},te={class:"srp-thumb-meta"},ae=["onClick"],re={class:"srp-card-body"},oe={class:"srp-title"},se={class:"srp-author"},ie=["src"],ne={class:"srp-author-name"},ue={key:5,class:"srp-feed-loading-more"},de={class:"srp-gallery-hint"},ce={class:"srp-gallery-grid"},ve=["onClick"],pe=["src","alt"],ye="promptEditor_styleRefFavoriteItems",me="promptEditor_styleRefRecentItems",fe=L(a({__name:"StyleReferencePanel",props:{modelValue:{type:Boolean},modelLabel:{}},emits:["update:modelValue","apply"],setup(a,{emit:L}){function normalizeStyleRefItem(e){const l="string"==typeof e.cover?e.cover.trim():"",t=(Array.isArray(e.styleGallery)?e.styleGallery:[]).filter((e=>"string"==typeof e&&!!e.trim())),a=t.length?t:l?[l]:[],r=l||a[0]||"",o="string"==typeof e.titleEn?e.titleEn.trim():"",s="string"==typeof e.authorNickname?e.authorNickname.trim():"",i="string"==typeof e.authorNicknameEn?e.authorNicknameEn.trim():"",n="USER_PROJECT"===e.sourceType?"USER_PROJECT":"STYLE_REF";return{...e,sourceType:n,cover:r,styleGallery:a,titleEn:o,authorNickname:s,authorNicknameEn:i}}function galleryUrlsFor(e){const l=e.styleGallery;return Array.isArray(l)&&l.length?l.filter((e=>"string"==typeof e&&e.trim())):e.cover?[e.cover]:[]}function thumbUrlFor(e){return function(e,l=20){if(!e||"string"!=typeof e)return e;const t=e.trim();if(!t)return e;try{const e=new URL(t),a=/\.aliyuncs\.com$/i.test(e.hostname),r=/(^|\.)aidesigns\.top$/i.test(e.hostname);if(!a&&!r)return t;if(e.searchParams.has("x-oss-process"))return t;const o=Math.max(1,Math.min(100,Math.round(l)));return e.searchParams.set("x-oss-process",`image/resize,p_${o}`),e.toString()}catch{return t}}(e.cover,20)}const fe=a,he=L,{t:ge,locale:be}=r();function displayTitle(e){return _(e,String(be.value))}function displayAuthor(e){return A(e,String(be.value))}const Re=x({get:()=>fe.modelValue,set:e=>he("update:modelValue",e)}),Ce=[{id:"explore",labelKey:"editor.styleRefTabExplore"},{id:"favorites",labelKey:"editor.styleRefTabFavorites"},{id:"recent",labelKey:"editor.styleRefTabRecent"}],ke=[{id:"all",labelKey:"editor.styleRefCatRecommend"},{id:"photo",labelKey:"editor.styleRefCatPhoto"},{id:"ecommerce",labelKey:"editor.styleRefCatEcommerce"},{id:"anime",labelKey:"editor.styleRefCatAnime"},{id:"illustration",labelKey:"editor.styleRefCatIllustration"},{id:"graphic",labelKey:"editor.styleRefCatGraphic"},{id:"architecture",labelKey:"editor.styleRefCatArchitecture"},{id:"creative",labelKey:"editor.styleRefCatCreative"},{id:"cultural",labelKey:"editor.styleRefCatCultural"},{id:"novel",labelKey:"editor.styleRefCatNovel"}],we=o("explore"),Se=o("all"),xe=o(""),Ie=o("recommend"),Ee=o(loadFavoriteItems()),Fe=o(loadRecentItems()),Le=o(!1),_e=o(null),Ae=x((()=>{const e=_e.value;return e?galleryUrlsFor(e):[]})),Ne=x((()=>{const e=_e.value;if(!e)return ge("editor.styleRefPickImageTitle");return _(e,String(be.value)).trim()||ge("editor.styleRefPickImageTitle")})),Oe=o([]),Ke=o(0),Me=o(1),Pe=o(!1),Ve=o(""),Te=o(null),ze=o(null);let Ue=null,je=null;function loadFavoriteItems(){try{const e=localStorage.getItem(ye);if(!e)return[];const l=JSON.parse(e);return Array.isArray(l)?l.filter((e=>null==e?void 0:e.id)).map((e=>normalizeStyleRefItem(e))):[]}catch{return[]}}function loadRecentItems(){try{const e=localStorage.getItem(me);if(!e)return[];const l=JSON.parse(e);return Array.isArray(l)?l.filter((e=>null==e?void 0:e.id)).map((e=>normalizeStyleRefItem(e))).slice(0,24):[]}catch{return[]}}function toggleFavorite(e){const l=Ee.value.findIndex((l=>l.id===e.id));l>=0?Ee.value.splice(l,1):Ee.value.unshift(normalizeStyleRefItem({...e})),Ee.value=[...Ee.value],localStorage.setItem(ye,JSON.stringify(Ee.value))}function pushRecent(e){const l=normalizeStyleRefItem(e);Fe.value=[l,...Fe.value.filter((e=>e.id!==l.id))].slice(0,24),localStorage.setItem(me,JSON.stringify(Fe.value.slice(0,24)))}const Be=x((()=>Ke.value>0&&Oe.value.length<Ke.value));async function loadFeedPage(e){if(!fe.modelValue)return;if("explore"!==we.value)return;if(e){if(Pe.value)return;if(!Be.value)return}Pe.value=!0,null==Ue||Ue.abort(),Ue=new AbortController,e||(Ve.value="",Me.value=1,Oe.value=[]);const l=e?Me.value:1;try{const t=await N({page:l,categoryId:Se.value,sortMode:Ie.value,signal:null==Ue?void 0:Ue.signal,includeUserProjects:!1});if(0!==t.rawCode)return void(e||(Ve.value=t.message||ge("editor.styleRefLoadError")));if(Ke.value=t.total,Me.value=t.page+1,e){const e=new Set(Oe.value.map((e=>e.id))),l=[];for(const a of t.items)a&&a.id&&!e.has(a.id)&&(e.add(a.id),l.push(a));l.length&&(Oe.value=[...Oe.value,...l])}else Oe.value=t.items}catch(t){if(I(t))return;e||(Ve.value=(null==t?void 0:t.message)||ge("editor.styleRefLoadError"))}finally{Pe.value=!1,await u(),setupLoadMoreObserver()}}let Ge=null;function setupLoadMoreObserver(){if("explore"!==we.value)return null==je||je.disconnect(),je=null,void(Ge=null);const e=Te.value,l=ze.value;e&&l&&(je&&Ge===l||(null==je||je.disconnect(),Ge=l,je=new IntersectionObserver((e=>{e.some((e=>e.isIntersecting))&&Be.value&&!Pe.value&&loadFeedPage(!0)}),{root:e,rootMargin:"120px",threshold:0}),je.observe(l)))}s((()=>{null==Ue||Ue.abort(),null==je||je.disconnect()}));const Je=x((()=>"hot"===Ie.value?ge("editor.styleRefSortHot"):"new"===Ie.value?ge("editor.styleRefSortNew"):ge("editor.styleRefSortRecommend")));function onSortCommand(e){"hot"!==e&&"new"!==e&&"recommend"!==e||(Ie.value=e)}const $e=x((()=>{let e=[];e="favorites"===we.value?[...Ee.value]:"recent"===we.value?[...Fe.value]:[...Oe.value],"explore"!==we.value&&"all"!==Se.value&&(e=e.filter((e=>e.category===Se.value)));const l=xe.value.trim().toLowerCase();l&&(e=e.filter((e=>[e.title,e.titleEn,e.author,e.authorNickname,e.authorNicknameEn,e.tags].filter((e=>"string"==typeof e)).join(" ").toLowerCase().includes(l))));const t=[...e];return"explore"!==we.value&&("hot"===Ie.value?t.sort(((e,l)=>l.uses-e.uses)):"new"===Ie.value&&t.sort(((e,l)=>Number(l.id)-Number(e.id)))),t})),De=x((()=>$e.value)),Ze=x((()=>"favorites"===we.value?ge("editor.styleRefEmptyFavorites"):"recent"===we.value?ge("editor.styleRefEmptyRecent"):ge("editor.styleRefEmptySearch")));function onGalleryDialogClosed(){_e.value=null}function applyItemFinal(e){const l=normalizeStyleRefItem(e);pushRecent(l),he("apply",{text:_(l,String(be.value)),item:l}),E.success(ge("editor.styleRefApplied")),Re.value=!1}function onDialogClosed(){xe.value=""}function noop(){}function refreshOnOpen(){Ee.value=loadFavoriteItems(),Fe.value=loadRecentItems(),"explore"===we.value&&loadFeedPage(!1)}return i((()=>fe.modelValue),(e=>{if(!e)return Le.value=!1,void(_e.value=null);refreshOnOpen()})),n((()=>{fe.modelValue&&refreshOnOpen()})),i([we,Se,Ie],(()=>{fe.modelValue&&"explore"===we.value&&loadFeedPage(!1)})),i((()=>we.value),(e=>{fe.modelValue&&"explore"===e&&u((()=>setupLoadMoreObserver()))})),(r,o)=>{const s=e,i=l,n=t,u=F;return d(),c(m,null,[v(u,{modelValue:Re.value,"onUpdate:modelValue":o[2]||(o[2]=e=>Re.value=e),"show-close":!1,width:"min(1560px, 98vw)",class:"style-reference-dialog","modal
1-class":"style-reference-dialog-overlay","append-to-body":"","align-center":"","destroy-on-close":"","z-index":10050,onClosed:onDialogClosed},{default:p((()=>[y("div",O,[y("div",K,[y("div",M,[(d(),c(m,null,f(Ce,(e=>y("button",{key:e.id,type:"button",class:h(["srp-seg-btn",{active:we.value===e.id}]),onClick:l=>we.value=e.id},g(b(ge)(e.labelKey)),11,P))),64))]),y("div",V,[R(y("input",{"onUpdate:modelValue":o[0]||(o[0]=e=>xe.value=e),type:"search",class:"srp-search-input",placeholder:b(ge)("editor.styleRefSearchPlaceholder")},null,8,T),[[C,xe.value]]),y("button",{type:"button",class:"srp-search-submit",title:b(ge)("editor.styleRefSearch"),onClick:noop},[...o[4]||(o[4]=[y("svg",{width:"16",height:"16",viewBox:"0 0 20.5 21",fill:"none","aria-hidden":"true"},[y("path",{d:"M9.03809 0C14.0298 0 18.0769 4.04645 18.0771 9.03809C18.0771 11.2831 17.2563 13.3355 15.9014 14.916L20.4951 19.4971L19.083 20.9131L14.4414 16.2842C12.9342 17.4099 11.064 18.0771 9.03809 18.0771C4.04645 18.0769 0 14.0298 0 9.03809C0.000243259 4.0466 4.0466 0.000242672 9.03809 0ZM9.03809 2C5.15117 2.00024 2.00024 5.15117 2 9.03809C2 12.9252 5.15102 16.0769 9.03809 16.0771C12.9254 16.0771 16.0771 12.9254 16.0771 9.03809C16.0769 5.15102 12.9252 2 9.03809 2Z",fill:"currentColor"})],-1)])],8,z)]),y("button",{type:"button",class:"srp-close",title:b(ge)("editor.cancel"),onClick:o[1]||(o[1]=e=>Re.value=!1)},[...o[5]||(o[5]=[y("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"},[y("line",{x1:"18",y1:"6",x2:"6",y2:"18",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"}),y("line",{x1:"6",y1:"6",x2:"18",y2:"18",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"})],-1)])],8,U)]),y("div",j,[y("div",B,[y("div",G,[(d(),c(m,null,f(ke,(e=>y("button",{key:e.id,type:"button",class:h(["srp-cat",{active:Se.value===e.id}]),onClick:l=>Se.value=e.id},g(b(ge)(e.labelKey)),11,J))),64))])]),y("div",$,[a.modelLabel?(d(),c("div",D,g(a.modelLabel),1)):k("",!0),v(n,{trigger:"click",onCommand:onSortCommand},{dropdown:p((()=>[v(i,null,{default:p((()=>[v(s,{command:"recommend"},{default:p((()=>[w(g(b(ge)("editor.styleRefSortRecommend")),1)])),_:1}),v(s,{command:"hot"},{default:p((()=>[w(g(b(ge)("editor.styleRefSortHot")),1)])),_:1}),v(s,{command:"new"},{default:p((()=>[w(g(b(ge)("editor.styleRefSortNew")),1)])),_:1})])),_:1})])),default:p((()=>[y("button",Z,[y("span",null,g(Je.value),1),o[6]||(o[6]=y("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",class:"srp-caret","aria-hidden":"true"},[y("path",{d:"M4.3 5.8h7.4L8 10.5 4.3 5.8Z",fill:"currentColor","fill-opacity":"0.7"})],-1))])])),_:1})])]),y("div",{ref_key:"scrollRootRef",ref:Te,class:"srp-scroll"},[Ve.value&&"explore"===we.value?(d(),c("div",H,g(Ve.value),1)):k("",!0),"explore"===we.value&&Pe.value&&!Oe.value.length?(d(),c("div",q,g(b(ge)("editor.styleRefLoading")),1)):k("",!0),De.value.length||"explore"===we.value&&Pe.value||"explore"===we.value&&Ve.value?k("",!0):(d(),c("div",Q,g(Ze.value),1)),De.value.length?(d(),c("div",W,[(d(!0),c(m,null,f(De.value,(e=>{return d(),c("button",{key:e.id,type:"button",class:"srp-card",onClick:l=>function(e){const l=normalizeStyleRefItem(e),t=galleryUrlsFor(l);t.length<=1?applyItemFinal(1===t.length?{...l,cover:t[0]}:l):(_e.value=l,Le.value=!0)}(e)},[y("div",X,[e.cover?(d(),c("img",{key:0,src:thumbUrlFor(e),alt:displayTitle(e),loading:"lazy",decoding:"async"},null,8,ee)):(d(),c("div",le)),y("div",te,[o[7]||(o[7]=y("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true"},[y("path",{d:"M4.5 3v10L13 8 4.5 3z",fill:"currentColor"})],-1)),y("span",null,g(e.uses),1)]),y("button",{type:"button",class:h(["srp-fav",{on:(l=e.id,Ee.value.some((e=>e.id===l)))}]),onClick:S((l=>toggleFavorite(e)),["stop"])},[...o[8]||(o[8]=[y("svg",{width:"16",height:"14",viewBox:"0 0 23 20",fill:"none","aria-hidden":"true"},[y("path",{d:"M16.6 0c2.2 0 4.2.8 5.8 2.2 1.6 1.5 2.6 3.6 2.6 5.9 0 2.3-.8 4.4-2.2 6l-8.4 8.6c-.6.5-1.4.5-2 0L3.7 14C2 12.4 1 10.3 1 8.1 1 3.6 4.6 0 9.1 0c1.2 0 2.4.2 3.5.71.1-.5 2.3-.7 3.5-.7h1.5Z",stroke:"currentColor","stroke-width":"1.2",fill:"none"})],-1)])],10,ae)]),y("div",re,[y("p",oe,g(displayTitle(e)),1),y("div",se,[e.authorAvatar?(d(),c("img",{key:0,src:e.authorAvatar,alt:"",class:"srp-avatar"},null,8,ie)):k("",!0),y("span",ne,g(displayAuthor(e)),1)])])],8,Y);var l})),128))])):k("",!0),"explore"===we.value&&De.value.length?(d(),c("div",{key:4,ref_key:"loadMoreSentinelRef",ref:ze,class:"srp-load-sentinel","aria-hidden":"true"},null,512)):k("",!0),"explore"===we.value&&Pe.value&&Oe.value.length?(d(),c("div",ue,g(b(ge)("editor.styleRefLoading")),1)):k("",!0)],512)])])),_:1},8,["modelValue"]),v(u,{modelValue:Le.value,"onUpdate:modelValue":o[3]||(o[3]=e=>
1Le.value=e),class:"style-ref-gallery-dialog","modal-class":"style-ref-gallery-dialog-overlay","append-to-body":"","align-center":"",width:"min(1200px, 96vw)",title:Ne.value,"destroy-on-close":"","z-index":10060,onClosed:onGalleryDialogClosed},{default:p((()=>[y("p",de,g(b(ge)("editor.styleRefPickImageHint")),1),y("div",ce,[(d(!0),c(m,null,f(Ae.value,((e,l)=>(d(),c("button",{key:`${e}-${l}`,type:"button",class:"srp-gallery-tile",onClick:l=>function(e){const l=_e.value,t=null==e?void 0:e.trim();l&&t&&(Le.value=!1,_e.value=null,applyItemFinal({...l,cover:t}))}(e)},[y("img",{src:e,alt:`${_e.value?displayTitle(_e.value):""} ${l+1}`,loading:"lazy",decoding:"async"},null,8,pe)],8,ve)))),128))])])),_:1},8,["modelValue","title"])],64)}}}),[["__scopeId","data-v-ac878bb3"]]);export{fe 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.