PageSourceSearch

https://visualab.ai/static/js/async/5882.b30c6dc53d.js

js visualab.ai collected 2026-10-05 15:16:21 UTC 8,921 bytes, 2 lines download raw bytes

1"use strict";(self.rspackChunknewapi_web=self.rspackChunknewapi_web||[]).push([[5882],{13889(e,t,r){var i=r(95163);function o(e){return e&&"object"==typeof e&&!Array.isArray(e)?e:{}}function n(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return"number"==typeof e&&Number.isFinite(e)?e:t}function a(e){if("string"==typeof e)return e;if(!e||"object"!=typeof e)return"";if(Array.isArray(e))return e.map(a).join("");let t=o(e);if("hardBreak"===t.type)return"\n";let r="string"==typeof t.text?t.text:a(t.content);return"paragraph"===t.type?`${r}
2`:r}function s(e){let t="string"==typeof e?JSON.parse(e):e,r=o(t);"document"in r&&(t=r.document);let s=o(t);if("store"in s?t=s.store:"records"in s&&(t=s.records),!t||"object"!=typeof t)throw Error("Invalid legacy canvas snapshot");let l={};for(let[e,r]of Array.isArray(t)?t.map(e=>[o(e).id,e]):Object.entries(t)){let t=o(r);if("string"!=typeof e||!e||e!==t.id||!["shape","asset","binding","page","document","user","camera","instance","instance_page_state","pointer","instance_presence"].includes(String(t.typeName)))throw Error("Invalid legacy canvas record");if(Object.hasOwn(l,e)||["__proto__","constructor","prototype"].includes(e))throw Error("Duplicate legacy canvas record");l[e]=structuredClone(t)}let p=(0,i.K1)(),d={sourceRecordCount:Object.keys(l).length,convertedNodeCount:0,convertedEdgeCount:0,compatibilityNodeIds:[],warnings:[]},c=Object.values(l).filter(e=>"shape"===e.typeName).sort((e,t)=>String(e.index).localeCompare(String(t.index))),g=Object.values(l).filter(e=>"binding"===e.typeName&&"arrow"===e.type),f=new Map;for(let e of c){if("arrow"!==e.type)continue;let t=g.find(t=>t.fromId===e.id&&"start"===o(t.props).terminal),r=g.find(t=>t.fromId===e.id&&"end"===o(t.props).terminal);t&&r&&"string"==typeof t.toId&&"string"==typeof r.toId&&t.toId!==r.toId&&l[t.toId]?.typeName==="shape"&&l[r.toId]?.typeName==="shape"&&l[t.toId]?.type!=="arrow"&&l[r.toId]?.type!=="arrow"&&f.set(e.id,{source:t.toId,target:r.toId})}for(let[e,t]of c.entries()){if(f.has(t.id))continue;if("string"!=typeof t.type||!Number.isFinite(t.x)||!Number.isFinite(t.y))throw Error("Invalid legacy shape geometry");let r=o(t.props),i=o(t.meta),s="string"==typeof r.assetId?l[r.assetId]:void 0,c=o(s?.props),g=Math.max(1,Math.min(2e4,n(r.w,280))),y=Math.max(1,Math.min(2e4,n(r.h,180))),h={id:t.id,type:"text",position:{x:n(t.x),y:n(t.y)},size:{w:g,h:y},zIndex:e,config:{legacy:{record:t,meta:i,...s?{asset:s}:{}},rotation:n(t.rotation)},assetIds:[],createdBy:"import",schemaVersion:1};if("string"==typeof t.parentId&&t.parentId.startsWith("shape:")){if(l[t.parentId]?.type!=="group"&&l[t.parentId]?.type!=="frame")throw Error("Unsupported legacy parent relationship");h.parentId=t.parentId}switch(t.type){case"image":case"video":{let e=String(i.url||c.src||""),r=Number(i.visualabAssetId??o(s?.meta).visualabAssetId??0),a=e.match("image"===t.type?/\/i\/(\d+)(?:[/?#]|$)/:/\/v\/(\d+)(?:[/?#]|$)/),l=Number.isSafeInteger(r)&&r>0?r:Number(a?.[1]??0);h.type="asset",Object.assign(h.config,{kind:t.type,assetId:l,url:e,naturalWidth:n(c.w,g),naturalHeight:n(c.h,y),title:String(c.name??"")}),h.assetIds=l>0?[l]:[],(!e||e.startsWith("blob:")||e.startsWith("asset:"))&&d.warnings.push(`local_asset:${h.id}`);break}case"prompt-node":h.type="generation",Object.assign(h.config,{...r,legacy:h.config.legacy,prompt:String(r.prompt??"").slice(0,4e3),kind:["image","video","text"].includes(String(r.kind))?r.kind:"image",model:String(r.model??""),strategy:r.strategy??"cost"}),String(r.prompt??"").length>4e3&&d.warnings.push(`truncated_prompt:${h.id}`),delete h.config.status,delete h.config.error;break;case"group":case"frame":h.type="group",h.config.title=String(r.name??i.name??"").slice(0,200),h.zIndex=-1;break;case"text":{let e=a(r.richText??r.text).trimEnd();h.config.text=e.slice(0,2e4),e.length>2e4&&d.warnings.push(`truncated_text:${h.id}`);break}default:h.config.text=a(r.richText??r.text??r.name).trimEnd().slice(0,2e4),h.config.compatibilitySvg=function(e,t,r){let i=o(e.props),s={black:"#334155",grey:"#64748b",red:"#ef4444",green:"#22c55e",blue:"#3b82f6",violet:"#8b5cf6",orange:"#f97316",yellow:"#eab308"}[String(i.color)]??"#475569",l="",p=[],d=`0 0 ${t} ${r}`;if("draw"===e.type||"highlight"===e.type)for(let e of Array.isArray(i.segments)?i.segments:[]){let t=
2o(e).points;if(!Array.isArray(t))continue;for(let e of t){let t=o(e);Number.isFinite(t.x)&&Number.isFinite(t.y)&&p.push({x:n(t.x),y:n(t.y)})}let r=t.map(e=>o(e)).filter(e=>Number.isFinite(e.x)&&Number.isFinite(e.y)).map(e=>`${n(e.x)},${n(e.y)}`).join(" ");r&&(l+=`<polyline points="${r}" fill="none" stroke="${s}" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>`)}else if("line"===e.type){let e=Object.values(o(i.points)).map(o).sort((e,t)=>String(e.index).localeCompare(String(t.index)));l=`<polyline points="${e.map(e=>`${n(e.x)},${n(e.y)}`).join(" ")}" fill="none" stroke="${s}" stroke-width="2"/>`}else if("arrow"===e.type){let e=o(i.start),a=o(i.end);l=`<line x1="${n(e.x)}" y1="${n(e.y)}" x2="${n(a.x,t)}" y2="${n(a.y,r)}" stroke="${s}" stroke-width="2"/>`}else l="geo"===e.type&&"ellipse"===i.geo?`<ellipse cx="${t/2}" cy="${r/2}" rx="${Math.max(1,t/2-2)}" ry="${Math.max(1,r/2-2)}" fill="none" stroke="${s}" stroke-width="2"/>`:"geo"===e.type&&"triangle"===i.geo?`<polygon points="${t/2},2 ${t-2},${r-2} 2,${r-2}" fill="none" stroke="${s}" stroke-width="2"/>`:"geo"===e.type&&"diamond"===i.geo?`<polygon points="${t/2},2 ${t-2},${r/2} ${t/2},${r-2} 2,${r/2}" fill="none" stroke="${s}" stroke-width="2"/>`:`<rect x="2" y="2" width="${Math.max(1,t-4)}" height="${Math.max(1,r-4)}" rx="6" fill="none" stroke="${s}" stroke-width="2"/>`;if(p.length){let e=1/0,t=1/0,r=-1/0,i=-1/0;for(let o of p)e=Math.min(e,o.x-4),t=Math.min(t,o.y-4),r=Math.max(r,o.x+4),i=Math.max(i,o.y+4);d=`${e} ${t} ${r-e} ${i-t}`}return l+=a(i.richText??i.text??i.name).trim().split("\n").slice(0,Math.max(1,Math.floor(r/22))).map((e,t)=>`<text x="12" y="${24+22*t}" font-family="sans-serif" font-size="14" fill="${s}">${e.slice(0,160).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&apos;")}</text>`).join(""),`data:image/svg+xml,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${r}" viewBox="${d}">${l}</svg>`)}`}(t,g,y),d.compatibilityNodeIds.push(h.id)}p.nodes[h.id]=h}let y=(0,i.dC)(p);if(y)throw Error(y);let h=new Map,m=new Map;for(let e of Object.values(p.nodes)){let t=[],r=l[e.id];for(;r;)t.unshift(r),r="string"==typeof r.parentId&&r.parentId.startsWith("shape:")?l[r.parentId]:void 0;let i=0,o=0,a=0;for(let e of t)i+=Math.cos(a)*n(e.x)-Math.sin(a)*n(e.y),o+=Math.sin(a)*n(e.x)+Math.cos(a)*n(e.y),a+=n(e.rotation);h.set(e.id,{x:i,y:o,rotation:a});let s=t[0]?.parentId;if("string"==typeof s&&s.startsWith("page:")){let t=m.get(s)??[];t.push(e),m.set(s,t)}}for(let e of Object.values(p.nodes)){let t=h.get(e.id);if(!t)continue;let r=e.parentId?h.get(e.parentId):void 0;e.position={x:t.x-(r?.x??0),y:t.y-(r?.y??0)},e.config.rotation="group"===e.type?0:t.rotation}for(let e of Object.values(p.nodes)){let t=l[e.id];if("group"===e.type&&"group"===t.type){let t=Object.values(p.nodes).filter(t=>t.parentId===e.id);if(t.length){let r=t.reduce((e,t)=>Math.max(e,t.position.x+t.size.w),1)+16,i=t.reduce((e,t)=>Math.max(e,t.position.y+t.size.h),1)+16;e.size.w=Math.min(2e4,r),e.size.h=Math.min(2e4,i),(r>2e4||i>2e4)&&(e.config.legacyExtents={width:r,height:i},d.warnings.push(`large_group:${e.id}`))}}}if(m.size>1){let e;for(let[t,r]of[...m.entries()].sort((e,t)=>{let[r]=e,[i]=t;return String(l[r]?.index??r).localeCompare(String(l[i]?.index??i))})){let i=1/0,o=1/0,a=-1/0,s=-1/0;for(let e of r){let t=h.get(e.id);if(!t)continue;let r=n(e.config.rotation);for(let[n,l]of[[0,0],[e.size.w,0],[0,e.size.h],[e.size.w,e.size.h]]){let e=t.x+Math.cos(r)*n-Math.sin(r)*l,p=t.y+Math.sin(r)*n+Math.cos(r)*l;i=Math.min(i,e),o=Math.min(o,p),a=Math.max(a,e),s=Math.max(s,p)}}let d=a-i+48,c=s-o+48;e??=i-24;let g=l[t]??{id:t,typeName:"page"};for(let n of(p.nodes[t]={id:t,type:"group",position:{x:e,y:o-24},size:{w:Math.min(2e4,d),h:Math.min(2e4,c)},zIndex:-2,config:{title:String(g.name??t).slice(0,200),legacy:{record:g},legacyExtents:{width:d,height:c}},assetIds:[],createdBy:"import",schemaVersion:1},r))n.parentId||(n.position={x:n.position.x-i+24,y:n.position.y-o+24},n.parentId=t);e+=d+160}}for(let[e,t]of f){let r=o(l[e].meta),i=new Set(["input","reference","mask","prompt","result","first_frame","last_frame"]),n=r.role;i.has(n)||(n=p.nodes[t.source]?.type==="text"?"prompt":p.nodes[t.source]?.type==="generation"||p.nodes[t.source]?.type==="agent"?"result":"input"),p.edges[e]={id:e,...t,role:n}}let u=(0,i.dC)(p);if(u)throw Error(u);return d.convertedNodeCount=Object.keys(p.nodes).length,d.convertedEdgeCount=Object.keys(p.edges).length,{graph:p,report:d,sourceRecords:l}}r.d(t,{convertLegacyCanvas:()=>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.