PageSourceSearch

https://magiclight.ai/assets/oFY0QPiw.js

js magiclight.ai collected 2026-10-01 14:41:33 UTC 11,049 bytes, 1 lines download raw bytes

1import{d as Be,bh as ke,r as P,c as ee,w as V,o as Ie,M as $,N as z,Q as Pe,a2 as Ve,ak as te,u as ne,an as He,ab as $e,a4 as ze,Y as Me,n as Fe,_ as le}from"./B9hccdKs.js";function qe(u,y,O){const a=[],f=[...y];let b="",g=0;const S=()=>{b&&(a.push({kind:"text",text:b}),b="")};for(;g<u.length;){const i=f[0];if(i){const p=O(i),h=p.trimEnd();if(p&&u.startsWith(p,g)){S(),a.push({kind:"chip",chip:i}),f.shift(),g+=p.length;continue}if(h&&h!==p&&u.startsWith(h,g)){S(),a.push({kind:"chip",chip:i}),f.shift(),g+=h.length,b=p.slice(h.length);continue}}b+=u[g],g+=1}return S(),a}const Ke=/[\u200B\uFEFF\u200E\u200F\u2060]/g;function Ue(u){return u.replace(/\r\n?/g,"\n").replace(/\u00A0/g," ").replace(/\t/g," ").replace(Ke,"")}const je={class:"rich-prompt-input"},Ge=["contenteditable","aria-label","aria-disabled"],We={key:0,class:"rich-prompt-input-placeholder","aria-hidden":"true"},C="rich-prompt-input-chip",oe="rich-prompt-input-chip-label",re="rich-prompt-input-chip-image",ae="rich-prompt-input-chip-del",H="​",Xe=Be({__name:"index",props:{modelValue:{},chips:{default:()=>[]},serializeChip:{},chipLabelMaxLength:{default:30},chipDeleteVisible:{default:"always"},chipClickRemoves:{type:Boolean,default:!1},chipDeleteOnBackspace:{type:Boolean,default:!0},chipRemoveLabel:{},placeholder:{default:""},showPlaceholder:{type:Boolean,default:!0},ariaLabel:{},disabled:{type:Boolean},singleLine:{type:Boolean},newlineOnEnter:{type:Boolean,default:!0},truncateValue:{}},emits:["update:modelValue","chip-remove","value-truncated","focus","blur","keydown"],setup(u,{expose:y,emit:O}){const a=u,f=O,b=new Set(["ADDRESS","BLOCKQUOTE","DIV","DL","FIGURE","H1","H2","H3","H4","H5","H6","LI","OL","P","PRE","UL"]),g=new Set(["AUDIO","IMG","VIDEO"]),S=/\u200B/g,i=ke("editorRef"),p=P(!1),h=P(!1),M=P(!0);let L=a.modelValue,_="",N=!1,B=new Set;const se=ee(()=>a.disabled?"false":M.value?"plaintext-only":"true"),ie=ee(()=>!p.value&&a.showPlaceholder);let A=null;const ce=()=>{if(A!==null)return A;const e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),A=e.contentEditable==="plaintext-only",A},F=e=>e.replace(/\xA0/g," ").replace(S,""),q=e=>a.serializeChip?a.serializeChip(e):e.text,K=e=>a.chips.find(t=>t.id===e),R=(e,t,n)=>{var r,l,s;if(e.nodeType===Node.TEXT_NODE){const c=F((r=e.textContent)!=null?r:"");return c?(t.push(c),!1):n}const o=e;if((l=o.classList)!=null&&l.contains(C)){const c=K((s=o.dataset.chipId)!=null?s:"");return c&&t.push(q(c)),!1}if(o.tagName==="BR")return t.push("\n"),!1;if(g.has(o.tagName))return n;if(b.has(o.tagName)){n||t.push("\n");let c=!0;return o.childNodes.forEach(d=>{c=R(d,t,c)&&c}),!1}return o.childNodes.forEach(c=>{n=R(c,t,n)&&n}),!1},U=e=>{const t=[];let n=!0;return e.childNodes.forEach(o=>{n=R(o,t,n)&&n}),t.join("")},ue=e=>{let t=e.lastChild;for(;t&&t.nodeType===Node.TEXT_NODE&&t.textContent==="";)t=t.previousSibling;return(t==null?void 0:t.tagName)==="BR"},j=()=>{const e=i.value;if(!e)return"";const t=U(e);return ue(e)?t.replace(/\n$/,""):t},de=(e,t)=>{let n=0,o=0;for(;n<e.length&&o<t;)e[n]!==H&&(o+=1),n+=1;return n},fe=e=>{const t=[];return R(e,t,!0),t.join("").length},G=e=>{var n;const t=document.createElement("img");return t.className=re,t.src=(n=e.image)!=null?n:"",t.alt="",t},W=e=>{var l;const t=document.createElement("span");t.className=C,t.contentEditable="false",t.dataset.chipId=e.id,e.image&&t.appendChild(G(e));const n=document.createElement("span");n.className=oe,n.textContent=e.label.slice(0,a.chipLabelMaxLength),t.appendChild(n);const o=document.createElement("button");o.type="button",o.className=ae,o.textContent="×";const r=(l=a.chipRemoveLabel)==null?void 0:l.call(a,e);return r&&o.setAttribute("aria-label",r),o.addEventListener("mousedown",s=>s.stopPropagation()),o.addEventListener("click",s=>{s.preventDefault(),s.stopPropagation(),k(e.id)}),t.appendChild(o),a.chipClickRemoves&&t.addEventListener("mousedown",s=>{s.preventDefault(),k(e.id)}),t},pe=(e,t)=>{var c;const n=e.querySelector(".".concat(re));t.image&&n instanceof HTMLImageElement?n.getAttribute("src")!==t.image&&(n.src=t.image):t.image?e.prepend(G(t)):n&&n.remove();const o=e.querySelector(".".concat(oe)),r=t.label.slice(0,a.chipLabelMaxLength);o&&o.textContent!==r&&(o.textContent=r);const l=e.querySelector(".".concat(ae)),s=(c=a.chipRemoveLabel)==null?void 0:c.call(a,t);l&&s&&l.setAttribute("aria-label",s)},X=e=>{var t,n;return(n=(t=i.value)==null?void 0:t.querySelector(".".concat(C,'[data-chip-id="').concat(e,'"]')))!=null?n:null},Q=()=>a.chips.map(e=>{var t;return"".concat(e.id,":").concat(e.label,":").concat((t=e.image)!=null?t:"")}).join("|"),x=e=>{const t=window.getSelection();t&&(t.removeAllRanges(),t.addRange(e))},he=(e,t)=>{const n=[];let o=t;for(;o&&o!==e;){const r=o.parentNode;if(!r)return null;n.unshift(Array.prototype.indexOf.call(r.childNodes,o)),o=r}return o===e?n:null},w=()=>{const e=i.value,t=window.getSelection();if(!e||!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);if(!n.collapsed||!e.contains(n.startContainer))return null;const o=he(e,n.startContainer);if(!o)return null;const r=e.cloneNode(!0);if(!r.childNodes.length)return 0;let l=r;
1for(const c of o){const d=l.childNodes[c];if(!d)return null;l=d}const s=document.createRange();return s.setStart(l,n.startOffset),s.setEndAfter(r.lastChild),s.deleteContents(),U(r).length},me=e=>{const t=i.value;if(!t)return null;const n=document.createRange();let o=Math.max(0,e);const r=l=>{var s,c;for(const d of Array.from(l.childNodes)){if(d.nodeType===Node.TEXT_NODE){const v=(s=d.textContent)!=null?s:"",J=F(v).length;if(o<=J)return n.setStart(d,de(v,o)),n.collapse(!0),!0;o-=J;continue}const m=d;if((c=m.classList)!=null&&c.contains(C)){const v=fe(d);if(o<=v)return o<v?n.setStartBefore(m):n.setStartAfter(m),n.collapse(!0),!0;o-=v;continue}if(m.tagName==="BR"){if(o<=0)return n.setStartBefore(m),n.collapse(!0),!0;o-=1;continue}if(m.childNodes.length&&r(m))return!0}return!1};return r(t)||(n.selectNodeContents(t),n.collapse(!1)),n},D=e=>{const t=i.value;if(!t)return;const n=document.createDocumentFragment();qe(e,a.chips,q).forEach(o=>{n.appendChild(o.kind==="chip"?W(o.chip):document.createTextNode(o.text))}),t.replaceChildren(n),_=Q(),L=e,p.value=e.trim().length>0},E=()=>{const e=i.value;if(!e)return;const t=B;B=new Set;const n=new Set(Array.from(e.querySelectorAll(".".concat(C))).map(l=>{var s;return(s=l.dataset.chipId)!=null?s:""}));a.chips.forEach(l=>{n.has(l.id)||t.has(l.id)||f("chip-remove",l)});const o=j(),r=a.truncateValue?a.truncateValue(o):o;if(r!==o){const l=w();D(r),l!==null&&T(Math.min(l,r.length)),f("value-truncated"),f("update:modelValue",r);return}p.value=r.trim().length>0,r!==L&&(L=r,f("update:modelValue",r))};function k(e){const t=K(e);if(!t)return;const n=X(e);if(n&&h.value){const o=document.createRange();o.setStartBefore(n),o.collapse(!0),x(o)}B.add(e),n==null||n.remove(),E(),f("chip-remove",t)}const Y=()=>{const e=i.value,t=Q();!e||t===_||(_=t,e.querySelectorAll(".".concat(C)).forEach(n=>{a.chips.some(o=>o.id===n.dataset.chipId)||n.remove()}),a.chips.forEach(n=>{const o=X(n.id);o?pe(o,n):e.appendChild(W(n))}),E())},ge=()=>{var e;return(e=i.value)==null?void 0:e.focus()},Ce=()=>{var e;return(e=i.value)==null?void 0:e.blur()},be=()=>{var e;return(e=i.value)!=null?e:null},I=(e={})=>{const t=i.value;if(!t)return;e.preserveScroll?t.focus({preventScroll:!0}):t.focus();const n=document.createRange();n.selectNodeContents(t),n.collapse(!1),x(n)};function T(e){const t=i.value;if(!t)return;t.focus();const n=me(e);n&&x(n)}const Ee=e=>D(e),ve=()=>j(),Se=e=>{const t=i.value;if(!t)return;const n=window.getSelection(),o=n&&n.rangeCount>0?n.getRangeAt(0):null;if(!o||!t.contains(o.commonAncestorContainer)){t.appendChild(document.createTextNode(e)),I();return}o.deleteContents();const r=document.createTextNode(e);o.insertNode(r),o.setStart(r,e.length),o.collapse(!0),x(o)},Ne=e=>{e.append(document.createElement("br"),document.createTextNode(H))},xe=()=>{const e=i.value;if(!e)return;const t=window.getSelection(),n=t&&t.rangeCount>0?t.getRangeAt(0):null;if(!n||!e.contains(n.commonAncestorContainer)){Ne(e),I(),E();return}n.deleteContents();const o=document.createElement("br"),r=document.createTextNode(H),l=document.createDocumentFragment();l.append(o,r),n.insertNode(l),n.setStart(r,1),n.collapse(!0),x(n),E()},ye=e=>{var n;if(!e)return"";const t=e.getData("text/html");return t&&(n=new DOMParser().parseFromString(t,"text/html").body.textContent)!=null?n:""},Le=e=>{if(e.preventDefault(),a.disabled)return;const t=e.clipboardData,n=(t==null?void 0:t.getData("text/plain"))||ye(t);n&&(Se(Ue(n)),E())},Ae=()=>{N||(Z(),E())};function Z(){const e=i.value;if(!e)return;const t=Array.from(e.querySelectorAll("*")).filter(o=>!o.closest(".".concat(C))&&o.tagName!=="BR");if(!t.length)return;const n=w();t.forEach(o=>{var r;o.replaceWith(document.createTextNode((r=o.textContent)!=null?r:""))}),e.normalize(),n!==null&&T(n)}const Re=()=>{var d,m;const e=i.value,t=window.getSelection();if(!e||!t||t.rangeCount===0)return!1;const n=t.getRangeAt(0);if(!n.collapsed)return!1;const{startContainer:o,startOffset:r}=n;if(!e.contains(o))return!1;const s=o.nodeType===Node.TEXT_NODE?r===0?o.previousSibling:null:o===e?o.childNodes[r-1]:null;if(!((d=s==null?void 0:s.classList)!=null&&d.contains(C)))return!1;const c=(m=s.dataset.chipId)!=null?m:"";return c?(k(c),!0):!1},we=e=>{if(f("keydown",e),!e.defaultPrevented&&!(a.disabled||e.isComposing||N)){if(e.key==="Enter"&&!e.altKey&&!e.metaKey){e.shiftKey||a.newlineOnEnter?(e.preventDefault(),xe()):e.preventDefault();return}e.key==="Backspace"&&a.chipDeleteOnBackspace&&Re()&&e.preventDefault()}},De=()=>{N=!0},Te=()=>{N=!1,Fe(()=>{Z(),E()})},Oe=e=>{h.value=!0,f("focus",e)},_e=e=>{h.value=!1,f("blur",e)};return V(()=>a.modelValue,e=>{if(e===L||N)return;const t=h.value?w():null;D(e),t!==null&&T(Math.min(t,e.length))}),V(()=>a.chips,Y,{deep:!0}),V(()=>a.disabled,e=>{e||Y()}),Ie(()=>{M.value=ce(),D(a.modelValue)}),y({focus:ge,blur:Ce,element:be,focusAtEnd:I,focusAtOffset:T,getCaretOffset:w,setValue:Ee,getValue:ve}),(e,t)=>(z(),$("div",je,[Pe("div",{ref_key:"editorRef",ref:i,class:He(["rich-prompt-input-editor",{"rich-prompt-input-editor-single-line":u.singleLine,"ric
1h-prompt-input-editor-disabled":u.disabled,"rich-prompt-input-editor-chip-delete-hover":u.chipDeleteVisible==="hover"}]),contenteditable:ne(se),"aria-label":u.ariaLabel,"aria-disabled":u.disabled?"true":void 0,translate:"no",spellcheck:"false",onInput:Ae,onKeydown:we,onPaste:Le,onCompositionstart:De,onCompositionend:Te,onFocus:Oe,onBlur:_e,onDragover:t[0]||(t[0]=te(()=>{},["prevent"])),onDrop:t[1]||(t[1]=te(()=>{},["prevent"]))},null,42,Ge),ne(ie)?(z(),$("div",We,[$e(e.$slots,"placeholder",{},()=>[ze(Me(u.placeholder),1)],!0)])):Ve("",!0)]))}}),et=Object.assign(le(Xe,[["__scopeId","data-v-f9e6c5ca"]]),{__name:"CommonRichPromptInput"}),Qe={},Ye={class:"skeleton"};function Ze(u,y){return z(),$("div",Ye)}const tt=Object.assign(le(Qe,[["render",Ze],["__scopeId","data-v-edb612eb"]]),{__name:"Skeleton"});export{et as R,tt as S};

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.