mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2025-01-20 19:49:08 +00:00
3980 lines
2.6 MiB
JavaScript
3980 lines
2.6 MiB
JavaScript
|
(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const r of i)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const r={};return i.integrity&&(r.integrity=i.integrity),i.referrerPolicy&&(r.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?r.credentials="include":i.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function s(i){if(i.ep)return;i.ep=!0;const r=n(i);fetch(i.href,r)}})();function nb(t,e){const n=Object.create(null),s=t.split(",");for(let i=0;i<s.length;i++)n[s[i]]=!0;return e?i=>!!n[i.toLowerCase()]:i=>!!n[i]}const jt={},Po=[],Ms=()=>{},CI=()=>!1,wI=/^on[^a-z]/,iu=t=>wI.test(t),sb=t=>t.startsWith("onUpdate:"),tn=Object.assign,ib=(t,e)=>{const n=t.indexOf(e);n>-1&&t.splice(n,1)},RI=Object.prototype.hasOwnProperty,kt=(t,e)=>RI.call(t,e),it=Array.isArray,Uo=t=>Sa(t)==="[object Map]",va=t=>Sa(t)==="[object Set]",JE=t=>Sa(t)==="[object Date]",AI=t=>Sa(t)==="[object RegExp]",gt=t=>typeof t=="function",nn=t=>typeof t=="string",Tl=t=>typeof t=="symbol",qt=t=>t!==null&&typeof t=="object",_w=t=>qt(t)&>(t.then)&>(t.catch),hw=Object.prototype.toString,Sa=t=>hw.call(t),NI=t=>Sa(t).slice(8,-1),fw=t=>Sa(t)==="[object Object]",rb=t=>nn(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,ad=nb(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),ru=t=>{const e=Object.create(null);return n=>e[n]||(e[n]=t(n))},OI=/-(\w)/g,Js=ru(t=>t.replace(OI,(e,n)=>n?n.toUpperCase():"")),II=/\B([A-Z])/g,so=ru(t=>t.replace(II,"-$1").toLowerCase()),ou=ru(t=>t.charAt(0).toUpperCase()+t.slice(1)),ld=ru(t=>t?`on${ou(t)}`:""),xl=(t,e)=>!Object.is(t,e),Fo=(t,e)=>{for(let n=0;n<t.length;n++)t[n](e)},xd=(t,e,n)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:n})},Cd=t=>{const e=parseFloat(t);return isNaN(e)?t:e},MI=t=>{const e=nn(t)?Number(t):NaN;return isNaN(e)?t:e};let ey;const Jm=()=>ey||(ey=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Ht(t){if(it(t)){const e={};for(let n=0;n<t.length;n++){const s=t[n],i=nn(s)?PI(s):Ht(s);if(i)for(const r in i)e[r]=i[r]}return e}else{if(nn(t))return t;if(qt(t))return t}}const kI=/;(?![^(]*\))/g,DI=/:([^]+)/,LI=/\/\*[^]*?\*\//g;function PI(t){const e={};return t.replace(LI,"").split(kI).forEach(n=>{if(n){const s=n.split(DI);s.length>1&&(e[s[0].trim()]=s[1].trim())}}),e}function Ge(t){let e="";if(nn(t))e=t;else if(it(t))for(let n=0;n<t.length;n++){const s=Ge(t[n]);s&&(e+=s+" ")}else if(qt(t))for(const n in t)t[n]&&(e+=n+" ");return e.trim()}const UI="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",FI=nb(UI);function mw(t){return!!t||t===""}function BI(t,e){if(t.length!==e.length)return!1;let n=!0;for(let s=0;n&&s<t.length;s++)n=jr(t[s],e[s]);return n}function jr(t,e){if(t===e)return!0;let n=JE(t),s=JE(e);if(n||s)return n&&s?t.getTime()===e.getTime():!1;if(n=Tl(t),s=Tl(e),n||s)return t===e;if(n=it(t),s=it(e),n||s)return n&&s?BI(t,e):!1;if(n=qt(t),s=qt(e),n||s){if(!n||!s)return!1;const i=Object.keys(t).length,r=Object.keys(e).length;if(i!==r)return!1;for(const o in t){const a=t.hasOwnProperty(o),c=e.hasOwnProperty(o);if(a&&!c||!a&&c||!jr(t[o],e[o]))return!1}}return String(t)===String(e)}function ob(t,e){return t.findIndex(n=>jr(n,e))}const W=t=>nn(t)?t:t==null?"":it(t)||qt(t)&&(t.toString===hw||!gt(t.toString))?JSON.stringify(t,gw,2):String(t),gw=(t,e)=>e&&e.__v_isRef?gw(t,e.value):Uo(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((n,[s,i])=>(n[`${s} =>`]=i,n),{})}:va(e)?{[`Set(${e.size})`]:[...e.values()]}:qt(e)&&!it(e)&&!fw(e)?String(e):e;let Xn;class bw{constructor(e=!1){this.detached=e,this._active=!0,this.effects=[],this.cleanups=[],this.parent=Xn,!e&&Xn&&(this.index=(Xn.scopes||(Xn.scopes=[])).pus
|
|||
|
* vuex v4.1.0
|
|||
|
* (c) 2022 Evan You
|
|||
|
* @license MIT
|
|||
|
*/var SR="store";function bk(t){return t===void 0&&(t=null),Zn(t!==null?t:SR)}function Ra(t,e){Object.keys(t).forEach(function(n){return e(t[n],n)})}function TR(t){return t!==null&&typeof t=="object"}function Ek(t){return t&&typeof t.then=="function"}function yk(t,e){return function(){return t(e)}}function xR(t,e,n){return e.indexOf(t)<0&&(n&&n.prepend?e.unshift(t):e.push(t)),function(){var s=e.indexOf(t);s>-1&&e.splice(s,1)}}function CR(t,e){t._actions=Object.create(null),t._mutations=Object.create(null),t._wrappedGetters=Object.create(null),t._modulesNamespaceMap=Object.create(null);var n=t.state;yu(t,n,[],t._modules.root,!0),Tb(t,n,e)}function Tb(t,e,n){var s=t._state,i=t._scope;t.getters={},t._makeLocalGettersCache=Object.create(null);var r=t._wrappedGetters,o={},a={},c=GI(!0);c.run(function(){Ra(r,function(d,u){o[u]=yk(d,t),a[u]=et(function(){return o[u]()}),Object.defineProperty(t.getters,u,{get:function(){return a[u].value},enumerable:!0})})}),t._state=Wn({data:e}),t._scope=c,t.strict&&Ck(t),s&&n&&t._withCommit(function(){s.data=null}),i&&i.stop()}function yu(t,e,n,s,i){var r=!n.length,o=t._modules.getNamespace(n);if(s.namespaced&&(t._modulesNamespaceMap[o],t._modulesNamespaceMap[o]=s),!r&&!i){var a=xb(e,n.slice(0,-1)),c=n[n.length-1];t._withCommit(function(){a[c]=s.state})}var d=s.context=vk(t,o,n);s.forEachMutation(function(u,h){var f=o+h;Sk(t,f,u,d)}),s.forEachAction(function(u,h){var f=u.root?h:o+h,m=u.handler||u;Tk(t,f,m,d)}),s.forEachGetter(function(u,h){var f=o+h;xk(t,f,u,d)}),s.forEachChild(function(u,h){yu(t,e,n.concat(h),u,i)})}function vk(t,e,n){var s=e==="",i={dispatch:s?t.dispatch:function(r,o,a){var c=Md(r,o,a),d=c.payload,u=c.options,h=c.type;return(!u||!u.root)&&(h=e+h),t.dispatch(h,d)},commit:s?t.commit:function(r,o,a){var c=Md(r,o,a),d=c.payload,u=c.options,h=c.type;(!u||!u.root)&&(h=e+h),t.commit(h,d,u)}};return Object.defineProperties(i,{getters:{get:s?function(){return t.getters}:function(){return wR(t,e)}},state:{get:function(){return xb(t.state,n)}}}),i}function wR(t,e){if(!t._makeLocalGettersCache[e]){var n={},s=e.length;Object.keys(t.getters).forEach(function(i){if(i.slice(0,s)===e){var r=i.slice(s);Object.defineProperty(n,r,{get:function(){return t.getters[i]},enumerable:!0})}}),t._makeLocalGettersCache[e]=n}return t._makeLocalGettersCache[e]}function Sk(t,e,n,s){var i=t._mutations[e]||(t._mutations[e]=[]);i.push(function(o){n.call(t,s.state,o)})}function Tk(t,e,n,s){var i=t._actions[e]||(t._actions[e]=[]);i.push(function(o){var a=n.call(t,{dispatch:s.dispatch,commit:s.commit,getters:s.getters,state:s.state,rootGetters:t.getters,rootState:t.state},o);return Ek(a)||(a=Promise.resolve(a)),t._devtoolHook?a.catch(function(c){throw t._devtoolHook.emit("vuex:error",c),c}):a})}function xk(t,e,n,s){t._wrappedGetters[e]||(t._wrappedGetters[e]=function(r){return n(s.state,s.getters,r.state,r.getters)})}function Ck(t){Mn(function(){return t._state.data},function(){},{deep:!0,flush:"sync"})}function xb(t,e){return e.reduce(function(n,s){return n[s]},t)}function Md(t,e,n){return TR(t)&&t.type&&(n=e,e=t,t=t.type),{type:t,payload:e,options:n}}var wk="vuex bindings",By="vuex:mutations",_p="vuex:actions",uo="vuex",Rk=0;function Ak(t,e){gk({id:"org.vuejs.vuex",app:t,label:"Vuex",homepage:"https://next.vuex.vuejs.org/",logo:"https://vuejs.org/images/icons/favicon-96x96.png",packageName:"vuex",componentStateTypes:[wk]},function(n){n.addTimelineLayer({id:By,label:"Vuex Mutations",color:Gy}),n.addTimelineLayer({id:_p,label:"Vuex Actions",color:Gy}),n.addInspector({id:uo,label:"Vuex",icon:"storage",treeFilterPlaceholder:"Filter stores..."}),n.on.getInspectorTree(function(s){if(s.app===t&&s.inspectorId===uo)if(s.filter){var i=[];OR(i,e._modules.root,s.filter,""),s.rootNodes=i}else s.rootNodes=[NR(e._modules.root,"")]}),n.on.getInspectorState(function(s){if(s.app===t&&s.inspectorId===uo){var i=s.nodeId;wR(e,i),s.state=Ik(kk(e._modules,i),i==="root"?e.getters:e._makeLocalGettersCache,i)}}),n.on.editInspectorState(function(s){if(s.app===t&&s.inspectorId===uo){var i=s.nodeId,r=s.path;i!=="root"&&(r=i.split("/").fi
|
|||
|
`).forEach(function(o){i=o.indexOf(":"),n=o.substring(0,i).trim().toLowerCase(),s=o.substring(i+1).trim(),!(!n||e[n]&&PD[n])&&(n==="set-cookie"?e[n]?e[n].push(s):e[n]=[s]:e[n]=e[n]?e[n]+", "+s:s)}),e},Yy=Symbol("internals");function $a(t){return t&&String(t).trim().toLowerCase()}function pd(t){return t===!1||t==null?t:Ie.isArray(t)?t.map(pd):String(t)}function FD(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=n.exec(t);)e[s[1]]=s[2];return e}const BD=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function fp(t,e,n,s,i){if(Ie.isFunction(s))return s.call(this,e,n);if(i&&(e=n),!!Ie.isString(e)){if(Ie.isString(s))return e.indexOf(s)!==-1;if(Ie.isRegExp(s))return s.test(e)}}function GD(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,s)=>n.toUpperCase()+s)}function VD(t,e){const n=Ie.toCamelCase(" "+e);["get","set","has"].forEach(s=>{Object.defineProperty(t,s+n,{value:function(i,r,o){return this[s].call(this,e,i,r,o)},configurable:!0})})}class Cu{constructor(e){e&&this.set(e)}set(e,n,s){const i=this;function r(a,c,d){const u=$a(c);if(!u)throw new Error("header name must be a non-empty string");const h=Ie.findKey(i,u);(!h||i[h]===void 0||d===!0||d===void 0&&i[h]!==!1)&&(i[h||c]=pd(a))}const o=(a,c)=>Ie.forEach(a,(d,u)=>r(d,u,c));return Ie.isPlainObject(e)||e instanceof this.constructor?o(e,n):Ie.isString(e)&&(e=e.trim())&&!BD(e)?o(UD(e),n):e!=null&&r(n,e,s),this}get(e,n){if(e=$a(e),e){const s=Ie.findKey(this,e);if(s){const i=this[s];if(!n)return i;if(n===!0)return FD(i);if(Ie.isFunction(n))return n.call(this,i,s);if(Ie.isRegExp(n))return n.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=$a(e),e){const s=Ie.findKey(this,e);return!!(s&&this[s]!==void 0&&(!n||fp(this,this[s],s,n)))}return!1}delete(e,n){const s=this;let i=!1;function r(o){if(o=$a(o),o){const a=Ie.findKey(s,o);a&&(!n||fp(s,s[a],a,n))&&(delete s[a],i=!0)}}return Ie.isArray(e)?e.forEach(r):r(e),i}clear(e){const n=Object.keys(this);let s=n.length,i=!1;for(;s--;){const r=n[s];(!e||fp(this,this[r],r,e,!0))&&(delete this[r],i=!0)}return i}normalize(e){const n=this,s={};return Ie.forEach(this,(i,r)=>{const o=Ie.findKey(s,r);if(o){n[o]=pd(i),delete n[r];return}const a=e?GD(r):String(r).trim();a!==r&&delete n[r],n[a]=pd(i),s[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return Ie.forEach(this,(s,i)=>{s!=null&&s!==!1&&(n[i]=e&&Ie.isArray(s)?s.join(", "):s)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(`
|
|||
|
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const s=new this(e);return n.forEach(i=>s.set(i)),s}static accessor(e){const s=(this[Yy]=this[Yy]={accessors:{}}).accessors,i=this.prototype;function r(o){const a=$a(o);s[a]||(VD(i,o),s[a]=!0)}return Ie.isArray(e)?e.forEach(r):r(e),this}}Cu.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Ie.reduceDescriptors(Cu.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(s){this[n]=s}}});Ie.freezeMethods(Cu);const Ci=Cu;function mp(t,e){const n=this||Nb,s=e||n,i=Ci.from(s.headers);let r=s.data;return Ie.forEach(t,function(a){r=a.call(n,r,i.normalize(),e?e.status:void 0)}),i.normalize(),r}function jR(t){return!!(t&&t.__CANCEL__)}function Wl(t,e,n){It.call(this,t??"canceled",It.ERR_CANCELED,e,n),this.name="CanceledError"}Ie.inherits(Wl,It,{__CANCEL__:!0});function zD(t,e,n){const s=n.config.validateStatus;!n.status||!s||s(n.status)?t(n):e(new It("Request failed with status code "+n.status,[It.ERR_BAD_REQUEST,It.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}const HD=Ws.hasStandardBrowserEnv?{write(t,e,n,s,i,r){const o=[t+"="+encodeURIComponent(e)];Ie.isNumber(n)&&o.push("expires="+new Date(n).toGMTString()),Ie.isString(s)&&o.push("path="+s),Ie.isString(i)&&o.push("domain="+i),r===!0&&o.push("secure"),document.cookie=o.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function qD(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function $D(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}function QR(t,e){return t&&!qD(e)?$D(t,e):e}const YD=Ws.hasStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");let s;function i(r){let o=r;return e&&(n.setAttribute("href",o),o=n.href),n.setAttribute("href",o),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return s=i(window.location.href),function(o){const a=Ie.isString(o)?i(o):o;return a.protocol===s.protocol&&a.host===s.host}}():function(){return function(){return!0}}();function WD(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function KD(t,e){t=t||10;const n=new Array(t),s=new Array(t);let i=0,r=0,o;return e=e!==void 0?e:1e3,function(c){const d=Date.now(),u=s[r];o||(o=d),n[i]=c,s[i]=d;let h=r,f=0;for(;h!==i;)f+=n[h++],h=h%t;if(i=(i+1)%t,i===r&&(r=(r+1)%t),d-o<e)return;const m=u&&d-u;return m?Math.round(f*1e3/m):void 0}}function Wy(t,e){let n=0;const s=KD(50,250);return i=>{const r=i.loaded,o=i.lengthComputable?i.total:void 0,a=r-n,c=s(a),d=r<=o;n=r;const u={loaded:r,total:o,progress:o?r/o:void 0,bytes:a,rate:c||void 0,estimated:c&&o&&d?(o-r)/c:void 0,event:i};u[e?"download":"upload"]=!0,t(u)}}const jD=typeof XMLHttpRequest<"u",QD=jD&&function(t){return new Promise(function(n,s){let i=t.data;const r=Ci.from(t.headers).normalize();let{responseType:o,withXSRFToken:a}=t,c;function d(){t.cancelToken&&t.cancelToken.unsubscribe(c),t.signal&&t.signal.removeEventListener("abort",c)}let u;if(Ie.isFormData(i)){if(Ws.hasStandardBrowserEnv||Ws.hasStandardBrowserWebWorkerEnv)r.setContentType(!1);else if((u=r.getContentType())!==!1){const[b,...E]=u?u.split(";").map(g=>g.trim()).filter(Boolean):[];r.setContentType([b||"multipart/form-data",...E].join("; "))}}let h=new XMLHttpRequest;if(t.auth){const b=t.auth.username||"",E=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";r.set("Authorization","Basic "+btoa(b+":"+E))}const f=QR(t.baseURL,t.url);h.open(t.method.toUpperCase(),$R(f,t.params,t.paramsSerializer),!0),h.timeout=t.timeout;function m(){if(!h)return;const b=Ci.from("getAllResponseHeaders"in h&&h.getAllR
|
|||
|
`+r.map(Ky).join(`
|
|||
|
`):" "+Ky(r[0]):"as no adapter specified";throw new It("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return s},adapters:fg};function gp(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Wl(null,t)}function jy(t){return gp(t),t.headers=Ci.from(t.headers),t.data=mp.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),XR.getAdapter(t.adapter||Nb.adapter)(t).then(function(s){return gp(t),s.data=mp.call(t,t.transformResponse,s),s.headers=Ci.from(s.headers),s},function(s){return jR(s)||(gp(t),s&&s.response&&(s.response.data=mp.call(t,t.transformResponse,s.response),s.response.headers=Ci.from(s.response.headers))),Promise.reject(s)})}const Qy=t=>t instanceof Ci?t.toJSON():t;function Zo(t,e){e=e||{};const n={};function s(d,u,h){return Ie.isPlainObject(d)&&Ie.isPlainObject(u)?Ie.merge.call({caseless:h},d,u):Ie.isPlainObject(u)?Ie.merge({},u):Ie.isArray(u)?u.slice():u}function i(d,u,h){if(Ie.isUndefined(u)){if(!Ie.isUndefined(d))return s(void 0,d,h)}else return s(d,u,h)}function r(d,u){if(!Ie.isUndefined(u))return s(void 0,u)}function o(d,u){if(Ie.isUndefined(u)){if(!Ie.isUndefined(d))return s(void 0,d)}else return s(void 0,u)}function a(d,u,h){if(h in e)return s(d,u);if(h in t)return s(void 0,d)}const c={url:r,method:r,data:r,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(d,u)=>i(Qy(d),Qy(u),!0)};return Ie.forEach(Object.keys(Object.assign({},t,e)),function(u){const h=c[u]||i,f=h(t[u],e[u],u);Ie.isUndefined(f)&&h!==a||(n[u]=f)}),n}const ZR="1.6.2",Ob={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{Ob[t]=function(s){return typeof s===t||"a"+(e<1?"n ":" ")+t}});const Xy={};Ob.transitional=function(e,n,s){function i(r,o){return"[Axios v"+ZR+"] Transitional option '"+r+"'"+o+(s?". "+s:"")}return(r,o,a)=>{if(e===!1)throw new It(i(o," has been removed"+(n?" in "+n:"")),It.ERR_DEPRECATED);return n&&!Xy[o]&&(Xy[o]=!0,console.warn(i(o," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(r,o,a):!0}};function ZD(t,e,n){if(typeof t!="object")throw new It("options must be an object",It.ERR_BAD_OPTION_VALUE);const s=Object.keys(t);let i=s.length;for(;i-- >0;){const r=s[i],o=e[r];if(o){const a=t[r],c=a===void 0||o(a,r,t);if(c!==!0)throw new It("option "+r+" must be "+c,It.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new It("Unknown option "+r,It.ERR_BAD_OPTION)}}const mg={assertOptions:ZD,validators:Ob},Gi=mg.validators;class kd{constructor(e){this.defaults=e,this.interceptors={request:new $y,response:new $y}}request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=Zo(this.defaults,n);const{transitional:s,paramsSerializer:i,headers:r}=n;s!==void 0&&mg.assertOptions(s,{silentJSONParsing:Gi.transitional(Gi.boolean),forcedJSONParsing:Gi.transitional(Gi.boolean),clarifyTimeoutError:Gi.transitional(Gi.boolean)},!1),i!=null&&(Ie.isFunction(i)?n.paramsSerializer={serialize:i}:mg.assertOptions(i,{encode:Gi.function,serialize:Gi.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=r&&Ie.merge(r.common,r[n.method]);r&&Ie.forEach(["delete","get","head","post","put","patch","common"],_=>{delete r[_]}),n.headers=Ci.concat(o,r);const a=[];let c=!0;this.interceptors.request.forEach(function(b){typeof b.runWhen=="function"&&b.runWhen(n)===!1||(c=c&&b.synchronous,a.unshift(b.fulfilled,b.rejected))});const d=[];this.interceptors.response.forEach(function(b){d.push(b.fulfilled,b.rejected)});let u,h=0,f;if(!c){const _=[jy.bind(this),void 0];for(_.unshift.apply(_,a),_.push.apply(_,d),f=_.length,u=Promise.resolve(n);h<f;)u=u.then(_[h++],_[h++]);return u}f=a.length;let
|
|||
|
* vue-router v4.2.5
|
|||
|
* (c) 2023 Eduardo San Martin Morote
|
|||
|
* @license MIT
|
|||
|
*/const Io=typeof window<"u";function sL(t){return t.__esModule||t[Symbol.toStringTag]==="Module"}const Ut=Object.assign;function bp(t,e){const n={};for(const s in e){const i=e[s];n[s]=Ps(i)?i.map(t):t(i)}return n}const pl=()=>{},Ps=Array.isArray,iL=/\/$/,rL=t=>t.replace(iL,"");function Ep(t,e,n="/"){let s,i={},r="",o="";const a=e.indexOf("#");let c=e.indexOf("?");return a<c&&a>=0&&(c=-1),c>-1&&(s=e.slice(0,c),r=e.slice(c+1,a>-1?a:e.length),i=t(r)),a>-1&&(s=s||e.slice(0,a),o=e.slice(a,e.length)),s=cL(s??e,n),{fullPath:s+(r&&"?")+r+o,path:s,query:i,hash:o}}function oL(t,e){const n=e.query?t(e.query):"";return e.path+(n&&"?")+n+(e.hash||"")}function Zy(t,e){return!e||!t.toLowerCase().startsWith(e.toLowerCase())?t:t.slice(e.length)||"/"}function aL(t,e,n){const s=e.matched.length-1,i=n.matched.length-1;return s>-1&&s===i&&Jo(e.matched[s],n.matched[i])&&eA(e.params,n.params)&&t(e.query)===t(n.query)&&e.hash===n.hash}function Jo(t,e){return(t.aliasOf||t)===(e.aliasOf||e)}function eA(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const n in t)if(!lL(t[n],e[n]))return!1;return!0}function lL(t,e){return Ps(t)?Jy(t,e):Ps(e)?Jy(e,t):t===e}function Jy(t,e){return Ps(e)?t.length===e.length&&t.every((n,s)=>n===e[s]):t.length===1&&t[0]===e}function cL(t,e){if(t.startsWith("/"))return t;if(!t)return e;const n=e.split("/"),s=t.split("/"),i=s[s.length-1];(i===".."||i===".")&&s.push("");let r=n.length-1,o,a;for(o=0;o<s.length;o++)if(a=s[o],a!==".")if(a==="..")r>1&&r--;else break;return n.slice(0,r).join("/")+"/"+s.slice(o-(o===s.length?1:0)).join("/")}var kl;(function(t){t.pop="pop",t.push="push"})(kl||(kl={}));var _l;(function(t){t.back="back",t.forward="forward",t.unknown=""})(_l||(_l={}));function dL(t){if(!t)if(Io){const e=document.querySelector("base");t=e&&e.getAttribute("href")||"/",t=t.replace(/^\w+:\/\/[^\/]+/,"")}else t="/";return t[0]!=="/"&&t[0]!=="#"&&(t="/"+t),rL(t)}const uL=/^[^#]+#/;function pL(t,e){return t.replace(uL,"#")+e}function _L(t,e){const n=document.documentElement.getBoundingClientRect(),s=t.getBoundingClientRect();return{behavior:e.behavior,left:s.left-n.left-(e.left||0),top:s.top-n.top-(e.top||0)}}const wu=()=>({left:window.pageXOffset,top:window.pageYOffset});function hL(t){let e;if("el"in t){const n=t.el,s=typeof n=="string"&&n.startsWith("#"),i=typeof n=="string"?s?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!i)return;e=_L(i,t)}else e=t;"scrollBehavior"in document.documentElement.style?window.scrollTo(e):window.scrollTo(e.left!=null?e.left:window.pageXOffset,e.top!=null?e.top:window.pageYOffset)}function ev(t,e){return(history.state?history.state.position-e:-1)+t}const bg=new Map;function fL(t,e){bg.set(t,e)}function mL(t){const e=bg.get(t);return bg.delete(t),e}let gL=()=>location.protocol+"//"+location.host;function tA(t,e){const{pathname:n,search:s,hash:i}=e,r=t.indexOf("#");if(r>-1){let a=i.includes(t.slice(r))?t.slice(r).length:1,c=i.slice(a);return c[0]!=="/"&&(c="/"+c),Zy(c,"")}return Zy(n,t)+s+i}function bL(t,e,n,s){let i=[],r=[],o=null;const a=({state:f})=>{const m=tA(t,location),_=n.value,b=e.value;let E=0;if(f){if(n.value=m,e.value=f,o&&o===_){o=null;return}E=b?f.position-b.position:0}else s(m);i.forEach(g=>{g(n.value,_,{delta:E,type:kl.pop,direction:E?E>0?_l.forward:_l.back:_l.unknown})})};function c(){o=n.value}function d(f){i.push(f);const m=()=>{const _=i.indexOf(f);_>-1&&i.splice(_,1)};return r.push(m),m}function u(){const{history:f}=window;f.state&&f.replaceState(Ut({},f.state,{scroll:wu()}),"")}function h(){for(const f of r)f();r=[],window.removeEventListener("popstate",a),window.removeEventListener("beforeunload",u)}return window.addEventListener("popstate",a),window.addEventListener("beforeunload",u,{passive:!0}),{pauseListeners:c,listen:d,destroy:h}}function tv(t,e,n,s=!1,i=!1){return{back:t,current:e,forward:n,replaced:s,position:window.history.length,scroll:i?wu():null}}function EL(t){const{history:e,location:n}=window,s={value:tA(t,n)},i={value:e.state};i.value||r(s.value,{back:null,current:s.value,forward:null,position:e.length-1,replace
|
|||
|
Copyright (c) 2016 Jed Watson.
|
|||
|
Licensed under the MIT License (MIT), see
|
|||
|
http://jedwatson.github.io/classnames
|
|||
|
*/(function(){var a=function(){function c(){}c.prototype=Object.create(null);function d(g,y){for(var v=y.length,S=0;S<v;++S)b(g,y[S])}var u={}.hasOwnProperty;function h(g,y){g[y]=!0}function f(g,y){for(var v in y)u.call(y,v)&&(g[v]=!!y[v])}var m=/\s+/;function _(g,y){for(var v=y.split(m),S=v.length,R=0;R<S;++R)g[v[R]]=!0}function b(g,y){if(y){var v=typeof y;v==="string"?_(g,y):Array.isArray(y)?d(g,y):v==="object"?f(g,y):v==="number"&&h(g,y)}}function E(){for(var g=arguments.length,y=Array(g),v=0;v<g;v++)y[v]=arguments[v];var S=new c;d(S,y);var R=[];for(var C in S)S[C]&&R.push(C);return R.join(" ")}return E}();typeof n<"u"&&n.exports?n.exports=a:(r=[],o=(function(){return a}).apply(s,r),o!==void 0&&(n.exports=o))})()},"./node_modules/core-js/es/array/from.js":function(n,s,i){i("./node_modules/core-js/modules/es.string.iterator.js"),i("./node_modules/core-js/modules/es.array.from.js");var r=i("./node_modules/core-js/internals/path.js");n.exports=r.Array.from},"./node_modules/core-js/internals/a-function.js":function(n,s){n.exports=function(i){if(typeof i!="function")throw TypeError(String(i)+" is not a function");return i}},"./node_modules/core-js/internals/an-object.js":function(n,s,i){var r=i("./node_modules/core-js/internals/is-object.js");n.exports=function(o){if(!r(o))throw TypeError(String(o)+" is not an object");return o}},"./node_modules/core-js/internals/array-from.js":function(n,s,i){var r=i("./node_modules/core-js/internals/bind-context.js"),o=i("./node_modules/core-js/internals/to-object.js"),a=i("./node_modules/core-js/internals/call-with-safe-iteration-closing.js"),c=i("./node_modules/core-js/internals/is-array-iterator-method.js"),d=i("./node_modules/core-js/internals/to-length.js"),u=i("./node_modules/core-js/internals/create-property.js"),h=i("./node_modules/core-js/internals/get-iterator-method.js");n.exports=function(m){var _=o(m),b=typeof this=="function"?this:Array,E=arguments.length,g=E>1?arguments[1]:void 0,y=g!==void 0,v=0,S=h(_),R,C,A,k;if(y&&(g=r(g,E>2?arguments[2]:void 0,2)),S!=null&&!(b==Array&&c(S)))for(k=S.call(_),C=new b;!(A=k.next()).done;v++)u(C,v,y?a(k,g,[A.value,v],!0):A.value);else for(R=d(_.length),C=new b(R);R>v;v++)u(C,v,y?g(_[v],v):_[v]);return C.length=v,C}},"./node_modules/core-js/internals/array-includes.js":function(n,s,i){var r=i("./node_modules/core-js/internals/to-indexed-object.js"),o=i("./node_modules/core-js/internals/to-length.js"),a=i("./node_modules/core-js/internals/to-absolute-index.js");n.exports=function(c){return function(d,u,h){var f=r(d),m=o(f.length),_=a(h,m),b;if(c&&u!=u){for(;m>_;)if(b=f[_++],b!=b)return!0}else for(;m>_;_++)if((c||_ in f)&&f[_]===u)return c||_||0;return!c&&-1}}},"./node_modules/core-js/internals/bind-context.js":function(n,s,i){var r=i("./node_modules/core-js/internals/a-function.js");n.exports=function(o,a,c){if(r(o),a===void 0)return o;switch(c){case 0:return function(){return o.call(a)};case 1:return function(d){return o.call(a,d)};case 2:return function(d,u){return o.call(a,d,u)};case 3:return function(d,u,h){return o.call(a,d,u,h)}}return function(){return o.apply(a,arguments)}}},"./node_modules/core-js/internals/call-with-safe-iteration-closing.js":function(n,s,i){var r=i("./node_modules/core-js/internals/an-object.js");n.exports=function(o,a,c,d){try{return d?a(r(c)[0],c[1]):a(c)}catch(h){var u=o.return;throw u!==void 0&&r(u.call(o)),h}}},"./node_modules/core-js/internals/check-correctness-of-iteration.js":function(n,s,i){var r=i("./node_modules/core-js/internals/well-known-symbol.js"),o=r("iterator"),a=!1;try{var c=0,d={next:function(){return{done:!!c++}},return:function(){a=!0}};d[o]=function(){return this},Array.from(d,function(){throw 2})}catch{}n.exports=function(u,h){if(!h&&!a)return!1;var f=!1;try{var m={};m[o]=function(){return{next:function(){return{done:f=!0}}}},u(m)}catch{}return f}},"./node_modules/core-js/internals/classof-raw.js":function(n,s){var i={}.toString;n.exports=function(r){return i.call(r).slice(8,-1)}},"./node_modules/core-js/internals/classof.js":function(n,s,i){var r=i("./node_modules/core-js/internals/classof
|
|||
|
`,hQ="∄",fQ="∄",mQ="𝔑",gQ="𝔫",bQ="≧̸",EQ="≱",yQ="≱",vQ="≧̸",SQ="⩾̸",TQ="⩾̸",xQ="⋙̸",CQ="≵",wQ="≫⃒",RQ="≯",AQ="≯",NQ="≫̸",OQ="↮",IQ="⇎",MQ="⫲",kQ="∋",DQ="⋼",LQ="⋺",PQ="∋",UQ="Њ",FQ="њ",BQ="↚",GQ="⇍",VQ="‥",zQ="≦̸",HQ="≰",qQ="↚",$Q="⇍",YQ="↮",WQ="⇎",KQ="≰",jQ="≦̸",QQ="⩽̸",XQ="⩽̸",ZQ="≮",JQ="⋘̸",eX="≴",tX="≪⃒",nX="≮",sX="⋪",iX="⋬",rX="≪̸",oX="∤",aX="",lX=" ",cX="𝕟",dX="ℕ",uX="⫬",pX="¬",_X="≢",hX="≭",fX="∦",mX="∉",gX="≠",bX="≂̸",EX="∄",yX="≯",vX="≱",SX="≧̸",TX="≫̸",xX="≹",CX="⩾̸",wX="≵",RX="≎̸",AX="≏̸",NX="∉",OX="⋵̸",IX="⋹̸",MX="∉",kX="⋷",DX="⋶",LX="⧏̸",PX="⋪",UX="⋬",FX="≮",BX="≰",GX="≸",VX="≪̸",zX="⩽̸",HX="≴",qX="⪢̸",$X="⪡̸",YX="∌",WX="∌",KX="⋾",jX="⋽",QX="⊀",XX="⪯̸",ZX="⋠",JX="∌",eZ="⧐̸",tZ="⋫",nZ="⋭",sZ="⊏̸",iZ="⋢",rZ="⊐̸",oZ="⋣",aZ="⊂⃒",lZ="⊈",cZ="⊁",dZ="⪰̸",uZ="⋡",pZ="≿̸",_Z="⊃⃒",hZ="⊉",fZ="≁",mZ="≄",gZ="≇",bZ="≉",EZ="∤",yZ="∦",vZ="∦",SZ="⫽⃥",TZ="∂̸",xZ="⨔",CZ="⊀",wZ="⋠",RZ="⊀",AZ="⪯̸",NZ="⪯̸",OZ="⤳̸",IZ="↛",MZ="⇏",kZ="↝̸",DZ="↛",LZ="⇏",PZ="⋫",UZ="⋭",FZ="⊁",BZ="⋡",GZ="⪰̸",VZ="𝒩",zZ="𝓃",HZ="∤",qZ="∦",$Z="≁",YZ="≄",WZ="≄",KZ="∤",jZ="∦",QZ="⋢",XZ="⋣",ZZ="⊄",JZ="⫅̸",eJ="⊈",tJ="⊂⃒",nJ="⊈",sJ="⫅̸",iJ="⊁",rJ="⪰̸",oJ="⊅",aJ="⫆̸",lJ="⊉",cJ="⊃⃒",dJ="⊉",uJ="⫆̸",pJ="≹",_J="Ñ",hJ="ñ",fJ="≸",mJ="⋪",gJ="⋬",bJ="⋫",EJ="⋭",yJ="Ν",vJ="ν",SJ="#",TJ="№",xJ=" ",CJ="≍⃒",wJ="⊬",RJ="⊭",AJ="⊮",NJ="⊯",OJ="≥⃒",IJ=">⃒",MJ="⤄",kJ="⧞",DJ="⤂",LJ="≤⃒",PJ="<⃒",UJ="⊴⃒",FJ="⤃",BJ="⊵⃒",GJ="∼⃒",VJ="⤣",zJ="↖",HJ="⇖",qJ="↖",$J="⤧",YJ="Ó",WJ="ó",KJ="⊛",jJ="Ô",QJ="ô",XJ="⊚",ZJ="О",JJ="о",eee="⊝",tee="Ő",nee="ő",see="⨸",iee="⊙",ree="⦼",oee="Œ",aee="œ",lee="⦿",cee="𝔒",dee="𝔬",uee="˛",pee="Ò",_ee="ò",hee="⧁",fee="⦵",mee="Ω",gee="∮",bee="↺",Eee="⦾",yee="⦻",vee="‾",See="⧀",Tee="Ō",xee="ō",Cee="Ω",wee="ω",Ree="Ο",Aee="ο",Nee="⦶",Oee="⊖",Iee="𝕆",Mee="𝕠",kee="⦷",Dee="“",Lee="‘",Pee="⦹",Uee="⊕",Fee="↻",Bee="⩔",Gee="∨",Vee="⩝",zee="ℴ",Hee="ℴ",qee="ª",$ee="º",Yee="⊶",Wee="⩖",Kee="⩗",jee="⩛",Qee="Ⓢ",Xee="𝒪",Zee="ℴ",Jee="Ø",ete="ø",tte="⊘",nte="Õ",ste="õ",ite="⨶",rte="⨷",ote="⊗",ate="Ö",lte="ö",cte="⌽",dte="‾",ute="⏞",pte="⎴",_te="⏜",hte="¶",fte="∥",mte="∥",gte="⫳",bte="⫽",Ete="∂",yte="∂",vte="П",Ste="п",Tte="%",xte=".",Cte="‰",wte="⊥",Rte="‱",Ate="𝔓",Nte="𝔭",Ote="Φ",Ite="φ",Mte="ϕ",kte="ℳ",Dte="☎",Lte="Π",Pte="π",Ute="⋔",Fte="ϖ",Bte="ℏ",Gte="ℎ",Vte="ℏ",zte="⨣",Hte="⊞",qte="⨢",$te="+",Yte="∔",Wte="⨥",Kte="⩲",jte="±",Qte="±",Xte="⨦",Zte="⨧",Jte="±",ene="ℌ",tne="⨕",nne="𝕡",sne="ℙ",ine="£",rne="⪷",one="⪻",ane="≺",lne="≼",cne="⪷",dne="≺",une="≼",pne="≺",_ne="⪯",hne="≼",fne="≾",mne="⪯",gne="⪹",bne="⪵",Ene="⋨",yne="⪯",vne="⪳",Sne="≾",Tne="′",xne="″",Cne="ℙ",wne="⪹",Rne="⪵",Ane="⋨",Nne="∏",One="∏",Ine="⌮",Mne="⌒",kne="⌓",Dne="∝",Lne="∝",Pne="∷",Une="∝",Fne="≾",Bne="⊰",Gne="𝒫",Vne="𝓅",zne="Ψ",Hne="ψ",qne=" ",$ne="𝔔",Yne="𝔮",Wne="⨌",Kne="𝕢",jne="ℚ",Qne="⁗",Xne="𝒬",Zne="𝓆",Jne="ℍ",ese="⨖",tse="?",nse="≟",sse='"',ise='"',rse="⇛",ose="∽̱",ase="Ŕ",lse="ŕ",cse="√",dse="⦳",use="⟩",pse="⟫",_se="⦒",hse="⦥",fse="⟩",mse="»",gse="⥵",bse="⇥",Ese="⤠",yse="⤳",vse="→",Sse="↠",Tse="⇒",xse="⤞",Cse="↪",wse="↬",Rse="⥅",Ase="⥴",Nse="⤖",Ose="↣",Ise="↝",Mse="⤚",kse="⤜",Dse="∶",Lse="ℚ",Pse="⤍",Use="⤏",Fse="⤐",Bse="❳",Gse="}",Vse="]",zse="⦌",Hse="⦎",qse="⦐",$se="Ř",Yse="ř",Wse="Ŗ",Kse="ŗ",jse="⌉",Qse="}",Xse="Р",Zse="р",Jse="⤷",eie="⥩",tie="”",nie="”",sie="↳",iie="ℜ
|
|||
|
`," "],_fe=["{","}","|","\\","^","`"].concat(pfe),hfe=["'"].concat(_fe),gv=["%","/","?",";","#"].concat(hfe),bv=["/","?","#"],ffe=255,Ev=/^[+a-z0-9A-Z_-]{0,63}$/,mfe=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,yv={javascript:!0,"javascript:":!0},vv={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function gfe(t,e){if(t&&t instanceof Ld)return t;var n=new Ld;return n.parse(t,e),n}Ld.prototype.parse=function(t,e){var n,s,i,r,o,a=t;if(a=a.trim(),!e&&t.split("#").length===1){var c=ufe.exec(a);if(c)return this.pathname=c[1],c[2]&&(this.search=c[2]),this}var d=cfe.exec(a);if(d&&(d=d[0],i=d.toLowerCase(),this.protocol=d,a=a.substr(d.length)),(e||d||a.match(/^\/\/[^@\/]+@[^@\/]+/))&&(o=a.substr(0,2)==="//",o&&!(d&&yv[d])&&(a=a.substr(2),this.slashes=!0)),!yv[d]&&(o||d&&!vv[d])){var u=-1;for(n=0;n<bv.length;n++)r=a.indexOf(bv[n]),r!==-1&&(u===-1||r<u)&&(u=r);var h,f;for(u===-1?f=a.lastIndexOf("@"):f=a.lastIndexOf("@",u),f!==-1&&(h=a.slice(0,f),a=a.slice(f+1),this.auth=h),u=-1,n=0;n<gv.length;n++)r=a.indexOf(gv[n]),r!==-1&&(u===-1||r<u)&&(u=r);u===-1&&(u=a.length),a[u-1]===":"&&u--;var m=a.slice(0,u);a=a.slice(u),this.parseHost(m),this.hostname=this.hostname||"";var _=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!_){var b=this.hostname.split(/\./);for(n=0,s=b.length;n<s;n++){var E=b[n];if(E&&!E.match(Ev)){for(var g="",y=0,v=E.length;y<v;y++)E.charCodeAt(y)>127?g+="x":g+=E[y];if(!g.match(Ev)){var S=b.slice(0,n),R=b.slice(n+1),C=E.match(mfe);C&&(S.push(C[1]),R.unshift(C[2])),R.length&&(a=R.join(".")+a),this.hostname=S.join(".");break}}}}this.hostname.length>ffe&&(this.hostname=""),_&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}var A=a.indexOf("#");A!==-1&&(this.hash=a.substr(A),a=a.slice(0,A));var k=a.indexOf("?");return k!==-1&&(this.search=a.substr(k),a=a.slice(0,k)),a&&(this.pathname=a),vv[i]&&this.hostname&&!this.pathname&&(this.pathname=""),this};Ld.prototype.parseHost=function(t){var e=dfe.exec(t);e&&(e=e[0],e!==":"&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)};var bfe=gfe;Na.encode=rfe;Na.decode=afe;Na.format=lfe;Na.parse=bfe;var Tr={},Sp,Sv;function hA(){return Sv||(Sv=1,Sp=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/),Sp}var Tp,Tv;function fA(){return Tv||(Tv=1,Tp=/[\0-\x1F\x7F-\x9F]/),Tp}var xp,xv;function Efe(){return xv||(xv=1,xp=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/),xp}var Cp,Cv;function mA(){return Cv||(Cv=1,Cp=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/),Cp}var wv;function yfe(){return wv||(wv=1,Tr.Any=hA(),Tr.Cc=fA(),Tr.Cf=Efe(),Tr.P=Pb,Tr.Z=mA()),Tr}(function(t){function e(M){return Object.prototype.toString.call(M)}function n(M){return e(M)==="[object String]"}var s=Object.prototype.hasOwnProperty;function i(M,q){return s.call(M,q)}function r(M){var q=Array.prototype.slice.call(arguments,1);return q.forEach(function(H){if(H){if(typeof H!="object")throw new TypeError(H+"must be object");Object.keys(H).forEach(function(P){M[P]=H[P]})}}),M}function o(M,q,H){return[].concat(M.slice(0,q),H,M.slice(q+1))}function a(M){return!(M>=55296&&M<=57343||M>=64976&&M<=65007||(M&65535)===65535||(M&65535)===65534||M>=0&&M<=8||M===11||M>=14&&M<=31||M>=127&&M<=159||M>1114111)}function c(M){if(M>65535){M-=65536;var q=55296+(M>>10),H=56320+(M&1023);return String.fromCharCode(q,H)}return String.fromCharCode(M)}var d=/\\([!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~])/g,u=/&([a-z#][a-z0-9]{1,31});/gi,h=new RegExp(d.source+"|"+u.source,"gi"),f=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i,m=_A;function _(M,q){var H;return i(m,q)?m[q]:q.charCodeAt(0)===35&&f.test(q)&&(H=q[1].toLowerCase()==="x"?parseInt(q.slice(2),16):parseInt(q.slice(1),10),a(H))?c(H):M}function b(M){return M.indexOf("\\")<0?M:M.replace(d,"$1")}function E(M){return M.indexOf("\\")<0&&M.indexOf("&"
|
|||
|
`};ri.fence=function(t,e,n,s,i){var r=t[e],o=r.info?wfe(r.info).trim():"",a="",c="",d,u,h,f,m;return o&&(h=o.split(/(\s+)/g),a=h[0],c=h.slice(2).join("")),n.highlight?d=n.highlight(r.content,a,c)||Qr(r.content):d=Qr(r.content),d.indexOf("<pre")===0?d+`
|
|||
|
`:o?(u=r.attrIndex("class"),f=r.attrs?r.attrs.slice():[],u<0?f.push(["class",n.langPrefix+a]):(f[u]=f[u].slice(),f[u][1]+=" "+n.langPrefix+a),m={attrs:f},"<pre><code"+i.renderAttrs(m)+">"+d+`</code></pre>
|
|||
|
`):"<pre><code"+i.renderAttrs(r)+">"+d+`</code></pre>
|
|||
|
`};ri.image=function(t,e,n,s,i){var r=t[e];return r.attrs[r.attrIndex("alt")][1]=i.renderInlineAsText(r.children,n,s),i.renderToken(t,e,n)};ri.hardbreak=function(t,e,n){return n.xhtmlOut?`<br />
|
|||
|
`:`<br>
|
|||
|
`};ri.softbreak=function(t,e,n){return n.breaks?n.xhtmlOut?`<br />
|
|||
|
`:`<br>
|
|||
|
`:`
|
|||
|
`};ri.text=function(t,e){return Qr(t[e].content)};ri.html_block=function(t,e){return t[e].content};ri.html_inline=function(t,e){return t[e].content};function Oa(){this.rules=Cfe({},ri)}Oa.prototype.renderAttrs=function(e){var n,s,i;if(!e.attrs)return"";for(i="",n=0,s=e.attrs.length;n<s;n++)i+=" "+Qr(e.attrs[n][0])+'="'+Qr(e.attrs[n][1])+'"';return i};Oa.prototype.renderToken=function(e,n,s){var i,r="",o=!1,a=e[n];return a.hidden?"":(a.block&&a.nesting!==-1&&n&&e[n-1].hidden&&(r+=`
|
|||
|
`),r+=(a.nesting===-1?"</":"<")+a.tag,r+=this.renderAttrs(a),a.nesting===0&&s.xhtmlOut&&(r+=" /"),a.block&&(o=!0,a.nesting===1&&n+1<e.length&&(i=e[n+1],(i.type==="inline"||i.hidden||i.nesting===-1&&i.tag===a.tag)&&(o=!1))),r+=o?`>
|
|||
|
`:">",r)};Oa.prototype.renderInline=function(t,e,n){for(var s,i="",r=this.rules,o=0,a=t.length;o<a;o++)s=t[o].type,typeof r[s]<"u"?i+=r[s](t,o,e,n,this):i+=this.renderToken(t,o,e);return i};Oa.prototype.renderInlineAsText=function(t,e,n){for(var s="",i=0,r=t.length;i<r;i++)t[i].type==="text"?s+=t[i].content:t[i].type==="image"?s+=this.renderInlineAsText(t[i].children,e,n):t[i].type==="softbreak"&&(s+=`
|
|||
|
`);return s};Oa.prototype.render=function(t,e,n){var s,i,r,o="",a=this.rules;for(s=0,i=t.length;s<i;s++)r=t[s].type,r==="inline"?o+=this.renderInline(t[s].children,e,n):typeof a[r]<"u"?o+=a[r](t,s,e,n,this):o+=this.renderToken(t,s,e,n);return o};var Rfe=Oa;function Fs(){this.__rules__=[],this.__cache__=null}Fs.prototype.__find__=function(t){for(var e=0;e<this.__rules__.length;e++)if(this.__rules__[e].name===t)return e;return-1};Fs.prototype.__compile__=function(){var t=this,e=[""];t.__rules__.forEach(function(n){n.enabled&&n.alt.forEach(function(s){e.indexOf(s)<0&&e.push(s)})}),t.__cache__={},e.forEach(function(n){t.__cache__[n]=[],t.__rules__.forEach(function(s){s.enabled&&(n&&s.alt.indexOf(n)<0||t.__cache__[n].push(s.fn))})})};Fs.prototype.at=function(t,e,n){var s=this.__find__(t),i=n||{};if(s===-1)throw new Error("Parser rule not found: "+t);this.__rules__[s].fn=e,this.__rules__[s].alt=i.alt||[],this.__cache__=null};Fs.prototype.before=function(t,e,n,s){var i=this.__find__(t),r=s||{};if(i===-1)throw new Error("Parser rule not found: "+t);this.__rules__.splice(i,0,{name:e,enabled:!0,fn:n,alt:r.alt||[]}),this.__cache__=null};Fs.prototype.after=function(t,e,n,s){var i=this.__find__(t),r=s||{};if(i===-1)throw new Error("Parser rule not found: "+t);this.__rules__.splice(i+1,0,{name:e,enabled:!0,fn:n,alt:r.alt||[]}),this.__cache__=null};Fs.prototype.push=function(t,e,n){var s=n||{};this.__rules__.push({name:t,enabled:!0,fn:e,alt:s.alt||[]}),this.__cache__=null};Fs.prototype.enable=function(t,e){Array.isArray(t)||(t=[t]);var n=[];return t.forEach(function(s){var i=this.__find__(s);if(i<0){if(e)return;throw new Error("Rules manager: invalid rule name "+s)}this.__rules__[i].enabled=!0,n.push(s)},this),this.__cache__=null,n};Fs.prototype.enableOnly=function(t,e){Array.isArray(t)||(t=[t]),this.__rules__.forEach(function(n){n.enabled=!1}),this.enable(t,e)};Fs.prototype.disable=function(t,e){Array.isArray(t)||(t=[t]);var n=[];return t.forEach(function(s){var i=this.__find__(s);if(i<0){if(e)return;throw new Error("Rules manager: invalid rule name "+s)}this.__rules__[i].enabled=!1,n.push(s)},this),this.__cache__=null,n};Fs.prototype.getRules=function(t){return this.__cache__===null&&this.__compile__(),this.__cache__[t]||[]};var Ub=Fs,Afe=/\r\n?|\n/g,Nfe=/\0/g,Ofe=function(e){var n;n=e.src.replace(Afe,`
|
|||
|
`),n=n.replace(Nfe,"<22>"),e.src=n},Ife=function(e){var n;e.inlineMode?(n=new e.Token("inline","",0),n.content=e.src,n.map=[0,1],n.children=[],e.tokens.push(n)):e.md.block.parse(e.src,e.md,e.env,e.tokens)},Mfe=function(e){var n=e.tokens,s,i,r;for(i=0,r=n.length;i<r;i++)s=n[i],s.type==="inline"&&e.md.inline.parse(s.content,e.md,e.env,s.children)},kfe=Lt.arrayReplaceAt;function Dfe(t){return/^<a[>\s]/i.test(t)}function Lfe(t){return/^<\/a\s*>/i.test(t)}var Pfe=function(e){var n,s,i,r,o,a,c,d,u,h,f,m,_,b,E,g,y=e.tokens,v;if(e.md.options.linkify){for(s=0,i=y.length;s<i;s++)if(!(y[s].type!=="inline"||!e.md.linkify.pretest(y[s].content)))for(r=y[s].children,_=0,n=r.length-1;n>=0;n--){if(a=r[n],a.type==="link_close"){for(n--;r[n].level!==a.level&&r[n].type!=="link_open";)n--;continue}if(a.type==="html_inline"&&(Dfe(a.content)&&_>0&&_--,Lfe(a.content)&&_++),!(_>0)&&a.type==="text"&&e.md.linkify.test(a.content)){for(u=a.content,v=e.md.linkify.match(u),c=[],m=a.level,f=0,v.length>0&&v[0].index===0&&n>0&&r[n-1].type==="text_special"&&(v=v.slice(1)),d=0;d<v.length;d++)b=v[d].url,E=e.md.normalizeLink(b),e.md.validateLink(E)&&(g=v[d].text,v[d].schema?v[d].schema==="mailto:"&&!/^mailto:/i.test(g)?g=e.md.normalizeLinkText("mailto:"+g).replace(/^mailto:/,""):g=e.md.normalizeLinkText(g):g=e.md.normalizeLinkText("http://"+g).replace(/^http:\/\//,""),h=v[d].index,h>f&&(o=new e.Token("text","",0),o.content=u.slice(f,h),o.level=m,c.push(o)),o=new e.Token("link_open","a",1),o.attrs=[["href",E]],o.level=m++,o.markup="linkify",o.info="auto",c.push(o),o=new e.Token("text","",0),o.content=g,o.level=m,c.push(o),o=new e.Token("link_close","a",-1),o.level=--m,o.markup="linkify",o.info="auto",c.push(o),f=v[d].lastIndex);f<u.length&&(o=new e.Token("text","",0),o.content=u.slice(f),o.level=m,c.push(o)),y[s].children=r=kfe(r,n,c)}}}},gA=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,Ufe=/\((c|tm|r)\)/i,Ffe=/\((c|tm|r)\)/ig,Bfe={c:"©",r:"®",tm:"™"};function Gfe(t,e){return Bfe[e.toLowerCase()]}function Vfe(t){var e,n,s=0;for(e=t.length-1;e>=0;e--)n=t[e],n.type==="text"&&!s&&(n.content=n.content.replace(Ffe,Gfe)),n.type==="link_open"&&n.info==="auto"&&s--,n.type==="link_close"&&n.info==="auto"&&s++}function zfe(t){var e,n,s=0;for(e=t.length-1;e>=0;e--)n=t[e],n.type==="text"&&!s&&gA.test(n.content)&&(n.content=n.content.replace(/\+-/g,"±").replace(/\.{2,}/g,"…").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---(?=[^-]|$)/mg,"$1—").replace(/(^|\s)--(?=\s|$)/mg,"$1–").replace(/(^|[^-\s])--(?=[^-\s]|$)/mg,"$1–")),n.type==="link_open"&&n.info==="auto"&&s--,n.type==="link_close"&&n.info==="auto"&&s++}var Hfe=function(e){var n;if(e.md.options.typographer)for(n=e.tokens.length-1;n>=0;n--)e.tokens[n].type==="inline"&&(Ufe.test(e.tokens[n].content)&&Vfe(e.tokens[n].children),gA.test(e.tokens[n].content)&&zfe(e.tokens[n].children))},Av=Lt.isWhiteSpace,Nv=Lt.isPunctChar,Ov=Lt.isMdAsciiPunct,qfe=/['"]/,Iv=/['"]/g,Mv="’";function gc(t,e,n){return t.slice(0,e)+n+t.slice(e+1)}function $fe(t,e){var n,s,i,r,o,a,c,d,u,h,f,m,_,b,E,g,y,v,S,R,C;for(S=[],n=0;n<t.length;n++){for(s=t[n],c=t[n].level,y=S.length-1;y>=0&&!(S[y].level<=c);y--);if(S.length=y+1,s.type==="text"){i=s.content,o=0,a=i.length;e:for(;o<a&&(Iv.lastIndex=o,r=Iv.exec(i),!!r);){if(E=g=!0,o=r.index+1,v=r[0]==="'",u=32,r.index-1>=0)u=i.charCodeAt(r.index-1);else for(y=n-1;y>=0&&!(t[y].type==="softbreak"||t[y].type==="hardbreak");y--)if(t[y].content){u=t[y].content.charCodeAt(t[y].content.length-1);break}if(h=32,o<a)h=i.charCodeAt(o);else for(y=n+1;y<t.length&&!(t[y].type==="softbreak"||t[y].type==="hardbreak");y++)if(t[y].content){h=t[y].content.charCodeAt(0);break}if(f=Ov(u)||Nv(String.fromCharCode(u)),m=Ov(h)||Nv(String.fromCharCode(h)),_=Av(u),b=Av(h),b?E=!1:m&&(_||f||(E=!1)),_?g=!1:f&&(b||m||(g=!1)),h===34&&r[0]==='"'&&u>=48&&u<=57&&(g=E=!1),E&&g&&(E=f,g=m),!E&&!g){v&&(s.content=gc(s.content,r.index,Mv));continue}if(g){for(y=S.length-1;y>=0&&(d=S[y],!(S[y].level<c));y--)if(d.single===v&&S[y].level===c){d=S[y],v?(R=e.md.options.quotes[2],C=e.md.options.quotes[
|
|||
|
`,o.map=[n,e.line],!0},eme=function(e,n,s,i){var r,o,a,c,d,u,h,f=!1,m=e.bMarks[n]+e.tShift[n],_=e.eMarks[n];if(e.sCount[n]-e.blkIndent>=4||m+3>_||(r=e.src.charCodeAt(m),r!==126&&r!==96)||(d=m,m=e.skipChars(m,r),o=m-d,o<3)||(h=e.src.slice(d,m),a=e.src.slice(m,_),r===96&&a.indexOf(String.fromCharCode(r))>=0))return!1;if(i)return!0;for(c=n;c++,!(c>=s||(m=d=e.bMarks[c]+e.tShift[c],_=e.eMarks[c],m<_&&e.sCount[c]<e.blkIndent));)if(e.src.charCodeAt(m)===r&&!(e.sCount[c]-e.blkIndent>=4)&&(m=e.skipChars(m,r),!(m-d<o)&&(m=e.skipSpaces(m),!(m<_)))){f=!0;break}return o=e.sCount[n],e.line=c+(f?1:0),u=e.push("fence","code",0),u.info=a,u.content=e.getLines(n+1,c,o,!0),u.markup=h,u.map=[n,e.line],!0},tme=Lt.isSpace,nme=function(e,n,s,i){var r,o,a,c,d,u,h,f,m,_,b,E,g,y,v,S,R,C,A,k,x=e.lineMax,O=e.bMarks[n]+e.tShift[n],B=e.eMarks[n];if(e.sCount[n]-e.blkIndent>=4||e.src.charCodeAt(O)!==62)return!1;if(i)return!0;for(_=[],b=[],y=[],v=[],C=e.md.block.ruler.getRules("blockquote"),g=e.parentType,e.parentType="blockquote",f=n;f<s&&(k=e.sCount[f]<e.blkIndent,O=e.bMarks[f]+e.tShift[f],B=e.eMarks[f],!(O>=B));f++){if(e.src.charCodeAt(O++)===62&&!k){for(c=e.sCount[f]+1,e.src.charCodeAt(O)===32?(O++,c++,r=!1,S=!0):e.src.charCodeAt(O)===9?(S=!0,(e.bsCount[f]+c)%4===3?(O++,c++,r=!1):r=!0):S=!1,m=c,_.push(e.bMarks[f]),e.bMarks[f]=O;O<B&&(o=e.src.charCodeAt(O),tme(o));){o===9?m+=4-(m+e.bsCount[f]+(r?1:0))%4:m++;O++}u=O>=B,b.push(e.bsCount[f]),e.bsCount[f]=e.sCount[f]+1+(S?1:0),y.push(e.sCount[f]),e.sCount[f]=m-c,v.push(e.tShift[f]),e.tShift[f]=O-e.bMarks[f];continue}if(u)break;for(R=!1,a=0,d=C.length;a<d;a++)if(C[a](e,f,s,!0)){R=!0;break}if(R){e.lineMax=f,e.blkIndent!==0&&(_.push(e.bMarks[f]),b.push(e.bsCount[f]),v.push(e.tShift[f]),y.push(e.sCount[f]),e.sCount[f]-=e.blkIndent);break}_.push(e.bMarks[f]),b.push(e.bsCount[f]),v.push(e.tShift[f]),y.push(e.sCount[f]),e.sCount[f]=-1}for(E=e.blkIndent,e.blkIndent=0,A=e.push("blockquote_open","blockquote",1),A.markup=">",A.map=h=[n,0],e.md.block.tokenize(e,n,f),A=e.push("blockquote_close","blockquote",-1),A.markup=">",e.lineMax=x,e.parentType=g,h[1]=e.line,a=0;a<v.length;a++)e.bMarks[a+n]=_[a],e.tShift[a+n]=v[a],e.sCount[a+n]=y[a],e.bsCount[a+n]=b[a];return e.blkIndent=E,!0},sme=Lt.isSpace,ime=function(e,n,s,i){var r,o,a,c,d=e.bMarks[n]+e.tShift[n],u=e.eMarks[n];if(e.sCount[n]-e.blkIndent>=4||(r=e.src.charCodeAt(d++),r!==42&&r!==45&&r!==95))return!1;for(o=1;d<u;){if(a=e.src.charCodeAt(d++),a!==r&&!sme(a))return!1;a===r&&o++}return o<3?!1:(i||(e.line=n+1,c=e.push("hr","hr",0),c.map=[n,e.line],c.markup=Array(o+1).join(String.fromCharCode(r))),!0)},EA=Lt.isSpace;function Dv(t,e){var n,s,i,r;return s=t.bMarks[e]+t.tShift[e],i=t.eMarks[e],n=t.src.charCodeAt(s++),n!==42&&n!==45&&n!==43||s<i&&(r=t.src.charCodeAt(s),!EA(r))?-1:s}function Lv(t,e){var n,s=t.bMarks[e]+t.tShift[e],i=s,r=t.eMarks[e];if(i+1>=r||(n=t.src.charCodeAt(i++),n<48||n>57))return-1;for(;;){if(i>=r)return-1;if(n=t.src.charCodeAt(i++),n>=48&&n<=57){if(i-s>=10)return-1;continue}if(n===41||n===46)break;return-1}return i<r&&(n=t.src.charCodeAt(i),!EA(n))?-1:i}function rme(t,e){var n,s,i=t.level+2;for(n=e+2,s=t.tokens.length-2;n<s;n++)t.tokens[n].level===i&&t.tokens[n].type==="paragraph_open"&&(t.tokens[n+2].hidden=!0,t.tokens[n].hidden=!0,n+=2)}var ome=function(e,n,s,i){var r,o,a,c,d,u,h,f,m,_,b,E,g,y,v,S,R,C,A,k,x,O,B,z,ee,M,q,H=n,P=!1,Y=!0;if(e.sCount[H]-e.blkIndent>=4||e.listIndent>=0&&e.sCount[H]-e.listIndent>=4&&e.sCount[H]<e.blkIndent)return!1;if(i&&e.parentType==="paragraph"&&e.sCount[H]>=e.blkIndent&&(P=!0),(O=Lv(e,H))>=0){if(h=!0,z=e.bMarks[H]+e.tShift[H],g=Number(e.src.slice(z,O-1)),P&&g!==1)return!1}else if((O=Dv(e,H))>=0)h=!1;else return!1;if(P&&e.skipSpaces(O)>=e.eMarks[H])return!1;if(i)return!0;for(E=e.src.charCodeAt(O-1),b=e.tokens.length,h?(q=e.push("ordered_list_open","ol",1),g!==1&&(q.attrs=[["start",g]])):q=e.push("bullet_list_open","ul",1),q.map=_=[H,0],q.markup=String.fromCharCode(E),B=!1,M=e.md.block.ruler.getRules("list"),R=e.parentType,e.parentType="list";H<s;){for(x=O,y=e.eMarks[H],u=v=e.sCount[H]+O-(e.bMarks[H]+e.tShift[H]);x<y;)
|
|||
|
`})),s.tokens.splice(i+3+u.length+1,0,Object.assign(new s.Token("html_block","",0),{content:e.wrapper[1]+`
|
|||
|
`})))});function Jv(t,e,n,s){var i=t,r=s;if(n&&Object.prototype.hasOwnProperty.call(e,i))throw new Error("User defined `id` attribute `"+t+"` is not unique. Please fix it in your Markdown to continue.");for(;Object.prototype.hasOwnProperty.call(e,i);)i=t+"-"+r,r+=1;return e[i]=!0,i}function ko(t,e){e=Object.assign({},ko.defaults,e),t.core.ruler.push("anchor",function(n){for(var s,i={},r=n.tokens,o=Array.isArray(e.level)?(s=e.level,function(h){return s.includes(h)}):function(h){return function(f){return f>=h}}(e.level),a=0;a<r.length;a++){var c=r[a];if(c.type==="heading_open"&&o(Number(c.tag.substr(1)))){var d=e.getTokensText(r[a+1].children),u=c.attrGet("id");u=u==null?Jv(e.slugify(d),i,!1,e.uniqueSlugStartIndex):Jv(u,i,!0,e.uniqueSlugStartIndex),c.attrSet("id",u),e.tabIndex!==!1&&c.attrSet("tabindex",""+e.tabIndex),typeof e.permalink=="function"?e.permalink(u,e,n,a):(e.permalink||e.renderPermalink&&e.renderPermalink!==Tg)&&e.renderPermalink(u,e,n,a),a=r.indexOf(c),e.callback&&e.callback(c,{slug:u,title:d})}}})}Object.assign(Zv.defaults,{style:"visually-hidden",space:!0,placement:"after",wrapper:null}),ko.permalink={__proto__:null,legacy:Tg,renderHref:DA,renderAttrs:LA,makePermalink:Xl,linkInsideHeader:Pu,ariaHidden:Nr,headerLink:PA,linkAfterHeader:Zv},ko.defaults={level:1,slugify:function(t){return encodeURIComponent(String(t).trim().toLowerCase().replace(/\s+/g,"-"))},uniqueSlugStartIndex:1,tabIndex:"-1",getTokensText:function(t){return t.filter(function(e){return["text","code_inline"].includes(e.type)}).map(function(e){return e.content}).join("")},permalink:!1,renderPermalink:Tg,permalinkClass:Nr.defaults.class,permalinkSpace:Nr.defaults.space,permalinkSymbol:"¶",permalinkBefore:Nr.defaults.placement==="before",permalinkHref:Nr.defaults.renderHref,permalinkAttrs:Nr.defaults.renderAttrs},ko.default=ko;function Li(){this.__highest_alphabet__=0,this.__match_alphabets__={},this.__initial_state__=0,this.__accept_states__={},this.__transitions__={},this.__actions__={}}Li.prototype.set_highest_alphabet=function(t){this.__highest_alphabet__=t};Li.prototype.set_match_alphabets=function(t){this.__match_alphabets__=t};Li.prototype.set_initial_state=function(t){this.__initial_state__=t};Li.prototype.set_accept_states=function(t){for(var e=0;e<t.length;e++)this.__accept_states__[t[e]]=!0};Li.prototype.set_transitions=function(t){this.__transitions__=t};Li.prototype.set_actions=function(t){this.__actions__=t};Li.prototype.update_transition=function(t,e){this.__transitions__[t]=Object.assign(this.__transitions__[t]||Object(),e)};Li.prototype.execute=function(t,e){var n,s,i;for(n=this.__initial_state__,s=t;n&&s<e;s++){for(i=this.__highest_alphabet__;i>0&&!(n&i&&this.__match_alphabets__[i].call(this,s,n,i));i>>=4);if(this.__actions__(s,n,i),i===0)break;n=this.__transitions__[n][i]||0}return!!this.__accept_states__[n]};var eHe=Li,tHe=eHe,nHe=function(e,n){var s={multiline:!1,rowspan:!1,headerless:!1,multibody:!0,autolabel:!0};n=e.utils.assign({},s,n||{});function i(u,h){var f=u.bMarks[h]+u.sCount[h],m=u.bMarks[h]+u.blkIndent,_=u.skipSpacesBack(u.eMarks[h],m),b=[],E,g,y=!1,v=!1,S=0;for(E=f;E<_;E++)switch(u.src.charCodeAt(E)){case 92:y=!0;break;case 96:g=u.skipChars(E,96)-1,g>E?(v||(S===0?S=g-E:S===g-E&&(S=0)),E=g):(v||!y&&!S)&&(v=!v),y=!1;break;case 124:!v&&!y&&b.push(E),y=!1;break;default:y=!1;break}return b.length===0||(b[0]>m&&b.unshift(m-1),b[b.length-1]<_-1&&b.push(_)),b}function r(u,h,f){var m={text:null,label:null},_=u.bMarks[f]+u.sCount[f],b=u.eMarks[f],E=/^\[(.+?)\](\[([^\[\]]+)\])?\s*$/,g=u.src.slice(_,b).match(E);return g?h?!0:(m.text=g[1],!n.autolabel&&!g[2]||(m.label=g[2]||g[1],m.label=m.label.toLowerCase().replace(/\W+/g,"")),m):!1}function o(u,h,f){var m={bounds:null,multiline:null},_=i(u,f),b,E,g;return _.length<2?!1:h?!0:(m.bounds=_,n.multiline&&(b=u.bMarks[f]+u.sCount[f],E=u.eMarks[f]-1,m.multiline=u.src.charCodeAt(E)===92,m.multiline&&(g=u.eMarks[f],u.eMarks[f]=u.skipSpacesBack(E,b),m.bounds=i(u,f),u.eMarks[f]=g)),m)}function a(u,h,f){var m={aligns:[],wraps:[]},_=i(u,f),b=/^:?(-+|=+):?\+?$/,E,g,y;if(u.sCount[f]-u.bl
|
|||
|
`),u.md,u.env,[]),P.level=v.level+1,u.md.block.tokenize(P,v.map[0],P.lineMax),H=0;H<P.tokens.length;H++)u.tokens.push(P.tokens[H])}else g=u.push("inline","",0),g.content=B.trim(),g.map=v.map,g.level=v.level+1,g.children=[];g=u.push(O+"_close",O,-1)}u.push("tr_close","tr",-1),v.meta.grp&1&&(O=v.meta.type===256?"thead":"tbody",g=u.push(O+"_close",O,-1),x[1]=v.map[1])}return k[1]=Math.max(x[1],y.meta.sep.map[1],y.meta.cap?y.meta.cap.map[1]:-1),g=u.push("table_close","table",-1),u.line=k[1],!0}e.block.ruler.at("table",d,{alt:["paragraph","reference"]})};const sHe=fr(nHe);var iHe=function(e,n){n=n||{};function s(i){for(var r=1,o=1,a=i.tokens.length;o<a-1;++o){var c=i.tokens[o];if(c.type==="inline"&&!(!c.children||c.children.length!==1&&c.children.length!==3)&&!(c.children.length===1&&c.children[0].type!=="image")&&!(c.children.length===3&&(c.children[0].type!=="link_open"||c.children[1].type!=="image"||c.children[2].type!=="link_close"))&&!(o!==0&&i.tokens[o-1].type!=="paragraph_open")&&!(o!==a-1&&i.tokens[o+1].type!=="paragraph_close")){var d=i.tokens[o-1];d.type="figure_open",d.tag="figure",i.tokens[o+1].type="figure_close",i.tokens[o+1].tag="figure",n.dataType==!0&&i.tokens[o-1].attrPush(["data-type","image"]);var u;if(n.link==!0&&c.children.length===1&&(u=c.children[0],c.children.unshift(new i.Token("link_open","a",1)),c.children[0].attrPush(["href",u.attrGet("src")]),c.children.push(new i.Token("link_close","a",-1))),u=c.children.length===1?c.children[0]:c.children[1],n.figcaption==!0&&u.children&&u.children.length&&(c.children.push(new i.Token("figcaption_open","figcaption",1)),c.children.splice(c.children.length,0,...u.children),c.children.push(new i.Token("figcaption_close","figcaption",-1)),u.children.length=0),n.copyAttrs&&u.attrs){const h=n.copyAttrs===!0?"":n.copyAttrs;d.attrs=u.attrs.filter(([f,m])=>f.match(h))}n.tabindex==!0&&(i.tokens[o-1].attrPush(["tabindex",r]),r++),n.lazyLoading==!0&&u.attrPush(["loading","lazy"])}}}e.core.ruler.before("linkify","implicit_figures",s)};const rHe=fr(iHe);var mr={};mr.getAttrs=function(t,e,n){const s=/[^\t\n\f />"'=]/,i=" ",r="=",o=".",a="#",c=[];let d="",u="",h=!0,f=!1;for(let m=e+n.leftDelimiter.length;m<t.length;m++){if(t.slice(m,m+n.rightDelimiter.length)===n.rightDelimiter){d!==""&&c.push([d,u]);break}const _=t.charAt(m);if(_===r&&h){h=!1;continue}if(_===o&&d===""){t.charAt(m+1)===o?(d="css-module",m+=1):d="class",h=!1;continue}if(_===a&&d===""){d="id",h=!1;continue}if(_==='"'&&u===""&&!f){f=!0;continue}if(_==='"'&&f){f=!1;continue}if(_===i&&!f){if(d==="")continue;c.push([d,u]),d="",u="",h=!0;continue}if(!(h&&_.search(s)===-1)){if(h){d+=_;continue}u+=_}}if(n.allowedAttributes&&n.allowedAttributes.length){const m=n.allowedAttributes;return c.filter(function(_){const b=_[0];function E(g){return b===g||g instanceof RegExp&&g.test(b)}return m.some(E)})}return c};mr.addAttrs=function(t,e){for(let n=0,s=t.length;n<s;++n){const i=t[n][0];i==="class"?e.attrJoin("class",t[n][1]):i==="css-module"?e.attrJoin("css-module",t[n][1]):e.attrPush(t[n])}return e};mr.hasDelimiters=function(t,e){if(!t)throw new Error('Parameter `where` not passed. Should be "start", "end" or "only".');return function(n){const s=e.leftDelimiter.length+1+e.rightDelimiter.length;if(!n||typeof n!="string"||n.length<s)return!1;function i(u){const h=u.charAt(e.leftDelimiter.length)===".",f=u.charAt(e.leftDelimiter.length)==="#";return h||f?u.length>=s+1:u.length>=s}let r,o,a,c;const d=s-e.rightDelimiter.length;switch(t){case"start":a=n.slice(0,e.leftDelimiter.length),r=a===e.leftDelimiter?0:-1,o=r===-1?-1:n.indexOf(e.rightDelimiter,d),c=n.charAt(o+e.rightDelimiter.length),c&&e.rightDelimiter.indexOf(c)!==-1&&(o=-1);break;case"end":r=n.lastIndexOf(e.leftDelimiter),o=r===-1?-1:n.indexOf(e.rightDelimiter,r+d),o=o===n.length-e.rightDelimiter.length?o:-1;break;case"only":a=n.slice(0,e.leftDelimiter.length),r=a===e.leftDelimiter?0:-1,a=n.slice(n.length-e.rightDelimiter.length),o=a===e.rightDelimiter?n.length-e.rightDelimiter.length:-1;break;default:throw new Error(`Unexpected case ${t}, expected 'start', 'end' or 'only
|
|||
|
{.a} softbreak then curly in start`,tests:[{shift:0,type:"inline",children:[{position:-2,type:"softbreak"},{position:-1,type:"text",content:xt.hasDelimiters("only",t)}]}],transform:(n,s,i)=>{const r=n[s].children[i],o=xt.getAttrs(r.content,0,t);let a=s+1;for(;n[a+1]&&n[a+1].nesting===-1;)a++;const c=xt.getMatchingOpeningToken(n,a);xt.addAttrs(o,c),n[s].children=n[s].children.slice(0,-2)}},{name:"horizontal rule",tests:[{shift:0,type:"paragraph_open"},{shift:1,type:"inline",children:n=>n.length===1,content:n=>n.match(e)!==null},{shift:2,type:"paragraph_close"}],transform:(n,s)=>{const i=n[s];i.type="hr",i.tag="hr",i.nesting=0;const r=n[s+1].content,o=r.lastIndexOf(t.leftDelimiter),a=xt.getAttrs(r,o,t);xt.addAttrs(a,i),i.markup=r,n.splice(s+1,2)}},{name:"end of block",tests:[{shift:0,type:"inline",children:[{position:-1,content:xt.hasDelimiters("end",t),type:n=>n!=="code_inline"&&n!=="math_inline"}]}],transform:(n,s,i)=>{const r=n[s].children[i],o=r.content,a=xt.getAttrs(o,o.lastIndexOf(t.leftDelimiter),t);let c=s+1;for(;n[c+1]&&n[c+1].nesting===-1;)c++;const d=xt.getMatchingOpeningToken(n,c);xt.addAttrs(a,d);const u=o.slice(0,o.lastIndexOf(t.leftDelimiter));r.content=eS(u)!==" "?u:u.slice(0,-1)}}]};function eS(t){return t.slice(-1)[0]}const uHe=dHe,pHe={leftDelimiter:"{",rightDelimiter:"}",allowedAttributes:[]};var _He=function(e,n){let s=Object.assign({},pHe);s=Object.assign(s,n);const i=uHe(s);function r(o){const a=o.tokens;for(let c=0;c<a.length;c++)for(let d=0;d<i.length;d++){const u=i[d];let h=null;u.tests.every(m=>{const _=Cg(a,c,m);return _.j!==null&&(h=_.j),_.match})&&(u.transform(a,c,h),(u.name==="inline attributes"||u.name==="inline nesting 0")&&d--)}}e.core.ruler.before("linkify","curly_attributes",r)};function Cg(t,e,n){const s={match:!1,j:null},i=n.shift!==void 0?e+n.shift:n.position;if(n.shift!==void 0&&i<0)return s;const r=mHe(t,i);if(r===void 0)return s;for(const o of Object.keys(n))if(!(o==="shift"||o==="position")){if(r[o]===void 0)return s;if(o==="children"&&hHe(n.children)){if(r.children.length===0)return s;let a;const c=n.children,d=r.children;if(c.every(u=>u.position!==void 0)){if(a=c.every(u=>Cg(d,u.position,u).match),a){const u=gHe(c).position;s.j=u>=0?u:d.length+u}}else for(let u=0;u<d.length;u++)if(a=c.every(h=>Cg(d,u,h).match),a){s.j=u;break}if(a===!1)return s;continue}switch(typeof n[o]){case"boolean":case"number":case"string":if(r[o]!==n[o])return s;break;case"function":if(!n[o](r[o]))return s;break;case"object":if(fHe(n[o])){if(n[o].every(c=>c(r[o]))===!1)return s;break}default:throw new Error(`Unknown type of pattern test (key: ${o}). Test should be of type boolean, number, string, function or array of functions.`)}}return s.match=!0,s}function hHe(t){return Array.isArray(t)&&t.length&&t.every(e=>typeof e=="object")}function fHe(t){return Array.isArray(t)&&t.length&&t.every(e=>typeof e=="function")}function mHe(t,e){return e>=0?t[e]:t[t.length+e]}function gHe(t){return t.slice(-1)[0]||{}}const bHe=fr(_He);function UA(t){return t instanceof Map?t.clear=t.delete=t.set=function(){throw new Error("map is read-only")}:t instanceof Set&&(t.add=t.clear=t.delete=function(){throw new Error("set is read-only")}),Object.freeze(t),Object.getOwnPropertyNames(t).forEach(e=>{const n=t[e],s=typeof n;(s==="object"||s==="function")&&!Object.isFrozen(n)&&UA(n)}),t}let tS=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function FA(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function ir(t,...e){const n=Object.create(null);for(const s in t)n[s]=t[s];return e.forEach(function(s){for(const i in s)n[i]=s[i]}),n}const EHe="</span>",nS=t=>!!t.scope,yHe=(t,{prefix:e})=>{if(t.startsWith("language:"))return t.replace("language:","language-");if(t.includes(".")){const n=t.split(".");return[`${e}${n.shift()}`,...n.map((s,i)=>`${s}${"_".repeat(i+1)}`)].join(" ")}return`${e}${t}`};class vHe{constructor(e,n){this.buffer="",this.classPrefix=n.classPrefix,e.walk(this)}ad
|
|||
|
https://github.com/highlightjs/highlight.js/issues/2277`),me=P,oe=Y),te===void 0&&(te=!0);const Se={code:oe,language:me};q("before:highlight",Se);const le=Se.result?Se.result:h(Se.language,Se.code,te);return le.code=Se.code,q("after:highlight",le),le}function h(P,Y,te,oe){const me=Object.create(null);function Se(j,ne){return j.keywords[ne]}function le(){if(!se.keywords){ge.addText(ke);return}let j=0;se.keywordPatternRe.lastIndex=0;let ne=se.keywordPatternRe.exec(ke),Re="";for(;ne;){Re+=ke.substring(j,ne.index);const xe=ie.case_insensitive?ne[0].toLowerCase():ne[0],Pe=Se(se,xe);if(Pe){const[Ze,ht]=Pe;if(ge.addText(Re),Re="",me[xe]=(me[xe]||0)+1,me[xe]<=d7e&&(L+=ht),Ze.startsWith("_"))Re+=ne[0];else{const Ue=ie.classNameAliases[Ze]||Ze;Me(ne[0],Ue)}}else Re+=ne[0];j=se.keywordPatternRe.lastIndex,ne=se.keywordPatternRe.exec(ke)}Re+=ke.substring(j),ge.addText(Re)}function Ee(){if(ke==="")return;let j=null;if(typeof se.subLanguage=="string"){if(!e[se.subLanguage]){ge.addText(ke);return}j=h(se.subLanguage,ke,!0,we[se.subLanguage]),we[se.subLanguage]=j._top}else j=m(ke,se.subLanguage.length?se.subLanguage:null);se.relevance>0&&(L+=j.relevance),ge.__addSublanguage(j._emitter,j.language)}function Oe(){se.subLanguage!=null?Ee():le(),ke=""}function Me(j,ne){j!==""&&(ge.startScope(ne),ge.addText(j),ge.endScope())}function Q(j,ne){let Re=1;const xe=ne.length-1;for(;Re<=xe;){if(!j._emit[Re]){Re++;continue}const Pe=ie.classNameAliases[j[Re]]||j[Re],Ze=ne[Re];Pe?Me(Ze,Pe):(ke=Ze,le(),ke=""),Re++}}function he(j,ne){return j.scope&&typeof j.scope=="string"&&ge.openNode(ie.classNameAliases[j.scope]||j.scope),j.beginScope&&(j.beginScope._wrap?(Me(ke,ie.classNameAliases[j.beginScope._wrap]||j.beginScope._wrap),ke=""):j.beginScope._multi&&(Q(j.beginScope,ne),ke="")),se=Object.create(j,{parent:{value:se}}),se}function _e(j,ne,Re){let xe=wHe(j.endRe,Re);if(xe){if(j["on:end"]){const Pe=new tS(j);j["on:end"](ne,Pe),Pe.isMatchIgnored&&(xe=!1)}if(xe){for(;j.endsParent&&j.parent;)j=j.parent;return j}}if(j.endsWithParent)return _e(j.parent,ne,Re)}function Ce(j){return se.matcher.regexIndex===0?(ke+=j[0],1):(ye=!0,0)}function Le(j){const ne=j[0],Re=j.rule,xe=new tS(Re),Pe=[Re.__beforeBegin,Re["on:begin"]];for(const Ze of Pe)if(Ze&&(Ze(j,xe),xe.isMatchIgnored))return Ce(ne);return Re.skip?ke+=ne:(Re.excludeBegin&&(ke+=ne),Oe(),!Re.returnBegin&&!Re.excludeBegin&&(ke=ne)),he(Re,j),Re.returnBegin?0:ne.length}function N(j){const ne=j[0],Re=Y.substring(j.index),xe=_e(se,j,Re);if(!xe)return aS;const Pe=se;se.endScope&&se.endScope._wrap?(Oe(),Me(ne,se.endScope._wrap)):se.endScope&&se.endScope._multi?(Oe(),Q(se.endScope,j)):Pe.skip?ke+=ne:(Pe.returnEnd||Pe.excludeEnd||(ke+=ne),Oe(),Pe.excludeEnd&&(ke=ne));do se.scope&&ge.closeNode(),!se.skip&&!se.subLanguage&&(L+=se.relevance),se=se.parent;while(se!==xe.parent);return xe.starts&&he(xe.starts,j),Pe.returnEnd?0:ne.length}function V(){const j=[];for(let ne=se;ne!==ie;ne=ne.parent)ne.scope&&j.unshift(ne.scope);j.forEach(ne=>ge.openNode(ne))}let $={};function ae(j,ne){const Re=ne&&ne[0];if(ke+=j,Re==null)return Oe(),0;if($.type==="begin"&&ne.type==="end"&&$.index===ne.index&&Re===""){if(ke+=Y.slice(ne.index,ne.index+1),!i){const xe=new Error(`0 width match regex (${P})`);throw xe.languageName=P,xe.badRule=$.rule,xe}return 1}if($=ne,ne.type==="begin")return Le(ne);if(ne.type==="illegal"&&!te){const xe=new Error('Illegal lexeme "'+Re+'" for mode "'+(se.scope||"<unnamed>")+'"');throw xe.mode=se,xe}else if(ne.type==="end"){const xe=N(ne);if(xe!==aS)return xe}if(ne.type==="illegal"&&Re==="")return 1;if(K>1e5&&K>ne.index*3)throw new Error("potential infinite loop, way more iterations than matches");return ke+=Re,Re.length}const ie=x(P);if(!ie)throw Hr(r.replace("{}",P)),new Error('Unknown language: "'+P+'"');const Te=o7e(ie);let Ae="",se=oe||Te;const we={},ge=new a.__emitter(a);V();let ke="",L=0,I=0,K=0,ye=!1;try{if(ie.__emitTokens)ie.__emitTokens(Y,ge);else{for(se.matcher.considerAll();;){K++,ye?ye=!1:se.matcher.considerAll(),se.matcher.lastIndex=I;const j=se.matcher.exec(Y);if(!j)break;const ne=Y.substring(I,j.index),
|
|||
|
`},_]}}return vh=i,vh}var Sh,W0;function Xqe(){if(W0)return Sh;W0=1;function t(e){const n="[a-zA-Z_][\\w.]*",s="<\\?(lasso(script)?|=)",i="\\]|\\?>",r={$pattern:n+"|&[lg]t;",literal:"true false none minimal full all void and or not bw nbw ew new cn ncn lt lte gt gte eq neq rx nrx ft",built_in:"array date decimal duration integer map pair string tag xml null boolean bytes keyword list locale queue set stack staticarray local var variable global data self inherited currentcapture givenblock",keyword:"cache database_names database_schemanames database_tablenames define_tag define_type email_batch encode_set html_comment handle handle_error header if inline iterate ljax_target link link_currentaction link_currentgroup link_currentrecord link_detail link_firstgroup link_firstrecord link_lastgroup link_lastrecord link_nextgroup link_nextrecord link_prevgroup link_prevrecord log loop namespace_using output_none portal private protect records referer referrer repeating resultset rows search_args search_arguments select sort_args sort_arguments thread_atomic value_list while abort case else fail_if fail_ifnot fail if_empty if_false if_null if_true loop_abort loop_continue loop_count params params_up return return_value run_children soap_definetag soap_lastrequest soap_lastresponse tag_name ascending average by define descending do equals frozen group handle_failure import in into join let match max min on order parent protected provide public require returnhome skip split_thread sum take thread to trait type where with yield yieldhome"},o=e.COMMENT("<!--","-->",{relevance:0}),a={className:"meta",begin:"\\[noprocess\\]",starts:{end:"\\[/noprocess\\]",returnEnd:!0,contains:[o]}},c={className:"meta",begin:"\\[/noprocess|"+s},d={className:"symbol",begin:"'"+n+"'"},u=[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,e.inherit(e.C_NUMBER_MODE,{begin:e.C_NUMBER_RE+"|(-?infinity|NaN)\\b"}),e.inherit(e.APOS_STRING_MODE,{illegal:null}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null}),{className:"string",begin:"`",end:"`"},{variants:[{begin:"[#$]"+n},{begin:"#",end:"\\d+",illegal:"\\W"}]},{className:"type",begin:"::\\s*",end:n,illegal:"\\W"},{className:"params",variants:[{begin:"-(?!infinity)"+n,relevance:0},{begin:"(\\.\\.\\.)"}]},{begin:/(->|\.)\s*/,relevance:0,contains:[d]},{className:"class",beginKeywords:"define",returnEnd:!0,end:"\\(|=>",contains:[e.inherit(e.TITLE_MODE,{begin:n+"(=(?!>))?|[-+*/%](?!>)"})]}];return{name:"Lasso",aliases:["ls","lassoscript"],case_insensitive:!0,keywords:r,contains:[{className:"meta",begin:i,relevance:0,starts:{end:"\\[|"+s,returnEnd:!0,relevance:0,contains:[o]}},a,c,{className:"meta",begin:"\\[no_square_brackets",starts:{end:"\\[/no_square_brackets\\]",keywords:r,contains:[{className:"meta",begin:i,relevance:0,starts:{end:"\\[noprocess\\]|"+s,returnEnd:!0,contains:[o]}},a,c].concat(u)}},{className:"meta",begin:"\\[",relevance:0},{className:"meta",begin:"^#!",end:"lasso9$",relevance:10}].concat(u)}}return Sh=t,Sh}var Th,K0;function Zqe(){if(K0)return Th;K0=1;function t(e){const s=e.regex.either(...["(?:NeedsTeXFormat|RequirePackage|GetIdInfo)","Provides(?:Expl)?(?:Package|Class|File)","(?:DeclareOption|ProcessOptions)","(?:documentclass|usepackage|input|include)","makeat(?:letter|other)","ExplSyntax(?:On|Off)","(?:new|renew|provide)?command","(?:re)newenvironment","(?:New|Renew|Provide|Declare)(?:Expandable)?DocumentCommand","(?:New|Renew|Provide|Declare)DocumentEnvironment","(?:(?:e|g|x)?def|let)","(?:begin|end)","(?:part|chapter|(?:sub){0,2}section|(?:sub)?paragraph)","caption","(?:label|(?:eq|page|name)?ref|(?:paren|foot|super)?cite)","(?:alpha|beta|[Gg]amma|[Dd]elta|(?:var)?epsilon|zeta|eta|[Tt]heta|vartheta)","(?:iota|(?:var)?kappa|[Ll]ambda|mu|nu|[Xx]i|[Pp]i|varpi|(?:var)rho)","(?:[Ss]igma|varsigma|tau|[Uu]psilon|[Pp]hi|varphi|chi|[Pp]si|[Oo]mega)","(?:frac|sum|prod|lim|infty|times|sqrt|leq|geq|left|right|middle|[bB]igg?)","(?:[lr]angle|q?quad|[lcvdi]?dots|d?dot|hat|tilde|bar)"].map(B=>B+"(?![a-zA-Z@:_])")),i=new RegExp(["(?:__)?[a-zA-Z]{2,}_[a-zA-Z](?:_?[a-zA-Z])+:[a-zA-Z]*","[lgc]__?[a-zA-Z](?:_?[a-zA-
|
|||
|
]`,_={scope:"string",variants:[u,d,h,f]},b={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},E=["false","null","true"],g=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],y=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],S={keyword:g,literal:(M=>{const q=[];return M.forEach(H=>{q.push(H),H.toLowerCase()===H?q.push(H.toUpperCase()):q.push(H.toLowerCase())}),q})(E),built_in:y},R=M=>M.map(q=>q.replace(/\|\d+$/,"")),C={variants:[{match:[/new/,n.concat(m,"+"),n.concat("(?!",R(y).join("\\b|"),"\\b)"),r],scope:{1:"keyword",4:"title.class"}}]},A=n.concat(i,"\\b(?!\\()"),k={variants:[{match:[n.concat(/::/,n.lookahead(/(?!class\b)/)),A],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[r,n.concat(/::/,n.lookahead(/(?!class\b)/)),A],scope:{1:"title.class",3:"variable.constant"}},{match:[r,n.concat("::",n.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[r,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},x={scope:"attr",match:n.concat(i,n.lookahead(":"),n.lookahead(/(?!::)/))},O={relevance:0,begin:/\(/,end:/\)/,keywords:S,contains:[x,o,k,e.C_BLOCK_COMMENT_MODE,_,b,C]},B={relevance:0,match:[/\b/,n.concat("(?!fn\\b|function\\b|",R(g).join("\\b|"),"|",R(y).join("\\b|"),"\\b)"),i,n.concat(m,"*"),n.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[O]};O.contains.push(B);const z=[x,k,e.C_BLOCK_COMMENT_MODE,_,b,C],ee={begin:n.concat(/#\[\s*/,r),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:E,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:E,keyword:["new","array"]},contains:["self",...z]},...z,{
|
|||
|
]*;`,relevance:0},{begin:"[vp][0-9]+"}]}}return Pf=t,Pf}var Uf,ax;function uYe(){if(ax)return Uf;ax=1;function t(e){const n="[a-z][a-zA-Z0-9_]*",s={className:"string",begin:"\\$.{1}"},i={className:"symbol",begin:"#"+e.UNDERSCORE_IDENT_RE};return{name:"Smalltalk",aliases:["st"],keywords:["self","super","nil","true","false","thisContext"],contains:[e.COMMENT('"','"'),e.APOS_STRING_MODE,{className:"type",begin:"\\b[A-Z][A-Za-z0-9_]*",relevance:0},{begin:n+":",relevance:0},e.C_NUMBER_MODE,i,s,{begin:"\\|[ ]*"+n+"([ ]+"+n+")*[ ]*\\|",returnBegin:!0,end:/\|/,illegal:/\S/,contains:[{begin:"(\\|[ ]*)?"+n}]},{begin:"#\\(",end:"\\)",contains:[e.APOS_STRING_MODE,s,e.C_NUMBER_MODE,i]}]}}return Uf=t,Uf}var Ff,lx;function pYe(){if(lx)return Ff;lx=1;function t(e){return{name:"SML (Standard ML)",aliases:["ml"],keywords:{$pattern:"[a-z_]\\w*!?",keyword:"abstype and andalso as case datatype do else end eqtype exception fn fun functor handle if in include infix infixr let local nonfix of op open orelse raise rec sharing sig signature struct structure then type val with withtype where while",built_in:"array bool char exn int list option order real ref string substring vector unit word",literal:"true false NONE SOME LESS EQUAL GREATER nil"},illegal:/\/\/|>>/,contains:[{className:"literal",begin:/\[(\|\|)?\]|\(\)/,relevance:0},e.COMMENT("\\(\\*","\\*\\)",{contains:["self"]}),{className:"symbol",begin:"'[A-Za-z_](?!')[\\w']*"},{className:"type",begin:"`[A-Z][\\w']*"},{className:"type",begin:"\\b[A-Z][\\w']*",relevance:0},{begin:"[a-z_]\\w*'[\\w']*"},e.inherit(e.APOS_STRING_MODE,{className:"string",relevance:0}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null}),{className:"number",begin:"\\b(0[xX][a-fA-F0-9_]+[Lln]?|0[oO][0-7_]+[Lln]?|0[bB][01_]+[Lln]?|[0-9][0-9_]*([Lln]|(\\.[0-9_]*)?([eE][-+]?[0-9_]+)?)?)",relevance:0},{begin:/[-=]>/}]}}return Ff=t,Ff}var Bf,cx;function _Ye(){if(cx)return Bf;cx=1;function t(e){const n={className:"variable",begin:/\b_+[a-zA-Z]\w*/},s={className:"title",begin:/[a-zA-Z][a-zA-Z_0-9]*_fnc_[a-zA-Z_0-9]+/},i={className:"string",variants:[{begin:'"',end:'"',contains:[{begin:'""',relevance:0}]},{begin:"'",end:"'",contains:[{begin:"''",relevance:0}]}]},r=["break","breakWith","breakOut","breakTo","case","catch","continue","continueWith","default","do","else","exit","exitWith","for","forEach","from","if","local","private","switch","step","then","throw","to","try","waitUntil","while","with"],o=["blufor","civilian","configNull","controlNull","displayNull","diaryRecordNull","east","endl","false","grpNull","independent","lineBreak","locationNull","nil","objNull","opfor","pi","resistance","scriptNull","sideAmbientLife","sideEmpty","sideEnemy","sideFriendly","sideLogic","sideUnknown","taskNull","teamMemberNull","true","west"],a=["abs","accTime","acos","action","actionIDs","actionKeys","actionKeysEx","actionKeysImages","actionKeysNames","actionKeysNamesArray","actionName","actionParams","activateAddons","activatedAddons","activateKey","activeTitleEffectParams","add3DENConnection","add3DENEventHandler","add3DENLayer","addAction","addBackpack","addBackpackCargo","addBackpackCargoGlobal","addBackpackGlobal","addBinocularItem","addCamShake","addCuratorAddons","addCuratorCameraArea","addCuratorEditableObjects","addCuratorEditingArea","addCuratorPoints","addEditorObject","addEventHandler","addForce","addForceGeneratorRTD","addGoggles","addGroupIcon","addHandgunItem","addHeadgear","addItem","addItemCargo","addItemCargoGlobal","addItemPool","addItemToBackpack","addItemToUniform","addItemToVest","addLiveStats","addMagazine","addMagazineAmmoCargo","addMagazineCargo","addMagazineCargoGlobal","addMagazineGlobal","addMagazinePool","addMagazines","addMagazineTurret","addMenu","addMenuItem","addMissionEventHandler","addMPEventHandler","addMusicEventHandler","addonFiles","addOwnedMine","addPlayerScores","addPrimaryWeaponItem","addPublicVariableEventHandler","addRating","addResources","addScore","addScoreSide","addSecondaryWeaponItem","addSwitchableUnit","addTeamMember","addToRemainsCollector","addTorque","addUniform","addUserActionEventHandler","a
|
|||
|
]*?"'`},{begin:`"[^\r
|
|||
|
"]*"`}]},{className:"built_in",variants:[{begin:"\\b(abs|acos|asin|atan|atan2|atanh|ceil|cloglog|comb|cos|digamma|exp|floor|invcloglog|invlogit|ln|lnfact|lnfactorial|lngamma|log|log10|max|min|mod|reldif|round|sign|sin|sqrt|sum|tan|tanh|trigamma|trunc|betaden|Binomial|binorm|binormal|chi2|chi2tail|dgammapda|dgammapdada|dgammapdadx|dgammapdx|dgammapdxdx|F|Fden|Ftail|gammaden|gammap|ibeta|invbinomial|invchi2|invchi2tail|invF|invFtail|invgammap|invibeta|invnchi2|invnFtail|invnibeta|invnorm|invnormal|invttail|nbetaden|nchi2|nFden|nFtail|nibeta|norm|normal|normalden|normd|npnchi2|tden|ttail|uniform|abbrev|char|index|indexnot|length|lower|ltrim|match|plural|proper|real|regexm|regexr|regexs|reverse|rtrim|string|strlen|strlower|strltrim|strmatch|strofreal|strpos|strproper|strreverse|strrtrim|strtrim|strupper|subinstr|subinword|substr|trim|upper|word|wordcount|_caller|autocode|byteorder|chop|clip|cond|e|epsdouble|epsfloat|group|inlist|inrange|irecode|matrix|maxbyte|maxdouble|maxfloat|maxint|maxlong|mi|minbyte|mindouble|minfloat|minint|minlong|missing|r|recode|replay|return|s|scalar|d|date|day|dow|doy|halfyear|mdy|month|quarter|week|year|d|daily|dofd|dofh|dofm|dofq|dofw|dofy|h|halfyearly|hofd|m|mofd|monthly|q|qofd|quarterly|tin|twithin|w|weekly|wofd|y|yearly|yh|ym|yofd|yq|yw|cholesky|colnumb|colsof|corr|det|diag|diag0cnt|el|get|hadamard|I|inv|invsym|issym|issymmetric|J|matmissing|matuniform|mreldif|nullmat|rownumb|rowsof|sweep|syminv|trace|vec|vecdiag)(?=\\()"}]},e.COMMENT("^[ ]*\\*.*$",!1),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]}}return zf=t,zf}var Hf,_x;function gYe(){if(_x)return Hf;_x=1;function t(e){return{name:"STEP Part 21",aliases:["p21","step","stp"],case_insensitive:!0,keywords:{$pattern:"[A-Z_][A-Z0-9_.]*",keyword:["HEADER","ENDSEC","DATA"]},contains:[{className:"meta",begin:"ISO-10303-21;",relevance:10},{className:"meta",begin:"END-ISO-10303-21;",relevance:10},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,e.COMMENT("/\\*\\*!","\\*/"),e.C_NUMBER_MODE,e.inherit(e.APOS_STRING_MODE,{illegal:null}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null}),{className:"string",begin:"'",end:"'"},{className:"symbol",variants:[{begin:"#",end:"\\d+",illegal:"\\W"}]}]}}return Hf=t,Hf}var qf,hx;function bYe(){if(hx)return qf;hx=1;const t=a=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:a.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[a.APOS_STRING_MODE,a.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:a.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),e=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","p","q","quote","samp","section","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],n=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"],s=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","
|
|||
|
(multipart)?`,end:`\\]
|
|||
|
`},{className:"string",begin:"\\d{4}-\\d{2}-\\d{2}(\\s+)\\d{2}:\\d{2}:\\d{2}.\\d+Z"},{className:"string",begin:"(\\+|-)\\d+"},{className:"keyword",relevance:10,variants:[{begin:"^(test|testing|success|successful|failure|error|skip|xfail|uxsuccess)(:?)\\s+(test)?"},{begin:"^progress(:?)(\\s+)?(pop|push)?"},{begin:"^tags:"},{begin:"^time:"}]}]}}return $f=t,$f}var Yf,mx;function yYe(){if(mx)return Yf;mx=1;function t(k){return k?typeof k=="string"?k:k.source:null}function e(k){return n("(?=",k,")")}function n(...k){return k.map(O=>t(O)).join("")}function s(k){const x=k[k.length-1];return typeof x=="object"&&x.constructor===Object?(k.splice(k.length-1,1),x):{}}function i(...k){return"("+(s(k).capture?"":"?:")+k.map(B=>t(B)).join("|")+")"}const r=k=>n(/\b/,k,/\w$/.test(k)?/\b/:/\B/),o=["Protocol","Type"].map(r),a=["init","self"].map(r),c=["Any","Self"],d=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],u=["false","nil","true"],h=["assignment","associativity","higherThan","left","lowerThan","none","right"],f=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],m=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],_=i(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),b=i(_,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),E=n(_,b,"*"),g=i(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),y=i(g,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),v=n(g,y,"*"),S=n(/[A-Z]/,y,"*"),R=["attached","autoclosure",n(/convention\(/,i("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",n(/objc\(/,v,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain",
|
|||
|
`),s=n.length.toString().length,i=n.map((d,u)=>(u+1).toString().padStart(s," ")),r=document.createElement("div");r.classList.add("line-numbers"),r.innerHTML=i.join("<br>");const o=document.createElement("div");o.classList.add("code-container");const a=document.createElement("pre"),c=document.createElement("code");return c.classList.add("code-content"),c.innerHTML=Xr.highlight(e,{language:t,ignoreIllegals:!0}).value,a.appendChild(c),o.appendChild(r),o.appendChild(a),o.outerHTML}},methods:{copyCode(){this.isCopied=!0,console.log("Copying code");const t=document.createElement("textarea");t.value=this.code,document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t),Fe(()=>{ze.replace()})},executeCode(){this.isExecuting=!0;const t=JSON.stringify({client_id:this.client_id,code:this.code,discussion_id:this.discussion_id?this.discussion_id:0,message_id:this.message_id?this.message_id:0,language:this.language});console.log(t),fetch(`${this.host}/execute_code`,{method:"POST",headers:{"Content-Type":"application/json"},body:t}).then(e=>(this.isExecuting=!1,e.json())).then(e=>{console.log(e),this.executionOutput=e.output}).catch(e=>{this.isExecuting=!1,console.error("Fetch error:",e)})},executeCode_in_new_tab(){this.isExecuting=!0;const t=JSON.stringify({client_id:this.client_id,code:this.code,discussion_id:this.discussion_id,message_id:this.message_id,language:this.language});console.log(t),fetch(`${this.host}/execute_code_in_new_tab`,{method:"POST",headers:{"Content-Type":"application/json"},body:t}).then(e=>(this.isExecuting=!1,e.json())).then(e=>{console.log(e),this.executionOutput=e.output}).catch(e=>{this.isExecuting=!1,console.error("Fetch error:",e)})},openFolderVsCode(){const t=JSON.stringify({client_id:this.client_id,code:this.code,discussion_id:this.discussion_id,message_id:this.message_id});console.log(t),fetch(`${this.host}/open_discussion_folder_in_vs_code`,{method:"POST",headers:{"Content-Type":"application/json"},body:t}).then(e=>e.json()).then(e=>{console.log(e)}).catch(e=>{console.error("Fetch error:",e)})},openVsCode(){const t=JSON.stringify({client_id:this.client_id,discussion_id:typeof this.discussion_id=="string"?parseInt(this.discussion_id):this.discussion_id,message_id:this.message_id,code:this.code});console.log(t),fetch(`${this.host}/open_code_in_vs_code`,{method:"POST",headers:{"Content-Type":"application/json"},body:t}).then(e=>e.json()).then(e=>{console.log(e)}).catch(e=>{console.error("Fetch error:",e)})},openFolder(){const t=JSON.stringify({client_id:this.client_id,discussion_id:this.discussion_id});console.log(t),fetch(`${this.host}/open_discussion_folder`,{method:"POST",headers:{"Content-Type":"application/json"},body:t}).then(e=>e.json()).then(e=>{console.log(e)}).catch(e=>{console.error("Fetch error:",e)})}}},YYe={class:"bg-bg-light-tone-panel dark:bg-bg-dark-tone-panel p-2 rounded-lg shadow-sm"},WYe={class:"hljs p-1 rounded-md break-all grid grid-cols-1"},KYe={class:"code-container"},jYe=["innerHTML"],QYe={class:"flex flex-row bg-bg-light-tone-panel dark:bg-bg-dark-tone-panel p-2 rounded-lg shadow-sm"},XYe={class:"text-2xl mr-2"},ZYe=["title"],JYe=l("i",{"data-feather":"copy"},null,-1),eWe=[JYe],tWe=l("i",{"data-feather":"play-circle"},null,-1),nWe=[tWe],sWe=l("i",{"data-feather":"airplay"},null,-1),iWe=[sWe],rWe=l("i",{"data-feather":"folder"},null,-1),oWe=[rWe],aWe=l("img",{src:HYe,width:"25",height:"25"},null,-1),lWe=[aWe],cWe=l("img",{src:qYe,width:"25",height:"25"},null,-1),dWe=[cWe],uWe={key:0,class:"text-2xl"},pWe={key:1,class:"hljs mt-0 p-1 rounded-md break-all grid grid-cols-1"},_We={class:"container h-[200px] overflow-x-auto break-all scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary"},hWe=["innerHTML"];function fWe(t,e,n,s,i,r){return T(),w("div",YYe,[l("pre",WYe,[Je(" "),l("div",KYe,[Je(`
|
|||
|
`),l("div",{class:"code-content overflow-x-auto break-all scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary",innerHTML:r.highlightedCode,contenteditable:"true",onInput:e[0]||(e[0]=(...o)=>t.updateCode&&t.updateCode(...o))},null,40,jYe),Je(`
|
|||
|
`)]),Je(`
|
|||
|
|
|||
|
`)]),l("div",QYe,[l("span",XYe,W(n.language.trim()),1),l("button",{onClick:e[1]||(e[1]=(...o)=>r.copyCode&&r.copyCode(...o)),title:i.isCopied?"Copied!":"Copy code",class:Ge([i.isCopied?"bg-green-500":"","px-2 py-1 mr-2 mb-2 text-left text-sm font-medium rounded-lg hover:bg-primary dark:hover:bg-primary text-white transition-colors duration-200"])},eWe,10,ZYe),["function","python","sh","shell","bash","cmd","powershell","latex","mermaid","graphviz","dot","javascript","html","html5","svg"].includes(n.language)?(T(),w("button",{key:0,ref:"btn_code_exec",onClick:e[2]||(e[2]=(...o)=>r.executeCode&&r.executeCode(...o)),title:"execute",class:Ge(["px-2 py-1 mr-2 mb-2 text-left text-sm font-medium rounded-lg hover:bg-primary dark:hover:bg-primary text-white transition-colors duration-200",i.isExecuting?"bg-green-500":""])},nWe,2)):G("",!0),["airplay","mermaid","graphviz","dot","javascript","html","html5","svg","css"].includes(n.language.trim())?(T(),w("button",{key:1,ref:"btn_code_exec_in_new_tab",onClick:e[3]||(e[3]=(...o)=>r.executeCode_in_new_tab&&r.executeCode_in_new_tab(...o)),title:"execute",class:Ge(["px-2 py-1 mr-2 mb-2 text-left text-sm font-medium rounded-lg hover:bg-primary dark:hover:bg-primary text-white transition-colors duration-200",i.isExecuting?"bg-green-500":""])},iWe,2)):G("",!0),l("button",{onClick:e[4]||(e[4]=(...o)=>r.openFolder&&r.openFolder(...o)),title:"open code project folder",class:"px-2 py-1 mr-2 mb-2 text-left text-sm font-medium rounded-lg hover:bg-primary dark:hover:bg-primary text-white transition-colors duration-200"},oWe),["python","latex","html"].includes(n.language.trim())?(T(),w("button",{key:2,onClick:e[5]||(e[5]=(...o)=>r.openFolderVsCode&&r.openFolderVsCode(...o)),title:"open code project folder in vscode",class:"px-2 py-1 mr-2 mb-2 text-left text-sm font-medium rounded-lg hover:bg-primary dark:hover:bg-primary text-white transition-colors duration-200"},lWe)):G("",!0),["python","latex","html"].includes(n.language.trim())?(T(),w("button",{key:3,onClick:e[6]||(e[6]=(...o)=>r.openVsCode&&r.openVsCode(...o)),title:"open code in vscode",class:"px-2 py-1 mr-2 mb-2 text-left text-sm font-medium rounded-lg hover:bg-primary dark:hover:bg-primary text-white transition-colors duration-200"},dWe)):G("",!0)]),i.executionOutput?(T(),w("span",uWe,"Execution output")):G("",!0),i.executionOutput?(T(),w("pre",pWe,[Je(" "),l("div",_We,[Je(`
|
|||
|
`),l("div",{ref:"execution_output",class:"w-full h-full overflow-y-auto scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary",innerHTML:i.executionOutput},null,8,hWe),Je(`
|
|||
|
`)]),Je(`
|
|||
|
`)])):G("",!0)])}const mWe=ot($Ye,[["render",fWe]]);var jA={exports:{}};(function(t,e){(function(n,s){t.exports=s()})(uA,function(){function n(a,c){var d=a.pos;if(a.src.charCodeAt(d)!==92)return!1;var u=a.src.slice(++d).match(/^(?:\\\[|\\\(|begin\{([^}]*)\})/);if(!u)return!1;d+=u[0].length;var h,f,m;u[0]==="\\["?(h="display_math",f="\\\\]"):u[0]==="\\("?(h="inline_math",f="\\\\)"):u[1]&&(h="math",f="\\end{"+u[1]+"}",m=!0);var _=a.src.indexOf(f,d);if(_===-1)return!1;var b=_+f.length;if(!c){var E=a.push(h,"",0);E.content=m?a.src.slice(a.pos,b):a.src.slice(d,_)}return a.pos=b,!0}function s(a,c){var d=a.pos;if(a.src.charCodeAt(d)!==36)return!1;var u="$",h=a.src.charCodeAt(++d);if(h===36){if(u="$$",a.src.charCodeAt(++d)===36)return!1}else if(h===32||h===9||h===10)return!1;var f=a.src.indexOf(u,d);if(f===-1||a.src.charCodeAt(f-1)===92)return!1;var m=f+u.length;if(u.length===1){var _=a.src.charCodeAt(f-1);if(_===32||_===9||_===10)return!1;var b=a.src.charCodeAt(m);if(b>=48&&b<58)return!1}if(!c){var E=a.push(u.length===1?"inline_math":"display_math","",0);E.content=a.src.slice(d,f)}return a.pos=m,!0}function i(a){return a.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")}function r(a,c){return Object.keys(c).reduce(function(d,u){return d[u]===void 0&&(d[u]=c[u]),d},a)}var o={math:"Math",inline_math:"InlineMath",display_math:"DisplayMath"};return function(a){var c={beforeMath:"",afterMath:"",beforeInlineMath:"\\(",afterInlineMath:"\\)",beforeDisplayMath:"\\[",afterDisplayMath:"\\]"};return a=r(a||{},c),function(d){d.inline.ruler.before("escape","math",n),d.inline.ruler.push("texMath",s),Object.keys(o).forEach(function(u){var h=a["before"+o[u]],f=a["after"+o[u]];d.renderer.rules[u]=function(m,_){return h+i(m[_].content)+f}})}}})})(jA);var gWe=jA.exports;const bWe=fr(gWe);function EWe(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const yWe={name:"MarkdownRenderer",props:{host:{type:String,required:!1,default:"http://localhost:9600"},client_id:{type:String,required:!0},markdownText:{type:String,required:!0},discussion_id:{type:[String,Number],default:"0",required:!1},message_id:{value:"0",type:[String,Number],required:!1}},components:{CodeBlock:mWe},setup(t){const e=new Kge({html:!0,highlight:(r,o)=>{const a=o&&Xr.getLanguage(o)?o:"plaintext";return Xr.highlight(a,r).value},renderInline:!0,breaks:!0}).use(Zze).use(ko).use(rHe,{figcaption:!0}).use(bHe).use(sHe,{enableRowspan:!0,enableColspan:!0,enableGridTables:!0,enableGridTablesExtra:!0,enableTableIndentation:!0,tableCellPadding:" ",tableCellJoiner:"|",multilineCellStartMarker:"|>",multilineCellEndMarker:"<|",multilineCellPadding:" ",multilineCellJoiner:`
|
|||
|
`}).use(bWe({inlineMath:[["$","$"],["\\(","\\)"]],blockMath:[["$$","$$"],["\\[","\\]"]]})),n=ct([]),s=()=>{if(t.markdownText){let r=e.parse(t.markdownText,{}),o=[];n.value=[];for(let a=0;a<r.length;a++)r[a].type!=="fence"?o.push(r[a]):(o.length>0&&(n.value.push({type:"html",html:e.renderer.render(o,e.options,{})}),o=[]),n.value.push({type:"code",language:EWe(r[a].info),code:r[a].content}));o.length>0&&(n.value.push({type:"html",html:e.renderer.render(o,e.options,{})}),o=[])}else n.value=[];Fe(()=>{ze.replace()})},i=(r,o)=>{n.value[r].code=o};return Mn(()=>t.markdownText,s),si(()=>{s(),Fe(()=>{window.MathJax&&window.MathJax.typesetPromise()})}),{markdownItems:n,updateCode:i}}},vWe={class:"break-all container w-full"},SWe={ref:"mdRender",class:"markdown-content"},TWe=["innerHTML"];function xWe(t,e,n,s,i,r){const o=rt("code-block");return T(),w("div",vWe,[l("div",SWe,[(T(!0),w(Be,null,je(s.markdownItems,(a,c)=>(T(),w("div",{key:c},[a.type==="code"?(T(),mt(o,{key:0,host:n.host,language:a.language,code:a.code,discussion_id:n.discussion_id,message_id:n.message_id,client_id:n.client_id,onUpdateCode:d=>s.updateCode(c,d)},null,8,["host","language","code","discussion_id","message_id","client_id","onUpdateCode"])):(T(),w("div",{key:1,innerHTML:a.html},null,8,TWe))]))),128))],512)])}const Fu=ot(yWe,[["render",xWe]]),CWe={data(){return{show:!1,has_button:!0,message:""}},components:{MarkdownRenderer:Fu},methods:{hide(){this.show=!1,this.$emit("ok")},showMessage(t){this.message=t,this.has_button=!0,this.show=!0},showBlockingMessage(t){this.message=t,this.has_button=!1,this.show=!0},updateMessage(t){this.message=t,this.show=!0},hideMessage(){this.show=!1}}},wWe={key:0,class:"fixed top-0 left-0 right-0 bottom-0 flex items-center justify-center bg-black bg-opacity-50 z-50"},RWe={class:"pl-10 pr-10 bg-bg-light dark:bg-bg-dark p-8 rounded-lg shadow-lg"},AWe={class:"container max-h-500 overflow-y-auto"},NWe={class:"text-lg font-medium"},OWe={class:"mt-4 flex justify-center"},IWe={key:1,"aria-hidden":"true",class:"w-6 h-6 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},MWe=l("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"},null,-1),kWe=l("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"},null,-1),DWe=[MWe,kWe];function LWe(t,e,n,s,i,r){const o=rt("MarkdownRenderer");return i.show?(T(),w("div",wWe,[l("div",RWe,[l("div",AWe,[l("div",NWe,[Z(o,{ref:"mdRender",host:"","markdown-text":i.message,message_id:0,discussion_id:0},null,8,["markdown-text"])])]),l("div",OWe,[i.has_button?(T(),w("button",{key:0,onClick:e[0]||(e[0]=(...a)=>r.hide&&r.hide(...a)),class:"bg-primary hover:bg-primary-light active:scale-95 duration-150 text-white px-4 py-2 rounded-lg shadow-lg hover:bg-secondary-dark"}," OK ")):G("",!0),i.has_button?G("",!0):(T(),w("svg",IWe,DWe))])])])):G("",!0)}const QA=ot(CWe,[["render",LWe]]);const PWe={props:{progress:{type:Number,required:!0}}},UWe={class:"progress-bar-container"};function FWe(t,e,n,s,i,r){return T(),w("div",UWe,[l("div",{class:"progress-bar",style:Ht({width:`${n.progress}%`})},null,4)])}const Bu=ot(PWe,[["render",FWe]]),BWe={setup(){return{}},name:"UniversalForm",data(){r
|
|||
|
<div class="bg-white p-6 rounded-md shadow-md w-80">
|
|||
|
<h2 class="text-lg font-semibold mb-3">${t}</h2>
|
|||
|
<textarea id="replacementInput" class="w-full h-32 border rounded p-2 mb-3">${e}</textarea>
|
|||
|
<div class="flex justify-end">
|
|||
|
<button id="cancelButton" class="mr-2 px-4 py-2 border rounded">Cancel</button>
|
|||
|
<button id="okButton" class="px-4 py-2 bg-blue-500 text-white rounded">OK</button>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
`:r.innerHTML=`
|
|||
|
<div class="bg-white p-6 rounded-md shadow-md w-80">
|
|||
|
<h2 class="text-lg font-semibold mb-3">${t}</h2>
|
|||
|
<select id="options_selector" class="form-control w-full h-25 border rounded p-2 mb-3">
|
|||
|
${n.map(c=>`<option value="${c}">${c}</option>`)}
|
|||
|
</select>
|
|||
|
<div class="flex justify-end">
|
|||
|
<button id="cancelButton" class="mr-2 px-4 py-2 border rounded">Cancel</button>
|
|||
|
<button id="okButton" class="px-4 py-2 bg-blue-500 text-white rounded">OK</button>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
`,document.body.appendChild(r);const o=r.querySelector("#cancelButton"),a=r.querySelector("#okButton");o.addEventListener("click",()=>{document.body.removeChild(r),s(null)}),a.addEventListener("click",()=>{if(n.length===0){const d=r.querySelector("#replacementInput").value.trim();document.body.removeChild(r),s(d)}else{const d=r.querySelector("#options_selector").value.trim();document.body.removeChild(r),s(d)}})})}function $Ze(t,e){console.log(t);let n={},s=/@<([^>]+)>@/g,i=[],r;for(;(r=s.exec(t))!==null;)i.push("@<"+r[1]+">@");console.log("matches"),console.log(i),i=[...new Set(i)];async function o(c){console.log(c);let d=c.toLowerCase().substring(2,c.length-2);if(d!=="generation_placeholder")if(d.includes(":")){Object.entries({all_language_options:"english:french:german:chinese:japanese:spanish:italian:russian:portuguese:swedish:danish:dutch:norwegian:slovak:czech:hungarian:polish:ukrainian:bulgarian:latvian:lithuanian:estonian:maltese:irish:galician:basque:welsh:breton:georgian:turkmen:kazakh:uzbek:tajik:afghan:sri-lankan:filipino:vietnamese:lao:cambodian:thai:burmese:kenyan:botswanan:zimbabwean:malawian:mozambican:angolan:namibian:south-african:madagascan:seychellois:mauritian:haitian:peruvian:ecuadorian:bolivian:paraguayan:chilean:argentinean:uruguayan:brazilian:colombian:venezuelan:puerto-rican:cuban:dominican:honduran:nicaraguan:salvadorean:guatemalan:el-salvadoran:belizean:panamanian:costa-rican:antiguan:barbudan:dominica's:grenada's:st-lucia's:st-vincent's:gibraltarian:faroe-islander:greenlandic:icelandic:jamaican:trinidadian:tobagonian:barbadian:anguillan:british-virgin-islander:us-virgin-islander:turkish:israeli:palestinian:lebanese:egyptian:libyan:tunisian:algerian:moroccan:bahraini:kuwaiti:saudi-arabian:yemeni:omani:irani:iraqi:afghanistan's:pakistani:indian:nepalese:sri-lankan:maldivan:burmese:thai:lao:vietnamese:kampuchean:malaysian:bruneian:indonesian:australian:new-zealanders:fijians:tongans:samoans:vanuatuans:wallisians:kiribatians:tuvaluans:solomon-islanders:marshallese:micronesians:hawaiians",all_programming_language_options:"python:c:c++:java:javascript:php:ruby:go:swift:kotlin:rust:haskell:erlang:lisp:scheme:prolog:cobol:fortran:pascal:delphi:d:eiffel:h:basic:visual_basic:smalltalk:objective-c:html5:node.js:vue.js:svelte:react:angular:ember:clipper:stex:arduino:brainfuck:r:assembly:mason:lepton:seacat:bbc_microbit:raspberry_pi_gpio:raspberry_pi_spi:raspberry_pi_i2c:raspberry_pi_uart:raspberry_pi_adc:raspberry_pi_ddio"}).forEach(([E,g])=>{console.log(`Key: ${E}, Value: ${g}`);function y(R){return R.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const v=y(E),S=new RegExp(v,"g");d=d.replace(S,g)});let h=d.split(":"),f=h[0],m=h[1]||"",_=[];h.length>2&&(_=h.slice(1));let b=await Kx(f,m,_);b!==null&&(n[c]=b)}else{let u=await Kx(d);u!==null&&(n[c]=u)}}let a=Promise.resolve();i.forEach(c=>{a=a.then(()=>o(c)).then(d=>{console.log(d)})}),a.then(()=>{Object.entries(n).forEach(([c,d])=>{console.log(`Key: ${c}, Value: ${d}`);function u(m){return m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const h=u(c),f=new RegExp(h,"g");t=t.replace(f,d)}),e(t)})}const YZe={name:"PlayGroundView",data(){return{posts_headers:{accept:"application/json","Content-Type":"application/json"},showSettings:!1,pending:!1,is_recording:!1,is_deaf_transcribing:!1,cpp_block:vN,html5_block:SN,LaTeX_block:TN,javascript_block:EN,json_block:yN,code_block:gN,python_block:bN,bash_block:xN,tokenize_icon:GZe,deaf_off:zZe,deaf_on:VZe,rec_off:qZe,rec_on:HZe,loading_icon:CN,isSynthesizingVoice:!1,audio_url:null,mdRenderHeight:300,selecting_model:!1,tab_id:"source",generating:!1,isSpeaking:!1,voices:[],isLesteningToVoice:!1,presets:[],selectedPreset:"",cursorPosition:0,namedTokens:[],text:"",pre_text:"",post_text:"",temperature:.1,top_k:50,top_p:.9,repeat_penalty:1.3,repeat_last_n:50,n_crop:-1,n_predicts:2e3,seed:-1,silenceTimeout:5e3}},components:{Toast:Kl,MarkdownRenderer:Fu,ClipBoardTextInput:nE,TokensHilighter:kZe,ChatBarButton:mN,Card:Vu},mounted(){de.get("./get_presets").then(t=>{console.log(t.data),this.presets=t.data,this.selectedPreset=this.presets[0]
|
|||
|
`?(this.text=this.text.slice(0,e)+"```"+t+"\n\n```\n"+this.text.slice(e),e=e+4+t.length):(this.text=this.text.slice(0,e)+"\n```"+t+"\n\n```\n"+this.text.slice(e),e=e+3+t.length):speechSynthesis==0||this.text[e-1]==`
|
|||
|
`?(this.text=this.text.slice(0,e)+"```"+t+`
|
|||
|
`+this.text.slice(e,n)+"\n```\n"+this.text.slice(n),e=e+4+t.length):(this.text=this.text.slice(0,e)+"\n```"+t+`
|
|||
|
`+this.text.slice(e,n)+"\n```\n"+this.text.slice(n),e=e+3+t.length),this.$refs.mdTextarea.focus(),this.$refs.mdTextarea.selectionStart=this.$refs.mdTextarea.selectionEnd=p},insertTab(t){const e=t.target,n=e.selectionStart,s=e.selectionEnd,i=e.value.substring(0,n),r=e.value.substring(s),o=i+" "+r;this.text=o,this.$nextTick(()=>{e.selectionStart=e.selectionEnd=n+4}),t.preventDefault()},mdTextarea_changed(){console.log("mdTextarea_changed"),this.cursorPosition=this.$refs.mdTextarea.selectionStart},mdTextarea_clicked(){console.log(`mdTextarea_clicked: ${this.$refs.mdTextarea.selectionStart}`),this.cursorPosition=this.$refs.mdTextarea.selectionStart},setModel(){this.selecting_model=!0,de.post("/update_setting",{client_id:this.$store.state.client_id,setting_name:"model_name",setting_value:this.selectedModel}).then(t=>{console.log(t),t.status&&this.$refs.toast.showToast(`Model changed to ${this.selectedModel}`,4,!0),this.selecting_model=!1}).catch(t=>{this.$refs.toast.showToast(`Error ${t}`,4,!0),this.selecting_model=!1})},onVoicesChanged(){this.voices=this.speechSynthesis.getVoices()},read(){console.log("READING..."),this.isSynthesizingVoice=!0;let t=this.$refs.mdTextarea.selectionStart,e=this.$refs.mdTextarea.selectionEnd,n=this.text;t!=e&&(n=n.slice(t,e)),de.post("./text2Wave",{client_id:this.$store.state.client_id,text:n}).then(s=>{console.log(s.data.url);let i=s.data.url;this.audio_url=i,this.isSynthesizingVoice=!1,Fe(()=>{ze.replace()})}).catch(s=>{this.$refs.toast.showToast(`Error: ${s}`,4,!1),this.isSynthesizingVoice=!1,Fe(()=>{ze.replace()})})},speak(){if(this.msg){this.speechSynthesis.cancel(),this.msg=null,this.isSpeaking=!1;return}let t=0;console.log("voice on"),this.isSpeaking=!0;const e=200;this.msg=new SpeechSynthesisUtterance,this.msg.pitch=this.$store.state.config.audio_pitch,this.voices.length>0&&(this.msg.voice=this.voices.filter(i=>i.name===this.$store.state.config.audio_out_voice)[0]);const n=i=>{let r=this.text.substring(i,i+e);const o=[".","!","?",`
|
|||
|
`];let a=-1;return o.forEach(c=>{const d=r.lastIndexOf(c);d>a&&(a=d)}),a==-1&&(a=r.length),console.log(a),a+i+1},s=()=>{const i=n(t),r=this.text.substring(t,i);this.msg.text=r,t=i+1,this.msg.onend=o=>{t<this.text.length-2?setTimeout(()=>{s()},1):(this.isSpeaking=!1,console.log("voice off :",this.text.length," ",i))},this.speechSynthesis.speak(this.msg)};s()},getCursorPosition(){return this.$refs.mdTextarea.selectionStart},appendToOutput(t){this.pre_text+=t,this.text=this.pre_text+this.post_text},generate_in_placeholder(){console.log("Finding cursor position");let t=this.text.indexOf("@<generation_placeholder>@");if(t<0){this.$refs.toast.showToast("No generation placeholder found",4,!1);return}this.text=this.text.substring(0,t)+this.text.substring(t+26,this.text.length),this.pre_text=this.text.substring(0,t),this.post_text=this.text.substring(t,this.text.length);var e=this.text.substring(0,t);console.log(e),qe.emit("generate_text",{prompt:e,personality:-1,n_predicts:this.n_predicts,n_crop:this.n_crop,parameters:{temperature:this.temperature,top_k:this.top_k,top_p:this.top_p,repeat_penalty:this.repeat_penalty,repeat_last_n:this.repeat_last_n,seed:parseInt(this.seed)}}),this.generating=!0},async tokenize_text(){const t=await de.post("/lollms_tokenize",{prompt:this.text},{headers:this.posts_headers});console.log(t.data.named_tokens),this.namedTokens=t.data.named_tokens},generate(){console.log("Finding cursor position"),this.pre_text=this.text.substring(0,this.getCursorPosition()),this.post_text=this.text.substring(this.getCursorPosition(),this.text.length);var t=this.text.substring(0,this.getCursorPosition());console.log(this.text),console.log(`cursor position :${this.getCursorPosition()}`),console.log(`pretext:${this.pre_text}`),console.log(`post_text:${this.post_text}`),console.log(`prompt:${t}`),qe.emit("generate_text",{prompt:t,personality:-1,n_predicts:this.n_predicts,n_crop:this.n_crop,parameters:{temperature:this.temperature,top_k:this.top_k,top_p:this.top_p,repeat_penalty:this.repeat_penalty,repeat_last_n:this.repeat_last_n,seed:parseInt(this.seed)}}),this.generating=!0},stopGeneration(){qe.emit("cancel_text_generation",{})},exportText(){const t=this.text,e=document.createElement("a"),n=new Blob([t],{type:"text/plain"});e.href=URL.createObjectURL(n),e.download="exported_text.txt",document.body.appendChild(e),e.click(),document.body.removeChild(e)},importText(){const t=document.getElementById("import-input");t&&(t.addEventListener("change",e=>{if(e.target.files&&e.target.files[0]){const n=new FileReader;n.onload=()=>{this.text=n.result},n.readAsText(e.target.files[0])}else alert("Please select a file.")}),t.click())},setPreset(){console.log("Setting preset"),console.log(this.selectedPreset),this.tab_id="render",this.text=$Ze(this.selectedPreset.content,t=>{console.log("Done"),console.log(t),this.text=t})},addPreset(){let t=prompt("Enter the title of the preset:");this.presets[t]={client_id:this.$store.state.client_id,name:t,content:this.text},de.post("./add_preset",this.presets[t]).then(e=>{console.log(e.data)}).catch(e=>{this.$refs.toast.showToast(`Error: ${e}`,4,!1)})},removePreset(){this.selectedPreset&&delete this.presets[this.selectedPreset.name]},reloadPresets(){de.get("./get_presets").then(t=>{console.log(t.data),this.presets=t.data,this.selectedPreset=this.presets[0]}).catch(t=>{this.$refs.toast.showToast(`Error: ${t}`,4,!1)})},startRecording(){this.pending=!0,this.is_recording?de.post("/stop_recording",{client_id:this.$store.state.client_id}).then(t=>{this.is_recording=!1,this.pending=!1,console.log(t),this.text+=t.data.text,console.log(t.data),this.presets=t.data,this.selectedPreset=this.presets[0]}).catch(t=>{this.$refs.toast.showToast(`Error: ${t}`,4,!1)}):de.post("/start_recording",{client_id:this.$store.state.client_id}).then(t=>{this.is_recording=!0,this.pending=!1,console.log(t.data)}).catch(t=>{this.$refs.toast.showToast(`Error: ${t}`,4,!1)})},startRecordingAndTranscribing(){this.pending=!0,this.is_deaf_transcribing?de.get("/stop_recording").then(t=>{this.is_deaf_transcribing=!1,this.pending=!1,this
|
|||
|
`,36),[[pe,i.text]]),l("span",null,"Cursor position "+W(i.cursorPosition),1)])):G("",!0),i.audio_url!=null?(T(),w("audio",{controls:"",key:i.audio_url},[l("source",{src:i.audio_url,type:"audio/wav",ref:"audio_player"},null,8,IJe),Je(" Your browser does not support the audio element. ")])):G("",!0),Z(a,{namedTokens:i.namedTokens},null,8,["namedTokens"]),i.tab_id==="render"?(T(),w("div",MJe,[Z(c,{ref:"mdRender",client_id:this.$store.state.client_id,message_id:0,discussion_id:0,"markdown-text":i.text,class:"mt-4 p-2 rounded shadow-lg dark:bg-bg-dark"},null,8,["client_id","markdown-text"])])):G("",!0)],2)]),i.showSettings?(T(),w("div",kJe,[DJe,Z(d,{title:"Model",class:"slider-container ml-0 mr-0",isHorizontal:!1,disableHoverAnimation:!0,disableFocus:!0},{default:De(()=>[U(l("select",{"onUpdate:modelValue":e[17]||(e[17]=h=>this.$store.state.selectedModel=h),onChange:e[18]||(e[18]=(...h)=>r.setModel&&r.setModel(...h)),class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},[(T(!0),w(Be,null,je(r.models,h=>(T(),w("option",{key:h,value:h},W(h),9,LJe))),128))],544),[[Gt,this.$store.state.selectedModel]]),i.selecting_model?(T(),w("div",PJe,FJe)):G("",!0)]),_:1}),Z(d,{title:"Presets",class:"slider-container ml-0 mr-0",is_subcard:!0,isHorizontal:!1,disableHoverAnimation:!0,disableFocus:!0},{default:De(()=>[U(l("select",{"onUpdate:modelValue":e[19]||(e[19]=h=>i.selectedPreset=h),class:"bg-white dark:bg-black mb-2 border-2 rounded-md shadow-sm w-full"},[(T(!0),w(Be,null,je(i.presets,h=>(T(),w("option",{key:h,value:h},W(h.name),9,BJe))),128))],512),[[Gt,i.selectedPreset]]),GJe,l("button",{class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer",onClick:e[20]||(e[20]=(...h)=>r.setPreset&&r.setPreset(...h)),title:"Use preset"},zJe),l("button",{class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer",onClick:e[21]||(e[21]=(...h)=>r.addPreset&&r.addPreset(...h)),title:"Add this text as a preset"},qJe),l("button",{class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer",onClick:e[22]||(e[22]=(...h)=>r.removePreset&&r.removePreset(...h)),title:"Remove preset"},YJe),l("button",{class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer",onClick:e[23]||(e[23]=(...h)=>r.reloadPresets&&r.reloadPresets(...h)),title:"Reload presets list"},KJe)]),_:1}),Z(d,{title:"Generation params",class:"slider-container ml-0 mr-0",is_subcard:!0,isHorizontal:!1,disableHoverAnimation:!0,disableFocus:!0},{default:De(()=>[l("div",jJe,[QJe,U(l("input",{type:"range","onUpdate:modelValue":e[24]||(e[24]=h=>i.temperature=h),min:"0",max:"5",step:"0.1",class:"w-full"},null,512),[[pe,i.temperature]]),l("span",XJe,"Current value: "+W(i.temperature),1)]),l("div",ZJe,[JJe,U(l("input",{type:"range","onUpdate:modelValue":e[25]||(e[25]=h=>i.top_k=h),min:"1",max:"100",step:"1",class:"w-full"},null,512),[[pe,i.top_k]]),l("span",eet,"Current value: "+W(i.top_k),1)]),l("div",tet,[net,U(l("input",{type:"range","onUpdate:modelValue":e[26]||(e[26]=h=>i.top_p=h),min:"0",max:"1",step:"0.1",class:"w-full"},null,512),[[pe,i.top_p]]),l("span",set,"Current value: "+W(i.top_p),1)]),l("div",iet,[ret,U(l("input",{type:"range","onUpdate:modelValue":e[27]||(e[27]=h=>i.repeat_penalty=h),min:"0",max:"5",step:"0.1",class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},null,512),[[pe,i.repeat_penalty]]),l("span",oet,"Current value: "+W(i.repeat_penalty),1)]),l("div",aet,[cet,U(l("input",{type:"range","onUpdate:modelValue":e[28]||(e[28]=h=>i.repeat_last_n=h),min:"0",max:"100",step:"1",class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},null,512),[[pe,i.repeat_last_n]]),l("span",det,"Current value: "+W(i.repeat_last_n),1)]),l("div",uet,[pet,U(l("input",{type:"number","onUpdate:modelValue":e[29]||(e[29]=h=>i.n_crop=h),class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},null,512),[[pe,i.n_crop]]),l("span",_et,"Current value: "+W(i.n_crop),1)]),l("div",het,[fet,U(l("input",{type:"number","onUpdate:modelValue":e[30]||(e[30
|
|||
|
<p class="mb-4 text-gray-700 dark:text-gray-300">LoLLMs (Lord of Large Language Multimodal Systems) is a powerful and versatile AI system designed to handle a wide range of tasks. Developed by ParisNeo, a computer geek passionate about AI, LoLLMs aims to be the ultimate tool for AI-assisted work and creativity.</p>
|
|||
|
<p class="mb-4 text-gray-700 dark:text-gray-300">With its advanced capabilities in natural language processing, multimodal understanding, and code interpretation, LoLLMs can assist users in various domains, from content creation to complex problem-solving.</p>
|
|||
|
`},{id:"key-features",title:"Key Features",content:`
|
|||
|
<ul class="list-disc list-inside mb-4 text-gray-700 dark:text-gray-300">
|
|||
|
<li>Advanced language understanding and generation</li>
|
|||
|
<li>Multimodal capabilities (text, images, and more)</li>
|
|||
|
<li>Built-in code interpreter for various programming languages</li>
|
|||
|
<li>Internet search integration for up-to-date information</li>
|
|||
|
<li>Customizable personalities for specialized tasks</li>
|
|||
|
<li>File handling and analysis capabilities</li>
|
|||
|
</ul>
|
|||
|
`},{id:"getting-started",title:"Getting Started",content:`
|
|||
|
<p class="mb-4 text-gray-700 dark:text-gray-300">To get started with LoLLMs, follow these steps:</p>
|
|||
|
<ol class="list-decimal list-inside mb-4 text-gray-700 dark:text-gray-300">
|
|||
|
<li>Install LoLLMs on your system (refer to the installation guide)</li>
|
|||
|
<li>Configure your preferences and API keys if necessary</li>
|
|||
|
<li>Choose a personality or mode that fits your task</li>
|
|||
|
<li>Start interacting with LoLLMs through the chat interface</li>
|
|||
|
</ol>
|
|||
|
<p class="mb-4 text-gray-700 dark:text-gray-300">For detailed installation instructions, visit our <a href="#" class="text-blue-600 dark:text-blue-400 hover:underline">installation guide</a>.</p>
|
|||
|
`},{id:"personalities",title:"Personalities",content:`
|
|||
|
<p class="mb-4 text-gray-700 dark:text-gray-300">LoLLMs offers various personalities to cater to different tasks and user needs. Each personality is optimized for specific use cases, ensuring the best possible assistance.</p>
|
|||
|
`,subsections:[{id:"document-summarization",title:"Document Summarization",content:`
|
|||
|
<p class="mb-4 text-gray-700 dark:text-gray-300">The Document Summarization personality, also known as <code class="bg-gray-200 dark:bg-gray-700 rounded px-1">docs_zipper</code>, specializes in condensing large documents into concise summaries while maintaining context and key information.</p>
|
|||
|
<p class="mb-4 text-gray-700 dark:text-gray-300">Key features:</p>
|
|||
|
<ul class="list-disc list-inside mb-4 text-gray-700 dark:text-gray-300">
|
|||
|
<li>Handles multiple document formats (PDF, DOCX, TXT, etc.)</li>
|
|||
|
<li>Provides customizable summary lengths</li>
|
|||
|
<li>Extracts main ideas and key points</li>
|
|||
|
<li>Maintains document structure in summaries</li>
|
|||
|
</ul>
|
|||
|
<p><a href="/help/personalities/documents summary/index.html" class="text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-300 hover:underline transition-colors duration-200">Learn more about Document Summarization</a></p>
|
|||
|
`},{id:"code-interpreter",title:"Code Interpreter",content:`
|
|||
|
<p class="mb-4 text-gray-700 dark:text-gray-300">The Code Interpreter personality allows LoLLMs to understand, analyze, and execute code in various programming languages.</p>
|
|||
|
<p class="mb-4 text-gray-700 dark:text-gray-300">Key features:</p>
|
|||
|
<ul class="list-disc list-inside mb-4 text-gray-700 dark:text-gray-300">
|
|||
|
<li>Supports multiple programming languages</li>
|
|||
|
<li>Provides code explanations and suggestions</li>
|
|||
|
<li>Assists in debugging and optimizing code</li>
|
|||
|
<li>Can generate code snippets based on natural language descriptions</li>
|
|||
|
</ul>
|
|||
|
`}]},{id:"advanced-features",title:"Advanced Features",content:`
|
|||
|
<p class="mb-4 text-gray-700 dark:text-gray-300">Explore the advanced capabilities of LoLLMs:</p>
|
|||
|
<ul class="list-disc list-inside mb-4 text-gray-700 dark:text-gray-300">
|
|||
|
<li>Internet Search Integration: Access up-to-date information by using the "send message with internet search" feature</li>
|
|||
|
<li>File Handling: Upload and analyze various file types, including images and documents</li>
|
|||
|
<li>SVG and Diagram Generation: Create visual representations using SVG, Graphviz, and Mermaid</li>
|
|||
|
<li>HTML and JavaScript Generation: Develop interactive web content directly through LoLLMs</li>
|
|||
|
<li>Python Code Execution: Run Python scripts for data analysis and more</li>
|
|||
|
</ul>
|
|||
|
`},{id:"use-cases",title:"Use Cases",content:`
|
|||
|
<p class="mb-4 text-gray-700 dark:text-gray-300">LoLLMs can be applied to a wide range of tasks, including:</p>
|
|||
|
<ul class="list-disc list-inside mb-4 text-gray-700 dark:text-gray-300">
|
|||
|
<li>Content Creation and Editing</li>
|
|||
|
<li>Data Analysis and Visualization</li>
|
|||
|
<li>Code Development and Debugging</li>
|
|||
|
<li>Research and Information Gathering</li>
|
|||
|
<li>Language Translation and Localization</li>
|
|||
|
<li>Creative Writing and Brainstorming</li>
|
|||
|
<li>Technical Documentation</li>
|
|||
|
<li>Educational Support and Tutoring</li>
|
|||
|
</ul>
|
|||
|
`},{id:"troubleshooting",title:"Troubleshooting",content:`
|
|||
|
<p class="mb-4 text-gray-700 dark:text-gray-300">If you encounter any issues while using LoLLMs, try the following steps:</p>
|
|||
|
<ol class="list-decimal list-inside mb-4 text-gray-700 dark:text-gray-300">
|
|||
|
<li>Check your internet connection</li>
|
|||
|
<li>Verify that you're using the latest version of LoLLMs</li>
|
|||
|
<li>Clear your browser cache (if using the web interface)</li>
|
|||
|
<li>Review the error messages for specific information</li>
|
|||
|
<li>Consult the <a href="#" class="text-blue-600 dark:text-blue-400 hover:underline">FAQ section</a> for common issues and solutions</li>
|
|||
|
</ol>
|
|||
|
<p class="mb-4 text-gray-700 dark:text-gray-300">If problems persist, please reach out to our support team through one of the contact methods listed below.</p>
|
|||
|
`}],contactLinks:[{text:"Email",url:"mailto:parisneoai@gmail.com"},{text:"Twitter",url:"https://twitter.com/ParisNeo_AI"},{text:"Discord",url:"https://discord.gg/BDxacQmv"},{text:"Sub-Reddit",url:"https://www.reddit.com/r/lollms"},{text:"Instagram",url:"https://www.instagram.com/spacenerduino/"}]}},methods:{scrollToSection(t){const e=document.getElementById(t);e&&e.scrollIntoView({behavior:"smooth",block:"start"})}}},Let={class:"min-h-screen w-full bg-gradient-to-br from-blue-100 to-purple-100 dark:from-blue-900 dark:to-purple-900 overflow-y-auto"},Pet={class:"container mx-auto px-4 py-8 relative z-10"},Uet=l("header",{class:"text-center mb-12 sticky top-0 bg-white dark:bg-gray-800 bg-opacity-90 dark:bg-opacity-90 backdrop-filter backdrop-blur-lg p-4 rounded-b-lg shadow-md"},[l("h1",{class:"text-5xl md:text-6xl font-bold text-transparent bg-clip-text bg-gradient-to-r from-blue-600 to-purple-600 dark:from-blue-400 dark:to-purple-400 mb-2 animate-glow"}," LoLLMs Help Documentation "),l("p",{class:"text-2xl text-gray-600 dark:text-gray-300 italic"},' "One tool to rule them all" ')],-1),Fet={class:"bg-white dark:bg-gray-800 shadow-md rounded-lg p-6 mb-8 animate-fade-in sticky top-32 max-h-[calc(100vh-8rem)] overflow-y-auto"},Bet=l("h2",{class:"text-3xl font-semibold mb-4 text-gray-800 dark:text-gray-200"},"Table of Contents",-1),Get={class:"space-y-2"},Vet=["href","onClick"],zet={key:0,class:"ml-4 mt-2 space-y-1"},Het=["href","onClick"],qet={class:"bg-white dark:bg-gray-800 shadow-md rounded-lg p-6 animate-fade-in"},$et=["id"],Yet={class:"text-4xl font-semibold mb-6 text-transparent bg-clip-text bg-gradient-to-r from-blue-600 to-purple-600 dark:from-blue-400 dark:to-purple-400"},Wet=["innerHTML"],Ket={key:0,class:"mt-8"},jet=["id"],Qet={class:"text-3xl font-semibold mb-4 text-gray-700 dark:text-gray-300"},Xet=["innerHTML"],Zet={class:"mt-12 pt-8 border-t border-gray-300 dark:border-gray-700 animate-fade-in"},Jet=l("h2",{class:"text-3xl font-semibold mb-6 text-center text-transparent bg-clip-text bg-gradient-to-r from-blue-600 to-purple-600 dark:from-blue-400 dark:to-purple-400"},"Contact",-1),ett={class:"flex flex-wrap justify-center gap-6 mb-8"},ttt=["href"],ntt=l("p",{class:"text-center font-bold text-2xl text-gray-700 dark:text-gray-300"},"See ya!",-1),stt={class:"fixed inset-0 pointer-events-none overflow-hidden"},itt=l("svg",{class:"w-2 h-2 text-yellow-300",fill:"currentColor",viewBox:"0 0 20 20"},[l("path",{d:"M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"})],-1),rtt=[itt];function ott(t,e,n,s,i,r){return T(),w("div",Let,[l("div",Pet,[Uet,l("nav",Fet,[Bet,l("ul",Get,[(T(!0),w(Be,null,je(i.sections,o=>(T(),w("li",{key:o.id,class:"ml-4"},[l("a",{href:`#${o.id}`,onClick:a=>r.scrollToSection(o.id),class:"text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-300 hover:underline transition-colors duration-200"},W(o.title),9,Vet),o.subsections?(T(),w("ul",zet,[(T(!0),w(Be,null,je(o.subsections,a=>(T(),w("li",{key:a.id},[l("a",{href:`#${a.id}`,onClick:c=>r.scrollToSection(a.id),class:"text-blue-500 dark:text-blue-300 hover:text-blue-700 dark:hover:text-blue-200 hover:underline transition-colors duration-200"},W(a.title),9,Het)]))),128))])):G("",!0)]))),128))])]),l("main",qet,[(T(!0),w(Be,null,je(i.sections,o=>(T(),w("section",{key:o.id,id:o.id,class:"mb-12"},[l("h2",Yet,W(o.title),1),l("div",{innerHTML:o.content,class:"prose dark:prose-invert max-w-none"},null,8,Wet),o.subsections?(T(),w("div",Ket,[(T(!0),w(Be,null,je(o.subsections,a=>(T(),w("section",{key:a.id,id:a.id,class:"mb-8"},[l("h3",Qet,W(a.title),1),l("div",{innerHTML:a.content,class:"prose dark:prose-invert max-w-none"},null,8,Xet)],8,jet))),128))])):G("",!0)],8,$et))),128))]),l("footer",Zet,[Jet,l("div",ett,[(T(!0),w(Be,null,je(i.contactLinks
|
|||
|
`,this.configFile.start_user_header_id_template="!@>",this.configFile.end_user_header_id_template=": ",this.configFile.end_user_message_id_template="",this.configFile.start_ai_header_id_template="!@>",this.configFile.end_ai_header_id_template=": ",this.configFile.end_ai_message_id_template="",this.settingsChanged=!0):e==="lollms_simplified"?(console.log("Using lollms template"),this.configFile.start_header_id_template="@>",this.configFile.system_message_template="system",this.configFile.end_header_id_template=": ",this.configFile.separator_template=`
|
|||
|
`,this.configFile.start_user_header_id_template="@>",this.configFile.end_user_header_id_template=": ",this.configFile.end_user_message_id_template="",this.configFile.start_ai_header_id_template="@>",this.configFile.end_ai_header_id_template=": ",this.configFile.end_ai_message_id_template="",this.settingsChanged=!0):e==="bare"?(console.log("Using lollms template"),this.configFile.start_header_id_template="",this.configFile.system_message_template="system",this.configFile.end_header_id_template=": ",this.configFile.separator_template=`
|
|||
|
`,this.configFile.start_user_header_id_template="",this.configFile.end_user_header_id_template=": ",this.configFile.end_user_message_id_template="",this.configFile.start_ai_header_id_template="",this.configFile.end_ai_header_id_template=": ",this.configFile.end_ai_message_id_template="",this.settingsChanged=!0):e==="llama3"?(console.log("Using llama3 template"),this.configFile.start_header_id_template="<|start_header_id|>",this.configFile.system_message_template="system",this.configFile.end_header_id_template="<|end_header_id|>",this.configFile.separator_template="<|eot_id|>",this.configFile.start_user_header_id_template="<|start_header_id|>",this.configFile.end_user_header_id_template="<|end_header_id|>",this.configFile.end_user_message_id_template="",this.configFile.start_ai_header_id_template="<|start_header_id|>",this.configFile.end_ai_header_id_template="<|end_header_id|>",this.configFile.end_ai_message_id_template="",this.settingsChanged=!0):e==="mistral"&&(console.log("Using mistral template"),this.configFile.start_header_id_template="[INST]",this.configFile.system_message_template=" Using this information",this.configFile.end_header_id_template=": ",this.configFile.separator_template=`
|
|||
|
`,this.configFile.start_user_header_id_template="[INST]",this.configFile.end_user_header_id_template=": ",this.configFile.end_user_message_id_template="[/INST]",this.configFile.start_ai_header_id_template="[INST]",this.configFile.end_ai_header_id_template=": ",this.configFile.end_ai_message_id_template="[/INST]",this.settingsChanged=!0)},install_model(){},reinstallDiffusersService(){de.post("/install_diffusers",{client_id:this.$store.state.client_id},this.posts_headers).then(t=>{}).catch(t=>{console.error(t)})},upgradeDiffusersService(){de.post("upgrade_sd",{client_id:this.$store.state.client_id},this.posts_headers).then(t=>{}).catch(t=>{console.error(t)})},reinstallSDService(){de.post("/install_sd",{client_id:this.$store.state.client_id},this.posts_headers).then(t=>{}).catch(t=>{console.error(t)})},upgradeSDService(){de.post("upgrade_sd",{client_id:this.$store.state.client_id},this.posts_headers).then(t=>{}).catch(t=>{console.error(t)})},startSDService(){de.post("start_sd",{client_id:this.$store.state.client_id},this.posts_headers).then(t=>{}).catch(t=>{console.error(t)})},showSD(){de.post("show_sd",{client_id:this.$store.state.client_id},this.posts_headers).then(t=>{}).catch(t=>{console.error(t)})},reinstallComfyUIService(){de.post("install_comfyui",{client_id:this.$store.state.client_id}).then(t=>{}).catch(t=>{console.error(t)})},upgradeComfyUIService(){de.post("upgrade_comfyui",{client_id:this.$store.state.client_id}).then(t=>{}).catch(t=>{console.error(t)})},startComfyUIService(){de.post("start_comfyui",{client_id:this.$store.state.client_id}).then(t=>{}).catch(t=>{console.error(t)})},showComfyui(){de.post("show_comfyui",{client_id:this.$store.state.client_id}).then(t=>{}).catch(t=>{console.error(t)})},reinstallMotionCtrlService(){de.post("install_motion_ctrl",{client_id:this.$store.state.client_id}).then(t=>{}).catch(t=>{console.error(t)})},reinstallvLLMService(){de.post("install_vllm",{client_id:this.$store.state.client_id}).then(t=>{}).catch(t=>{console.error(t)})},startvLLMService(){de.post("start_vllm",{client_id:this.$store.state.client_id}).then(t=>{}).catch(t=>{console.error(t)})},startollamaService(){de.post("start_ollama",{client_id:this.$store.state.client_id}).then(t=>{}).catch(t=>{console.error(t)})},reinstallPetalsService(){de.post("install_petals",{client_id:this.$store.state.client_id}).then(t=>{}).catch(t=>{console.error(t)})},reinstallOLLAMAService(){de.post("install_ollama",{client_id:this.$store.state.client_id}).then(t=>{}).catch(t=>{console.error(t)})},reinstallElasticSearchService(){de.post("install_vllm",{client_id:this.$store.state.client_id}).then(t=>{}).catch(t=>{console.error(t)})},getSeviceVoices(){de.get("list_voices").then(t=>{this.voices=t.data.voices}).catch(t=>{console.error(t)})},load_more_models(){this.models_zoo_initialLoadCount+10<this.models_zoo.length?this.models_zoo_initialLoadCount+=10:this.models_zoo_initialLoadCount=this.models_zoo.length},async modelsZooToggleCollapse(){this.mzc_collapsed=!this.mzc_collapsed,Fe(()=>{ze.replace()}),this.binding_changed&&!this.mzc_collapsed&&(this.modelsZoo==null||this.modelsZoo.length==0)&&(console.log("Refreshing models"),await this.$store.dispatch("refreshConfig"),this.models_zoo=[],this.refreshModelsZoo(),this.binding_changed=!1)},async selectSortOption(t){this.$store.state.sort_type=t,this.updateModelsZoo(),console.log(`Selected sorting:${t}`),console.log(`models:${this.models_zoo}`)},handleRadioSelected(t){this.isLoading=!0,this.selectSortOption(t).then(()=>{this.isLoading=!1})},filter_installed(t){return console.log("filtering"),t.filter(e=>e.isInstalled===!0)},getVoices(){"speechSynthesis"in window&&(console.log("voice synthesis"),this.audioVoices=speechSynthesis.getVoices(),console.log("Voices:"+this.audioVoices),!this.audio_out_voice&&this.audioVoices.length>0&&(this.audio_out_voice=this.audioVoices[0].name),speechSynthesis.onvoiceschanged=()=>{})},async updateHasUpdates(){let t=await this.api_get_req("check_update");this.has_updates=t.update_availability,console.log("has_updates",this.has_updates)},onVariantChoiceSelected(t){thi
|
|||
|
`+e.model.name+`
|
|||
|
installed!`,4,!0),this.$store.dispatch("refreshDiskUsage")}}else qe.off("install_progress",s),console.log("Install failed"),e.installing=!1,this.showProgress=!1,console.error("Installation failed:",i.error),this.$store.state.toast.showToast(`Model:
|
|||
|
`+e.model.name+`
|
|||
|
failed to install!`,4,!1),this.$store.dispatch("refreshDiskUsage");console.log("Here")};qe.on("install_progress",s),qe.emit("install_model",{path:n,name:e.model.name,variant_name:this.selected_variant.name,type:e.model.type}),console.log("Started installation, please wait")},resetLogo(){this.configFile.app_custom_logo="",this.settingsChanged=!0},resetAvatar(){this.configFile.user_avatar="",this.settingsChanged=!0},uploadLogo(t){const e=t.target.files[0],n=new FormData;n.append("logo",e),console.log("Uploading logo"),de.post("/upload_logo",n).then(s=>{console.log("Logo uploaded successfully"),this.$store.state.toast.showToast("Avatar uploaded successfully!",4,!0);const i=s.data.fileName;console.log("response",s),this.app_custom_logo=i,this.$store.state.config.app_custom_logo=i,this.settingsChanged=!0}).catch(s=>{console.error("Error uploading avatar:",s)})},uploadAvatar(t){const e=t.target.files[0],n=new FormData;n.append("avatar",e),console.log("Uploading avatar"),de.post("/upload_avatar",n).then(s=>{console.log("Avatar uploaded successfully"),this.$store.state.toast.showToast("Avatar uploaded successfully!",4,!0);const i=s.data.fileName;console.log("response",s),this.user_avatar=i,this.$store.state.config.user_avatar=i,this.settingsChanged=!0}).catch(s=>{console.error("Error uploading avatar:",s)})},async update_software(){console.log("Posting");const t=await this.api_post_req("update_software");console.log("Posting done"),t.status?this.$store.state.toast.showToast("Success!",4,!0):this.$store.state.toast.showToast("Failure!",4,!1)},async restart_software(){console.log("Posting");const t=await this.api_post_req("restart_program");console.log("Posting done"),t.status?this.$store.state.toast.showToast("Success!",4,!0):this.$store.state.toast.showToast("Failure!",4,!1)},on_loading_text(t){console.log("Loading text",t),this.loading_text=t},async load_everything(){for(this.isLoading=!0,Fe(()=>{ze.replace()});this.isReady===!1;)await new Promise(t=>setTimeout(t,100));this.refresh(),console.log("Ready"),this.configFile.model_name&&(this.isModelSelected=!0),this.persCatgArr=await this.api_get_req("list_personalities_categories"),this.persArr=await this.api_get_req("list_personalities?category="+this.configFile.personality_category),console.log("category"),this.personality_category=this.configFile.personality_category,this.personalitiesFiltered=this.personalities.filter(t=>t.category===this.configFile.personality_category),this.modelsFiltered=[],this.updateModelsZoo(),this.isLoading=!1,this.isMounted=!0,console.log("READY Stuff")},async open_mzl(){this.mzl_collapsed=!this.mzl_collapsed,console.log("Fetching models")},async getVramUsage(){await this.api_get_req("vram_usage")},async progressListener(t){if(console.log("received something"),t.status==="progress"){if(this.$refs.modelZoo){const e=this.$refs.modelZoo.findIndex(s=>s.model.name==t.model_name&&this.configFile.binding_name==t.binding_folder),n=this.models_zoo[e];n&&(console.log("model entry",n),n.installing=!0,n.progress=t.progress,console.log(`Progress = ${t.progress}`),t.progress>=100?(n.installing=!1,n.isInstalled=!0):(n.installing=!0,n.isInstalled=!0))}}else if(t.status==="succeeded"){if(console.log("Received succeeded"),this.$refs.modelZoo){const e=this.$refs.modelZoo.findIndex(s=>s.model.name==t.model_name&&this.configFile.binding_name==t.binding_folder),n=this.models_zoo[e];t.progress>=100&&(n.installing=!1,n.isInstalled=!0)}if(console.log("Installed successfully"),this.$refs.modelZoo){const e=this.$refs.modelZoo.findIndex(s=>s.model.name==t.model_name&&this.configFile.binding_name==t.binding_folder),n=this.models_zoo[e];n&&(n.installing=!1,n.isInstalled=!0)}this.$store.state.toast.showToast(`Model:
|
|||
|
`+model_object.name+`
|
|||
|
installed!`,4,!0),this.$store.dispatch("refreshDiskUsage")}else if(t.status==="failed"&&(console.log("Install failed"),this.$refs.modelZoo)){const e=this.$refs.modelZoo.findIndex(s=>s.model.name==t.model_name&&this.configFile.binding_name==t.binding_folder),n=this.models_zoo[e];n&&(n.installing=!1,n.isInstalled=!1),console.error("Installation failed:",t.error),this.$store.state.toast.showToast(`Model:
|
|||
|
`+model_object.name+`
|
|||
|
failed to install!`,4,!1),this.$store.dispatch("refreshDiskUsage")}},showAddModelDialog(){this.$refs.addmodeldialog.showDialog("").then(()=>{console.log(this.$refs.addmodeldialog.model_path);const t=this.$refs.addmodeldialog.model_path;qe.emit("install_model",{path:t,type:this.models_zoo[0].type},e=>{console.log("Model installation successful:",e)}),console.log(this.$refs.addmodeldialog.model_path)})},closeAddModelDialog(){this.addModelDialogVisibility=!1},collapseAll(t){this.servers_conf_collapsed=t,this.mainconf_collapsed=t,this.bec_collapsed=t,this.mzc_collapsed=t,this.pzc_collapsed=t,this.bzc_collapsed=t,this.pc_collapsed=t,this.mc_collapsed=t,this.sc_collapsed=t,this.mzdc_collapsed=t},fetchPersonalities(){this.api_get_req("list_personalities_categories").then(t=>{this.persCatgArr=t,this.persCatgArr.sort()}),this.api_get_req("list_personalities").then(t=>{this.persArr=t,this.persArr.sort(),console.log(`Listed personalities:
|
|||
|
${t}`)})},fetchHardwareInfos(){this.$store.dispatch("refreshDiskUsage"),this.$store.dispatch("refreshRamUsage")},async onPersonalitySelected(t){if(console.log("on pers",t),this.isLoading&&this.$store.state.toast.showToast("Loading... please wait",4,!1),this.isLoading=!0,console.log("selecting ",t),t){if(t.selected){this.$store.state.toast.showToast("Personality already selected",4,!0),this.isLoading=!1;return}let e=t.language==null?t.full_path:t.full_path+":"+t.language;if(console.log("pth",e),t.isMounted&&this.configFile.personalities.includes(e)){const n=await this.select_personality(t);console.log("pers is mounted",n),n&&n.status&&n.active_personality_id>-1?this.$store.state.toast.showToast(`Selected personality:
|
|||
|
`+t.name,4,!0):this.$store.state.toast.showToast(`Error on select personality:
|
|||
|
`+t.name,4,!1),this.isLoading=!1}else console.log("mounting pers"),this.mountPersonality(t);Fe(()=>{ze.replace()})}},onModelSelected(t){if(this.isLoading){this.$store.state.toast.showToast("Loading... please wait",4,!1);return}t&&(t.isInstalled?this.update_model(t.model.name).then(e=>{console.log("update_model",e),this.configFile.model_name=t.model.name,e.status?(this.$store.state.toast.showToast(`Selected model:
|
|||
|
`+t.name,4,!0),Fe(()=>{ze.replace(),this.is_loading_zoo=!1}),this.updateModelsZoo(),this.api_get_req("get_model_status").then(n=>{this.$store.commit("setIsModelOk",n)})):(this.$store.state.toast.showToast(`Couldn't select model:
|
|||
|
`+t.name,4,!1),Fe(()=>{ze.replace()})),this.settingsChanged=!0,this.isModelSelected=!0}):this.$store.state.toast.showToast(`Model:
|
|||
|
`+t.model.name+`
|
|||
|
is not installed`,4,!1),Fe(()=>{ze.replace()}))},onCopy(t){let e;t.model.isCustomModel?e=`Model name: ${t.name}
|
|||
|
File size: ${t.fileSize}
|
|||
|
Manually downloaded model `:e=`Model name: ${t.name}
|
|||
|
File size: ${t.fileSize}
|
|||
|
Download: ${"https://huggingface.co/"+t.quantizer+"/"+t.name}
|
|||
|
License: ${t.license}
|
|||
|
Owner: ${t.quantizer}
|
|||
|
Website: ${"https://huggingface.co/"+t.quantizer}
|
|||
|
Description: ${t.description}`,this.$store.state.toast.showToast("Copied model info to clipboard!",4,!0),navigator.clipboard.writeText(e.trim())},onCopyLink(t){this.$store.state.toast.showToast("Copied link to clipboard!",4,!0),navigator.clipboard.writeText(t.model.name)},onCopyPersonalityName(t){this.$store.state.toast.showToast("Copied name to clipboard!",4,!0),navigator.clipboard.writeText(t.name)},async onCopyToCustom(t){await de.post("/copy_to_custom_personas",{client_id:this.$store.state.client_id,category:t.personality.category,name:t.personality.name})},async handleOpenFolder(t){await de.post("/open_personality_folder",{client_id:this.$store.state.client_id,personality_folder:t.personality.folder})},onCancelInstall(){const t=this.addModel;console.log("cancel install",t),this.modelDownlaodInProgress=!1,this.addModel={},qe.emit("cancel_install",{model_name:t.model_name,binding_folder:t.binding_folder,model_url:t.model_url,patreon:t.patreon?t.patreon:"None"}),this.$store.state.toast.showToast("Model installation aborted",4,!1)},onInstall(t){this.variant_choices=t.model.variants,this.currenModelToInstall=t,console.log("variant_choices"),console.log(this.variant_choices),console.log(t),this.variantSelectionDialogVisible=!0},onCreateReference(){de.post("/add_reference_to_local_model",{path:this.reference_path}).then(t=>{t.status?(this.$store.state.toast.showToast("Reference created",4,!0),this.is_loading_zoo=!0,this.refreshModelsZoo().then(()=>{this.updateModelsZoo(),this.is_loading_zoofalse})):this.$store.state.toast.showToast("Couldn't create reference",4,!1)})},onInstallAddModel(){if(!this.addModel.url){this.$store.state.toast.showToast("Link is empty",4,!1);return}let t=this.addModel.url;this.addModel.progress=0,console.log("installing..."),console.log("value ",this.addModel.url),this.modelDownlaodInProgress=!0;const e=n=>{console.log("received something"),n.status&&n.progress<=100?(console.log("Progress",n),this.addModel=n,this.addModel.url=t,this.addModel.progress==100&&(this.modelDownlaodInProgress=!1,console.log("Received succeeded"),qe.off("install_progress",e),console.log("Installed successfully"),this.addModel={},this.$store.state.toast.showToast(`Model:
|
|||
|
`+this.addModel.model_name+`
|
|||
|
installed!`,4,!0),this.$store.dispatch("refreshDiskUsage"))):(qe.off("install_progress",e),console.log("Install failed"),this.modelDownlaodInProgress=!1,console.error("Installation failed:",n.error),this.$store.state.toast.showToast(`Model:
|
|||
|
`+this.addModel.model_name+`
|
|||
|
failed to install!`,4,!1),this.$store.dispatch("refreshDiskUsage"))};qe.on("install_progress",e),qe.emit("install_model",{path:t,type:this.models_zoo[0].type}),console.log("Started installation, please wait")},uploadLocalModel(){if(this.uploadData.length==0){this.$store.state.toast.showToast("No files to upload",4,!1);return}let t=this.addModel.url;this.addModel.progress=0,console.log("installing..."),console.log("value ",this.addModel.url),this.modelDownlaodInProgress=!0;const e=n=>{console.log("received something"),n.status&&n.progress<=100?(console.log("Progress",n),this.addModel=n,this.addModel.url=t,this.addModel.progress==100&&(this.modelDownlaodInProgress=!1,console.log("Received succeeded"),qe.off("progress",e),console.log("Installed successfully"),this.addModel={},this.$store.state.toast.showToast(`Model:
|
|||
|
`+this.addModel.model_name+`
|
|||
|
installed!`,4,!0),this.$store.dispatch("refreshDiskUsage"))):(qe.off("progress",e),console.log("Install failed"),this.modelDownlaodInProgress=!1,console.error("Installation failed:",n.error),this.$store.state.toast.showToast(`Model:
|
|||
|
`+this.addModel.model_name+`
|
|||
|
failed to install!`,4,!1),this.$store.dispatch("refreshDiskUsage"))};qe.on("progress",e),console.log("Started installation, please wait")},setFileList(t){this.uploadData=t.target.files,console.log("set file list",this.uploadData)},onUninstall(t){this.$store.state.yesNoDialog.askQuestion(`Are you sure you want to delete this model?
|
|||
|
[`+t.name+"]","Yes","Cancel").then(e=>{if(e){console.log("uninstalling model...");const n=s=>{console.log("uninstalling res",s),s.status?(console.log("uninstalling success",s),t.uninstalling=!1,qe.off("install_progress",n),this.showProgress=!1,this.is_loading_zoo=!0,this.refreshModelsZoo().then(()=>{this.updateModelsZoo(),this.is_loading_zoo=!1}),this.modelsFiltered=this.models_zoo,this.$store.state.toast.showToast(`Model:
|
|||
|
`+t.model.name+`
|
|||
|
was uninstalled!`,4,!0),this.$store.dispatch("refreshDiskUsage")):(console.log("uninstalling failed",s),t.uninstalling=!1,this.showProgress=!1,qe.off("uninstall_progress",n),console.error("Uninstallation failed:",s.error),this.$store.state.toast.showToast(`Model:
|
|||
|
`+t.model.name+`
|
|||
|
failed to uninstall!`,4,!1),this.$store.dispatch("refreshDiskUsage"))};qe.on("uninstall_progress",n),this.selected_variant!=null?qe.emit("uninstall_model",{path:"https://huggingface.co/"+t.model.quantizer+"/"+t.model.name+"/resolve/main/"+this.selected_variant.name,type:t.model.type}):qe.emit("uninstall_model",{path:"https://huggingface.co/"+t.model.quantizer+"/"+t.model.name,type:t.model.type})}})},onBindingSelected(t){if(console.log("Binding selected"),!t.binding.installed){this.$store.state.toast.showToast(`Binding is not installed:
|
|||
|
`+t.binding.name,4,!1);return}this.mzc_collapsed=!0,this.configFile.binding_name!=t.binding.folder&&(this.update_binding(t.binding.folder),this.binding_changed=!0),this.api_get_req("get_model_status").then(e=>{this.$store.commit("setIsModelOk",e)})},onInstallBinding(t){this.configFile.binding_name!=t.binding.folder?(this.isLoading=!0,t.disclaimer&&this.$store.state.yesNoDialog.askQuestion(t.disclaimer,"Proceed","Cancel"),de.post("/install_binding",{name:t.binding.folder}).then(e=>{if(e)return this.isLoading=!1,console.log("install_binding",e),e.data.status?(this.$store.state.toast.showToast("Binding installed successfully!",4,!0),this.$store.state.messageBox.showMessage(`It is advised to reboot the application after installing a binding.
|
|||
|
Page will refresh in 5s.`),setTimeout(()=>{window.location.href="/"},5e3)):this.$store.state.toast.showToast("Could not reinstall binding",4,!1),this.isLoading=!1,e.data;this.isLoading=!1}).catch(e=>(this.isLoading=!1,this.$store.state.toast.showToast(`Could not reinstall binding
|
|||
|
`+e.message,4,!1),{status:!1}))):this.update_binding(t.binding.folder)},onUnInstallBinding(t){this.isLoading=!0,de.post("/unInstall_binding",{name:t.binding.folder}).then(e=>{if(e){if(this.isLoading=!1,console.log("unInstall_binding",e),e.data.status){const n=this.bindingsZoo.findIndex(i=>i.folder==t.binding.folder),s=this.bindingsZoo[n];s?s.installed=!0:s.installed=!1,this.settingsChanged=!0,this.binding_changed=!0,this.$store.state.toast.showToast("Binding uninstalled successfully!",4,!0)}else this.$store.state.toast.showToast("Could not uninstall binding",4,!1);return e.data}this.isLoading=!1,t.isInstalled=False}).catch(e=>(this.isLoading=!1,this.$store.state.toast.showToast(`Could not uninstall binding
|
|||
|
`+e.message,4,!1),{status:!1}))},onReinstallBinding(t){this.isLoading=!0,de.post("/reinstall_binding",{name:t.binding.folder}).then(e=>{if(e)return this.isLoading=!1,console.log("reinstall_binding",e),e.data.status?(this.$store.state.toast.showToast("Binding reinstalled successfully!",4,!0),this.$store.state.messageBox.showMessage("It is advised to reboot the application after installing a binding")):this.$store.state.toast.showToast("Could not reinstall binding",4,!1),e.data;this.isLoading=!1}).catch(e=>(this.isLoading=!1,this.$store.state.toast.showToast(`Could not reinstall binding
|
|||
|
`+e.message,4,!1),{status:!1}))},onSettingsBinding(t){try{this.isLoading=!0,de.get("/get_active_binding_settings").then(e=>{console.log(e),this.isLoading=!1,e&&(console.log("binding setting",e),e.data&&Object.keys(e.data).length>0?this.$store.state.universalForm.showForm(e.data,"Binding settings - "+t.binding.name,"Save changes","Cancel").then(n=>{try{de.post("/set_active_binding_settings",{client_id:this.$store.state.client_id,settings:n},{headers:this.posts_headers}).then(s=>{s&&s.data?(console.log("binding set with new settings",s.data),this.$store.state.toast.showToast("Binding settings updated successfully!",4,!0),de.post("/update_binding_settings",{client_id:this.$store.state.client_id}).then(i=>{this.$store.state.toast.showToast("Binding settings committed successfully!",4,!0),window.location.href="/"})):(this.$store.state.toast.showToast(`Did not get binding settings responses.
|
|||
|
`+s,4,!1),this.isLoading=!1)})}catch(s){this.$store.state.toast.showToast(`Did not get binding settings responses.
|
|||
|
Endpoint error: `+s.message,4,!1),this.isLoading=!1}}):(this.$store.state.toast.showToast("Binding has no settings",4,!1),this.isLoading=!1))})}catch(e){this.isLoading=!1,this.$store.state.toast.showToast("Could not open binding settings. Endpoint error: "+e.message,4,!1)}},onReloadBinding(t){console.log("Reloading binding"),this.isLoading=!0,de.post("/reload_binding",{name:t.binding.folder},{headers:this.posts_headers}).then(e=>{if(e)return this.isLoading=!1,console.log("reload_binding",e),e.data.status?this.$store.state.toast.showToast("Binding reloaded successfully!",4,!0):this.$store.state.toast.showToast("Could not reload binding",4,!1),e.data;this.isLoading=!1}).catch(e=>(this.isLoading=!1,this.$store.state.toast.showToast(`Could not reload binding
|
|||
|
`+e.message,4,!1),{status:!1}))},onSettingsPersonality(t){try{this.isLoading=!0,de.get("/get_active_personality_settings").then(e=>{this.isLoading=!1,e&&(console.log("pers sett",e),e.data&&Object.keys(e.data).length>0?this.$store.state.universalForm.showForm(e.data,"Personality settings - "+t.personality.name,"Save changes","Cancel").then(n=>{try{de.post("/set_active_personality_settings",n).then(s=>{s&&s.data?(console.log("personality set with new settings",s.data),this.$store.state.toast.showToast("Personality settings updated successfully!",4,!0)):(this.$store.state.toast.showToast(`Did not get Personality settings responses.
|
|||
|
`+s,4,!1),this.isLoading=!1)})}catch(s){this.$store.state.toast.showToast(`Did not get Personality settings responses.
|
|||
|
Endpoint error: `+s.message,4,!1),this.isLoading=!1}}):(this.$store.state.toast.showToast("Personality has no settings",4,!1),this.isLoading=!1))})}catch(e){this.isLoading=!1,this.$store.state.toast.showToast("Could not open personality settings. Endpoint error: "+e.message,4,!1)}},onMessageBoxOk(){console.log("OK button clicked")},update_personality_category(t,e){this.personality_category=t,e()},refresh(){console.log("Refreshing"),this.$store.dispatch("refreshConfig").then(()=>{console.log(this.personality_category),this.api_get_req("list_personalities_categories").then(t=>{console.log("cats",t),this.persCatgArr=t,this.personalitiesFiltered=this.personalities.filter(e=>e.category===this.personality_category),this.personalitiesFiltered.sort()})})},toggleAccordion(){this.showAccordion=!this.showAccordion},async update_setting(t,e,n){this.isLoading=!0;const s={client_id:this.$store.state.client_id,setting_name:t,setting_value:e};console.log("Updating setting",t,":",e);let i=await de.post("/update_setting",s,{headers:this.posts_headers});if(i)return this.isLoading=!1,console.log("update_setting",i),i.status?this.$store.state.toast.showToast(`Setting updated successfully.
|
|||
|
`,4,!0):this.$store.state.toast.showToast(`Setting update failed.
|
|||
|
Please view the console for more details.`,4,!1),n!==void 0&&n(i),i.data;this.isLoading=!1},async refreshModelsZoo(){this.models_zoo=[],console.log("refreshing models"),this.is_loading_zoo=!0,await this.$store.dispatch("refreshModelsZoo"),console.log("ModelsZoo refreshed"),await this.$store.dispatch("refreshModels"),console.log("Models refreshed"),this.updateModelsZoo(),console.log("Models updated"),this.is_loading_zoo=!1},async updateModelsZoo(){let t=this.$store.state.modelsZoo;if(t.length!=0){console.log(`REFRESHING models using sorting ${this.sort_type}`),t.length>1?(this.sort_type==0?(t.sort((e,n)=>{const s=new Date(e.last_commit_time);return new Date(n.last_commit_time)-s}),console.log("Sorted")):this.sort_type==1?t.sort((e,n)=>n.rank-e.rank):this.sort_type==2?t.sort((e,n)=>e.name.localeCompare(n.name)):this.sort_type==3&&t.sort((e,n)=>e.name.localeCompare(n.name)),console.log("Sorted")):console.log("No sorting needed"),t.forEach(e=>{e.name==this.$store.state.config.model_name?e.selected=!0:e.selected=!1}),console.log("Selected models");for(let e=0;e<this.$store.state.modelsArr.length;e++){const n=this.$store.state.modelsArr[e];let s=t.findIndex(i=>i.name==n);if(s==-1)for(let i=0;i<t.length;i++){let r=t[i].variants;if(r!=null&&(s=r.findIndex(o=>o.name==n),s!=-1)){s=i,console.log(`Found ${n} at index ${s}`);break}}if(s==-1){let i={};i.name=n,i.icon=this.imgBinding,i.isCustomModel=!0,i.isInstalled=!0,t.push(i)}else t[s].isInstalled=!0}console.log("Determined models"),t.sort((e,n)=>e.isInstalled&&!n.isInstalled?-1:!e.isInstalled&&n.isInstalled?1:0),console.log("Done"),this.models_zoo=this.$store.state.modelsZoo}},update_binding(t){this.isLoading=!0,this.$store.state.modelsZoo=[],this.configFile.model_name=null,this.$store.state.config.model_name=null,console.log("updating binding_name"),this.update_setting("binding_name",t,async e=>{console.log("updated binding_name"),await this.$store.dispatch("refreshConfig"),this.models_zoo=[],this.mzc_collapsed=!0;const n=this.bindingsZoo.findIndex(i=>i.folder==t),s=this.bindingsZoo[n];s?s.installed=!0:s.installed=!1,this.settingsChanged=!0,this.isLoading=!1,Fe(()=>{ze.replace()}),console.log("updating model"),this.update_model(null).then(()=>{}),Fe(()=>{ze.replace()})}),Fe(()=>{ze.replace()})},async update_model(t){t||(this.isModelSelected=!1),this.isLoading=!0;let e=await this.update_setting("model_name",t);return this.isLoading=!1,Fe(()=>{ze.replace()}),e},async cancelConfiguration(){await this.$store.dispatch("refreshConfig"),this.settingsChanged=!1},applyConfiguration(){this.isLoading=!0,de.post("/apply_settings",{client_id:this.$store.state.client_id,config:this.configFile},{headers:this.posts_headers}).then(t=>{this.isLoading=!1,t.data.status?(this.$store.state.toast.showToast("Configuration changed successfully.",4,!0),this.settingsChanged=!1):this.$store.state.toast.showToast("Configuration change failed.",4,!1),Fe(()=>{ze.replace()})})},save_configuration(){this.showConfirmation=!1,de.post("/save_settings",{},{headers:this.posts_headers}).then(t=>{if(t)return t.status||this.$store.state.messageBox.showMessage("Error: Couldn't save settings!"),t.data}).catch(t=>(console.log(t.message,"save_configuration"),this.$store.state.messageBox.showMessage("Couldn't save settings!"),{status:!1}))},reset_configuration(){this.$store.state.yesNoDialog.askQuestion(`Are you sure?
|
|||
|
This will delete all your configurations and get back to default configuration.`).then(t=>{t&&de.post("/reset_settings",{},{headers:this.posts_headers}).then(e=>{if(e)return e.status?this.$store.state.messageBox.showMessage("Settings have been reset correctly"):this.$store.state.messageBox.showMessage("Couldn't reset settings!"),e.data}).catch(e=>(console.log(e.message,"reset_configuration"),this.$store.state.messageBox.showMessage("Couldn't reset settings!"),{status:!1}))})},async api_get_req(t){try{const e=await de.get("/"+t);if(e)return e.data}catch(e){console.log(e.message,"api_get_req - settings");return}},async api_post_req(t){try{const e=await de.post("/"+t,{client_id:this.$store.state.client_id});if(e)return e.data}catch(e){console.log(e.message,"api_post_req - settings");return}},closeToast(){this.showToast=!1},async getPersonalitiesArr(){this.isLoading=!0,this.personalities=[];const t=await this.api_get_req("get_all_personalities"),e=this.$store.state.config,n=Object.keys(t);for(let s=0;s<n.length;s++){const i=n[s],o=t[i].map(a=>{const c=e.personalities.includes(i+"/"+a.folder);let d={};return d=a,d.category=i,d.language="",d.full_path=i+"/"+a.folder,d.isMounted=c,d});this.personalities.length==0?this.personalities=o:this.personalities=this.personalities.concat(o)}this.personalities.sort((s,i)=>s.name.localeCompare(i.name)),this.personalitiesFiltered=this.personalities.filter(s=>s.category===this.configFile.personality_category),this.personalitiesFiltered.sort(),console.log("per filtered",this.personalitiesFiltered),this.isLoading=!1},async filterPersonalities(){if(!this.searchPersonality){this.personalitiesFiltered=this.personalities.filter(n=>n.category===this.configFile.personality_category),this.personalitiesFiltered.sort(),this.searchPersonalityInProgress=!1;return}const t=this.searchPersonality.toLowerCase(),e=this.personalities.filter(n=>{if(n.name&&n.name.toLowerCase().includes(t)||n.description&&n.description.toLowerCase().includes(t)||n.full_path&&n.full_path.toLowerCase().includes(t))return n});e.length>0?this.personalitiesFiltered=e.sort():(this.personalitiesFiltered=this.personalities.filter(n=>n.category===this.configFile.personality_category),this.personalitiesFiltered.sort()),this.searchPersonalityInProgress=!1},async filterModels(){const t=this.searchModel.toLowerCase();this.is_loading_zoo=!0,console.log("filtering models"),console.log(this.models_zoo);const e=this.models_zoo.filter(n=>{if(n.name&&n.name.toLowerCase().includes(t)||n.description&&n.description.toLowerCase().includes(t)||n.category&&n.category.toLowerCase().includes(t))return n});this.is_loading_zoo=!1,e.length>0?this.modelsFiltered=e:this.modelsFiltered=[],this.searchModelInProgress=!1},computedFileSize(t){return Qs(t)},async mount_personality(t){if(!t)return{status:!1,error:"no personality - mount_personality"};try{const e={client_id:this.$store.state.client_id,language:t.language?t.language:"",category:t.category?t.category:"",folder:t.folder?t.folder:""},n=await de.post("/mount_personality",e,{headers:this.posts_headers});if(n)return n.data}catch(e){console.log(e.message,"mount_personality - settings");return}},async unmount_personality(t){if(!t)return{status:!1,error:"no personality - unmount_personality"};const e={client_id:this.$store.state.client_id,language:t.language,category:t.category,folder:t.folder};try{const n=await de.post("/unmount_personality",e,{headers:this.posts_headers});if(n)return n.data}catch(n){console.log(n.message,"unmount_personality - settings");return}},async select_personality(t){if(!t)return{status:!1,error:"no personality - select_personality"};let e=t.language==null?t.full_path:t.full_path+":"+t.language;console.log("pth",e);const n=this.configFile.personalities.findIndex(i=>i===e),s={client_id:this.$store.state.client_id,id:n};try{const i=await de.post("/select_personality",s,{headers:this.posts_headers});if(i)return this.$store.dispatch("refreshConfig").then(()=>{this.$store.dispatch("refreshPersonalitiesZoo").then(()=>{this.$store.dispatch("refreshMountedPersonalities")})}),i.data}catch(i){c
|
|||
|
`+t.personality.name,4,!0),this.$store.dispatch("refreshMountedPersonalities")):(t.isMounted=!1,this.$store.state.toast.showToast(`Could not mount personality
|
|||
|
Error: `+e.error+`
|
|||
|
Response:
|
|||
|
`+e,4,!1)),this.isLoading=!1},async unmountAll(){await de.post("/unmount_all_personalities",{client_id:this.$store.state.client_id},{headers:this.posts_headers}),this.$store.dispatch("refreshMountedPersonalities"),this.$store.dispatch("refreshConfig"),this.$store.state.toast.showToast("All personas unmounted",4,!0)},async unmountPersonality(t){if(this.isLoading=!0,!t)return;const e=await this.unmount_personality(t.personality||t);if(e.status){this.configFile.personalities=e.personalities,this.$store.state.toast.showToast("Personality unmounted",4,!0);const n=this.personalities.findIndex(a=>a.full_path==t.full_path),s=this.personalitiesFiltered.findIndex(a=>a.full_path==t.full_path),i=this.$refs.personalitiesZoo.findIndex(a=>a.full_path==t.full_path);console.log("ppp",this.personalities[n]),this.personalities[n].isMounted=!1,s>-1&&(this.personalitiesFiltered[s].isMounted=!1),i>-1&&(this.$refs.personalitiesZoo[i].isMounted=!1),this.$store.dispatch("refreshMountedPersonalities");const r=this.mountedPersArr[this.mountedPersArr.length-1];console.log(r,this.mountedPersArr.length),(await this.select_personality(t.personality)).status&&this.$store.state.toast.showToast(`Selected personality:
|
|||
|
`+r.name,4,!0)}else this.$store.state.toast.showToast(`Could not unmount personality
|
|||
|
Error: `+e.error,4,!1);this.isLoading=!1},editPersonality(t){t=t.personality,de.post("/get_personality_config",{client_id:this.$store.state.client_id,category:t.category,name:t.folder}).then(e=>{const n=e.data;console.log("Done"),n.status?(this.$store.state.currentPersonConfig=n.config,this.$store.state.showPersonalityEditor=!0,this.$store.state.personality_editor.showPanel(),this.$store.state.selectedPersonality=t):console.error(n.error)}).catch(e=>{console.error(e)})},copyToCustom(t){t=t.personality,de.post("/copy_to_custom_personas",{category:t.category,name:t.folder}).then(e=>{e.status?(this.$store.state.messageBox.showMessage(`Personality copied to the custom personalities folder:
|
|||
|
Now it's up to you to modify it, enhance it, and maybe even share it.
|
|||
|
Feel free to add your name as an author, but please remember to keep the original creator's name as well.
|
|||
|
You have the freedom to give, sell, or keep the personas you create for yourself.
|
|||
|
The possibilities are endless, they are now yours to mold and customize as you see fit.`),this.$store.dispatch("refreshPersonalitiesZoo")):this.$store.state.toast.showToast(`Personality couldn't be copied to the custom personalities folder:
|
|||
|
Verify that the personality is not already copied there.`,4,!1)}).catch(e=>{this.$store.state.toast.showToast(`Personality couldn't be copied to the custom personalities folder:
|
|||
|
`,4,!1),console.error(e)})},async remountPersonality(t){await this.unmountPersonality(t),await this.mountPersonality(t)},onPersonalityReinstall(t){console.log("on reinstall ",t),this.isLoading=!0,console.log("Personality path:",t.personality.path),de.post("/reinstall_personality",{client_id:this.$store.state.client_id,name:t.personality.path},{headers:this.posts_headers}).then(e=>{if(e)return this.isLoading=!1,console.log("reinstall_personality",e),e.data.status?this.$store.state.toast.showToast("Personality reinstalled successfully!",4,!0):this.$store.state.toast.showToast("Could not reinstall personality",4,!1),e.data;this.isLoading=!1}).catch(e=>(this.isLoading=!1,this.$store.state.toast.showToast(`Could not reinstall personality
|
|||
|
`+e.message,4,!1),{status:!1}))},personalityImgPlacehodler(t){t.target.src=fs},searchPersonality_func(){clearTimeout(this.searchPersonalityTimer),this.searchPersonality&&(this.searchPersonalityInProgress=!0,setTimeout(this.filterPersonalities,this.searchPersonalityTimerInterval))},searchModel_func(){this.filterModels()}},async mounted(){console.log("Getting voices"),this.getVoices(),console.log("Constructing"),this.load_everything(),this.getSeviceVoices();try{console.log("Loading input devices list");const t=await de.get("/get_snd_input_devices");this.snd_input_devices=t.data.device_names,this.snd_input_devices_indexes=t.data.device_indexes}catch{console.log("Couldin't list input devices")}try{console.log("Loading output devices list");const t=await de.get("/get_snd_output_devices");this.snd_output_devices=t.data.device_names,this.snd_output_devices_indexes=t.data.device_indexes}catch{console.log("Couldin't list output devices")}try{console.log("Getting comfyui models");const t=await de.get("/list_comfyui_models");console.log("res is ",t),t.data.status&&(this.comfyui_models=t.data.models)}catch{console.log("Couldin't list output devices")}this.fetchElevenLabsVoices()},activated(){},computed:{full_template:{get(){return(this.configFile.start_header_id_template+this.configFile.system_message_template+this.configFile.end_header_id_template+" system message"+this.configFile.separator_template+this.configFile.start_user_header_id_template+"user name"+this.configFile.end_user_header_id_template+" User prompt"+this.configFile.separator_template+this.configFile.end_user_message_id_template+this.configFile.separator_template+this.configFile.start_ai_header_id_template+"ai personality"+this.configFile.end_ai_header_id_template+"ai response"+this.configFile.end_ai_message_id_template).replace(`
|
|||
|
`,"<br>")}},rendered_models_zoo:{get(){return this.searchModel?this.show_only_installed_models?this.modelsFiltered.filter(t=>t.isInstalled===!0):this.modelsFiltered.slice(0,Math.min(this.models_zoo.length,this.models_zoo_initialLoadCount)):(console.log("this.models_zoo"),console.log(this.models_zoo),console.log(this.models_zoo_initialLoadCount),this.show_only_installed_models?this.models_zoo.filter(t=>t.isInstalled===!0):this.models_zoo.slice(0,Math.min(this.models_zoo.length,this.models_zoo_initialLoadCount)))}},imgBinding:{get(){if(!this.isMounted)return As;try{return this.$refs.bindingZoo[this.$refs.bindingZoo.findIndex(t=>t.binding.folder==this.configFile.binding_name)].$refs.imgElement.src}catch{return As}}},imgModel:{get(){try{let t=this.$store.state.modelsZoo.findIndex(e=>e.name==this.$store.state.selectedModel);return t>=0?(console.log(`model avatar : ${this.$store.state.modelsZoo[t].icon}`),this.$store.state.modelsZoo[t].icon):As}catch{console.log("error")}if(!this.isMounted)return As;try{return this.$refs.bindingZoo[this.$refs.bindingZoo.findIndex(t=>t.binding.folder==this.configFile.binding_name)].$refs.imgElement.src}catch{return As}}},isReady:{get(){return this.$store.state.ready}},audio_out_voice:{get(){return this.$store.state.config.audio_out_voice},set(t){this.$store.state.config.audio_out_voice=t}},openaiWhisperModels(){return["whisper-1"]},whisperModels(){return["tiny.en","tiny","base.en","base","small.en","small","medium.en","medium","large-v1","large-v2","large-v3","large"]},audioLanguages(){return[{code:"en-US",name:"English (US)"},{code:"en-GB",name:"English (UK)"},{code:"es-ES",name:"Spanish (Spain)"},{code:"es-MX",name:"Spanish (Mexico)"},{code:"fr-FR",name:"French (France)"},{code:"fr-CA",name:"French (Canada)"},{code:"de-DE",name:"German (Germany)"},{code:"it-IT",name:"Italian (Italy)"},{code:"pt-BR",name:"Portuguese (Brazil)"},{code:"pt-PT",name:"Portuguese (Portugal)"},{code:"ru-RU",name:"Russian (Russia)"},{code:"zh-CN",name:"Chinese (China)"},{code:"ja-JP",name:"Japanese (Japan)"},{code:"ar-SA",name:"Arabic (Saudi Arabia)"},{code:"tr-TR",name:"Turkish (Turkey)"},{code:"ms-MY",name:"Malay (Malaysia)"},{code:"ko-KR",name:"Korean (South Korea)"},{code:"nl-NL",name:"Dutch (Netherlands)"},{code:"sv-SE",name:"Swedish (Sweden)"},{code:"da-DK",name:"Danish (Denmark)"},{code:"fi-FI",name:"Finnish (Finland)"},{code:"no-NO",name:"Norwegian (Norway)"},{code:"pl-PL",name:"Polish (Poland)"},{code:"el-GR",name:"Greek (Greece)"},{code:"hu-HU",name:"Hungarian (Hungary)"},{code:"cs-CZ",name:"Czech (Czech Republic)"},{code:"th-TH",name:"Thai (Thailand)"},{code:"hi-IN",name:"Hindi (India)"},{code:"he-IL",name:"Hebrew (Israel)"},{code:"id-ID",name:"Indonesian (Indonesia)"},{code:"vi-VN",name:"Vietnamese (Vietnam)"},{code:"uk-UA",name:"Ukrainian (Ukraine)"},{code:"ro-RO",name:"Romanian (Romania)"},{code:"bg-BG",name:"Bulgarian (Bulgaria)"},{code:"hr-HR",name:"Croatian (Croatia)"},{code:"sr-RS",name:"Serbian (Serbia)"},{code:"sk-SK",name:"Slovak (Slovakia)"},{code:"sl-SI",name:"Slovenian (Slovenia)"},{code:"et-EE",name:"Estonian (Estonia)"},{code:"lv-LV",name:"Latvian (Latvia)"},{code:"lt-LT",name:"Lithuanian (Lithuania)"},{code:"ka-GE",name:"Georgian (Georgia)"},{code:"hy-AM",name:"Armenian (Armenia)"},{code:"az-AZ",name:"Azerbaijani (Azerbaijan)"},{code:"kk-KZ",name:"Kazakh (Kazakhstan)"},{code:"uz-UZ",name:"Uzbek (Uzbekistan)"},{code:"kkj-CM",name:"Kako (Cameroon)"},{code:"my-MM",name:"Burmese (Myanmar)"},{code:"ne-NP",name:"Nepali (Nepal)"},{code:"si-LK",name:"Sinhala (Sri Lanka)"}]},configFile:{get(){return this.$store.state.config},set(t){this.$store.commit("setConfig",t)}},userName:{get(){return this.$store.state.config.user_name},set(t){this.$store.state.config.user_name=t}},user_avatar:{get(){return this.$store.state.config.user_avatar!=""?"/user_infos/"+this.$store.state.config.user_avatar:fs},set(t){this.$store.state.config.user_avatar=t}},hardware_mode:{get(){return this.$store.state.config.hardware_mode},set(t){this.$store.state.config.hardware_mode=t}},auto_update:{get(){return this.$store.state.co
|
|||
|
You need to apply changes before you leave, or else.`,"Apply configuration","Cancel")&&this.applyConfiguration(),!1}},D=t=>(Mi("data-v-f4dd91c5"),t=t(),ki(),t),Art={class:"container flex flex-row shadow-lg p-10 pt-0 overflow-y-scroll w-full background-color scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary"},Nrt={class:"sticky top-0 z-10 flex flex-row mb-2 p-3 gap-3 w-full rounded-b-lg panels-color shadow-lg"},Ort={key:0,class:"flex gap-3 flex-1 items-center duration-75"},Irt=D(()=>l("i",{"data-feather":"x"},null,-1)),Mrt=[Irt],krt=D(()=>l("i",{"data-feather":"check"},null,-1)),Drt=[krt],Lrt={key:1,class:"flex gap-3 flex-1 items-center"},Prt=D(()=>l("i",{"data-feather":"refresh-ccw"},null,-1)),Urt=[Prt],Frt=D(()=>l("i",{"data-feather":"list"},null,-1)),Brt=[Frt],Grt={class:"flex gap-3 flex-1 items-center justify-end"},Vrt=D(()=>l("i",{"data-feather":"trash-2"},null,-1)),zrt=[Vrt],Hrt=D(()=>l("i",{"data-feather":"refresh-ccw"},null,-1)),qrt=[Hrt],$rt=D(()=>l("i",{"data-feather":"arrow-up-circle"},null,-1)),Yrt=D(()=>l("i",{"data-feather":"alert-circle"},null,-1)),Wrt=[$rt,Yrt],Krt={class:"flex gap-3 items-center"},jrt={key:0,class:"flex gap-3 items-center"},Qrt=D(()=>l("div",{class:"flex flex-row"},[l("p",{class:"text-green-600 font-bold hover:text-green-300 ml-4 pl-4 mr-4 pr-4"},"Apply changes:"),l("i",{"data-feather":"check"})],-1)),Xrt=[Qrt],Zrt=D(()=>l("div",{class:"flex flex-row"},[l("p",{class:"text-red-600 font-bold hover:text-red-300 ml-4 pl-4 mr-4 pr-4"},"Cancel changes:"),l("i",{"data-feather":"x"})],-1)),Jrt=[Zrt],eot={key:1,role:"status"},tot=D(()=>l("svg",{"aria-hidden":"true",class:"w-6 h-6 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[l("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),l("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})],-1)),not=D(()=>l("span",{class:"sr-only"},"Loading...",-1)),sot={class:"flex flex-col mb-2 rounded-lg panels-color hover:bg-bg-light-tone-panel hover:dark:bg-bg-dark-tone-panel duration-150 shadow-lg"},iot={class:"flex flex-row p-3"},rot=D(()=>l("i",{"data-feather":"chevron-right"},null,-1)),oot=[rot],aot=D(()=>l("i",{"data-feather":"chevron-down"},null,-1)),lot=[aot],cot=D(()=>l("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," System status",-1)),dot=D(()=>l("div",{class:"mr-2"},"|",-1)),uot={class:"text-base font-semibold cursor-pointer select-none items-center"},pot={class:"flex gap-2 items-center"},_ot={key:0},hot=["src"],fot={class:"font-bold font-large text-lg"},mot={key:1},got={class:"flex gap-2 items-center"},bot=["src"],Eot={class:"font-bold font-large text-lg"},yot=D(()=>l("i",{"data-feather":"cpu",title:"CPU Ram",class:"w-5 h-5 mx-1 flex-shrink-0"},null,-1)),vot={class:"font-bold font-large text-lg"},Sot=D(()=>l("i",{"data-feather":"hard-drive",title:"Hard drive",class:"w-5 h-5 mx-1 flex-shrink-0"},null,-1)),Tot={class:"font-bold font-large text-lg"},xot={class:"mb-2"},Cot=D(()=>l("la
|
|||
|
If you are using windows, this uses wsl which requires you to have it installed or at least activated.
|
|||
|
If You are using windows, this will install wsl so you need to activate it.
|
|||
|
<a href='https://techcommunity.microsoft.com/t5/windows-11/how-to-install-the-linux-windows-subsystem-in-windows-11/m-p/2701207' target='_blank'>Here is how you can do that</a>`))},bft)])]),l("tr",null,[Eft,l("td",null,[l("div",yft,[l("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[371]||(e[371]=(..._)=>r.reinstallOLLAMAService&&r.reinstallOLLAMAService(..._))},"install ollama service"),l("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[372]||(e[372]=(..._)=>r.startollamaService&&r.startollamaService(..._))},"start ollama service")])])]),l("tr",null,[vft,l("td",null,[l("div",Sft,[U(l("input",{type:"text",id:"ollama_base_url",required:"","onUpdate:modelValue":e[373]||(e[373]=_=>r.configFile.ollama_base_url=_),onChange:e[374]||(e[374]=_=>i.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[pe,r.configFile.ollama_base_url]])])])])])]),_:1}),Z(a,{title:"vLLM service",is_subcard:!0,class:"pb-2 m-2"},{default:De(()=>[l("table",Tft,[l("tr",null,[xft,l("td",null,[l("div",Cft,[U(l("input",{type:"checkbox",id:"enable_vllm_service",required:"","onUpdate:modelValue":e[375]||(e[375]=_=>r.configFile.enable_vllm_service=_),onChange:e[376]||(e[376]=_=>i.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[$e,r.configFile.enable_vllm_service]])])]),l("td",null,[l("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary",onClick:e[377]||(e[377]=_=>this.$store.state.messageBox.showMessage(`Activates vllm service. The service will be automatically loaded at startup alowing you to use the elf binding.
|
|||
|
If you are using windows, this uses wsl which requires you to have it installed or at least activated.
|
|||
|
If You are using windows, this will install wsl so you need to activate it.
|
|||
|
<a href='https://techcommunity.microsoft.com/t5/windows-11/how-to-install-the-linux-windows-subsystem-in-windows-11/m-p/2701207' target='_blank'>Here is how you can do that</a>`))},Rft)])]),l("tr",null,[Aft,l("td",null,[l("div",Nft,[l("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[378]||(e[378]=(..._)=>r.reinstallvLLMService&&r.reinstallvLLMService(..._))},"install vLLM service"),l("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[379]||(e[379]=(..._)=>r.startvLLMService&&r.startvLLMService(..._))},"start vllm service")])])]),l("tr",null,[Oft,l("td",null,[l("div",Ift,[U(l("input",{type:"text",id:"vllm_url",required:"","onUpdate:modelValue":e[380]||(e[380]=_=>r.configFile.vllm_url=_),onChange:e[381]||(e[381]=_=>i.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[pe,r.configFile.vllm_url]])])])]),l("tr",null,[Mft,l("td",null,[l("div",kft,[l("div",Dft,[Lft,l("p",Pft,[U(l("input",{type:"text",id:"temp-val","onUpdate:modelValue":e[382]||(e[382]=_=>r.configFile.vllm_gpu_memory_utilization=_),onChange:e[383]||(e[383]=_=>i.settingsChanged=!0),class:"mt-2 w-16 text-right p-2 border border-gray-300 rounded-lg bg-gray-50 sm:text-xs focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[pe,r.configFile.vllm_gpu_memory_utilization]])])]),U(l("input",{id:"vllm_gpu_memory_utilization",onChange:e[384]||(e[384]=_=>i.settingsChanged=!0),type:"range","onUpdate:modelValue":e[385]||(e[385]=_=>r.configFile.vllm_gpu_memory_utilization=_),min:"0.10",max:"1",step:"0.01",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[pe,r.configFile.vllm_gpu_memory_utilization]])])])]),l("tr",null,[Uft,l("td",null,[l("div",Fft,[U(l("input",{type:"number",id:"vllm_max_num_seqs",min:"64",max:"2048",required:"","onUpdate:modelValue":e[386]||(e[386]=_=>r.configFile.vllm_max_num_seqs=_),onChange:e[387]||(e[387]=_=>i.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[pe,r.configFile.vllm_max_num_seqs]])])])]),l("tr",null,[Bft,l("td",null,[l("div",Gft,[U(l("input",{type:"number",id:"vllm_max_model_len",min:"2048",max:"1000000",required:"","onUpdate:modelValue":e[388]||(e[388]=_=>r.configFile.vllm_max_model_len=_),onChange:e[389]||(e[389]=_=>i.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[pe,r.configFile.vllm_max_model_len]])])])]),l("tr",null,[Vft,l("td",null,[l("div",zft,[U(l("input",{type:"text",id:"vllm_model_path",required:"","onUpdate:modelValue":e[390]||(e[390]=_=>r.configFile.vllm_model_path=_),onChange:e[391]||(e[391]=_=>i.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[pe,r.configFile.vllm_model_path]])])])])])]),_:1}),Z(a,{title:"Petals service",is_subcard:!0,class:"pb-2 m-2"},{default:De(()=>[l("table",Hft,[l("tr",null,[qft,l("td",null,[l("div",$ft,[U(l("input",{type:"checkbox",id:"enable_petals_service",required:"","onUpdate:modelValue":e[392]||(e[392]=_=>r.configFile.enable_petals_service=_),onChange:e[393]||(e[393]=_=>i.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[$e,r.configFile.enable_petals_service]])])]),l("td",null,[l("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary",onClick:e[394]||(e[394]=_=>this.$store.state.messageBox.showMessage(`Activates Petals service. The service will be automatically loaded at startup alowing you to use the petals endpoint to generate text in a distributed network.
|
|||
|
If You are using windows, this will install wsl so you need to activate it.
|
|||
|
<a href='https://techcommunity.microsoft.com/t5/windows-11/how-to-install-the-linux-windows-subsystem-in-windows-11/m-p/2701207' target='_blank'>Here is how you can do that</a>`))},Wft)])]),l("tr",null,[Kft,l("td",null,[l("div",jft,[l("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[395]||(e[395]=(..._)=>r.reinstallPetalsService&&r.reinstallPetalsService(..._))},"install petals service")])])]),l("tr",null,[Qft,l("td",null,[l("div",Xft,[U(l("input",{type:"text",id:"petals_base_url",required:"","onUpdate:modelValue":e[396]||(e[396]=_=>r.configFile.petals_base_url=_),onChange:e[397]||(e[397]=_=>i.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[pe,r.configFile.petals_base_url]])])])])])]),_:1})]),_:1}),Z(a,{title:"Misc",is_shrunk:!0,is_subcard:!0,class:"pb-2 m-2"},{default:De(()=>[Z(a,{title:"Motion Ctrl service",is_subcard:!0,class:"pb-2 m-2"},{default:De(()=>[l("table",Zft,[l("tr",null,[Jft,l("td",null,[l("div",emt,[U(l("input",{type:"checkbox",id:"enable_motion_ctrl_service",required:"","onUpdate:modelValue":e[398]||(e[398]=_=>r.configFile.enable_motion_ctrl_service=_),onChange:e[399]||(e[399]=_=>i.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[$e,r.configFile.enable_motion_ctrl_service]])])]),l("td",null,[l("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary",onClick:e[400]||(e[400]=_=>this.$store.state.messageBox.showMessage("Activates Motion ctrl service. The service will be automatically loaded at startup alowing you to use the motoin control endpoint to generate videos"))},nmt)])]),l("tr",null,[smt,l("td",null,[l("div",imt,[l("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[401]||(e[401]=(..._)=>r.reinstallMotionCtrlService&&r.reinstallMotionCtrlService(..._))},"install Motion Ctrl service")])])]),l("tr",null,[rmt,l("td",null,[l("div",omt,[U(l("input",{type:"text",id:"sd_base_url",required:"","onUpdate:modelValue":e[402]||(e[402]=_=>r.configFile.sd_base_url=_),onChange:e[403]||(e[403]=_=>i.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[pe,r.configFile.sd_base_url]])])])])])]),_:1}),Z(a,{title:"Elastic search Service (under construction)",is_subcard:!0,class:"pb-2 m-2"},{default:De(()=>[l("table",amt,[l("tr",null,[lmt,l("td",null,[l("div",cmt,[U(l("input",{type:"checkbox",id:"elastic_search_service",required:"","onUpdate:modelValue":e[404]||(e[404]=_=>r.configFile.elastic_search_service=_),onChange:e[405]||(e[405]=_=>i.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[$e,r.configFile.elastic_search_service]])])])]),l("tr",null,[dmt,l("td",null,[l("div",umt,[l("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[406]||(e[406]=(..._)=>r.reinstallElasticSearchService&&r.reinstallElasticSearchService(..._))},"install ElasticSearch service")])])]),l("tr",null,[pmt,l("td",null,[l("div",_mt,[U(l("input",{type:"text",id:"elastic_search_url",required:"","onUpdate:modelValue":e[407]||(e[407]=_=>r.configFile.elastic_search_url=_),onChange:e[408]||(e[408]=_=>i.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[pe,r.configFile.elastic_search_url]])])])])])]),_:1})]),_:1})],2)]),l("div",hmt,[l("div",fmt,[l("button",{onClick:e[409]||(e[409]=ue(_=>i.bzc_collapsed=!i.bzc_collapsed,["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 w-full text-left flex flex-row items-center"},[U(l("div",null,gmt,512),[[Ct,i.bzc_collapsed]]),U(l("div",null,Emt,512),[[Ct,!i.bzc_collapsed]]),ymt,r.configFile.binding_name?G("",!0):(T(),w("div",vmt,[Smt,Je(" No binding selected! ")])),r.configFile.binding_name?(T(),w("div",Tmt,"|")):G("",!0),r.configFile.binding_name?(T(),w("div",xmt,[l("div",Cmt,[l("img",{src:r.imgBinding,class:"w-8 h-8 rounded-full object-fill te
|
|||
|
`).map(u=>u.trim()===""?u:i?u.startsWith(" ")?u.substring(4):u:" "+u),a=e.value.substring(0,n),c=e.value.substring(s),d=a+o.join(`
|
|||
|
`)+c;this.message.content=d,this.$nextTick(()=>{e.selectionStart=n,e.selectionEnd=s+o.length*4})}t.preventDefault()},onVoicesChanged(){this.voices=this.speechSynthesis.getVoices()},read(){this.isSynthesizingVoice?(this.isSynthesizingVoice=!1,this.$refs.audio_player.pause()):(this.isSynthesizingVoice=!0,de.post("./text2wav",{text:this.message.content}).then(t=>{this.isSynthesizingVoice=!1;let e=t.data.url;console.log(e),this.audio_url=e,this.message.metadata||(this.message.metadata=[]);let n=!1;for(let s of this.message.metadata)Object.prototype.hasOwnProperty.call(s,"audio_url")&&(s.audio_url=this.audio_url,n=!0);n||this.message.metadata.push({audio_url:this.audio_url}),this.$emit("updateMessage",this.message.id,this.message.content,this.audio_url)}).catch(t=>{this.$store.state.toast.showToast(`Error: ${t}`,4,!1),this.isSynthesizingVoice=!1}))},async speak(){if(this.$store.state.config.active_tts_service!="browser"&&this.$store.state.config.active_tts_service!="None")this.isSpeaking?(this.isSpeaking=!0,de.post("./stop",{text:this.message.content}).then(t=>{this.isSpeaking=!1}).catch(t=>{this.$store.state.toast.showToast(`Error: ${t}`,4,!1),this.isSpeaking=!1})):(this.isSpeaking=!0,de.post("./text2Audio",{client_id:this.$store.state.client_id,text:this.message.content}).then(t=>{this.isSpeaking=!1}).catch(t=>{this.$store.state.toast.showToast(`Error: ${t}`,4,!1),this.isSpeaking=!1}));else{if(this.msg){this.speechSynthesis.cancel(),this.msg=null,this.isSpeaking=!1;return}let t=0;console.log("voice on"),this.isSpeaking=!0;const e=200;this.message.content,this.msg=new SpeechSynthesisUtterance,this.msg.pitch=this.$store.state.config.audio_pitch,this.voices.length>0&&(this.msg.voice=this.voices.filter(i=>i.name===this.$store.state.config.audio_out_voice)[0]);const n=i=>{let r=this.message.content.substring(i,i+e);const o=[".","!","?",`
|
|||
|
`];let a=-1;return o.forEach(c=>{const d=r.lastIndexOf(c);d>a&&(a=d)}),a==-1&&(a=r.length),console.log(a),a+i+1},s=()=>{if(this.message.status_message=="Done"||this.message.content.includes(".")||this.message.content.includes("?")||this.message.content.includes("!")){const i=n(t),r=this.message.content.substring(t,i);this.msg.text=r,t=i+1,this.msg.onend=o=>{t<this.message.content.length-2?setTimeout(()=>{s()},1):(this.isSpeaking=!1,console.log("voice off :",this.message.content.length," ",i))},this.speechSynthesis.speak(this.msg)}else setTimeout(()=>{s()},1)};console.log("Speaking chunk"),s()}},toggleModel(){this.expanded=!this.expanded},addBlock(t){let e=this.$refs.mdTextarea.selectionStart,n=this.$refs.mdTextarea.selectionEnd;e==n?speechSynthesis==0||this.message.content[e-1]==`
|
|||
|
`?(this.message.content=this.message.content.slice(0,e)+"```"+t+"\n\n```\n"+this.message.content.slice(e),e=e+4+t.length):(this.message.content=this.message.content.slice(0,e)+"\n```"+t+"\n\n```\n"+this.message.content.slice(e),e=e+3+t.length):speechSynthesis==0||this.message.content[e-1]==`
|
|||
|
`?(this.message.content=this.message.content.slice(0,e)+"```"+t+`
|
|||
|
`+this.message.content.slice(e,n)+"\n```\n"+this.message.content.slice(n),e=e+4+t.length):(this.message.content=this.message.content.slice(0,e)+"\n```"+t+`
|
|||
|
`+this.message.content.slice(e,n)+"\n```\n"+this.message.content.slice(n),p=p+3+t.length),this.$refs.mdTextarea.focus(),this.$refs.mdTextarea.selectionStart=this.$refs.mdTextarea.selectionEnd=p},copyContentToClipboard(){this.$emit("copy",this)},deleteMsg(){this.$emit("delete",this.message.id),this.deleteMsgMode=!1},rankUp(){this.$emit("rankUp",this.message.id)},rankDown(){this.$emit("rankDown",this.message.id)},updateMessage(){this.$emit("updateMessage",this.message.id,this.message.content,this.audio_url),this.editMsgMode=!1},resendMessage(t){this.$emit("resendMessage",this.message.id,this.message.content,t)},continueMessage(){this.$emit("continueMessage",this.message.id,this.message.content)},getImgUrl(){return this.avatar?wvt+this.avatar:(console.log("No avatar found"),fs)},defaultImg(t){t.target.src=fs},parseDate(t){let e=new Date(Date.parse(t)),s=Math.floor((new Date-e)/1e3);return s<=1?"just now":s<20?s+" seconds ago":s<40?"half a minute ago":s<60?"less than a minute ago":s<=90?"one minute ago":s<=3540?Math.round(s/60)+" minutes ago":s<=5400?"1 hour ago":s<=86400?Math.round(s/3600)+" hours ago":s<=129600?"1 day ago":s<604800?Math.round(s/86400)+" days ago":s<=777600?"1 week ago":t},prettyDate(t){let e=new Date((t||"").replace(/-/g,"/").replace(/[TZ]/g," ")),n=(new Date().getTime()-e.getTime())/1e3,s=Math.floor(n/86400);if(!(isNaN(s)||s<0||s>=31))return s==0&&(n<60&&"just now"||n<120&&"1 minute ago"||n<3600&&Math.floor(n/60)+" minutes ago"||n<7200&&"1 hour ago"||n<86400&&Math.floor(n/3600)+" hours ago")||s==1&&"Yesterday"||s<7&&s+" days ago"||s<31&&Math.ceil(s/7)+" weeks ago"},checkForFullSentence(){if(this.message.content.trim().split(" ").length>3){this.speak();return}}},watch:{audio_url(t){t&&(this.$refs.audio_player.src=t)},"message.content":function(t){this.$store.state.config.auto_speak&&(this.$store.state.config.xtts_enable&&this.$store.state.config.xtts_use_streaming_mode||this.isSpeaking||this.checkForFullSentence())},"message.ui":function(t){console.log("ui changed to",t),this.ui_componentKey++},showConfirmation(){Fe(()=>{ze.replace()})},deleteMsgMode(){Fe(()=>{ze.replace()})}},computed:{editMsgMode:{get(){return this.message.hasOwnProperty("open")?this.editMsgMode_||this.message.open:this.editMsgMode_},set(t){this.message.open=t,this.editMsgMode_=t,Fe(()=>{ze.replace()})}},isTalking:{get(){return this.isSpeaking}},created_at(){return this.prettyDate(this.message.created_at)},created_at_parsed(){return new Date(Date.parse(this.message.created_at)).toLocaleString()},finished_generating_at_parsed(){return new Date(Date.parse(this.message.finished_generating_at)).toLocaleString()},time_spent(){const t=new Date(Date.parse(this.message.started_generating_at)),e=new Date(Date.parse(this.message.finished_generating_at));if(e.getTime()===t.getTime()||!t.getTime()||!e.getTime())return;let[s,i,r]=this.computeTimeDiff(t,e);function o(c){return c<10&&(c="0"+c),c}return o(s)+"h:"+o(i)+"m:"+o(r)+"s"},warmup_duration(){const t=new Date(Date.parse(this.message.created_at)),e=new Date(Date.parse(this.message.started_generating_at));if(console.log("Computing the warmup duration, ",t," -> ",e),e.getTime()===t.getTime())return 0;if(!t.getTime()||!e.getTime())return;let s,i,r;[s,i,r]=this.computeTimeDiff(t,e);function o(c){return c<10&&(c="0"+c),c}return o(s)+"h:"+o(i)+"m:"+o(r)+"s"},generation_rate(){const t=new Date(Date.parse(this.message.started_generating_at)),e=new Date(Date.parse(this.message.finished_generating_at)),n=this.message.nb_tokens;if(e.getTime()===t.getTime()||!n||!t.getTime()||!e.getTime())return;let i=e.getTime()-t.getTime();const r=Math.floor(i/1e3),o=n/r;return Math.round(o)+" t/s"}}},Avt={class:"relative w-full group rounded-lg m-2 shadow-lg message hover:border-primary dark:hover:border-primary hover:border-solid hover:border-2 border-2 border-transparent flex flex-col flex-grow flex-wrap overflow-visible p-4 pb-2"},Nvt={class:"flex flex-row gap-2"},Ovt={class:"flex-shrink-0"},Ivt={class:"group/avatar"},Mvt=["src","data-popover-target"],kvt={class:"flex flex-col w-full flex-grow-0"},Dvt={class:"flex fle
|
|||
|
`,544)),[[pe,n.message.content]]):G("",!0)]),n.message.metadata!==null?(T(),w("div",oSt,[(T(!0),w(Be,null,je(((m=n.message.metadata)==null?void 0:m.filter(_=>_!=null&&_.hasOwnProperty("title")&&_.hasOwnProperty("content")))||[],(_,b)=>(T(),w("div",{key:"json-"+n.message.id+"-"+b,class:"json font-bold"},[(T(),mt(d,{jsonFormText:_.title,jsonData:_.content,key:"msgjson-"+n.message.id},null,8,["jsonFormText","jsonData"]))]))),128))])):G("",!0),(T(),mt(u,{ref:"ui",class:"w-full",ui:n.message.ui,key:"msgui-"+n.message.id},null,8,["ui"])),i.audio_url!=null?(T(),w("audio",{controls:"",key:i.audio_url},[l("source",{src:i.audio_url,type:"audio/wav",ref:"audio_player"},null,8,aSt),Je(" Your browser does not support the audio element. ")])):G("",!0)]),l("div",lSt,[l("div",cSt,[r.editMsgMode?(T(),w("div",dSt,[Z(h,{onClick:e[3]||(e[3]=ue(_=>r.editMsgMode=!1,["stop"])),title:"Cancel edit",icon:"x"}),Z(h,{onClick:ue(r.updateMessage,["stop"]),title:"Update message",icon:"check"},null,8,["onClick"]),Z(f,{title:"Add Block"},{default:De(()=>[Z(h,{onClick:e[4]||(e[4]=ue(_=>r.addBlock(""),["stop"])),title:"Generic Block",icon:"code"}),Z(h,{onClick:e[5]||(e[5]=ue(_=>r.addBlock("python"),["stop"])),title:"Python",icon:"python"}),Z(h,{onClick:e[6]||(e[6]=ue(_=>r.addBlock("javascript"),["stop"])),title:"JavaScript",icon:"js"}),Z(h,{onClick:e[7]||(e[7]=ue(_=>r.addBlock("json"),["stop"])),title:"JSON",icon:"braces"}),Z(h,{onClick:e[8]||(e[8]=ue(_=>r.addBlock("c++"),["stop"])),title:"C++",icon:"cplusplus"}),Z(h,{onClick:e[9]||(e[9]=ue(_=>r.addBlock("html"),["stop"])),title:"HTML",icon:"html5"}),Z(h,{onClick:e[10]||(e[10]=ue(_=>r.addBlock("latex"),["stop"])),title:"LaTeX",icon:"mathFunction"}),Z(h,{onClick:e[11]||(e[11]=ue(_=>r.addBlock("bash"),["stop"])),title:"Bash",icon:"terminal"}),Z(h,{onClick:e[12]||(e[12]=ue(_=>r.addBlock("mermaid"),["stop"])),title:"Mermaid",icon:"diagram"}),Z(h,{onClick:e[13]||(e[13]=ue(_=>r.addBlock("graphviz"),["stop"])),title:"Graphviz",icon:"graph"})]),_:1})])):(T(),w("div",uSt,[Z(h,{onClick:e[14]||(e[14]=ue(_=>r.editMsgMode=!0,["stop"])),title:"Edit message",icon:"edit"})])),Z(h,{onClick:r.copyContentToClipboard,title:"Copy message to clipboard",icon:"copy"},null,8,["onClick"]),!r.editMsgMode&&n.message.sender!==t.$store.state.mountedPers.name?(T(),w("div",pSt,[Z(h,{onClick:e[15]||(e[15]=ue(_=>r.resendMessage("full_context"),["stop"])),title:"Resend message with full context",icon:"send"}),Z(h,{onClick:e[16]||(e[16]=ue(_=>r.resendMessage("full_context_with_internet"),["stop"])),title:"Resend message with internet search",icon:"globe"}),Z(h,{onClick:e[17]||(e[17]=ue(_=>r.resendMessage("simple_question"),["stop"])),title:"Resend message without context",icon:"sendSimple"})])):G("",!0),!r.editMsgMode&&n.message.sender===t.$store.state.mountedPers.name?(T(),w("div",_St,[Z(h,{onClick:r.continueMessage,title:"Continue message",icon:"fastForward"},null,8,["onClick"])])):G("",!0),i.deleteMsgMode?(T(),w("div",hSt,[l("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90 p-2 cursor-pointer",title:"Cancel removal",type:"button",onClick:e[18]||(e[18]=ue(_=>i.deleteMsgMode=!1,["stop"]))},mSt),l("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Confirm removal",type:"button",onClick:e[19]||(e[19]=ue(_=>r.deleteMsg(),["stop"]))},bSt)])):G("",!0),!r.editMsgMode&&!i.deleteMsgMode?(T(),w("div",{key:5,class:"text-lg hover:text-red-600 duration-75 active:scale-90 p-2 cursor-pointer",title:"Remove message",onClick:e[20]||(e[20]=_=>i.deleteMsgMode=!0)},ySt)):G("",!0),l("div",{class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Upvote",onClick:e[21]||(e[21]=ue(_=>r.rankUp(),["stop"]))},SSt),l("div",TSt,[l("div",{class:"text-lg hover:text-red-600 duration-75 active:scale-90 p-2 cursor-pointer",title:"Downvote",onClick:e[22]||(e[22]=ue(_=>r.rankDown(),["stop"]))},CSt),n.message.rank!=0?(T(),w("div",{key:0,class:Ge(["rounded-full px-2 text-sm flex items-center justify-center font-bold cursor-pointer",n.message.ran
|
|||
|
`+s,4,!1)})}catch(s){this.$refs.toast.showToast(`Did not get Personality settings responses.
|
|||
|
Endpoint error: `+s.message,4,!1)}}):this.$refs.toast.showToast("Personality has no settings",4,!1))})}catch(e){this.$refs.toast.showToast("Could not open personality settings. Endpoint error: "+e.message,4,!1)}},toggleShowPersList(){this.onShowPersList()},async constructor(){for(Fe(()=>{ze.replace()});this.$store.state.ready===!1;)await new Promise(t=>setTimeout(t,100));this.onReady()},async api_get_req(t){try{const e=await de.get("/"+t);if(e)return e.data}catch(e){console.log(e.message,"api_get_req - mountedPersonalities");return}},personalityImgPlacehodler(t){t.target.src=zu}}},ZSt={class:"w-fit flex select-none"},JSt={class:"w-fit flex select-none"},e0t={class:"w-8 h-8 group relative"},t0t=["src","title"],n0t={class:"opacity-0 group-hover:opacity-100"},s0t=l("span",{title:"Remount"},[l("svg",{xmlns:"http://www.w3.org/2000/svg",class:"top-0 left-1 relative w-4 h-4 text-red-600 hover:text-red-500",viewBox:"0 0 30 30",width:"2",height:"2",fill:"none",stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round"},[l("g",{id:"surface1"},[l("path",{style:{},d:"M 16 4 C 10.886719 4 6.617188 7.160156 4.875 11.625 L 6.71875 12.375 C 8.175781 8.640625 11.710938 6 16 6 C 19.242188 6 22.132813 7.589844 23.9375 10 L 20 10 L 20 12 L 27 12 L 27 5 L 25 5 L 25 8.09375 C 22.808594 5.582031 19.570313 4 16 4 Z M 25.28125 19.625 C 23.824219 23.359375 20.289063 26 16 26 C 12.722656 26 9.84375 24.386719 8.03125 22 L 12 22 L 12 20 L 5 20 L 5 27 L 7 27 L 7 23.90625 C 9.1875 26.386719 12.394531 28 16 28 C 21.113281 28 25.382813 24.839844 27.125 20.375 Z "})])])],-1),i0t=[s0t],r0t=l("span",{title:"Talk"},[l("svg",{xmlns:"http://www.w3.org/2000/svg",class:"left-1 relative w-4 h-4 text-red-600 hover:text-red-500",viewBox:"0 0 24 24",width:"2",height:"2",fill:"none",stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round"},[l("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),l("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})])],-1),o0t=[r0t];function a0t(t,e,n,s,i,r){const o=rt("UniversalForm");return T(),w(Be,null,[l("div",ZSt,[l("div",JSt,[l("div",e0t,[l("img",{src:i.bUrl+r.mountedPers.avatar,onError:e[0]||(e[0]=(...a)=>r.personalityImgPlacehodler&&r.personalityImgPlacehodler(...a)),class:"w-8 h-8 rounded-full object-fill text-red-700 hover:scale-150 active:scale-90 hover:z-50 hover:-translate-y-2 duration-150 border-secondary cursor-pointer",title:"Active personality: "+r.mountedPers.name,onClick:e[1]||(e[1]=a=>r.onSettingsPersonality(r.mountedPers))},null,40,t0t),l("div",n0t,[t.personalityHoveredIndex===t.index?(T(),w("button",{key:0,class:"z-50 -top-1 group-hover:translate-x-5 border-gray-500 absolute active:scale-90 w-7 h-7 hover:scale-150 transition bg-bg-light dark:bg-bg-dark rounded-full border-2",onClick:e[2]||(e[2]=ue(a=>r.remount_personality(),["prevent"]))},i0t)):G("",!0),t.personalityHoveredIndex===t.index?(T(),w("button",{key:1,class:"-top-1 group-hover:-translate-x-12 border-gray-500 active:scale-90 absolute items-center w-7 h-7 hover:scale-150 transition text-red-200 absolute active:scale-90 bg-bg-light dark:bg-bg-dark rounded-full border-2",onClick:e[3]||(e[3]=ue(a=>r.handleOnTalk(),["prevent"]))},o0t)):G("",!0),l("div",{class:"top-0 group-hover:-translate-x-8 group-hover:-translate-y-8 left-0 border-gray-500 active:scale-90 absolute items-center w-7 h-7 hover:scale-150 transition text-red-500 absolute active:scale-90 bg-bg-light dark:bg-bg-dark rounded-full border-2",onClick:e[4]||(e[4]=ue((...a)=>r.toggleShowPersList&&r.toggleShowPersList(...a),["stop"])),title:"Click to show more"},"+"+W(r.mountedPersArr.length-1),1)])])])]),Z(o,{ref:"universalForm",class:"z-50"},null,512)],64)}const l0t=ot(XSt,[["render",a0t]]);const c0t="/";de.defaults.baseURL="/";const d0t={props:{onTalk:Function,onMounted:Function,onUnmounted:Function,onRemounted:Function,discussionPersonalities:Array,onShowPersList:Function},components:{PersonalityEntry:wN,Toast:Kl,UniversalForm:Zl},name:"MountedPersonalitiesList",data(){return{posts_headers:{accept:"application/json","Content-Type":"application/js
|
|||
|
`+e.message,4,!1),{status:!1}))},editPersonality(t){t=t.personality,de.post("/get_personality_config",{client_id:this.$store.state.client_id,category:t.category,name:t.folder}).then(e=>{const n=e.data;console.log("Done"),n.status?(this.$store.state.currentPersonConfig=n.config,this.$store.state.showPersonalityEditor=!0,this.$store.state.personality_editor.showPanel(),this.$store.state.selectedPersonality=t):console.error(n.error)}).catch(e=>{console.error(e)})},onPersonalityMounted(t){this.mountPersonality(t)},onPersonalityUnMounted(t){this.unmountPersonality(t)},onPersonalityRemount(t){this.reMountPersonality(t)},async handleOpenFolder(t){const e={client_id:this.$store.state.client_id,personality_folder:t.personality.category+"/"+t.personality.folder};console.log(e),await de.post("/open_personality_folder",e)},async handleOnTalk(t){if(ze.replace(),console.log("ppa",t),t){if(t.isMounted){const e=await this.select_personality(t);e&&e.status&&(await this.constructor(),this.$refs.toast.showToast(`Selected personality:
|
|||
|
`+t.name,4,!0))}else this.onPersonalityMounted(t);this.onTalk(t)}},async onPersonalitySelected(t){if(ze.replace(),console.log("Selected personality : ",JSON.stringify(t.personality)),t){if(t.selected){this.$refs.toast.showToast("Personality already selected",4,!0);return}if(t.isMounted){const e=await this.select_personality(t);e&&e.status&&(await this.constructor(),this.$refs.toast.showToast(`Selected personality:
|
|||
|
`+t.name,4,!0))}else this.onPersonalityMounted(t)}},onSettingsPersonality(t){try{de.get("/get_active_personality_settings").then(e=>{e&&(console.log("pers sett",e),e.data&&Object.keys(e.data).length>0?this.$refs.universalForm.showForm(e.data,"Personality settings - "+t.personality.name,"Save changes","Cancel").then(n=>{try{de.post("/set_active_personality_settings",n).then(s=>{s&&s.data?(console.log("personality set with new settings",s.data),this.$refs.toast.showToast("Personality settings updated successfully!",4,!0)):this.$refs.toast.showToast(`Did not get Personality settings responses.
|
|||
|
`+s,4,!1)})}catch(s){this.$refs.toast.showToast(`Did not get Personality settings responses.
|
|||
|
Endpoint error: `+s.message,4,!1)}}):this.$refs.toast.showToast("Personality has no settings",4,!1))})}catch(e){this.$refs.toast.showToast("Could not open personality settings. Endpoint error: "+e.message,4,!1)}},async mount_personality(t){if(!t)return{status:!1,error:"no personality - mount_personality"};try{const e={category:t.category,folder:t.folder,language:t.language},n=await de.post("/mount_personality",e);if(n)return n.data}catch(e){console.log(e.message,"mount_personality - settings");return}},async remount_personality(t){if(console.log("Remounting personality ",t),!t)return{status:!1,error:"no personality - mount_personality"};try{console.log("before");const e={client_id:this.$store.state.client_id,category:t.category,folder:t.folder,language:t.language};console.log("after");const n=await de.post("/remount_personality",e);if(console.log("Remounting personality executed:",n),n)return console.log("Remounting personality res"),n.data;console.log("failed remount_personality")}catch(e){console.log(e.message,"remount_personality - settings");return}},async unmount_personality(t){if(!t)return{status:!1,error:"no personality - unmount_personality"};const e={client_id:this.$store.state.client_id,language:t.language,category:t.category,folder:t.folder};try{const n=await de.post("/unmount_personality",e,{headers:this.posts_headers});if(n)return n.data}catch(n){console.log(n.message,"unmount_personality - settings");return}},async select_personality(t){if(!t||!t.personality)return{status:!1,error:"no personality - select_personality"};let e=-1;if(console.log("Personality full path : ",t.full_path),console.log("Personality language : ",t.personality.language),t.personality.language!=null&&t.personality.language!=null?(console.log("Mounting a localized version of personality"),console.log("Mounted personalities :",JSON.stringify(this.configFile.personalities)),console.log("Personality to select: ",t.full_path+":"+t.personality.language),e=this.configFile.personalities.findIndex(n=>n===t.full_path+":"+t.personality.language)):(console.log("Mounted personalities :",JSON.stringify(this.configFile.personalities)),e=this.configFile.personalities.findIndex(n=>n===t.full_path)),e>-1){console.log("Selecting personality with id:",JSON.stringify(e));const n={client_id:this.$store.state.client_id,id:e};try{const s=await de.post("/select_personality",n);if(s)return this.$store.dispatch("refreshConfig").then(()=>{console.log("recovered config",this.configFile.active_personality_id),this.$store.dispatch("refreshPersonalitiesZoo").then(()=>{this.$store.dispatch("refreshMountedPersonalities")})}),s.data}catch(s){console.log(s,"select_personality - settings");return}}else return console.log("Personality id is wrong"),this.$refs.toast.showToast("Personality id is wrong!",4,!1),{status:!1,error:"Personality id is wrong"}},async mountPersonality(t){if(console.log("mount pers",t),!t)return;if(this.configFile.personalities.includes(t.personality.full_path)){this.$refs.toast.showToast("Personality already mounted",4,!1);return}const e=await this.mount_personality(t.personality);console.log("mount_personality res",e),e.status?(this.configFile.personalities=e.personalities,this.$refs.toast.showToast("Personality mounted",4,!0),t.isMounted=!0,this.onMounted(this),(await this.select_personality(t.personality)).status&&this.$refs.toast.showToast(`Selected personality:
|
|||
|
`+t.personality.name,4,!0),this.getMountedPersonalities()):(t.isMounted=!1,this.$refs.toast.showToast(`Could not mount personality
|
|||
|
Error: `+e.error,4,!1))},async reMountPersonality(t){if(console.log("remount pers",t),!t)return;if(!this.configFile.personalities.includes(t.personality.full_path)){this.$refs.toast.showToast("Personality not mounted",4,!1);return}const e=await this.remount_personality(t.personality);console.log("remount_personality res",e),e.status?(this.configFile.personalities=e.personalities,this.$refs.toast.showToast("Personality remounted",4,!0),t.isMounted=!0,this.onMounted(this),(await this.select_personality(t.personality)).status&&this.$refs.toast.showToast(`Selected personality:
|
|||
|
`+t.personality.name,4,!0),this.getMountedPersonalities()):(t.isMounted=!1,this.$refs.toast.showToast(`Could not mount personality
|
|||
|
Error: `+e.error,4,!1))},async unmountPersonality(t){if(!t)return;console.log(`Unmounting ${JSON.stringify(t.personality)}`);const e=await this.unmount_personality(t.personality);if(e.status){console.log("unmount response",e),this.configFile.active_personality_id=e.active_personality_id,this.configFile.personalities=e.personalities;const n=this.configFile.personalities[this.configFile.active_personality_id],s=this.personalities.findIndex(a=>a.full_path==n),i=this.$refs.personalitiesZoo.findIndex(a=>a.full_path==t.full_path),r=this.personalities[s];r.isMounted=!1,r.selected=!0,this.$refs.personalitiesZoo[i].isMounted=!1,this.getMountedPersonalities(),(await this.select_personality(r)).status&&ze.replace(),this.$refs.toast.showToast("Personality unmounted",4,!0),this.onUnMounted(this)}else this.$refs.toast.showToast(`Could not unmount personality
|
|||
|
Error: `+e.error,4,!1)},getMountedPersonalities(){this.isLoading=!0;let t=[];console.log(this.configFile.personalities.length);for(let e=0;e<this.configFile.personalities.length;e++){const n=this.configFile.personalities[e],s=this.personalities.findIndex(r=>r.full_path==n),i=this.personalities[s];if(i)console.log("adding from config"),t.push(i);else{console.log("adding default");const r=this.personalities.findIndex(a=>a.full_path=="english/generic/lollms"),o=this.personalities[r];t.push(o)}}if(this.mountedPersArr=[],this.mountedPersArr=t,console.log("discussionPersonalities",this.discussionPersonalities),this.discussionPersonalities!=null&&this.discussionPersonalities.length>0)for(let e=0;e<this.discussionPersonalities.length;e++){const n=this.discussionPersonalities[e];console.log("discussionPersonalities - per",n);const s=this.mountedPersArr.findIndex(i=>i.full_path==n);if(console.log("discussionPersonalities -includes",s),console.log("discussionPersonalities -mounted list",this.mountedPersArr),s==-1){const i=this.personalities.findIndex(o=>o.full_path==n),r=this.personalities[i];console.log("adding discucc121",r,n),r&&(this.mountedPersArr.push(r),console.log("adding discucc",r))}}this.isLoading=!1,console.log("getMountedPersonalities",this.mountedPersArr),console.log("fig",this.configFile)}}},oE=t=>(Mi("data-v-f44002af"),t=t(),ki(),t),u0t={class:"text-left overflow-visible text-base font-semibold cursor-pointer select-none items-center flex flex-col flex-grow w-full overflow-x-auto scrollbar-thin scrollbar-track-bg-light scrollbar-thumb-bg-light-tone hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark dark:scrollbar-thumb-bg-dark-tone dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary"},p0t={key:0,role:"status",class:"flex justify-center overflow-y-hidden"},_0t=oE(()=>l("svg",{"aria-hidden":"true",class:"w-6 h-6 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[l("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),l("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})],-1)),h0t=oE(()=>l("span",{class:"sr-only"},"Loading...",-1)),f0t=[_0t,h0t],m0t=oE(()=>l("i",{"data-feather":"chevron-down"},null,-1)),g0t=[m0t],b0t={class:"block my-2 text-sm font-medium text-gray-900 dark:text-white"},E0t={class:"overflow-y-auto no-scrollbar pb-0 grid lg:grid-cols-3 md:grid-cols-2 gap-4 max-h-96"};function y0t(t,e,n,s,i,r){const o=rt("personality-entry"),a=rt("Toast"),c=rt("UniversalForm");return T(),w("div",u0t,[i.isLoading?(T(),w("div",p0t,f0t)):G("",!0),l("div",null,[r.mountedPersArr.length>0?(T(),w("div",{key:0,class:Ge(i.isLoading?"pointer-events-none opacity-30 cursor-default":"")},[l("button",{class:"mt-0 w-full text-2xl hover:text-secondary duration-75 flex justify-center hover:bg-bg-light-tone hover:dark:bg-bg-dark-tone rounded-lg",title:"Close personality list",type:"button",onClick:e[0]||(e[0]=ue((...d)=>r.toggleShowPersList&&r.toggleShowPersList(...d),["stop"]))},g0t),l("label",b0t," Mounted Personalities: ("+W(r.mountedPersArr.length)+") ",1),l("div",E0t,[Z(Xs,{name:"bounce"},{default:De(()=>[(T(!0),w(Be,null,je(this.$store.state.mountedPersArr,(d,u)
|
|||
|
`+s.error,4,!1),this.loading=!1,qe.off("file_received")}),qe.emit("send_file",n)},e.readAsDataURL(this.selectedFile)},async constructor(){Fe(()=>{ze.replace()})},toggleMenu(){this.showMenu=!this.showMenu},execute_cmd(t){this.showMenu=!this.showMenu,t.hasOwnProperty("is_file")?(console.log("Need to send a file."),this.selectFile(t.hasOwnProperty("file_types")?t.file_types:"*",()=>{this.selectedFile!=null&&this.uploadFile()})):this.sendCommand(t.value)},handleClickOutside(t){const e=this.$el.querySelector(".commands-menu-items-wrapper");e&&!e.contains(t.target)&&(this.showMenu=!1)}},beforeUnmount(){document.removeEventListener("click",this.handleClickOutside)}},T0t=t=>(Mi("data-v-1a32c141"),t=t(),ki(),t),x0t={key:0,title:"Loading..",class:"flex flex-row flex-grow justify-end"},C0t=T0t(()=>l("div",{role:"status"},[l("svg",{"aria-hidden":"true",class:"w-6 h-6 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[l("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),l("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]),l("span",{class:"sr-only"},"Loading...")],-1)),w0t=[C0t];function R0t(t,e,n,s,i,r){const o=rt("InteractiveMenu");return i.loading?(T(),w("div",x0t,w0t)):(T(),mt(o,{key:1,commands:n.commandsList,execute_cmd:r.execute_cmd},null,8,["commands","execute_cmd"]))}const A0t=ot(S0t,[["render",R0t],["__scopeId","data-v-1a32c141"]]),N0t="/assets/loader_v0-16906488.svg";console.log("modelImgPlaceholder:",As);const O0t="/",I0t={name:"ChatBox",emits:["messageSentEvent","sendCMDEvent","stopGenerating","loaded","createEmptyUserMessage","createEmptyAIMessage","personalitySelected","addWebLink"],props:{onTalk:Function,discussionList:Array,loading:{default:!1},onShowToastMessage:Function},components:{UniversalForm:Zl,MountedPersonalities:l0t,MountedPersonalitiesList:v0t,PersonalitiesCommands:A0t,ChatBarButton:mN},setup(){},data(){return{is_rt:!1,bindingHoveredIndex:null,modelHoveredIndex:null,personalityHoveredIndex:null,loader_v0:N0t,sendGlobe:ON,modelImgPlaceholder:As,bUrl:O0t,message:"",selecting_binding:!1,selecting_model:!1,selectedModel:"",isListeningToVoice:!1,filesList:[],isFileSentList:[],totalSize:0,showfilesList:!0,showPersonalities:!1,personalities_ready:!1,models_menu_icon:"",posts_headers:{accept:"application/json","Content-Type":"application/json"}}},computed:{isDataSourceNamesValid(){return console.log("dataSourceNames:",this.dataSourceNames),console.log("Type of dataSourceNames:",typeof this.dataSourceNames),Array.isArray(this.dataSourceNames)&&this.dataSourceNames.length>0},dataSourceNames(){console.log("dataSourceNames",this.$store.state.config.rag_databases);const t=this.$store.state.config.rag_databases.map(e=>{console.log("entry",e);const n=e.split("::");console.log("extracted",n[0]);const i=e.endsWith("mounted")?"feather:check":"";return console.log("icon decision",i),{name:n[0],value:n[0]||"default_value",icon:i,help:"mounts the database"}});return console.log("formatted data sources",t),t},currentBindingIcon(){return this.currentBinding.icon||this.modelImgPlaceholder},currentBinding(){return this.$store.state.currentBinding||{}},currentModel(){return this.$
|
|||
|
`+n,4,!1),this.isLoading=!1)})}catch(n){this.$store.state.toast.showToast(`Did not get binding settings responses.
|
|||
|
Endpoint error: `+n.message,4,!1),this.isLoading=!1}}):(this.$store.state.toast.showToast("Binding has no settings",4,!1),this.isLoading=!1))})}catch(t){this.isLoading=!1,this.$store.state.toast.showToast("Could not open binding settings. Endpoint error: "+t.message,4,!1)}},async remount_personality(t){if(console.log("Remounting personality ",t),!t)return{status:!1,error:"no personality - mount_personality"};try{console.log("before");const e={client_id:this.$store.state.client_id,category:t.category,folder:t.folder,language:t.language};console.log("after");const n=await de.post("/remount_personality",e);if(console.log("Remounting personality executed:",n),n)return console.log("Remounting personality res"),this.$store.state.toast.showToast("Personality remounted",4,!0),n.data;console.log("failed remount_personality")}catch(e){console.log(e.message,"remount_personality - settings");return}},async unmountPersonality(t){if(console.log("Unmounting personality:",t),!t)return;const e=await this.unmount_personality(t.personality||t);if(console.log(e),e.status){this.$store.state.config.personalities=e.personalities,this.$store.state.toast.showToast("Personality unmounted",4,!0),this.$store.dispatch("refreshMountedPersonalities");const n=this.$store.state.mountedPersArr[this.$store.state.mountedPersArr.length-1];console.log(n,this.$store.state.mountedPersArr.length),(await this.select_personality(t.personality)).status&&this.$store.state.toast.showToast(`Selected personality:
|
|||
|
`+n.name,4,!0)}else this.$store.state.toast.showToast(`Could not unmount personality
|
|||
|
Error: `+e.error,4,!1)},async unmount_personality(t){if(!t)return{status:!1,error:"no personality - unmount_personality"};const e={client_id:this.$store.state.client_id,language:t.language,category:t.category,folder:t.folder};try{const n=await de.post("/unmount_personality",e);if(n)return n.data}catch(n){console.log(n.message,"unmount_personality - settings");return}},async showBindingHoveredIn(t){this.bindingHoveredIndex=t},async showBindingHoveredOut(){this.bindingHoveredIndex=null},async showModelHoveredIn(t){this.modelHoveredIndex=t},async showModelHoveredOut(){this.modelHoveredIndex=null},async showPersonalityHoveredIn(t){this.personalityHoveredIndex=t},async showPersonalityHoveredOut(){this.personalityHoveredIndex=null},async onPersonalitySelected(t){if(t){if(t.selected){this.$store.state.toast.showToast("Personality already selected",4,!0);return}const e=t.language===null?t.full_path:t.full_path+":"+t.language;if(console.log("pers_path",e),console.log("this.$store.state.config.personalities",this.$store.state.config.personalities),this.$store.state.config.personalities.includes(e)){const n=await this.select_personality(t);await this.$store.dispatch("refreshConfig"),await this.$store.dispatch("refreshBindings"),await this.$store.dispatch("refreshModelsZoo"),await this.$store.dispatch("refreshModels"),await this.$store.dispatch("refreshMountedPersonalities"),await this.$store.dispatch("refreshConfig"),await this.$store.dispatch("fetchLanguages"),await this.$store.dispatch("fetchLanguage"),await this.$store.dispatch("fetchisRTOn"),console.log("pers is mounted",n),n&&n.status&&n.active_personality_id>-1?this.$store.state.toast.showToast(`Selected personality:
|
|||
|
`+t.name,4,!0):this.$store.state.toast.showToast(`Error on select personality:
|
|||
|
`+t.name,4,!1)}else console.log("mounting pers");this.$emit("personalitySelected"),Fe(()=>{ze.replace()})}},async select_personality(t){if(!t)return{status:!1,error:"no personality - select_personality"};const e=t.language===null?t.full_path:t.full_path+":"+t.language;console.log("Selecting personality ",e);const n=this.$store.state.config.personalities.findIndex(i=>i===e),s={client_id:this.$store.state.client_id,id:n};try{const i=await de.post("/select_personality",s);if(i)return this.$store.dispatch("refreshConfig").then(()=>{this.$store.dispatch("refreshPersonalitiesZoo").then(()=>{this.$store.dispatch("refreshMountedPersonalities")})}),i.data}catch(i){console.log(i.message,"select_personality - settings");return}},emitloaded(){this.$emit("loaded")},showModels(t){t.preventDefault();const e=this.$refs.modelsSelectionList;console.log(e);const n=new MouseEvent("click");e.dispatchEvent(n)},setBinding(t){console.log("Setting binding to "+t.name),this.selecting_binding=!0,this.selectedBinding=t,this.$store.state.messageBox.showBlockingMessage("Loading binding"),de.post("/update_setting",{client_id:this.$store.state.client_id,setting_name:"binding_name",setting_value:t.name}).then(async e=>{this.$store.state.messageBox.hideMessage(),console.log("UPDATED"),console.log(e),await this.$store.dispatch("refreshConfig"),await this.$store.dispatch("refreshBindings"),await this.$store.dispatch("refreshModelsZoo"),await this.$store.dispatch("refreshModels"),this.$store.state.toast.showToast(`Binding changed to ${this.currentBinding.name}`,4,!0),this.selecting_binding=!1}).catch(e=>{this.$store.state.messageBox.hideMessage(),this.$store.state.toast.showToast(`Error ${e}`,4,!0),this.selecting_binding=!1})},setModel(t){console.log("Setting model to "+t.name),this.selecting_model=!0,this.selectedModel=t,this.$store.state.messageBox.showBlockingMessage("Loading model"),de.post("/update_setting",{client_id:this.$store.state.client_id,setting_name:"model_name",setting_value:t.name}).then(async e=>{this.$store.state.messageBox.hideMessage(),console.log("UPDATED"),console.log(e),await this.$store.dispatch("refreshConfig"),await this.$store.dispatch("refreshModels"),this.$store.state.toast.showToast(`Model changed to ${this.currentModel.name}`,4,!0),this.selecting_model=!1}).catch(e=>{this.$store.state.messageBox.hideMessage(),this.$store.state.toast.showToast(`Error ${e}`,4,!0),this.selecting_model=!1})},download_files(){de.get("/download_files")},remove_file(t){de.get("/remove_discussion_file",{client_id:this.$store.state.client_id,name:t}).then(e=>{console.log(e)})},clear_files(){de.post("/clear_discussion_files_list",{client_id:this.$store.state.client_id}).then(t=>{console.log(t),t.data.state?(this.$store.state.toast.showToast("File removed successfully",4,!0),this.filesList.length=0,this.isFileSentList.length=0,this.totalSize=0):this.$store.state.toast.showToast("Files couldn't be removed",4,!1)})},send_file(t,e){console.log("Send file triggered");const n=new FileReader,s=24*1024;let i=0,r=0;n.onloadend=()=>{if(n.error){console.error("Error reading file:",n.error);return}const a=n.result,c=i+a.byteLength>=t.size;qe.emit("send_file_chunk",{filename:t.name,chunk:a,offset:i,isLastChunk:c,chunkIndex:r}),i+=a.byteLength,r++,c?(console.log("File sent successfully"),this.isFileSentList[this.filesList.length-1]=!0,console.log(this.isFileSentList),this.$store.state.toast.showToast("File uploaded successfully",4,!0),e()):o()};function o(){const a=t.slice(i,i+s);n.readAsArrayBuffer(a)}console.log("Uploading file"),o()},makeAnEmptyUserMessage(){this.$emit("createEmptyUserMessage",this.message),this.message=""},makeAnEmptyAIMessage(){this.$emit("createEmptyAIMessage")},startRTCom(){this.is_rt=!0,console.log("is_rt:",this.is_rt),qe.emit("start_bidirectional_audio_stream"),Fe(()=>{ze.replace()})},stopRTCom(){this.is_rt=!1,console.log("is_rt:",this.is_rt),qe.emit("stop_bidirectional_audio_stream"),Fe(()=>{ze.replace()})},startSpeechRecognition(){"SpeechRecognition"in window||"webkitSpeechRecognition"in window?(this.recognition=new(window.SpeechRecogniti
|
|||
|
<!DOCTYPE html>
|
|||
|
<html lang="en">
|
|||
|
<head>
|
|||
|
<meta charset="UTF-8">
|
|||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|||
|
<title>Default Render Panel</title>
|
|||
|
<style>
|
|||
|
body, html {
|
|||
|
margin: 0;
|
|||
|
padding: 0;
|
|||
|
height: 100%;
|
|||
|
font-family: Arial, sans-serif;
|
|||
|
background-color: #f0f0f0;
|
|||
|
}
|
|||
|
.container {
|
|||
|
display: flex;
|
|||
|
flex-direction: column;
|
|||
|
align-items: center;
|
|||
|
justify-content: center;
|
|||
|
height: 100%;
|
|||
|
padding: 20px;
|
|||
|
box-sizing: border-box;
|
|||
|
}
|
|||
|
.message {
|
|||
|
text-align: center;
|
|||
|
padding: 30px;
|
|||
|
background-color: white;
|
|||
|
border-radius: 12px;
|
|||
|
box-shadow: 0 4px 20px rgba(0,0,0,0.1);
|
|||
|
max-width: 600px;
|
|||
|
width: 100%;
|
|||
|
}
|
|||
|
h1 {
|
|||
|
color: #2c3e50;
|
|||
|
margin-bottom: 20px;
|
|||
|
font-size: 28px;
|
|||
|
}
|
|||
|
p {
|
|||
|
color: #34495e;
|
|||
|
margin: 0 0 15px;
|
|||
|
line-height: 1.6;
|
|||
|
}
|
|||
|
.highlight {
|
|||
|
color: #e74c3c;
|
|||
|
font-weight: bold;
|
|||
|
}
|
|||
|
</style>
|
|||
|
</head>
|
|||
|
<body>
|
|||
|
<div class="container">
|
|||
|
<div class="message">
|
|||
|
<h1>Welcome to the Interactive Render Panel</h1>
|
|||
|
<p>This space is designed to bring your ideas to life! Currently, it's empty because no HTML has been generated yet.</p>
|
|||
|
<p>To see something amazing here, try asking the AI to <span class="highlight">create a specific web component or application</span>. For example:</p>
|
|||
|
<p>"Create a responsive image gallery" or "Build a simple todo list app"</p>
|
|||
|
<p>Once you request a web component, the AI will generate the necessary HTML, CSS, and JavaScript, and it will be rendered right here in this panel!</p>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</body>
|
|||
|
</html>
|
|||
|
`,memory_icon:I1t,active_skills:M1t,inactive_skills:k1t,skillsRegistry:D1t,robot:L1t,posts_headers:{accept:"application/json","Content-Type":"application/json"},host:"",progress_visibility_val:!0,progress_value:0,msgTypes:{MSG_TYPE_CONTENT:1,MSG_TYPE_CONTENT_INVISIBLE_TO_AI:2,MSG_TYPE_CONTENT_INVISIBLE_TO_USER:3},operationTypes:{MSG_OPERATION_TYPE_ADD_CHUNK:0,MSG_OPERATION_TYPE_SET_CONTENT:1,MSG_OPERATION_TYPE_SET_CONTENT_INVISIBLE_TO_AI:2,MSG_OPERATION_TYPE_SET_CONTENT_INVISIBLE_TO_USER:3,MSG_OPERATION_TYPE_EXCEPTION:4,MSG_OPERATION_TYPE_WARNING:5,MSG_OPERATION_TYPE_INFO:6,MSG_OPERATION_TYPE_STEP:7,MSG_OPERATION_TYPE_STEP_START:8,MSG_OPERATION_TYPE_STEP_PROGRESS:9,MSG_OPERATION_TYPE_STEP_END_SUCCESS:10,MSG_OPERATION_TYPE_STEP_END_FAILURE:11,MSG_OPERATION_TYPE_JSON_INFOS:12,MSG_OPERATION_TYPE_REF:13,MSG_OPERATION_TYPE_CODE:14,MSG_OPERATION_TYPE_UI:15,MSG_OPERATION_TYPE_NEW_MESSAGE:16,MSG_OPERATION_TYPE_FINISHED_MESSAGE:17},senderTypes:{SENDER_TYPES_USER:0,SENDER_TYPES_AI:1,SENDER_TYPES_SYSTEM:2},list:[],tempList:[],currentDiscussion:{},discussionArr:[],loading:!1,filterTitle:"",filterInProgress:!1,isCreated:!1,isCheckbox:!1,isSelectAll:!1,showSaveConfirmation:!1,showBrainConfirmation:!1,showConfirmation:!1,chime:new Audio("chime_aud.wav"),showToast:!1,isSearch:!1,isDiscussionBottom:!1,personalityAvatars:[],fileList:[],database_selectorDialogVisible:!1,isDragOverDiscussion:!1,isDragOverChat:!1,leftPanelCollapsed:!1,rightPanelCollapsed:!0,isOpen:!1,discussion_id:0}},methods:{getRandomEdgePosition(){switch(Math.floor(Math.random()*4)){case 0:return 0;case 1:return 100;case 2:return Math.random()*100;case 3:return Math.random()*100}},selectPrompt(t){this.$refs.chatBox.message=t},extractHtml(){if(this.discussionArr.length>0){const t=this.discussionArr[this.discussionArr.length-1].content,e="```html",n="```";let s=t.indexOf(e);if(s===-1)return this.lastMessageHtml=this.defaultMessageHtml,this.renderIsolatedContent(),this.defaultMessageHtml;s+=e.length;let i=t.indexOf(n,s);i===-1?this.lastMessageHtml=t.slice(s).trim():this.lastMessageHtml=t.slice(s,i).trim()}else this.lastMessageHtml=this.defaultMessageHtml;this.renderIsolatedContent()},renderIsolatedContent(){const t=document.createElement("iframe");if(t.style.border="none",t.style.width="100%",t.style.height="100%",this.$refs.isolatedContent){this.$refs.isolatedContent.innerHTML="",this.$refs.isolatedContent.appendChild(t);const e=t.contentDocument||t.contentWindow.document;e.open(),e.write(`
|
|||
|
${this.lastMessageHtml}
|
|||
|
`),e.close()}},async triggerRobotAction(){this.rightPanelCollapsed=!this.rightPanelCollapsed,this.rightPanelCollapsed||(this.leftPanelCollapsed=!0,this.$nextTick(()=>{this.extractHtml()})),console.log(this.rightPanelCollapsed)},add_webpage(){console.log("addWebLink received"),this.$refs.web_url_input_box.showPanel()},addWebpage(){de.post("/add_webpage",{client_id:this.client_id,url:this.$refs.web_url_input_box.inputText},{headers:this.posts_headers}).then(t=>{t&&t.status&&(console.log("Done"),this.recoverFiles())})},show_progress(t){this.progress_visibility_val=!0},hide_progress(t){this.progress_visibility_val=!1},update_progress(t){console.log("Progress update"),this.progress_value=t.value},onSettingsBinding(){try{this.isLoading=!0,de.get("/get_active_binding_settings").then(t=>{if(this.isLoading=!1,t)if(t.data&&Object.keys(t.data).length>0){const e=this.$store.state.bindingsZoo.find(n=>n.name==this.state.config.binding_name);this.$store.state.universalForm.showForm(t.data,"Binding settings - "+e.binding.name,"Save changes","Cancel").then(n=>{try{de.post("/set_active_binding_settings",{client_id:this.$store.state.client_id,settings:n}).then(s=>{s&&s.data?(console.log("binding set with new settings",s.data),this.$store.state.toast.showToast("Binding settings updated successfully!",4,!0)):(this.$store.state.toast.showToast(`Did not get binding settings responses.
|
|||
|
`+s,4,!1),this.isLoading=!1)})}catch(s){this.$store.state.toast.showToast(`Did not get binding settings responses.
|
|||
|
Endpoint error: `+s.message,4,!1),this.isLoading=!1}})}else this.$store.state.toast.showToast("Binding has no settings",4,!1),this.isLoading=!1})}catch(t){this.isLoading=!1,this.$store.state.toast.showToast("Could not open binding settings. Endpoint error: "+t.message,4,!1)}},showDatabaseSelector(){this.database_selectorDialogVisible=!0},async ondatabase_selectorDialogSelected(t){console.log("Selected:",t)},onclosedatabase_selectorDialog(){this.database_selectorDialogVisible=!1},async onvalidatedatabase_selectorChoice(t){if(this.database_selectorDialogVisible=!1,(await de.post("/select_database",{client_id:this.client_id,name:t},{headers:this.posts_headers})).status){console.log("Selected database"),this.$store.state.config=await de.post("/get_config",{client_id:this.client_id}),console.log("new config loaded :",this.$store.state.config);let n=await de.get("/list_databases").data;console.log("New list of database: ",n),this.$store.state.databases=n,console.log("New list of database: ",this.$store.state.databases),location.reload()}},async addDiscussion2SkillsLibrary(){(await de.post("/add_discussion_to_skills_library",{client_id:this.client_id},{headers:this.posts_headers})).status&&console.log("done")},async toggleSkillsLib(){this.$store.state.config.activate_skills_lib=!this.$store.state.config.activate_skills_lib,await this.applyConfiguration()},async showSkillsLib(){this.$refs.skills_lib.showSkillsLibrary()},async applyConfiguration(){this.loading=!0;const t=await de.post("/apply_settings",{client_id:this.$store.state.client_id,config:this.$store.state.config});this.loading=!1,t.data.status?this.$store.state.toast.showToast("Configuration changed successfully.",4,!0):this.$store.state.toast.showToast("Configuration change failed.",4,!1),Fe(()=>{ze.replace()})},save_configuration(){this.showConfirmation=!1,de.post("/save_settings",{}).then(t=>{if(t)return t.status?this.$store.state.toast.showToast("Settings saved!",4,!0):this.$store.state.messageBox.showMessage("Error: Couldn't save settings!"),t.data}).catch(t=>(console.log(t.message,"save_configuration"),this.$store.state.messageBox.showMessage("Couldn't save settings!"),{status:!1}))},showToastMessage(t,e,n){console.log("sending",t),this.$store.state.toast.showToast(t,e,n)},togglePanel(){this.leftPanelCollapsed=!this.leftPanelCollapsed,this.leftPanelCollapsed||(this.rightPanelCollapsed=!0)},toggleDropdown(){this.isOpen=!this.isOpen},importChatGPT(){},async api_get_req(t){try{const e=await de.get("/"+t);if(e)return e.data}catch(e){console.log(e.message,"api_get_req");return}},async list_discussions(){try{const t=await de.get("/list_discussions");if(t)return this.createDiscussionList(t.data),t.data}catch(t){return console.log("Error: Could not list discussions",t.message),[]}},load_discussion(t,e){t&&(console.log("Loading discussion",t),this.loading=!0,this.discussionArr=[],this.setDiscussionLoading(t,this.loading),qe.on("discussion",n=>{console.log("Discussion recovered"),this.loading=!1,this.setDiscussionLoading(t,this.loading),n&&(this.discussionArr=n.filter(s=>s.message_type==this.msgTypes.MSG_TYPE_CONTENT||s.message_type==this.msgTypes.MSG_TYPE_CONTENT_INVISIBLE_TO_AI),this.discussionArr.forEach(s=>{s.status_message="Done"}),console.log("this.discussionArr"),console.log(this.discussionArr),e&&e()),qe.off("discussion"),this.extractHtml()}),qe.emit("load_discussion",{id:t}))},recoverFiles(){console.log("Recovering files"),de.post("/get_discussion_files_list",{client_id:this.$store.state.client_id}).then(t=>{this.$refs.chatBox.filesList=t.data.files,this.$refs.chatBox.isFileSentList=t.data.files.map(e=>!0),console.log(`Files recovered: ${this.$refs.chatBox.filesList}`)})},new_discussion(t){try{this.loading=!0,qe.on("discussion_created",e=>{qe.off("discussion_created"),this.list_discussions().then(()=>{const n=this.list.findIndex(i=>i.id==e.id),s=this.list[n];this.selectDiscussion(s),this.load_discussion(e.id,()=>{this.loading=!1,this.recoverFiles(),Fe(()=>{const i=document.getElementById("dis-"+e.id);this.scrollToElement(i),console.log("Scrolling tp "+i)})})})}),
|
|||
|
Personality: ${t.message.personality}`);let i="";t.created_at_parsed&&(i=`
|
|||
|
Created: ${t.created_at_parsed}`);let r="";t.message.model&&(r=`Model: ${t.message.model}`);let o="";t.message.seed&&(o=`Seed: ${t.message.seed}`);let a="";t.time_spent&&(a=`
|
|||
|
Time spent: ${t.time_spent}`);let c="";c=`${n} ${r} ${o} ${a}`.trim();const d=`${t.message.sender}${s}${i}
|
|||
|
|
|||
|
${e}
|
|||
|
|
|||
|
${c}`;navigator.clipboard.writeText(d)}else navigator.clipboard.writeText(e);this.$store.state.toast.showToast("Copied to clipboard successfully",4,!0),Fe(()=>{ze.replace()})},closeToast(){this.showToast=!1},saveJSONtoFile(t,e){e=e||"data.json";const n=document.createElement("a");n.href=URL.createObjectURL(new Blob([JSON.stringify(t,null,2)],{type:"text/plain"})),n.setAttribute("download",e),document.body.appendChild(n),n.click(),document.body.removeChild(n)},saveMarkdowntoFile(t,e){e=e||"data.md";const n=document.createElement("a");n.href=URL.createObjectURL(new Blob([t],{type:"text/plain"})),n.setAttribute("download",e),document.body.appendChild(n),n.click(),document.body.removeChild(n)},parseJsonObj(t){try{return JSON.parse(t)}catch(e){return this.$store.state.toast.showToast(`Could not parse JSON.
|
|||
|
`+e.message,4,!1),null}},async parseJsonFile(t){return new Promise((e,n)=>{const s=new FileReader;s.onload=i=>e(this.parseJsonObj(i.target.result)),s.onerror=i=>n(i),s.readAsText(t)})},async exportDiscussionsAsMarkdown(){const t=this.list.filter(e=>e.checkBoxValue==!0).map(e=>e.id);if(t.length>0){console.log("export",t);let e=new Date;const n=e.getFullYear(),s=(e.getMonth()+1).toString().padStart(2,"0"),i=e.getDate().toString().padStart(2,"0"),r=e.getHours().toString().padStart(2,"0"),o=e.getMinutes().toString().padStart(2,"0"),a=e.getSeconds().toString().padStart(2,"0"),d="discussions_export_"+(n+"."+s+"."+i+"."+r+o+a)+".md";this.loading=!0;const u=await this.export_multiple_discussions(t,"markdown");u?(this.saveMarkdowntoFile(u,d),this.$store.state.toast.showToast("Successfully exported",4,!0),this.isCheckbox=!1):this.$store.state.toast.showToast("Failed to export discussions",4,!1),this.loading=!1}},async exportDiscussions(){},async exportDiscussionsAsJson(){const t=this.list.filter(e=>e.checkBoxValue==!0).map(e=>e.id);if(t.length>0){console.log("export",t);let e=new Date;const n=e.getFullYear(),s=(e.getMonth()+1).toString().padStart(2,"0"),i=e.getDate().toString().padStart(2,"0"),r=e.getHours().toString().padStart(2,"0"),o=e.getMinutes().toString().padStart(2,"0"),a=e.getSeconds().toString().padStart(2,"0"),d="discussions_export_"+(n+"."+s+"."+i+"."+r+o+a)+".json";this.loading=!0;const u=await this.export_multiple_discussions(t,"json");u?(this.saveJSONtoFile(u,d),this.$store.state.toast.showToast("Successfully exported",4,!0),this.isCheckbox=!1):this.$store.state.toast.showToast("Failed to export discussions",4,!1),this.loading=!1}},async importDiscussionsBundle(t){},async importDiscussions(t){const e=await this.parseJsonFile(t.target.files[0]);await this.import_multiple_discussions(e)?(this.$store.state.toast.showToast("Successfully imported ("+e.length+")",4,!0),await this.list_discussions()):this.$store.state.toast.showToast("Failed to import discussions",4,!1)},async getPersonalityAvatars(){for(;this.$store.state.personalities===null;)await new Promise(e=>setTimeout(e,100));let t=this.$store.state.personalities;this.personalityAvatars=t.map(e=>({name:e.name,avatar:e.avatar}))},getAvatar(t){if(t.toLowerCase().trim()==this.$store.state.config.user_name.toLowerCase().trim())return"user_infos/"+this.$store.state.config.user_avatar;const e=this.personalityAvatars.findIndex(s=>s.name===t),n=this.personalityAvatars[e];if(n)return console.log("Avatar",n.avatar),n.avatar},setFileListChat(t){try{this.$refs.chatBox.fileList=this.$refs.chatBox.fileList.concat(t)}catch(e){this.$store.state.toast.showToast(`Failed to set filelist in chatbox
|
|||
|
`+e.message,4,!1)}this.isDragOverChat=!1},async setFileListDiscussion(t){if(t.length>1){this.$store.state.toast.showToast("Failed to import discussions. Too many files",4,!1);return}const e=await this.parseJsonFile(t[0]);await this.import_multiple_discussions(e)?(this.$store.state.toast.showToast("Successfully imported ("+e.length+")",4,!0),await this.list_discussions()):this.$store.state.toast.showToast("Failed to import discussions",4,!1),this.isDragOverDiscussion=!1}},async created(){console.log("Created discussions view");const e=(await de.get("/get_versionID")).data.versionId;qe.onopen=()=>{console.log("WebSocket connection established."),this.currentDiscussion!=null&&(this.setPageTitle(item),localStorage.setItem("selected_discussion",this.currentDiscussion.id),this.load_discussion(item.id,()=>{this.discussionArr.length>1&&(this.currentDiscussion.title===""||this.currentDiscussion.title===null)&&this.changeTitleUsingUserMSG(this.currentDiscussion.id,this.discussionArr[1].content)}))},this.versionId!==e&&(this.$store.commit("updateVersionId",e),window.location.reload(!0)),this.$nextTick(()=>{ze.replace()}),console.log("Connected to socket io");try{this.$store.state.loading_infos="Getting version",this.$store.state.loading_progress=30,await this.$store.dispatch("getVersion")}catch(n){console.log("Error cought:",n)}try{for(this.$store.state.loading_infos="Loading Configuration";qe.id===void 0;)await new Promise(n=>setTimeout(n,100));this.$store.state.client_id=qe.id,console.log(this.$store.state.client_id),await this.$store.dispatch("refreshConfig"),console.log("Config ready")}catch(n){console.log("Error cought:",n)}try{this.$store.state.loading_infos="Loading Database",this.$store.state.loading_progress=20,await this.$store.dispatch("refreshDatabase")}catch(n){console.log("Error cought:",n)}try{this.$store.state.loading_infos="Getting Bindings list",this.$store.state.loading_progress=40,await this.$store.dispatch("refreshBindings")}catch(n){console.log("Error cought:",n)}try{this.$store.state.loading_infos="Getting personalities zoo",this.$store.state.loading_progress=70,await this.$store.dispatch("refreshPersonalitiesZoo")}catch(n){console.log("Error cought:",n)}try{this.$store.state.loading_infos="Getting mounted personalities",this.$store.state.loading_progress=80,await this.$store.dispatch("refreshMountedPersonalities")}catch(n){console.log("Error cought:",n)}try{this.$store.state.loading_infos="Getting models zoo",this.$store.state.loading_progress=90,await this.$store.dispatch("refreshModelsZoo")}catch(n){console.log("Error cought:",n)}try{this.$store.state.loading_infos="Getting active models",this.$store.state.loading_progress=100,await this.$store.dispatch("refreshModels"),await this.$store.dispatch("refreshModelStatus")}catch(n){console.log("Error cought:",n)}try{await this.$store.dispatch("fetchLanguages"),await this.$store.dispatch("fetchLanguage")}catch(n){console.log("Error cought:",n)}try{await this.$store.dispatch("fetchisRTOn")}catch(n){console.log("Error cought:",n)}this.$store.state.isConnected=!0,this.$store.state.client_id=qe.id,console.log("Ready"),this.setPageTitle(),await this.list_discussions(),this.loadLastUsedDiscussion(),this.isCreated=!0,this.$store.state.ready=!0,qe.on("connected",this.socketIOConnected),qe.on("disconnected",this.socketIODisconnected),console.log("Added events"),qe.on("show_progress",this.show_progress),qe.on("hide_progress",this.hide_progress),qe.on("update_progress",this.update_progress),qe.on("notification",this.notify),qe.on("new_message",this.new_message),qe.on("update_message",this.update_message),qe.on("close_message",this.finalMsgEvent),qe.on("disucssion_renamed",n=>{console.log("Received new title",n.discussion_id,n.title);const s=this.list.findIndex(r=>r.id==n.discussion_id),i=this.list[s];i.title=n.title}),qe.onclose=n=>{console.log("WebSocket connection closed:",n.code,n.reason),this.socketIODisconnected()},qe.on("connect_error",n=>{n.message==="ERR_CONNECTION_REFUSED"?console.error("Connection refused. The server is not available."):console.error("Connection
|
|||
|
* @license
|
|||
|
* Copyright 2010-2023 Three.js Authors
|
|||
|
* SPDX-License-Identifier: MIT
|
|||
|
*/const wE="159",Fwt=0,a1=1,Bwt=2,tO=1,Gwt=2,yi=3,Ii=0,$n=1,$s=2,cr=0,$o=1,l1=2,c1=3,d1=4,Vwt=5,Pr=100,zwt=101,Hwt=102,u1=103,p1=104,qwt=200,$wt=201,Ywt=202,Wwt=203,Pg=204,Ug=205,Kwt=206,jwt=207,Qwt=208,Xwt=209,Zwt=210,Jwt=211,eRt=212,tRt=213,nRt=214,sRt=0,iRt=1,rRt=2,jd=3,oRt=4,aRt=5,lRt=6,cRt=7,RE=0,dRt=1,uRt=2,dr=0,pRt=1,_Rt=2,hRt=3,fRt=4,mRt=5,_1="attached",gRt="detached",nO=300,aa=301,la=302,Fg=303,Bg=304,$u=306,ca=1e3,ls=1001,Qd=1002,gn=1003,Gg=1004,vd=1005,zn=1006,sO=1007,Jr=1008,ur=1009,bRt=1010,ERt=1011,AE=1012,iO=1013,rr=1014,Ti=1015,Bl=1016,rO=1017,oO=1018,$r=1020,yRt=1021,cs=1023,vRt=1024,SRt=1025,Yr=1026,da=1027,TRt=1028,aO=1029,xRt=1030,lO=1031,cO=1033,mm=33776,gm=33777,bm=33778,Em=33779,h1=35840,f1=35841,m1=35842,g1=35843,dO=36196,b1=37492,E1=37496,y1=37808,v1=37809,S1=37810,T1=37811,x1=37812,C1=37813,w1=37814,R1=37815,A1=37816,N1=37817,O1=37818,I1=37819,M1=37820,k1=37821,ym=36492,D1=36494,L1=36495,CRt=36283,P1=36284,U1=36285,F1=36286,Gl=2300,ua=2301,vm=2302,B1=2400,G1=2401,V1=2402,wRt=2500,RRt=0,uO=1,Vg=2,pO=3e3,Wr=3001,ARt=3200,NRt=3201,NE=0,ORt=1,ds="",en="srgb",wn="srgb-linear",OE="display-p3",Yu="display-p3-linear",Xd="linear",Kt="srgb",Zd="rec709",Jd="p3",ho=7680,z1=519,IRt=512,MRt=513,kRt=514,_O=515,DRt=516,LRt=517,PRt=518,URt=519,zg=35044,H1="300 es",Hg=1035,xi=2e3,eu=2001;class ka{addEventListener(e,n){this._listeners===void 0&&(this._listeners={});const s=this._listeners;s[e]===void 0&&(s[e]=[]),s[e].indexOf(n)===-1&&s[e].push(n)}hasEventListener(e,n){if(this._listeners===void 0)return!1;const s=this._listeners;return s[e]!==void 0&&s[e].indexOf(n)!==-1}removeEventListener(e,n){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const r=i.indexOf(n);r!==-1&&i.splice(r,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const s=this._listeners[e.type];if(s!==void 0){e.target=this;const i=s.slice(0);for(let r=0,o=i.length;r<o;r++)i[r].call(this,e);e.target=null}}}const Rn=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let q1=1234567;const bl=Math.PI/180,pa=180/Math.PI;function Ds(){const t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0,s=Math.random()*4294967295|0;return(Rn[t&255]+Rn[t>>8&255]+Rn[t>>16&255]+Rn[t>>24&255]+"-"+Rn[e&255]+Rn[e>>8&255]+"-"+Rn[e>>16&15|64]+Rn[e>>24&255]+"-"+Rn[n&63|128]+Rn[n>>8&255]+"-"+Rn[n>>16&255]+Rn[n>>24&255]+Rn[s&255]+Rn[s>>8&255]+Rn[s>>16&255]+Rn[s>>24&255]).toLowerCase()}function Nn(t,e,n){return Math.max(e,Math.min(n,t))}function IE(t,e){return(t%e+e)%e}function FRt(t,e,n,s,i){return s+(t-e)*(i-s)/(n-e)}function BRt(t,e,n){return t!==e?(n-t)/(e-t):0}function El(t,e,n){return(1-n)*t+n*e}function GRt(t,e,n,s){return El(t,e,1-Math.exp(-n*s))}function VRt(t,e=1){return e-Math.abs(IE(t,e*2)-e)}function zRt(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*(3-2*t))}function HRt(t,e,n){return
|
|||
|
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|||
|
}`,EAt=`void main() {
|
|||
|
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
|
|||
|
}`;class to extends Ls{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=bAt,this.fragmentShader=EAt,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=_a(e.uniforms),this.uniformsGroups=mAt(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const n=super.toJSON(e);n.glslVersion=this.glslVersion,n.uniforms={};for(const i in this.uniforms){const o=this.uniforms[i].value;o&&o.isTexture?n.uniforms[i]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?n.uniforms[i]={type:"c",value:o.getHex()}:o&&o.isVector2?n.uniforms[i]={type:"v2",value:o.toArray()}:o&&o.isVector3?n.uniforms[i]={type:"v3",value:o.toArray()}:o&&o.isVector4?n.uniforms[i]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?n.uniforms[i]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?n.uniforms[i]={type:"m4",value:o.toArray()}:n.uniforms[i]={value:o}}Object.keys(this.defines).length>0&&(n.defines=this.defines),n.vertexShader=this.vertexShader,n.fragmentShader=this.fragmentShader,n.lights=this.lights,n.clipping=this.clipping;const s={};for(const i in this.extensions)this.extensions[i]===!0&&(s[i]=!0);return Object.keys(s).length>0&&(n.extensions=s),n}}class TO extends Jt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Tt,this.projectionMatrix=new Tt,this.projectionMatrixInverse=new Tt,this.coordinateSystem=xi}copy(e,n){return super.copy(e,n),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,n){super.updateWorldMatrix(e,n),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class Un extends TO{constructor(e=50,n=1,s=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=s,this.far=i,this.focus=10,this.aspect=n,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const n=.5*this.getFilmHeight()/e;this.fov=pa*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(bl*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return pa*2*Math.atan(Math.tan(bl*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,n,s,i,r,o){this.aspect=e/n,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=n,this.view.offsetX=s,this.view.offsetY=i,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let n=e*Math.tan(bl*.5*this.fov)/this.zoom,s=2*n,i=this.aspect*s,r=-
|
|||
|
|
|||
|
varying vec3 vWorldDirection;
|
|||
|
|
|||
|
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
|
|||
|
|
|||
|
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
void main() {
|
|||
|
|
|||
|
vWorldDirection = transformDirection( position, modelMatrix );
|
|||
|
|
|||
|
#include <begin_vertex>
|
|||
|
#include <project_vertex>
|
|||
|
|
|||
|
}
|
|||
|
`,fragmentShader:`
|
|||
|
|
|||
|
uniform sampler2D tEquirect;
|
|||
|
|
|||
|
varying vec3 vWorldDirection;
|
|||
|
|
|||
|
#include <common>
|
|||
|
|
|||
|
void main() {
|
|||
|
|
|||
|
vec3 direction = normalize( vWorldDirection );
|
|||
|
|
|||
|
vec2 sampleUV = equirectUv( direction );
|
|||
|
|
|||
|
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|||
|
|
|||
|
}
|
|||
|
`},i=new pr(5,5,5),r=new to({name:"CubemapFromEquirect",uniforms:_a(s.uniforms),vertexShader:s.vertexShader,fragmentShader:s.fragmentShader,side:$n,blending:cr});r.uniforms.tEquirect.value=n;const o=new Fn(i,r),a=n.minFilter;return n.minFilter===Jr&&(n.minFilter=zn),new yAt(1,10,this).update(e,o),n.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,n,s,i){const r=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(n,s,i);e.setRenderTarget(r)}}const Fm=new re,SAt=new re,TAt=new St;class Or{constructor(e=new re(1,0,0),n=0){this.isPlane=!0,this.normal=e,this.constant=n}set(e,n){return this.normal.copy(e),this.constant=n,this}setComponents(e,n,s,i){return this.normal.set(e,n,s),this.constant=i,this}setFromNormalAndCoplanarPoint(e,n){return this.normal.copy(e),this.constant=-n.dot(this.normal),this}setFromCoplanarPoints(e,n,s){const i=Fm.subVectors(s,n).cross(SAt.subVectors(e,n)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,n){return n.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,n){const s=e.delta(Fm),i=this.normal.dot(s);if(i===0)return this.distanceToPoint(e.start)===0?n.copy(e.start):null;const r=-(e.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:n.copy(e.start).addScaledVector(s,r)}intersectsLine(e){const n=this.distanceToPoint(e.start),s=this.distanceToPoint(e.end);return n<0&&s>0||s<0&&n>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,n){const s=n||TAt.getNormalMatrix(e),i=this.coplanarPoint(Fm).applyMatrix4(e),r=this.normal.applyMatrix3(s).normalize();return this.constant=-i.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Rr=new ai,Qc=new re;class ME{constructor(e=new Or,n=new Or,s=new Or,i=new Or,r=new Or,o=new Or){this.planes=[e,n,s,i,r,o]}set(e,n,s,i,r,o){const a=this.planes;return a[0].copy(e),a[1].copy(n),a[2].copy(s),a[3].copy(i),a[4].copy(r),a[5].copy(o),this}copy(e){const n=this.planes;for(let s=0;s<6;s++)n[s].copy(e.planes[s]);return this}setFromProjectionMatrix(e,n=xi){const s=this.planes,i=e.elements,r=i[0],o=i[1],a=i[2],c=i[3],d=i[4],u=i[5],h=i[6],f=i[7],m=i[8],_=i[9],b=i[10],E=i[11],g=i[12],y=i[13],v=i[14],S=i[15];if(s[0].setComponents(c-r,f-d,E-m,S-g).normalize(),s[1].setComponents(c+r,f+d,E+m,S+g).normalize(),s[2].setComponents(c+o,f+u,E+_,S+y).normalize(),s[3].setComponents(c-o,f-u,E-_,S-y).normalize(),s[4].setComponents(c-a,f-h,E-b,S-v).normalize(),n===xi)s[5].setComponents(c+a,f+h,E+b,S+v).normalize();else if(n===eu)s[5].setComponents(a,h,b,v).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+n);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Rr.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),Rr.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Rr)}intersectsSprite(e){return Rr.center.set(0,0,0),Rr.radius=.7071067811865476,Rr.applyMatrix4(e.matrixWorld),this.intersectsSphere(Rr)}intersectsSphere(e){const n=this.planes,s=e.center,i=-e.radius;for(let r=0;r<6;r++)if(n[r].distanceToPoint(s)<i)return!1;return!0}intersectsBox(e){const n=this.planes;for(let s=0;s<6;s++){const i=n[s];if(Qc.x=i.normal.x>0?e.max.x:e.min.x,Qc.y=i.normal.y>0?e.max.y:e.min.y,Qc.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Qc)<0)return!1}ret
|
|||
|
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
|
|||
|
#endif`,wAt=`#ifdef USE_ALPHAHASH
|
|||
|
const float ALPHA_HASH_SCALE = 0.05;
|
|||
|
float hash2D( vec2 value ) {
|
|||
|
return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
|
|||
|
}
|
|||
|
float hash3D( vec3 value ) {
|
|||
|
return hash2D( vec2( hash2D( value.xy ), value.z ) );
|
|||
|
}
|
|||
|
float getAlphaHashThreshold( vec3 position ) {
|
|||
|
float maxDeriv = max(
|
|||
|
length( dFdx( position.xyz ) ),
|
|||
|
length( dFdy( position.xyz ) )
|
|||
|
);
|
|||
|
float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
|
|||
|
vec2 pixScales = vec2(
|
|||
|
exp2( floor( log2( pixScale ) ) ),
|
|||
|
exp2( ceil( log2( pixScale ) ) )
|
|||
|
);
|
|||
|
vec2 alpha = vec2(
|
|||
|
hash3D( floor( pixScales.x * position.xyz ) ),
|
|||
|
hash3D( floor( pixScales.y * position.xyz ) )
|
|||
|
);
|
|||
|
float lerpFactor = fract( log2( pixScale ) );
|
|||
|
float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
|
|||
|
float a = min( lerpFactor, 1.0 - lerpFactor );
|
|||
|
vec3 cases = vec3(
|
|||
|
x * x / ( 2.0 * a * ( 1.0 - a ) ),
|
|||
|
( x - 0.5 * a ) / ( 1.0 - a ),
|
|||
|
1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
|
|||
|
);
|
|||
|
float threshold = ( x < ( 1.0 - a ) )
|
|||
|
? ( ( x < a ) ? cases.x : cases.y )
|
|||
|
: cases.z;
|
|||
|
return clamp( threshold , 1.0e-6, 1.0 );
|
|||
|
}
|
|||
|
#endif`,RAt=`#ifdef USE_ALPHAMAP
|
|||
|
diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
|
|||
|
#endif`,AAt=`#ifdef USE_ALPHAMAP
|
|||
|
uniform sampler2D alphaMap;
|
|||
|
#endif`,NAt=`#ifdef USE_ALPHATEST
|
|||
|
if ( diffuseColor.a < alphaTest ) discard;
|
|||
|
#endif`,OAt=`#ifdef USE_ALPHATEST
|
|||
|
uniform float alphaTest;
|
|||
|
#endif`,IAt=`#ifdef USE_AOMAP
|
|||
|
float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
|
|||
|
reflectedLight.indirectDiffuse *= ambientOcclusion;
|
|||
|
#if defined( USE_CLEARCOAT )
|
|||
|
clearcoatSpecularIndirect *= ambientOcclusion;
|
|||
|
#endif
|
|||
|
#if defined( USE_SHEEN )
|
|||
|
sheenSpecularIndirect *= ambientOcclusion;
|
|||
|
#endif
|
|||
|
#if defined( USE_ENVMAP ) && defined( STANDARD )
|
|||
|
float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
|
|||
|
reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
|
|||
|
#endif
|
|||
|
#endif`,MAt=`#ifdef USE_AOMAP
|
|||
|
uniform sampler2D aoMap;
|
|||
|
uniform float aoMapIntensity;
|
|||
|
#endif`,kAt=`#ifdef USE_BATCHING
|
|||
|
attribute float batchId;
|
|||
|
uniform highp sampler2D batchingTexture;
|
|||
|
mat4 getBatchingMatrix( const in float i ) {
|
|||
|
int size = textureSize( batchingTexture, 0 ).x;
|
|||
|
int j = int( i ) * 4;
|
|||
|
int x = j % size;
|
|||
|
int y = j / size;
|
|||
|
vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
|
|||
|
vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
|
|||
|
vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
|
|||
|
vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
|
|||
|
return mat4( v1, v2, v3, v4 );
|
|||
|
}
|
|||
|
#endif`,DAt=`#ifdef USE_BATCHING
|
|||
|
mat4 batchingMatrix = getBatchingMatrix( batchId );
|
|||
|
#endif`,LAt=`vec3 transformed = vec3( position );
|
|||
|
#ifdef USE_ALPHAHASH
|
|||
|
vPosition = vec3( position );
|
|||
|
#endif`,PAt=`vec3 objectNormal = vec3( normal );
|
|||
|
#ifdef USE_TANGENT
|
|||
|
vec3 objectTangent = vec3( tangent.xyz );
|
|||
|
#endif`,UAt=`float G_BlinnPhong_Implicit( ) {
|
|||
|
return 0.25;
|
|||
|
}
|
|||
|
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
|
|||
|
return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
|
|||
|
}
|
|||
|
vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
|
|||
|
vec3 halfDir = normalize( lightDir + viewDir );
|
|||
|
float dotNH = saturate( dot( normal, halfDir ) );
|
|||
|
float dotVH = saturate( dot( viewDir, halfDir ) );
|
|||
|
vec3 F = F_Schlick( specularColor, 1.0, dotVH );
|
|||
|
float G = G_BlinnPhong_Implicit( );
|
|||
|
float D = D_BlinnPhong( shininess, dotNH );
|
|||
|
return F * ( G * D );
|
|||
|
} // validated`,FAt=`#ifdef USE_IRIDESCENCE
|
|||
|
const mat3 XYZ_TO_REC709 = mat3(
|
|||
|
3.2404542, -0.9692660, 0.0556434,
|
|||
|
-1.5371385, 1.8760108, -0.2040259,
|
|||
|
-0.4985314, 0.0415560, 1.0572252
|
|||
|
);
|
|||
|
vec3 Fresnel0ToIor( vec3 fresnel0 ) {
|
|||
|
vec3 sqrtF0 = sqrt( fresnel0 );
|
|||
|
return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
|
|||
|
}
|
|||
|
vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
|
|||
|
return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
|
|||
|
}
|
|||
|
float IorToFresnel0( float transmittedIor, float incidentIor ) {
|
|||
|
return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
|
|||
|
}
|
|||
|
vec3 evalSensitivity( float OPD, vec3 shift ) {
|
|||
|
float phase = 2.0 * PI * OPD * 1.0e-9;
|
|||
|
vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
|
|||
|
vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
|
|||
|
vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
|
|||
|
vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
|
|||
|
xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
|
|||
|
xyz /= 1.0685e-7;
|
|||
|
vec3 rgb = XYZ_TO_REC709 * xyz;
|
|||
|
return rgb;
|
|||
|
}
|
|||
|
vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
|
|||
|
vec3 I;
|
|||
|
float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
|
|||
|
float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
|
|||
|
float cosTheta2Sq = 1.0 - sinTheta2Sq;
|
|||
|
if ( cosTheta2Sq < 0.0 ) {
|
|||
|
return vec3( 1.0 );
|
|||
|
}
|
|||
|
float cosTheta2 = sqrt( cosTheta2Sq );
|
|||
|
float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
|
|||
|
float R12 = F_Schlick( R0, 1.0, cosTheta1 );
|
|||
|
float T121 = 1.0 - R12;
|
|||
|
float phi12 = 0.0;
|
|||
|
if ( iridescenceIOR < outsideIOR ) phi12 = PI;
|
|||
|
float phi21 = PI - phi12;
|
|||
|
vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
|
|||
|
vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
|
|||
|
vec3 phi23 = vec3( 0.0 );
|
|||
|
if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
|
|||
|
if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
|
|||
|
if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
|
|||
|
float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
|
|||
|
vec3 phi = vec3( phi21 ) + phi23;
|
|||
|
vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
|
|||
|
vec3 r123 = sqrt( R123 );
|
|||
|
vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
|
|||
|
vec3 C0 = R12 + Rs;
|
|||
|
I = C0;
|
|||
|
vec3 Cm = Rs - T121;
|
|||
|
for ( int m = 1; m <= 2; ++ m ) {
|
|||
|
Cm *= r123;
|
|||
|
vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
|
|||
|
I += Cm * Sm;
|
|||
|
}
|
|||
|
return max( I, vec3( 0.0 ) );
|
|||
|
}
|
|||
|
#endif`,BAt=`#ifdef USE_BUMPMAP
|
|||
|
uniform sampler2D bumpMap;
|
|||
|
uniform float bumpScale;
|
|||
|
vec2 dHdxy_fwd() {
|
|||
|
vec2 dSTdx = dFdx( vBumpMapUv );
|
|||
|
vec2 dSTdy = dFdy( vBumpMapUv );
|
|||
|
float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
|
|||
|
float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
|
|||
|
float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
|
|||
|
return vec2( dBx, dBy );
|
|||
|
}
|
|||
|
vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
|
|||
|
vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
|
|||
|
vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
|
|||
|
vec3 vN = surf_norm;
|
|||
|
vec3 R1 = cross( vSigmaY, vN );
|
|||
|
vec3 R2 = cross( vN, vSigmaX );
|
|||
|
float fDet = dot( vSigmaX, R1 ) * faceDirection;
|
|||
|
vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
|
|||
|
return normalize( abs( fDet ) * surf_norm - vGrad );
|
|||
|
}
|
|||
|
#endif`,GAt=`#if NUM_CLIPPING_PLANES > 0
|
|||
|
vec4 plane;
|
|||
|
#pragma unroll_loop_start
|
|||
|
for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
|
|||
|
plane = clippingPlanes[ i ];
|
|||
|
if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
|
|||
|
}
|
|||
|
#pragma unroll_loop_end
|
|||
|
#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
|
|||
|
bool clipped = true;
|
|||
|
#pragma unroll_loop_start
|
|||
|
for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
|
|||
|
plane = clippingPlanes[ i ];
|
|||
|
clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
|
|||
|
}
|
|||
|
#pragma unroll_loop_end
|
|||
|
if ( clipped ) discard;
|
|||
|
#endif
|
|||
|
#endif`,VAt=`#if NUM_CLIPPING_PLANES > 0
|
|||
|
varying vec3 vClipPosition;
|
|||
|
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
|
|||
|
#endif`,zAt=`#if NUM_CLIPPING_PLANES > 0
|
|||
|
varying vec3 vClipPosition;
|
|||
|
#endif`,HAt=`#if NUM_CLIPPING_PLANES > 0
|
|||
|
vClipPosition = - mvPosition.xyz;
|
|||
|
#endif`,qAt=`#if defined( USE_COLOR_ALPHA )
|
|||
|
diffuseColor *= vColor;
|
|||
|
#elif defined( USE_COLOR )
|
|||
|
diffuseColor.rgb *= vColor;
|
|||
|
#endif`,$At=`#if defined( USE_COLOR_ALPHA )
|
|||
|
varying vec4 vColor;
|
|||
|
#elif defined( USE_COLOR )
|
|||
|
varying vec3 vColor;
|
|||
|
#endif`,YAt=`#if defined( USE_COLOR_ALPHA )
|
|||
|
varying vec4 vColor;
|
|||
|
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
|
|||
|
varying vec3 vColor;
|
|||
|
#endif`,WAt=`#if defined( USE_COLOR_ALPHA )
|
|||
|
vColor = vec4( 1.0 );
|
|||
|
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
|
|||
|
vColor = vec3( 1.0 );
|
|||
|
#endif
|
|||
|
#ifdef USE_COLOR
|
|||
|
vColor *= color;
|
|||
|
#endif
|
|||
|
#ifdef USE_INSTANCING_COLOR
|
|||
|
vColor.xyz *= instanceColor.xyz;
|
|||
|
#endif`,KAt=`#define PI 3.141592653589793
|
|||
|
#define PI2 6.283185307179586
|
|||
|
#define PI_HALF 1.5707963267948966
|
|||
|
#define RECIPROCAL_PI 0.3183098861837907
|
|||
|
#define RECIPROCAL_PI2 0.15915494309189535
|
|||
|
#define EPSILON 1e-6
|
|||
|
#ifndef saturate
|
|||
|
#define saturate( a ) clamp( a, 0.0, 1.0 )
|
|||
|
#endif
|
|||
|
#define whiteComplement( a ) ( 1.0 - saturate( a ) )
|
|||
|
float pow2( const in float x ) { return x*x; }
|
|||
|
vec3 pow2( const in vec3 x ) { return x*x; }
|
|||
|
float pow3( const in float x ) { return x*x*x; }
|
|||
|
float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
|
|||
|
float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
|
|||
|
float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
|
|||
|
highp float rand( const in vec2 uv ) {
|
|||
|
const highp float a = 12.9898, b = 78.233, c = 43758.5453;
|
|||
|
highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
|
|||
|
return fract( sin( sn ) * c );
|
|||
|
}
|
|||
|
#ifdef HIGH_PRECISION
|
|||
|
float precisionSafeLength( vec3 v ) { return length( v ); }
|
|||
|
#else
|
|||
|
float precisionSafeLength( vec3 v ) {
|
|||
|
float maxComponent = max3( abs( v ) );
|
|||
|
return length( v / maxComponent ) * maxComponent;
|
|||
|
}
|
|||
|
#endif
|
|||
|
struct IncidentLight {
|
|||
|
vec3 color;
|
|||
|
vec3 direction;
|
|||
|
bool visible;
|
|||
|
};
|
|||
|
struct ReflectedLight {
|
|||
|
vec3 directDiffuse;
|
|||
|
vec3 directSpecular;
|
|||
|
vec3 indirectDiffuse;
|
|||
|
vec3 indirectSpecular;
|
|||
|
};
|
|||
|
#ifdef USE_ALPHAHASH
|
|||
|
varying vec3 vPosition;
|
|||
|
#endif
|
|||
|
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
|
|||
|
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
|
|||
|
}
|
|||
|
vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
|
|||
|
return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
|
|||
|
}
|
|||
|
mat3 transposeMat3( const in mat3 m ) {
|
|||
|
mat3 tmp;
|
|||
|
tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
|
|||
|
tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
|
|||
|
tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
|
|||
|
return tmp;
|
|||
|
}
|
|||
|
float luminance( const in vec3 rgb ) {
|
|||
|
const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );
|
|||
|
return dot( weights, rgb );
|
|||
|
}
|
|||
|
bool isPerspectiveMatrix( mat4 m ) {
|
|||
|
return m[ 2 ][ 3 ] == - 1.0;
|
|||
|
}
|
|||
|
vec2 equirectUv( in vec3 dir ) {
|
|||
|
float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
|
|||
|
float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
|
|||
|
return vec2( u, v );
|
|||
|
}
|
|||
|
vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
|
|||
|
return RECIPROCAL_PI * diffuseColor;
|
|||
|
}
|
|||
|
vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
|
|||
|
float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
|
|||
|
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
|
|||
|
}
|
|||
|
float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
|
|||
|
float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
|
|||
|
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
|
|||
|
} // validated`,jAt=`#ifdef ENVMAP_TYPE_CUBE_UV
|
|||
|
#define cubeUV_minMipLevel 4.0
|
|||
|
#define cubeUV_minTileSize 16.0
|
|||
|
float getFace( vec3 direction ) {
|
|||
|
vec3 absDirection = abs( direction );
|
|||
|
float face = - 1.0;
|
|||
|
if ( absDirection.x > absDirection.z ) {
|
|||
|
if ( absDirection.x > absDirection.y )
|
|||
|
face = direction.x > 0.0 ? 0.0 : 3.0;
|
|||
|
else
|
|||
|
face = direction.y > 0.0 ? 1.0 : 4.0;
|
|||
|
} else {
|
|||
|
if ( absDirection.z > absDirection.y )
|
|||
|
face = direction.z > 0.0 ? 2.0 : 5.0;
|
|||
|
else
|
|||
|
face = direction.y > 0.0 ? 1.0 : 4.0;
|
|||
|
}
|
|||
|
return face;
|
|||
|
}
|
|||
|
vec2 getUV( vec3 direction, float face ) {
|
|||
|
vec2 uv;
|
|||
|
if ( face == 0.0 ) {
|
|||
|
uv = vec2( direction.z, direction.y ) / abs( direction.x );
|
|||
|
} else if ( face == 1.0 ) {
|
|||
|
uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
|
|||
|
} else if ( face == 2.0 ) {
|
|||
|
uv = vec2( - direction.x, direction.y ) / abs( direction.z );
|
|||
|
} else if ( face == 3.0 ) {
|
|||
|
uv = vec2( - direction.z, direction.y ) / abs( direction.x );
|
|||
|
} else if ( face == 4.0 ) {
|
|||
|
uv = vec2( - direction.x, direction.z ) / abs( direction.y );
|
|||
|
} else {
|
|||
|
uv = vec2( direction.x, direction.y ) / abs( direction.z );
|
|||
|
}
|
|||
|
return 0.5 * ( uv + 1.0 );
|
|||
|
}
|
|||
|
vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
|
|||
|
float face = getFace( direction );
|
|||
|
float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
|
|||
|
mipInt = max( mipInt, cubeUV_minMipLevel );
|
|||
|
float faceSize = exp2( mipInt );
|
|||
|
highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
|
|||
|
if ( face > 2.0 ) {
|
|||
|
uv.y += faceSize;
|
|||
|
face -= 3.0;
|
|||
|
}
|
|||
|
uv.x += face * faceSize;
|
|||
|
uv.x += filterInt * 3.0 * cubeUV_minTileSize;
|
|||
|
uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
|
|||
|
uv.x *= CUBEUV_TEXEL_WIDTH;
|
|||
|
uv.y *= CUBEUV_TEXEL_HEIGHT;
|
|||
|
#ifdef texture2DGradEXT
|
|||
|
return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
|
|||
|
#else
|
|||
|
return texture2D( envMap, uv ).rgb;
|
|||
|
#endif
|
|||
|
}
|
|||
|
#define cubeUV_r0 1.0
|
|||
|
#define cubeUV_v0 0.339
|
|||
|
#define cubeUV_m0 - 2.0
|
|||
|
#define cubeUV_r1 0.8
|
|||
|
#define cubeUV_v1 0.276
|
|||
|
#define cubeUV_m1 - 1.0
|
|||
|
#define cubeUV_r4 0.4
|
|||
|
#define cubeUV_v4 0.046
|
|||
|
#define cubeUV_m4 2.0
|
|||
|
#define cubeUV_r5 0.305
|
|||
|
#define cubeUV_v5 0.016
|
|||
|
#define cubeUV_m5 3.0
|
|||
|
#define cubeUV_r6 0.21
|
|||
|
#define cubeUV_v6 0.0038
|
|||
|
#define cubeUV_m6 4.0
|
|||
|
float roughnessToMip( float roughness ) {
|
|||
|
float mip = 0.0;
|
|||
|
if ( roughness >= cubeUV_r1 ) {
|
|||
|
mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
|
|||
|
} else if ( roughness >= cubeUV_r4 ) {
|
|||
|
mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
|
|||
|
} else if ( roughness >= cubeUV_r5 ) {
|
|||
|
mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
|
|||
|
} else if ( roughness >= cubeUV_r6 ) {
|
|||
|
mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
|
|||
|
} else {
|
|||
|
mip = - 2.0 * log2( 1.16 * roughness ); }
|
|||
|
return mip;
|
|||
|
}
|
|||
|
vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
|
|||
|
float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
|
|||
|
float mipF = fract( mip );
|
|||
|
float mipInt = floor( mip );
|
|||
|
vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
|
|||
|
if ( mipF == 0.0 ) {
|
|||
|
return vec4( color0, 1.0 );
|
|||
|
} else {
|
|||
|
vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
|
|||
|
return vec4( mix( color0, color1, mipF ), 1.0 );
|
|||
|
}
|
|||
|
}
|
|||
|
#endif`,QAt=`vec3 transformedNormal = objectNormal;
|
|||
|
#ifdef USE_TANGENT
|
|||
|
vec3 transformedTangent = objectTangent;
|
|||
|
#endif
|
|||
|
#ifdef USE_BATCHING
|
|||
|
mat3 bm = mat3( batchingMatrix );
|
|||
|
transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
|
|||
|
transformedNormal = bm * transformedNormal;
|
|||
|
#ifdef USE_TANGENT
|
|||
|
transformedTangent = bm * transformedTangent;
|
|||
|
#endif
|
|||
|
#endif
|
|||
|
#ifdef USE_INSTANCING
|
|||
|
mat3 im = mat3( instanceMatrix );
|
|||
|
transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
|
|||
|
transformedNormal = im * transformedNormal;
|
|||
|
#ifdef USE_TANGENT
|
|||
|
transformedTangent = im * transformedTangent;
|
|||
|
#endif
|
|||
|
#endif
|
|||
|
transformedNormal = normalMatrix * transformedNormal;
|
|||
|
#ifdef FLIP_SIDED
|
|||
|
transformedNormal = - transformedNormal;
|
|||
|
#endif
|
|||
|
#ifdef USE_TANGENT
|
|||
|
transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
|
|||
|
#ifdef FLIP_SIDED
|
|||
|
transformedTangent = - transformedTangent;
|
|||
|
#endif
|
|||
|
#endif`,XAt=`#ifdef USE_DISPLACEMENTMAP
|
|||
|
uniform sampler2D displacementMap;
|
|||
|
uniform float displacementScale;
|
|||
|
uniform float displacementBias;
|
|||
|
#endif`,ZAt=`#ifdef USE_DISPLACEMENTMAP
|
|||
|
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
|
|||
|
#endif`,JAt=`#ifdef USE_EMISSIVEMAP
|
|||
|
vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
|
|||
|
totalEmissiveRadiance *= emissiveColor.rgb;
|
|||
|
#endif`,eNt=`#ifdef USE_EMISSIVEMAP
|
|||
|
uniform sampler2D emissiveMap;
|
|||
|
#endif`,tNt="gl_FragColor = linearToOutputTexel( gl_FragColor );",nNt=`
|
|||
|
const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(
|
|||
|
vec3( 0.8224621, 0.177538, 0.0 ),
|
|||
|
vec3( 0.0331941, 0.9668058, 0.0 ),
|
|||
|
vec3( 0.0170827, 0.0723974, 0.9105199 )
|
|||
|
);
|
|||
|
const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(
|
|||
|
vec3( 1.2249401, - 0.2249404, 0.0 ),
|
|||
|
vec3( - 0.0420569, 1.0420571, 0.0 ),
|
|||
|
vec3( - 0.0196376, - 0.0786361, 1.0982735 )
|
|||
|
);
|
|||
|
vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {
|
|||
|
return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );
|
|||
|
}
|
|||
|
vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {
|
|||
|
return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );
|
|||
|
}
|
|||
|
vec4 LinearTransferOETF( in vec4 value ) {
|
|||
|
return value;
|
|||
|
}
|
|||
|
vec4 sRGBTransferOETF( in vec4 value ) {
|
|||
|
return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
|
|||
|
}
|
|||
|
vec4 LinearToLinear( in vec4 value ) {
|
|||
|
return value;
|
|||
|
}
|
|||
|
vec4 LinearTosRGB( in vec4 value ) {
|
|||
|
return sRGBTransferOETF( value );
|
|||
|
}`,sNt=`#ifdef USE_ENVMAP
|
|||
|
#ifdef ENV_WORLDPOS
|
|||
|
vec3 cameraToFrag;
|
|||
|
if ( isOrthographic ) {
|
|||
|
cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
|
|||
|
} else {
|
|||
|
cameraToFrag = normalize( vWorldPosition - cameraPosition );
|
|||
|
}
|
|||
|
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
|
|||
|
#ifdef ENVMAP_MODE_REFLECTION
|
|||
|
vec3 reflectVec = reflect( cameraToFrag, worldNormal );
|
|||
|
#else
|
|||
|
vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
|
|||
|
#endif
|
|||
|
#else
|
|||
|
vec3 reflectVec = vReflect;
|
|||
|
#endif
|
|||
|
#ifdef ENVMAP_TYPE_CUBE
|
|||
|
vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
|
|||
|
#else
|
|||
|
vec4 envColor = vec4( 0.0 );
|
|||
|
#endif
|
|||
|
#ifdef ENVMAP_BLENDING_MULTIPLY
|
|||
|
outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
|
|||
|
#elif defined( ENVMAP_BLENDING_MIX )
|
|||
|
outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
|
|||
|
#elif defined( ENVMAP_BLENDING_ADD )
|
|||
|
outgoingLight += envColor.xyz * specularStrength * reflectivity;
|
|||
|
#endif
|
|||
|
#endif`,iNt=`#ifdef USE_ENVMAP
|
|||
|
uniform float envMapIntensity;
|
|||
|
uniform float flipEnvMap;
|
|||
|
#ifdef ENVMAP_TYPE_CUBE
|
|||
|
uniform samplerCube envMap;
|
|||
|
#else
|
|||
|
uniform sampler2D envMap;
|
|||
|
#endif
|
|||
|
|
|||
|
#endif`,rNt=`#ifdef USE_ENVMAP
|
|||
|
uniform float reflectivity;
|
|||
|
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
|
|||
|
#define ENV_WORLDPOS
|
|||
|
#endif
|
|||
|
#ifdef ENV_WORLDPOS
|
|||
|
varying vec3 vWorldPosition;
|
|||
|
uniform float refractionRatio;
|
|||
|
#else
|
|||
|
varying vec3 vReflect;
|
|||
|
#endif
|
|||
|
#endif`,oNt=`#ifdef USE_ENVMAP
|
|||
|
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
|
|||
|
#define ENV_WORLDPOS
|
|||
|
#endif
|
|||
|
#ifdef ENV_WORLDPOS
|
|||
|
|
|||
|
varying vec3 vWorldPosition;
|
|||
|
#else
|
|||
|
varying vec3 vReflect;
|
|||
|
uniform float refractionRatio;
|
|||
|
#endif
|
|||
|
#endif`,aNt=`#ifdef USE_ENVMAP
|
|||
|
#ifdef ENV_WORLDPOS
|
|||
|
vWorldPosition = worldPosition.xyz;
|
|||
|
#else
|
|||
|
vec3 cameraToVertex;
|
|||
|
if ( isOrthographic ) {
|
|||
|
cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
|
|||
|
} else {
|
|||
|
cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
|
|||
|
}
|
|||
|
vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
|
|||
|
#ifdef ENVMAP_MODE_REFLECTION
|
|||
|
vReflect = reflect( cameraToVertex, worldNormal );
|
|||
|
#else
|
|||
|
vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
|
|||
|
#endif
|
|||
|
#endif
|
|||
|
#endif`,lNt=`#ifdef USE_FOG
|
|||
|
vFogDepth = - mvPosition.z;
|
|||
|
#endif`,cNt=`#ifdef USE_FOG
|
|||
|
varying float vFogDepth;
|
|||
|
#endif`,dNt=`#ifdef USE_FOG
|
|||
|
#ifdef FOG_EXP2
|
|||
|
float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
|
|||
|
#else
|
|||
|
float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
|
|||
|
#endif
|
|||
|
gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
|
|||
|
#endif`,uNt=`#ifdef USE_FOG
|
|||
|
uniform vec3 fogColor;
|
|||
|
varying float vFogDepth;
|
|||
|
#ifdef FOG_EXP2
|
|||
|
uniform float fogDensity;
|
|||
|
#else
|
|||
|
uniform float fogNear;
|
|||
|
uniform float fogFar;
|
|||
|
#endif
|
|||
|
#endif`,pNt=`#ifdef USE_GRADIENTMAP
|
|||
|
uniform sampler2D gradientMap;
|
|||
|
#endif
|
|||
|
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
|
|||
|
float dotNL = dot( normal, lightDirection );
|
|||
|
vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
|
|||
|
#ifdef USE_GRADIENTMAP
|
|||
|
return vec3( texture2D( gradientMap, coord ).r );
|
|||
|
#else
|
|||
|
vec2 fw = fwidth( coord ) * 0.5;
|
|||
|
return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
|
|||
|
#endif
|
|||
|
}`,_Nt=`#ifdef USE_LIGHTMAP
|
|||
|
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
|
|||
|
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
|
|||
|
reflectedLight.indirectDiffuse += lightMapIrradiance;
|
|||
|
#endif`,hNt=`#ifdef USE_LIGHTMAP
|
|||
|
uniform sampler2D lightMap;
|
|||
|
uniform float lightMapIntensity;
|
|||
|
#endif`,fNt=`LambertMaterial material;
|
|||
|
material.diffuseColor = diffuseColor.rgb;
|
|||
|
material.specularStrength = specularStrength;`,mNt=`varying vec3 vViewPosition;
|
|||
|
struct LambertMaterial {
|
|||
|
vec3 diffuseColor;
|
|||
|
float specularStrength;
|
|||
|
};
|
|||
|
void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
|
|||
|
float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
|
|||
|
vec3 irradiance = dotNL * directLight.color;
|
|||
|
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|||
|
}
|
|||
|
void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
|
|||
|
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|||
|
}
|
|||
|
#define RE_Direct RE_Direct_Lambert
|
|||
|
#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,gNt=`uniform bool receiveShadow;
|
|||
|
uniform vec3 ambientLightColor;
|
|||
|
#if defined( USE_LIGHT_PROBES )
|
|||
|
uniform vec3 lightProbe[ 9 ];
|
|||
|
#endif
|
|||
|
vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
|
|||
|
float x = normal.x, y = normal.y, z = normal.z;
|
|||
|
vec3 result = shCoefficients[ 0 ] * 0.886227;
|
|||
|
result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
|
|||
|
result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
|
|||
|
result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
|
|||
|
result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
|
|||
|
result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
|
|||
|
result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
|
|||
|
result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
|
|||
|
result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
|
|||
|
return result;
|
|||
|
}
|
|||
|
vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
|
|||
|
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
|
|||
|
vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
|
|||
|
return irradiance;
|
|||
|
}
|
|||
|
vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
|
|||
|
vec3 irradiance = ambientLightColor;
|
|||
|
return irradiance;
|
|||
|
}
|
|||
|
float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
|
|||
|
#if defined ( LEGACY_LIGHTS )
|
|||
|
if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {
|
|||
|
return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );
|
|||
|
}
|
|||
|
return 1.0;
|
|||
|
#else
|
|||
|
float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
|
|||
|
if ( cutoffDistance > 0.0 ) {
|
|||
|
distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
|
|||
|
}
|
|||
|
return distanceFalloff;
|
|||
|
#endif
|
|||
|
}
|
|||
|
float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
|
|||
|
return smoothstep( coneCosine, penumbraCosine, angleCosine );
|
|||
|
}
|
|||
|
#if NUM_DIR_LIGHTS > 0
|
|||
|
struct DirectionalLight {
|
|||
|
vec3 direction;
|
|||
|
vec3 color;
|
|||
|
};
|
|||
|
uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
|
|||
|
void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
|
|||
|
light.color = directionalLight.color;
|
|||
|
light.direction = directionalLight.direction;
|
|||
|
light.visible = true;
|
|||
|
}
|
|||
|
#endif
|
|||
|
#if NUM_POINT_LIGHTS > 0
|
|||
|
struct PointLight {
|
|||
|
vec3 position;
|
|||
|
vec3 color;
|
|||
|
float distance;
|
|||
|
float decay;
|
|||
|
};
|
|||
|
uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
|
|||
|
void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
|
|||
|
vec3 lVector = pointLight.position - geometryPosition;
|
|||
|
light.direction = normalize( lVector );
|
|||
|
float lightDistance = length( lVector );
|
|||
|
light.color = pointLight.color;
|
|||
|
light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
|
|||
|
light.visible = ( light.color != vec3( 0.0 ) );
|
|||
|
}
|
|||
|
#endif
|
|||
|
#if NUM_SPOT_LIGHTS > 0
|
|||
|
struct SpotLight {
|
|||
|
vec3 position;
|
|||
|
vec3 direction;
|
|||
|
vec3 color;
|
|||
|
float distance;
|
|||
|
float decay;
|
|||
|
float coneCos;
|
|||
|
float penumbraCos;
|
|||
|
};
|
|||
|
uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
|
|||
|
void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
|
|||
|
vec3 lVector = spotLight.position - geometryPosition;
|
|||
|
light.direction = normalize( lVector );
|
|||
|
float angleCos = dot( light.direction, spotLight.direction );
|
|||
|
float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
|
|||
|
if ( spotAttenuation > 0.0 ) {
|
|||
|
float lightDistance = length( lVector );
|
|||
|
light.color = spotLight.color * spotAttenuation;
|
|||
|
light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
|
|||
|
light.visible = ( light.color != vec3( 0.0 ) );
|
|||
|
} else {
|
|||
|
light.color = vec3( 0.0 );
|
|||
|
light.visible = false;
|
|||
|
}
|
|||
|
}
|
|||
|
#endif
|
|||
|
#if NUM_RECT_AREA_LIGHTS > 0
|
|||
|
struct RectAreaLight {
|
|||
|
vec3 color;
|
|||
|
vec3 position;
|
|||
|
vec3 halfWidth;
|
|||
|
vec3 halfHeight;
|
|||
|
};
|
|||
|
uniform sampler2D ltc_1; uniform sampler2D ltc_2;
|
|||
|
uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
|
|||
|
#endif
|
|||
|
#if NUM_HEMI_LIGHTS > 0
|
|||
|
struct HemisphereLight {
|
|||
|
vec3 direction;
|
|||
|
vec3 skyColor;
|
|||
|
vec3 groundColor;
|
|||
|
};
|
|||
|
uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
|
|||
|
vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
|
|||
|
float dotNL = dot( normal, hemiLight.direction );
|
|||
|
float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
|
|||
|
vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
|
|||
|
return irradiance;
|
|||
|
}
|
|||
|
#endif`,bNt=`#ifdef USE_ENVMAP
|
|||
|
vec3 getIBLIrradiance( const in vec3 normal ) {
|
|||
|
#ifdef ENVMAP_TYPE_CUBE_UV
|
|||
|
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
|
|||
|
vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );
|
|||
|
return PI * envMapColor.rgb * envMapIntensity;
|
|||
|
#else
|
|||
|
return vec3( 0.0 );
|
|||
|
#endif
|
|||
|
}
|
|||
|
vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
|
|||
|
#ifdef ENVMAP_TYPE_CUBE_UV
|
|||
|
vec3 reflectVec = reflect( - viewDir, normal );
|
|||
|
reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
|
|||
|
reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
|
|||
|
vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );
|
|||
|
return envMapColor.rgb * envMapIntensity;
|
|||
|
#else
|
|||
|
return vec3( 0.0 );
|
|||
|
#endif
|
|||
|
}
|
|||
|
#ifdef USE_ANISOTROPY
|
|||
|
vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
|
|||
|
#ifdef ENVMAP_TYPE_CUBE_UV
|
|||
|
vec3 bentNormal = cross( bitangent, viewDir );
|
|||
|
bentNormal = normalize( cross( bentNormal, bitangent ) );
|
|||
|
bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
|
|||
|
return getIBLRadiance( viewDir, bentNormal, roughness );
|
|||
|
#else
|
|||
|
return vec3( 0.0 );
|
|||
|
#endif
|
|||
|
}
|
|||
|
#endif
|
|||
|
#endif`,ENt=`ToonMaterial material;
|
|||
|
material.diffuseColor = diffuseColor.rgb;`,yNt=`varying vec3 vViewPosition;
|
|||
|
struct ToonMaterial {
|
|||
|
vec3 diffuseColor;
|
|||
|
};
|
|||
|
void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
|
|||
|
vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
|
|||
|
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|||
|
}
|
|||
|
void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
|
|||
|
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|||
|
}
|
|||
|
#define RE_Direct RE_Direct_Toon
|
|||
|
#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,vNt=`BlinnPhongMaterial material;
|
|||
|
material.diffuseColor = diffuseColor.rgb;
|
|||
|
material.specularColor = specular;
|
|||
|
material.specularShininess = shininess;
|
|||
|
material.specularStrength = specularStrength;`,SNt=`varying vec3 vViewPosition;
|
|||
|
struct BlinnPhongMaterial {
|
|||
|
vec3 diffuseColor;
|
|||
|
vec3 specularColor;
|
|||
|
float specularShininess;
|
|||
|
float specularStrength;
|
|||
|
};
|
|||
|
void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
|
|||
|
float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
|
|||
|
vec3 irradiance = dotNL * directLight.color;
|
|||
|
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|||
|
reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
|
|||
|
}
|
|||
|
void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
|
|||
|
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|||
|
}
|
|||
|
#define RE_Direct RE_Direct_BlinnPhong
|
|||
|
#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,TNt=`PhysicalMaterial material;
|
|||
|
material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
|
|||
|
vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
|
|||
|
float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
|
|||
|
material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
|
|||
|
material.roughness = min( material.roughness, 1.0 );
|
|||
|
#ifdef IOR
|
|||
|
material.ior = ior;
|
|||
|
#ifdef USE_SPECULAR
|
|||
|
float specularIntensityFactor = specularIntensity;
|
|||
|
vec3 specularColorFactor = specularColor;
|
|||
|
#ifdef USE_SPECULAR_COLORMAP
|
|||
|
specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
|
|||
|
#endif
|
|||
|
#ifdef USE_SPECULAR_INTENSITYMAP
|
|||
|
specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
|
|||
|
#endif
|
|||
|
material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
|
|||
|
#else
|
|||
|
float specularIntensityFactor = 1.0;
|
|||
|
vec3 specularColorFactor = vec3( 1.0 );
|
|||
|
material.specularF90 = 1.0;
|
|||
|
#endif
|
|||
|
material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
|
|||
|
#else
|
|||
|
material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
|
|||
|
material.specularF90 = 1.0;
|
|||
|
#endif
|
|||
|
#ifdef USE_CLEARCOAT
|
|||
|
material.clearcoat = clearcoat;
|
|||
|
material.clearcoatRoughness = clearcoatRoughness;
|
|||
|
material.clearcoatF0 = vec3( 0.04 );
|
|||
|
material.clearcoatF90 = 1.0;
|
|||
|
#ifdef USE_CLEARCOATMAP
|
|||
|
material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
|
|||
|
#endif
|
|||
|
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|||
|
material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
|
|||
|
#endif
|
|||
|
material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
|
|||
|
material.clearcoatRoughness += geometryRoughness;
|
|||
|
material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
|
|||
|
#endif
|
|||
|
#ifdef USE_IRIDESCENCE
|
|||
|
material.iridescence = iridescence;
|
|||
|
material.iridescenceIOR = iridescenceIOR;
|
|||
|
#ifdef USE_IRIDESCENCEMAP
|
|||
|
material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
|
|||
|
#endif
|
|||
|
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
|||
|
material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
|
|||
|
#else
|
|||
|
material.iridescenceThickness = iridescenceThicknessMaximum;
|
|||
|
#endif
|
|||
|
#endif
|
|||
|
#ifdef USE_SHEEN
|
|||
|
material.sheenColor = sheenColor;
|
|||
|
#ifdef USE_SHEEN_COLORMAP
|
|||
|
material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
|
|||
|
#endif
|
|||
|
material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
|
|||
|
#ifdef USE_SHEEN_ROUGHNESSMAP
|
|||
|
material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
|
|||
|
#endif
|
|||
|
#endif
|
|||
|
#ifdef USE_ANISOTROPY
|
|||
|
#ifdef USE_ANISOTROPYMAP
|
|||
|
mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
|
|||
|
vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
|
|||
|
vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
|
|||
|
#else
|
|||
|
vec2 anisotropyV = anisotropyVector;
|
|||
|
#endif
|
|||
|
material.anisotropy = length( anisotropyV );
|
|||
|
if( material.anisotropy == 0.0 ) {
|
|||
|
anisotropyV = vec2( 1.0, 0.0 );
|
|||
|
} else {
|
|||
|
anisotropyV /= material.anisotropy;
|
|||
|
material.anisotropy = saturate( material.anisotropy );
|
|||
|
}
|
|||
|
material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
|
|||
|
material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
|
|||
|
material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
|
|||
|
#endif`,xNt=`struct PhysicalMaterial {
|
|||
|
vec3 diffuseColor;
|
|||
|
float roughness;
|
|||
|
vec3 specularColor;
|
|||
|
float specularF90;
|
|||
|
#ifdef USE_CLEARCOAT
|
|||
|
float clearcoat;
|
|||
|
float clearcoatRoughness;
|
|||
|
vec3 clearcoatF0;
|
|||
|
float clearcoatF90;
|
|||
|
#endif
|
|||
|
#ifdef USE_IRIDESCENCE
|
|||
|
float iridescence;
|
|||
|
float iridescenceIOR;
|
|||
|
float iridescenceThickness;
|
|||
|
vec3 iridescenceFresnel;
|
|||
|
vec3 iridescenceF0;
|
|||
|
#endif
|
|||
|
#ifdef USE_SHEEN
|
|||
|
vec3 sheenColor;
|
|||
|
float sheenRoughness;
|
|||
|
#endif
|
|||
|
#ifdef IOR
|
|||
|
float ior;
|
|||
|
#endif
|
|||
|
#ifdef USE_TRANSMISSION
|
|||
|
float transmission;
|
|||
|
float transmissionAlpha;
|
|||
|
float thickness;
|
|||
|
float attenuationDistance;
|
|||
|
vec3 attenuationColor;
|
|||
|
#endif
|
|||
|
#ifdef USE_ANISOTROPY
|
|||
|
float anisotropy;
|
|||
|
float alphaT;
|
|||
|
vec3 anisotropyT;
|
|||
|
vec3 anisotropyB;
|
|||
|
#endif
|
|||
|
};
|
|||
|
vec3 clearcoatSpecularDirect = vec3( 0.0 );
|
|||
|
vec3 clearcoatSpecularIndirect = vec3( 0.0 );
|
|||
|
vec3 sheenSpecularDirect = vec3( 0.0 );
|
|||
|
vec3 sheenSpecularIndirect = vec3(0.0 );
|
|||
|
vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
|
|||
|
float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
|
|||
|
float x2 = x * x;
|
|||
|
float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
|
|||
|
return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
|
|||
|
}
|
|||
|
float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
|
|||
|
float a2 = pow2( alpha );
|
|||
|
float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
|
|||
|
float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
|
|||
|
return 0.5 / max( gv + gl, EPSILON );
|
|||
|
}
|
|||
|
float D_GGX( const in float alpha, const in float dotNH ) {
|
|||
|
float a2 = pow2( alpha );
|
|||
|
float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
|
|||
|
return RECIPROCAL_PI * a2 / pow2( denom );
|
|||
|
}
|
|||
|
#ifdef USE_ANISOTROPY
|
|||
|
float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {
|
|||
|
float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
|
|||
|
float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
|
|||
|
float v = 0.5 / ( gv + gl );
|
|||
|
return saturate(v);
|
|||
|
}
|
|||
|
float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
|
|||
|
float a2 = alphaT * alphaB;
|
|||
|
highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
|
|||
|
highp float v2 = dot( v, v );
|
|||
|
float w2 = a2 / v2;
|
|||
|
return RECIPROCAL_PI * a2 * pow2 ( w2 );
|
|||
|
}
|
|||
|
#endif
|
|||
|
#ifdef USE_CLEARCOAT
|
|||
|
vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
|
|||
|
vec3 f0 = material.clearcoatF0;
|
|||
|
float f90 = material.clearcoatF90;
|
|||
|
float roughness = material.clearcoatRoughness;
|
|||
|
float alpha = pow2( roughness );
|
|||
|
vec3 halfDir = normalize( lightDir + viewDir );
|
|||
|
float dotNL = saturate( dot( normal, lightDir ) );
|
|||
|
float dotNV = saturate( dot( normal, viewDir ) );
|
|||
|
float dotNH = saturate( dot( normal, halfDir ) );
|
|||
|
float dotVH = saturate( dot( viewDir, halfDir ) );
|
|||
|
vec3 F = F_Schlick( f0, f90, dotVH );
|
|||
|
float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
|
|||
|
float D = D_GGX( alpha, dotNH );
|
|||
|
return F * ( V * D );
|
|||
|
}
|
|||
|
#endif
|
|||
|
vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
|
|||
|
vec3 f0 = material.specularColor;
|
|||
|
float f90 = material.specularF90;
|
|||
|
float roughness = material.roughness;
|
|||
|
float alpha = pow2( roughness );
|
|||
|
vec3 halfDir = normalize( lightDir + viewDir );
|
|||
|
float dotNL = saturate( dot( normal, lightDir ) );
|
|||
|
float dotNV = saturate( dot( normal, viewDir ) );
|
|||
|
float dotNH = saturate( dot( normal, halfDir ) );
|
|||
|
float dotVH = saturate( dot( viewDir, halfDir ) );
|
|||
|
vec3 F = F_Schlick( f0, f90, dotVH );
|
|||
|
#ifdef USE_IRIDESCENCE
|
|||
|
F = mix( F, material.iridescenceFresnel, material.iridescence );
|
|||
|
#endif
|
|||
|
#ifdef USE_ANISOTROPY
|
|||
|
float dotTL = dot( material.anisotropyT, lightDir );
|
|||
|
float dotTV = dot( material.anisotropyT, viewDir );
|
|||
|
float dotTH = dot( material.anisotropyT, halfDir );
|
|||
|
float dotBL = dot( material.anisotropyB, lightDir );
|
|||
|
float dotBV = dot( material.anisotropyB, viewDir );
|
|||
|
float dotBH = dot( material.anisotropyB, halfDir );
|
|||
|
float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
|
|||
|
float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
|
|||
|
#else
|
|||
|
float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
|
|||
|
float D = D_GGX( alpha, dotNH );
|
|||
|
#endif
|
|||
|
return F * ( V * D );
|
|||
|
}
|
|||
|
vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
|
|||
|
const float LUT_SIZE = 64.0;
|
|||
|
const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
|
|||
|
const float LUT_BIAS = 0.5 / LUT_SIZE;
|
|||
|
float dotNV = saturate( dot( N, V ) );
|
|||
|
vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
|
|||
|
uv = uv * LUT_SCALE + LUT_BIAS;
|
|||
|
return uv;
|
|||
|
}
|
|||
|
float LTC_ClippedSphereFormFactor( const in vec3 f ) {
|
|||
|
float l = length( f );
|
|||
|
return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
|
|||
|
}
|
|||
|
vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
|
|||
|
float x = dot( v1, v2 );
|
|||
|
float y = abs( x );
|
|||
|
float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
|
|||
|
float b = 3.4175940 + ( 4.1616724 + y ) * y;
|
|||
|
float v = a / b;
|
|||
|
float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
|
|||
|
return cross( v1, v2 ) * theta_sintheta;
|
|||
|
}
|
|||
|
vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
|
|||
|
vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
|
|||
|
vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
|
|||
|
vec3 lightNormal = cross( v1, v2 );
|
|||
|
if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
|
|||
|
vec3 T1, T2;
|
|||
|
T1 = normalize( V - N * dot( V, N ) );
|
|||
|
T2 = - cross( N, T1 );
|
|||
|
mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
|
|||
|
vec3 coords[ 4 ];
|
|||
|
coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
|
|||
|
coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
|
|||
|
coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
|
|||
|
coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
|
|||
|
coords[ 0 ] = normalize( coords[ 0 ] );
|
|||
|
coords[ 1 ] = normalize( coords[ 1 ] );
|
|||
|
coords[ 2 ] = normalize( coords[ 2 ] );
|
|||
|
coords[ 3 ] = normalize( coords[ 3 ] );
|
|||
|
vec3 vectorFormFactor = vec3( 0.0 );
|
|||
|
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
|
|||
|
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
|
|||
|
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
|
|||
|
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
|
|||
|
float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
|
|||
|
return vec3( result );
|
|||
|
}
|
|||
|
#if defined( USE_SHEEN )
|
|||
|
float D_Charlie( float roughness, float dotNH ) {
|
|||
|
float alpha = pow2( roughness );
|
|||
|
float invAlpha = 1.0 / alpha;
|
|||
|
float cos2h = dotNH * dotNH;
|
|||
|
float sin2h = max( 1.0 - cos2h, 0.0078125 );
|
|||
|
return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
|
|||
|
}
|
|||
|
float V_Neubelt( float dotNV, float dotNL ) {
|
|||
|
return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
|
|||
|
}
|
|||
|
vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
|
|||
|
vec3 halfDir = normalize( lightDir + viewDir );
|
|||
|
float dotNL = saturate( dot( normal, lightDir ) );
|
|||
|
float dotNV = saturate( dot( normal, viewDir ) );
|
|||
|
float dotNH = saturate( dot( normal, halfDir ) );
|
|||
|
float D = D_Charlie( sheenRoughness, dotNH );
|
|||
|
float V = V_Neubelt( dotNV, dotNL );
|
|||
|
return sheenColor * ( D * V );
|
|||
|
}
|
|||
|
#endif
|
|||
|
float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
|
|||
|
float dotNV = saturate( dot( normal, viewDir ) );
|
|||
|
float r2 = roughness * roughness;
|
|||
|
float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
|
|||
|
float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
|
|||
|
float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
|
|||
|
return saturate( DG * RECIPROCAL_PI );
|
|||
|
}
|
|||
|
vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
|
|||
|
float dotNV = saturate( dot( normal, viewDir ) );
|
|||
|
const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
|
|||
|
const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
|
|||
|
vec4 r = roughness * c0 + c1;
|
|||
|
float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
|
|||
|
vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
|
|||
|
return fab;
|
|||
|
}
|
|||
|
vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
|
|||
|
vec2 fab = DFGApprox( normal, viewDir, roughness );
|
|||
|
return specularColor * fab.x + specularF90 * fab.y;
|
|||
|
}
|
|||
|
#ifdef USE_IRIDESCENCE
|
|||
|
void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
|
|||
|
#else
|
|||
|
void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
|
|||
|
#endif
|
|||
|
vec2 fab = DFGApprox( normal, viewDir, roughness );
|
|||
|
#ifdef USE_IRIDESCENCE
|
|||
|
vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
|
|||
|
#else
|
|||
|
vec3 Fr = specularColor;
|
|||
|
#endif
|
|||
|
vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
|
|||
|
float Ess = fab.x + fab.y;
|
|||
|
float Ems = 1.0 - Ess;
|
|||
|
vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
|
|||
|
singleScatter += FssEss;
|
|||
|
multiScatter += Fms * Ems;
|
|||
|
}
|
|||
|
#if NUM_RECT_AREA_LIGHTS > 0
|
|||
|
void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
|
|||
|
vec3 normal = geometryNormal;
|
|||
|
vec3 viewDir = geometryViewDir;
|
|||
|
vec3 position = geometryPosition;
|
|||
|
vec3 lightPos = rectAreaLight.position;
|
|||
|
vec3 halfWidth = rectAreaLight.halfWidth;
|
|||
|
vec3 halfHeight = rectAreaLight.halfHeight;
|
|||
|
vec3 lightColor = rectAreaLight.color;
|
|||
|
float roughness = material.roughness;
|
|||
|
vec3 rectCoords[ 4 ];
|
|||
|
rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
|
|||
|
rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
|
|||
|
rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
|
|||
|
vec2 uv = LTC_Uv( normal, viewDir, roughness );
|
|||
|
vec4 t1 = texture2D( ltc_1, uv );
|
|||
|
vec4 t2 = texture2D( ltc_2, uv );
|
|||
|
mat3 mInv = mat3(
|
|||
|
vec3( t1.x, 0, t1.y ),
|
|||
|
vec3( 0, 1, 0 ),
|
|||
|
vec3( t1.z, 0, t1.w )
|
|||
|
);
|
|||
|
vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
|
|||
|
reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
|
|||
|
reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
|
|||
|
}
|
|||
|
#endif
|
|||
|
void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
|
|||
|
float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
|
|||
|
vec3 irradiance = dotNL * directLight.color;
|
|||
|
#ifdef USE_CLEARCOAT
|
|||
|
float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
|
|||
|
vec3 ccIrradiance = dotNLcc * directLight.color;
|
|||
|
clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
|
|||
|
#endif
|
|||
|
#ifdef USE_SHEEN
|
|||
|
sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
|
|||
|
#endif
|
|||
|
reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
|
|||
|
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|||
|
}
|
|||
|
void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
|
|||
|
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|||
|
}
|
|||
|
void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
|
|||
|
#ifdef USE_CLEARCOAT
|
|||
|
clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
|
|||
|
#endif
|
|||
|
#ifdef USE_SHEEN
|
|||
|
sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
|
|||
|
#endif
|
|||
|
vec3 singleScattering = vec3( 0.0 );
|
|||
|
vec3 multiScattering = vec3( 0.0 );
|
|||
|
vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
|
|||
|
#ifdef USE_IRIDESCENCE
|
|||
|
computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
|
|||
|
#else
|
|||
|
computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
|
|||
|
#endif
|
|||
|
vec3 totalScattering = singleScattering + multiScattering;
|
|||
|
vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
|
|||
|
reflectedLight.indirectSpecular += radiance * singleScattering;
|
|||
|
reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
|
|||
|
reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
|
|||
|
}
|
|||
|
#define RE_Direct RE_Direct_Physical
|
|||
|
#define RE_Direct_RectArea RE_Direct_RectArea_Physical
|
|||
|
#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical
|
|||
|
#define RE_IndirectSpecular RE_IndirectSpecular_Physical
|
|||
|
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
|
|||
|
return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
|
|||
|
}`,CNt=`
|
|||
|
vec3 geometryPosition = - vViewPosition;
|
|||
|
vec3 geometryNormal = normal;
|
|||
|
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
|
|||
|
vec3 geometryClearcoatNormal = vec3( 0.0 );
|
|||
|
#ifdef USE_CLEARCOAT
|
|||
|
geometryClearcoatNormal = clearcoatNormal;
|
|||
|
#endif
|
|||
|
#ifdef USE_IRIDESCENCE
|
|||
|
float dotNVi = saturate( dot( normal, geometryViewDir ) );
|
|||
|
if ( material.iridescenceThickness == 0.0 ) {
|
|||
|
material.iridescence = 0.0;
|
|||
|
} else {
|
|||
|
material.iridescence = saturate( material.iridescence );
|
|||
|
}
|
|||
|
if ( material.iridescence > 0.0 ) {
|
|||
|
material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
|
|||
|
material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
|
|||
|
}
|
|||
|
#endif
|
|||
|
IncidentLight directLight;
|
|||
|
#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
|
|||
|
PointLight pointLight;
|
|||
|
#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
|
|||
|
PointLightShadow pointLightShadow;
|
|||
|
#endif
|
|||
|
#pragma unroll_loop_start
|
|||
|
for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
|
|||
|
pointLight = pointLights[ i ];
|
|||
|
getPointLightInfo( pointLight, geometryPosition, directLight );
|
|||
|
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
|
|||
|
pointLightShadow = pointLightShadows[ i ];
|
|||
|
directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
|
|||
|
#endif
|
|||
|
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|||
|
}
|
|||
|
#pragma unroll_loop_end
|
|||
|
#endif
|
|||
|
#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
|
|||
|
SpotLight spotLight;
|
|||
|
vec4 spotColor;
|
|||
|
vec3 spotLightCoord;
|
|||
|
bool inSpotLightMap;
|
|||
|
#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
|
|||
|
SpotLightShadow spotLightShadow;
|
|||
|
#endif
|
|||
|
#pragma unroll_loop_start
|
|||
|
for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
|
|||
|
spotLight = spotLights[ i ];
|
|||
|
getSpotLightInfo( spotLight, geometryPosition, directLight );
|
|||
|
#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
|
|||
|
#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
|
|||
|
#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
|
|||
|
#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
|
|||
|
#else
|
|||
|
#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
|
|||
|
#endif
|
|||
|
#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
|
|||
|
spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
|
|||
|
inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
|
|||
|
spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
|
|||
|
directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
|
|||
|
#endif
|
|||
|
#undef SPOT_LIGHT_MAP_INDEX
|
|||
|
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
|
|||
|
spotLightShadow = spotLightShadows[ i ];
|
|||
|
directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
|
|||
|
#endif
|
|||
|
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|||
|
}
|
|||
|
#pragma unroll_loop_end
|
|||
|
#endif
|
|||
|
#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
|
|||
|
DirectionalLight directionalLight;
|
|||
|
#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
|
|||
|
DirectionalLightShadow directionalLightShadow;
|
|||
|
#endif
|
|||
|
#pragma unroll_loop_start
|
|||
|
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
|
|||
|
directionalLight = directionalLights[ i ];
|
|||
|
getDirectionalLightInfo( directionalLight, directLight );
|
|||
|
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
|
|||
|
directionalLightShadow = directionalLightShadows[ i ];
|
|||
|
directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
|
|||
|
#endif
|
|||
|
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|||
|
}
|
|||
|
#pragma unroll_loop_end
|
|||
|
#endif
|
|||
|
#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
|
|||
|
RectAreaLight rectAreaLight;
|
|||
|
#pragma unroll_loop_start
|
|||
|
for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
|
|||
|
rectAreaLight = rectAreaLights[ i ];
|
|||
|
RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|||
|
}
|
|||
|
#pragma unroll_loop_end
|
|||
|
#endif
|
|||
|
#if defined( RE_IndirectDiffuse )
|
|||
|
vec3 iblIrradiance = vec3( 0.0 );
|
|||
|
vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
|
|||
|
#if defined( USE_LIGHT_PROBES )
|
|||
|
irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
|
|||
|
#endif
|
|||
|
#if ( NUM_HEMI_LIGHTS > 0 )
|
|||
|
#pragma unroll_loop_start
|
|||
|
for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
|
|||
|
irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
|
|||
|
}
|
|||
|
#pragma unroll_loop_end
|
|||
|
#endif
|
|||
|
#endif
|
|||
|
#if defined( RE_IndirectSpecular )
|
|||
|
vec3 radiance = vec3( 0.0 );
|
|||
|
vec3 clearcoatRadiance = vec3( 0.0 );
|
|||
|
#endif`,wNt=`#if defined( RE_IndirectDiffuse )
|
|||
|
#ifdef USE_LIGHTMAP
|
|||
|
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
|
|||
|
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
|
|||
|
irradiance += lightMapIrradiance;
|
|||
|
#endif
|
|||
|
#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
|
|||
|
iblIrradiance += getIBLIrradiance( geometryNormal );
|
|||
|
#endif
|
|||
|
#endif
|
|||
|
#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
|
|||
|
#ifdef USE_ANISOTROPY
|
|||
|
radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
|
|||
|
#else
|
|||
|
radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
|
|||
|
#endif
|
|||
|
#ifdef USE_CLEARCOAT
|
|||
|
clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
|
|||
|
#endif
|
|||
|
#endif`,RNt=`#if defined( RE_IndirectDiffuse )
|
|||
|
RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|||
|
#endif
|
|||
|
#if defined( RE_IndirectSpecular )
|
|||
|
RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|||
|
#endif`,ANt=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
|
|||
|
gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
|
|||
|
#endif`,NNt=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
|
|||
|
uniform float logDepthBufFC;
|
|||
|
varying float vFragDepth;
|
|||
|
varying float vIsPerspective;
|
|||
|
#endif`,ONt=`#ifdef USE_LOGDEPTHBUF
|
|||
|
#ifdef USE_LOGDEPTHBUF_EXT
|
|||
|
varying float vFragDepth;
|
|||
|
varying float vIsPerspective;
|
|||
|
#else
|
|||
|
uniform float logDepthBufFC;
|
|||
|
#endif
|
|||
|
#endif`,INt=`#ifdef USE_LOGDEPTHBUF
|
|||
|
#ifdef USE_LOGDEPTHBUF_EXT
|
|||
|
vFragDepth = 1.0 + gl_Position.w;
|
|||
|
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
|
|||
|
#else
|
|||
|
if ( isPerspectiveMatrix( projectionMatrix ) ) {
|
|||
|
gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;
|
|||
|
gl_Position.z *= gl_Position.w;
|
|||
|
}
|
|||
|
#endif
|
|||
|
#endif`,MNt=`#ifdef USE_MAP
|
|||
|
vec4 sampledDiffuseColor = texture2D( map, vMapUv );
|
|||
|
#ifdef DECODE_VIDEO_TEXTURE
|
|||
|
sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );
|
|||
|
|
|||
|
#endif
|
|||
|
diffuseColor *= sampledDiffuseColor;
|
|||
|
#endif`,kNt=`#ifdef USE_MAP
|
|||
|
uniform sampler2D map;
|
|||
|
#endif`,DNt=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
|
|||
|
#if defined( USE_POINTS_UV )
|
|||
|
vec2 uv = vUv;
|
|||
|
#else
|
|||
|
vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#endif
|
|||
|
#ifdef USE_MAP
|
|||
|
diffuseColor *= texture2D( map, uv );
|
|||
|
#endif
|
|||
|
#ifdef USE_ALPHAMAP
|
|||
|
diffuseColor.a *= texture2D( alphaMap, uv ).g;
|
|||
|
#endif`,LNt=`#if defined( USE_POINTS_UV )
|
|||
|
varying vec2 vUv;
|
|||
|
#else
|
|||
|
#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
|
|||
|
uniform mat3 uvTransform;
|
|||
|
#endif
|
|||
|
#endif
|
|||
|
#ifdef USE_MAP
|
|||
|
uniform sampler2D map;
|
|||
|
#endif
|
|||
|
#ifdef USE_ALPHAMAP
|
|||
|
uniform sampler2D alphaMap;
|
|||
|
#endif`,PNt=`float metalnessFactor = metalness;
|
|||
|
#ifdef USE_METALNESSMAP
|
|||
|
vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
|
|||
|
metalnessFactor *= texelMetalness.b;
|
|||
|
#endif`,UNt=`#ifdef USE_METALNESSMAP
|
|||
|
uniform sampler2D metalnessMap;
|
|||
|
#endif`,FNt=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )
|
|||
|
vColor *= morphTargetBaseInfluence;
|
|||
|
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|||
|
#if defined( USE_COLOR_ALPHA )
|
|||
|
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
|
|||
|
#elif defined( USE_COLOR )
|
|||
|
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
|
|||
|
#endif
|
|||
|
}
|
|||
|
#endif`,BNt=`#ifdef USE_MORPHNORMALS
|
|||
|
objectNormal *= morphTargetBaseInfluence;
|
|||
|
#ifdef MORPHTARGETS_TEXTURE
|
|||
|
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|||
|
if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
|
|||
|
}
|
|||
|
#else
|
|||
|
objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];
|
|||
|
objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];
|
|||
|
objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];
|
|||
|
objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];
|
|||
|
#endif
|
|||
|
#endif`,GNt=`#ifdef USE_MORPHTARGETS
|
|||
|
uniform float morphTargetBaseInfluence;
|
|||
|
#ifdef MORPHTARGETS_TEXTURE
|
|||
|
uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
|
|||
|
uniform sampler2DArray morphTargetsTexture;
|
|||
|
uniform ivec2 morphTargetsTextureSize;
|
|||
|
vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
|
|||
|
int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
|
|||
|
int y = texelIndex / morphTargetsTextureSize.x;
|
|||
|
int x = texelIndex - y * morphTargetsTextureSize.x;
|
|||
|
ivec3 morphUV = ivec3( x, y, morphTargetIndex );
|
|||
|
return texelFetch( morphTargetsTexture, morphUV, 0 );
|
|||
|
}
|
|||
|
#else
|
|||
|
#ifndef USE_MORPHNORMALS
|
|||
|
uniform float morphTargetInfluences[ 8 ];
|
|||
|
#else
|
|||
|
uniform float morphTargetInfluences[ 4 ];
|
|||
|
#endif
|
|||
|
#endif
|
|||
|
#endif`,VNt=`#ifdef USE_MORPHTARGETS
|
|||
|
transformed *= morphTargetBaseInfluence;
|
|||
|
#ifdef MORPHTARGETS_TEXTURE
|
|||
|
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|||
|
if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
|
|||
|
}
|
|||
|
#else
|
|||
|
transformed += morphTarget0 * morphTargetInfluences[ 0 ];
|
|||
|
transformed += morphTarget1 * morphTargetInfluences[ 1 ];
|
|||
|
transformed += morphTarget2 * morphTargetInfluences[ 2 ];
|
|||
|
transformed += morphTarget3 * morphTargetInfluences[ 3 ];
|
|||
|
#ifndef USE_MORPHNORMALS
|
|||
|
transformed += morphTarget4 * morphTargetInfluences[ 4 ];
|
|||
|
transformed += morphTarget5 * morphTargetInfluences[ 5 ];
|
|||
|
transformed += morphTarget6 * morphTargetInfluences[ 6 ];
|
|||
|
transformed += morphTarget7 * morphTargetInfluences[ 7 ];
|
|||
|
#endif
|
|||
|
#endif
|
|||
|
#endif`,zNt=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
|
|||
|
#ifdef FLAT_SHADED
|
|||
|
vec3 fdx = dFdx( vViewPosition );
|
|||
|
vec3 fdy = dFdy( vViewPosition );
|
|||
|
vec3 normal = normalize( cross( fdx, fdy ) );
|
|||
|
#else
|
|||
|
vec3 normal = normalize( vNormal );
|
|||
|
#ifdef DOUBLE_SIDED
|
|||
|
normal *= faceDirection;
|
|||
|
#endif
|
|||
|
#endif
|
|||
|
#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
|
|||
|
#ifdef USE_TANGENT
|
|||
|
mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
|
|||
|
#else
|
|||
|
mat3 tbn = getTangentFrame( - vViewPosition, normal,
|
|||
|
#if defined( USE_NORMALMAP )
|
|||
|
vNormalMapUv
|
|||
|
#elif defined( USE_CLEARCOAT_NORMALMAP )
|
|||
|
vClearcoatNormalMapUv
|
|||
|
#else
|
|||
|
vUv
|
|||
|
#endif
|
|||
|
);
|
|||
|
#endif
|
|||
|
#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
|
|||
|
tbn[0] *= faceDirection;
|
|||
|
tbn[1] *= faceDirection;
|
|||
|
#endif
|
|||
|
#endif
|
|||
|
#ifdef USE_CLEARCOAT_NORMALMAP
|
|||
|
#ifdef USE_TANGENT
|
|||
|
mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
|
|||
|
#else
|
|||
|
mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
|
|||
|
#endif
|
|||
|
#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
|
|||
|
tbn2[0] *= faceDirection;
|
|||
|
tbn2[1] *= faceDirection;
|
|||
|
#endif
|
|||
|
#endif
|
|||
|
vec3 nonPerturbedNormal = normal;`,HNt=`#ifdef USE_NORMALMAP_OBJECTSPACE
|
|||
|
normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
|
|||
|
#ifdef FLIP_SIDED
|
|||
|
normal = - normal;
|
|||
|
#endif
|
|||
|
#ifdef DOUBLE_SIDED
|
|||
|
normal = normal * faceDirection;
|
|||
|
#endif
|
|||
|
normal = normalize( normalMatrix * normal );
|
|||
|
#elif defined( USE_NORMALMAP_TANGENTSPACE )
|
|||
|
vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
|
|||
|
mapN.xy *= normalScale;
|
|||
|
normal = normalize( tbn * mapN );
|
|||
|
#elif defined( USE_BUMPMAP )
|
|||
|
normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
|
|||
|
#endif`,qNt=`#ifndef FLAT_SHADED
|
|||
|
varying vec3 vNormal;
|
|||
|
#ifdef USE_TANGENT
|
|||
|
varying vec3 vTangent;
|
|||
|
varying vec3 vBitangent;
|
|||
|
#endif
|
|||
|
#endif`,$Nt=`#ifndef FLAT_SHADED
|
|||
|
varying vec3 vNormal;
|
|||
|
#ifdef USE_TANGENT
|
|||
|
varying vec3 vTangent;
|
|||
|
varying vec3 vBitangent;
|
|||
|
#endif
|
|||
|
#endif`,YNt=`#ifndef FLAT_SHADED
|
|||
|
vNormal = normalize( transformedNormal );
|
|||
|
#ifdef USE_TANGENT
|
|||
|
vTangent = normalize( transformedTangent );
|
|||
|
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
|
|||
|
#endif
|
|||
|
#endif`,WNt=`#ifdef USE_NORMALMAP
|
|||
|
uniform sampler2D normalMap;
|
|||
|
uniform vec2 normalScale;
|
|||
|
#endif
|
|||
|
#ifdef USE_NORMALMAP_OBJECTSPACE
|
|||
|
uniform mat3 normalMatrix;
|
|||
|
#endif
|
|||
|
#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
|
|||
|
mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
|
|||
|
vec3 q0 = dFdx( eye_pos.xyz );
|
|||
|
vec3 q1 = dFdy( eye_pos.xyz );
|
|||
|
vec2 st0 = dFdx( uv.st );
|
|||
|
vec2 st1 = dFdy( uv.st );
|
|||
|
vec3 N = surf_norm;
|
|||
|
vec3 q1perp = cross( q1, N );
|
|||
|
vec3 q0perp = cross( N, q0 );
|
|||
|
vec3 T = q1perp * st0.x + q0perp * st1.x;
|
|||
|
vec3 B = q1perp * st0.y + q0perp * st1.y;
|
|||
|
float det = max( dot( T, T ), dot( B, B ) );
|
|||
|
float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
|
|||
|
return mat3( T * scale, B * scale, N );
|
|||
|
}
|
|||
|
#endif`,KNt=`#ifdef USE_CLEARCOAT
|
|||
|
vec3 clearcoatNormal = nonPerturbedNormal;
|
|||
|
#endif`,jNt=`#ifdef USE_CLEARCOAT_NORMALMAP
|
|||
|
vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
|
|||
|
clearcoatMapN.xy *= clearcoatNormalScale;
|
|||
|
clearcoatNormal = normalize( tbn2 * clearcoatMapN );
|
|||
|
#endif`,QNt=`#ifdef USE_CLEARCOATMAP
|
|||
|
uniform sampler2D clearcoatMap;
|
|||
|
#endif
|
|||
|
#ifdef USE_CLEARCOAT_NORMALMAP
|
|||
|
uniform sampler2D clearcoatNormalMap;
|
|||
|
uniform vec2 clearcoatNormalScale;
|
|||
|
#endif
|
|||
|
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|||
|
uniform sampler2D clearcoatRoughnessMap;
|
|||
|
#endif`,XNt=`#ifdef USE_IRIDESCENCEMAP
|
|||
|
uniform sampler2D iridescenceMap;
|
|||
|
#endif
|
|||
|
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
|||
|
uniform sampler2D iridescenceThicknessMap;
|
|||
|
#endif`,ZNt=`#ifdef OPAQUE
|
|||
|
diffuseColor.a = 1.0;
|
|||
|
#endif
|
|||
|
#ifdef USE_TRANSMISSION
|
|||
|
diffuseColor.a *= material.transmissionAlpha;
|
|||
|
#endif
|
|||
|
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,JNt=`vec3 packNormalToRGB( const in vec3 normal ) {
|
|||
|
return normalize( normal ) * 0.5 + 0.5;
|
|||
|
}
|
|||
|
vec3 unpackRGBToNormal( const in vec3 rgb ) {
|
|||
|
return 2.0 * rgb.xyz - 1.0;
|
|||
|
}
|
|||
|
const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;
|
|||
|
const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );
|
|||
|
const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );
|
|||
|
const float ShiftRight8 = 1. / 256.;
|
|||
|
vec4 packDepthToRGBA( const in float v ) {
|
|||
|
vec4 r = vec4( fract( v * PackFactors ), v );
|
|||
|
r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale;
|
|||
|
}
|
|||
|
float unpackRGBAToDepth( const in vec4 v ) {
|
|||
|
return dot( v, UnpackFactors );
|
|||
|
}
|
|||
|
vec2 packDepthToRG( in highp float v ) {
|
|||
|
return packDepthToRGBA( v ).yx;
|
|||
|
}
|
|||
|
float unpackRGToDepth( const in highp vec2 v ) {
|
|||
|
return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );
|
|||
|
}
|
|||
|
vec4 pack2HalfToRGBA( vec2 v ) {
|
|||
|
vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
|
|||
|
return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
|
|||
|
}
|
|||
|
vec2 unpackRGBATo2Half( vec4 v ) {
|
|||
|
return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
|
|||
|
}
|
|||
|
float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
|
|||
|
return ( viewZ + near ) / ( near - far );
|
|||
|
}
|
|||
|
float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
|
|||
|
return depth * ( near - far ) - near;
|
|||
|
}
|
|||
|
float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
|
|||
|
return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
|
|||
|
}
|
|||
|
float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
|
|||
|
return ( near * far ) / ( ( far - near ) * depth - far );
|
|||
|
}`,eOt=`#ifdef PREMULTIPLIED_ALPHA
|
|||
|
gl_FragColor.rgb *= gl_FragColor.a;
|
|||
|
#endif`,tOt=`vec4 mvPosition = vec4( transformed, 1.0 );
|
|||
|
#ifdef USE_BATCHING
|
|||
|
mvPosition = batchingMatrix * mvPosition;
|
|||
|
#endif
|
|||
|
#ifdef USE_INSTANCING
|
|||
|
mvPosition = instanceMatrix * mvPosition;
|
|||
|
#endif
|
|||
|
mvPosition = modelViewMatrix * mvPosition;
|
|||
|
gl_Position = projectionMatrix * mvPosition;`,nOt=`#ifdef DITHERING
|
|||
|
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
|
|||
|
#endif`,sOt=`#ifdef DITHERING
|
|||
|
vec3 dithering( vec3 color ) {
|
|||
|
float grid_position = rand( gl_FragCoord.xy );
|
|||
|
vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
|
|||
|
dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
|
|||
|
return color + dither_shift_RGB;
|
|||
|
}
|
|||
|
#endif`,iOt=`float roughnessFactor = roughness;
|
|||
|
#ifdef USE_ROUGHNESSMAP
|
|||
|
vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
|
|||
|
roughnessFactor *= texelRoughness.g;
|
|||
|
#endif`,rOt=`#ifdef USE_ROUGHNESSMAP
|
|||
|
uniform sampler2D roughnessMap;
|
|||
|
#endif`,oOt=`#if NUM_SPOT_LIGHT_COORDS > 0
|
|||
|
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
|
|||
|
#endif
|
|||
|
#if NUM_SPOT_LIGHT_MAPS > 0
|
|||
|
uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
|
|||
|
#endif
|
|||
|
#ifdef USE_SHADOWMAP
|
|||
|
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|||
|
uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
|
|||
|
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
|
|||
|
struct DirectionalLightShadow {
|
|||
|
float shadowBias;
|
|||
|
float shadowNormalBias;
|
|||
|
float shadowRadius;
|
|||
|
vec2 shadowMapSize;
|
|||
|
};
|
|||
|
uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
|
|||
|
#endif
|
|||
|
#if NUM_SPOT_LIGHT_SHADOWS > 0
|
|||
|
uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
|
|||
|
struct SpotLightShadow {
|
|||
|
float shadowBias;
|
|||
|
float shadowNormalBias;
|
|||
|
float shadowRadius;
|
|||
|
vec2 shadowMapSize;
|
|||
|
};
|
|||
|
uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
|
|||
|
#endif
|
|||
|
#if NUM_POINT_LIGHT_SHADOWS > 0
|
|||
|
uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
|
|||
|
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
|
|||
|
struct PointLightShadow {
|
|||
|
float shadowBias;
|
|||
|
float shadowNormalBias;
|
|||
|
float shadowRadius;
|
|||
|
vec2 shadowMapSize;
|
|||
|
float shadowCameraNear;
|
|||
|
float shadowCameraFar;
|
|||
|
};
|
|||
|
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
|
|||
|
#endif
|
|||
|
float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
|
|||
|
return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
|
|||
|
}
|
|||
|
vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
|
|||
|
return unpackRGBATo2Half( texture2D( shadow, uv ) );
|
|||
|
}
|
|||
|
float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
|
|||
|
float occlusion = 1.0;
|
|||
|
vec2 distribution = texture2DDistribution( shadow, uv );
|
|||
|
float hard_shadow = step( compare , distribution.x );
|
|||
|
if (hard_shadow != 1.0 ) {
|
|||
|
float distance = compare - distribution.x ;
|
|||
|
float variance = max( 0.00000, distribution.y * distribution.y );
|
|||
|
float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );
|
|||
|
}
|
|||
|
return occlusion;
|
|||
|
}
|
|||
|
float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
|
|||
|
float shadow = 1.0;
|
|||
|
shadowCoord.xyz /= shadowCoord.w;
|
|||
|
shadowCoord.z += shadowBias;
|
|||
|
bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
|
|||
|
bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
|
|||
|
if ( frustumTest ) {
|
|||
|
#if defined( SHADOWMAP_TYPE_PCF )
|
|||
|
vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
|
|||
|
float dx0 = - texelSize.x * shadowRadius;
|
|||
|
float dy0 = - texelSize.y * shadowRadius;
|
|||
|
float dx1 = + texelSize.x * shadowRadius;
|
|||
|
float dy1 = + texelSize.y * shadowRadius;
|
|||
|
float dx2 = dx0 / 2.0;
|
|||
|
float dy2 = dy0 / 2.0;
|
|||
|
float dx3 = dx1 / 2.0;
|
|||
|
float dy3 = dy1 / 2.0;
|
|||
|
shadow = (
|
|||
|
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
|
|||
|
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
|
|||
|
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
|
|||
|
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
|
|||
|
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
|
|||
|
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
|
|||
|
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
|
|||
|
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
|
|||
|
texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
|
|||
|
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
|
|||
|
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
|
|||
|
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
|
|||
|
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
|
|||
|
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
|
|||
|
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
|
|||
|
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
|
|||
|
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
|
|||
|
) * ( 1.0 / 17.0 );
|
|||
|
#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
|
|||
|
vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
|
|||
|
float dx = texelSize.x;
|
|||
|
float dy = texelSize.y;
|
|||
|
vec2 uv = shadowCoord.xy;
|
|||
|
vec2 f = fract( uv * shadowMapSize + 0.5 );
|
|||
|
uv -= f * texelSize;
|
|||
|
shadow = (
|
|||
|
texture2DCompare( shadowMap, uv, shadowCoord.z ) +
|
|||
|
texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
|
|||
|
texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
|
|||
|
texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
|
|||
|
mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
|
|||
|
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
|
|||
|
f.x ) +
|
|||
|
mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
|
|||
|
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
|
|||
|
f.x ) +
|
|||
|
mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
|
|||
|
texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
|
|||
|
f.y ) +
|
|||
|
mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
|
|||
|
texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
|
|||
|
f.y ) +
|
|||
|
mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
|
|||
|
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
|
|||
|
f.x ),
|
|||
|
mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
|
|||
|
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
|
|||
|
f.x ),
|
|||
|
f.y )
|
|||
|
) * ( 1.0 / 9.0 );
|
|||
|
#elif defined( SHADOWMAP_TYPE_VSM )
|
|||
|
shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
|
|||
|
#else
|
|||
|
shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
|
|||
|
#endif
|
|||
|
}
|
|||
|
return shadow;
|
|||
|
}
|
|||
|
vec2 cubeToUV( vec3 v, float texelSizeY ) {
|
|||
|
vec3 absV = abs( v );
|
|||
|
float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
|
|||
|
absV *= scaleToCube;
|
|||
|
v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
|
|||
|
vec2 planar = v.xy;
|
|||
|
float almostATexel = 1.5 * texelSizeY;
|
|||
|
float almostOne = 1.0 - almostATexel;
|
|||
|
if ( absV.z >= almostOne ) {
|
|||
|
if ( v.z > 0.0 )
|
|||
|
planar.x = 4.0 - v.x;
|
|||
|
} else if ( absV.x >= almostOne ) {
|
|||
|
float signX = sign( v.x );
|
|||
|
planar.x = v.z * signX + 2.0 * signX;
|
|||
|
} else if ( absV.y >= almostOne ) {
|
|||
|
float signY = sign( v.y );
|
|||
|
planar.x = v.x + 2.0 * signY + 2.0;
|
|||
|
planar.y = v.z * signY - 2.0;
|
|||
|
}
|
|||
|
return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
|
|||
|
}
|
|||
|
float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
|
|||
|
vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
|
|||
|
vec3 lightToPosition = shadowCoord.xyz;
|
|||
|
float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;
|
|||
|
vec3 bd3D = normalize( lightToPosition );
|
|||
|
#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
|
|||
|
vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
|
|||
|
return (
|
|||
|
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
|
|||
|
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
|
|||
|
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
|
|||
|
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
|
|||
|
texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
|
|||
|
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
|
|||
|
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
|
|||
|
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
|
|||
|
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
|
|||
|
) * ( 1.0 / 9.0 );
|
|||
|
#else
|
|||
|
return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
|
|||
|
#endif
|
|||
|
}
|
|||
|
#endif`,aOt=`#if NUM_SPOT_LIGHT_COORDS > 0
|
|||
|
uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
|
|||
|
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
|
|||
|
#endif
|
|||
|
#ifdef USE_SHADOWMAP
|
|||
|
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|||
|
uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
|
|||
|
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
|
|||
|
struct DirectionalLightShadow {
|
|||
|
float shadowBias;
|
|||
|
float shadowNormalBias;
|
|||
|
float shadowRadius;
|
|||
|
vec2 shadowMapSize;
|
|||
|
};
|
|||
|
uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
|
|||
|
#endif
|
|||
|
#if NUM_SPOT_LIGHT_SHADOWS > 0
|
|||
|
struct SpotLightShadow {
|
|||
|
float shadowBias;
|
|||
|
float shadowNormalBias;
|
|||
|
float shadowRadius;
|
|||
|
vec2 shadowMapSize;
|
|||
|
};
|
|||
|
uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
|
|||
|
#endif
|
|||
|
#if NUM_POINT_LIGHT_SHADOWS > 0
|
|||
|
uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
|
|||
|
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
|
|||
|
struct PointLightShadow {
|
|||
|
float shadowBias;
|
|||
|
float shadowNormalBias;
|
|||
|
float shadowRadius;
|
|||
|
vec2 shadowMapSize;
|
|||
|
float shadowCameraNear;
|
|||
|
float shadowCameraFar;
|
|||
|
};
|
|||
|
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
|
|||
|
#endif
|
|||
|
#endif`,lOt=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
|
|||
|
vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
|
|||
|
vec4 shadowWorldPosition;
|
|||
|
#endif
|
|||
|
#if defined( USE_SHADOWMAP )
|
|||
|
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|||
|
#pragma unroll_loop_start
|
|||
|
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
|
|||
|
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
|
|||
|
vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
|
|||
|
}
|
|||
|
#pragma unroll_loop_end
|
|||
|
#endif
|
|||
|
#if NUM_POINT_LIGHT_SHADOWS > 0
|
|||
|
#pragma unroll_loop_start
|
|||
|
for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
|
|||
|
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
|
|||
|
vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
|
|||
|
}
|
|||
|
#pragma unroll_loop_end
|
|||
|
#endif
|
|||
|
#endif
|
|||
|
#if NUM_SPOT_LIGHT_COORDS > 0
|
|||
|
#pragma unroll_loop_start
|
|||
|
for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
|
|||
|
shadowWorldPosition = worldPosition;
|
|||
|
#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
|
|||
|
shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
|
|||
|
#endif
|
|||
|
vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
|
|||
|
}
|
|||
|
#pragma unroll_loop_end
|
|||
|
#endif`,cOt=`float getShadowMask() {
|
|||
|
float shadow = 1.0;
|
|||
|
#ifdef USE_SHADOWMAP
|
|||
|
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|||
|
DirectionalLightShadow directionalLight;
|
|||
|
#pragma unroll_loop_start
|
|||
|
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
|
|||
|
directionalLight = directionalLightShadows[ i ];
|
|||
|
shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
|
|||
|
}
|
|||
|
#pragma unroll_loop_end
|
|||
|
#endif
|
|||
|
#if NUM_SPOT_LIGHT_SHADOWS > 0
|
|||
|
SpotLightShadow spotLight;
|
|||
|
#pragma unroll_loop_start
|
|||
|
for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
|
|||
|
spotLight = spotLightShadows[ i ];
|
|||
|
shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
|
|||
|
}
|
|||
|
#pragma unroll_loop_end
|
|||
|
#endif
|
|||
|
#if NUM_POINT_LIGHT_SHADOWS > 0
|
|||
|
PointLightShadow pointLight;
|
|||
|
#pragma unroll_loop_start
|
|||
|
for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
|
|||
|
pointLight = pointLightShadows[ i ];
|
|||
|
shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
|
|||
|
}
|
|||
|
#pragma unroll_loop_end
|
|||
|
#endif
|
|||
|
#endif
|
|||
|
return shadow;
|
|||
|
}`,dOt=`#ifdef USE_SKINNING
|
|||
|
mat4 boneMatX = getBoneMatrix( skinIndex.x );
|
|||
|
mat4 boneMatY = getBoneMatrix( skinIndex.y );
|
|||
|
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
|
|||
|
mat4 boneMatW = getBoneMatrix( skinIndex.w );
|
|||
|
#endif`,uOt=`#ifdef USE_SKINNING
|
|||
|
uniform mat4 bindMatrix;
|
|||
|
uniform mat4 bindMatrixInverse;
|
|||
|
uniform highp sampler2D boneTexture;
|
|||
|
mat4 getBoneMatrix( const in float i ) {
|
|||
|
int size = textureSize( boneTexture, 0 ).x;
|
|||
|
int j = int( i ) * 4;
|
|||
|
int x = j % size;
|
|||
|
int y = j / size;
|
|||
|
vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
|
|||
|
vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
|
|||
|
vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
|
|||
|
vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
|
|||
|
return mat4( v1, v2, v3, v4 );
|
|||
|
}
|
|||
|
#endif`,pOt=`#ifdef USE_SKINNING
|
|||
|
vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
|
|||
|
vec4 skinned = vec4( 0.0 );
|
|||
|
skinned += boneMatX * skinVertex * skinWeight.x;
|
|||
|
skinned += boneMatY * skinVertex * skinWeight.y;
|
|||
|
skinned += boneMatZ * skinVertex * skinWeight.z;
|
|||
|
skinned += boneMatW * skinVertex * skinWeight.w;
|
|||
|
transformed = ( bindMatrixInverse * skinned ).xyz;
|
|||
|
#endif`,_Ot=`#ifdef USE_SKINNING
|
|||
|
mat4 skinMatrix = mat4( 0.0 );
|
|||
|
skinMatrix += skinWeight.x * boneMatX;
|
|||
|
skinMatrix += skinWeight.y * boneMatY;
|
|||
|
skinMatrix += skinWeight.z * boneMatZ;
|
|||
|
skinMatrix += skinWeight.w * boneMatW;
|
|||
|
skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
|
|||
|
objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
|
|||
|
#ifdef USE_TANGENT
|
|||
|
objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
|
|||
|
#endif
|
|||
|
#endif`,hOt=`float specularStrength;
|
|||
|
#ifdef USE_SPECULARMAP
|
|||
|
vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
|
|||
|
specularStrength = texelSpecular.r;
|
|||
|
#else
|
|||
|
specularStrength = 1.0;
|
|||
|
#endif`,fOt=`#ifdef USE_SPECULARMAP
|
|||
|
uniform sampler2D specularMap;
|
|||
|
#endif`,mOt=`#if defined( TONE_MAPPING )
|
|||
|
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
|
|||
|
#endif`,gOt=`#ifndef saturate
|
|||
|
#define saturate( a ) clamp( a, 0.0, 1.0 )
|
|||
|
#endif
|
|||
|
uniform float toneMappingExposure;
|
|||
|
vec3 LinearToneMapping( vec3 color ) {
|
|||
|
return saturate( toneMappingExposure * color );
|
|||
|
}
|
|||
|
vec3 ReinhardToneMapping( vec3 color ) {
|
|||
|
color *= toneMappingExposure;
|
|||
|
return saturate( color / ( vec3( 1.0 ) + color ) );
|
|||
|
}
|
|||
|
vec3 OptimizedCineonToneMapping( vec3 color ) {
|
|||
|
color *= toneMappingExposure;
|
|||
|
color = max( vec3( 0.0 ), color - 0.004 );
|
|||
|
return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
|
|||
|
}
|
|||
|
vec3 RRTAndODTFit( vec3 v ) {
|
|||
|
vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
|
|||
|
vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
|
|||
|
return a / b;
|
|||
|
}
|
|||
|
vec3 ACESFilmicToneMapping( vec3 color ) {
|
|||
|
const mat3 ACESInputMat = mat3(
|
|||
|
vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),
|
|||
|
vec3( 0.04823, 0.01566, 0.83777 )
|
|||
|
);
|
|||
|
const mat3 ACESOutputMat = mat3(
|
|||
|
vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),
|
|||
|
vec3( -0.07367, -0.00605, 1.07602 )
|
|||
|
);
|
|||
|
color *= toneMappingExposure / 0.6;
|
|||
|
color = ACESInputMat * color;
|
|||
|
color = RRTAndODTFit( color );
|
|||
|
color = ACESOutputMat * color;
|
|||
|
return saturate( color );
|
|||
|
}
|
|||
|
vec3 CustomToneMapping( vec3 color ) { return color; }`,bOt=`#ifdef USE_TRANSMISSION
|
|||
|
material.transmission = transmission;
|
|||
|
material.transmissionAlpha = 1.0;
|
|||
|
material.thickness = thickness;
|
|||
|
material.attenuationDistance = attenuationDistance;
|
|||
|
material.attenuationColor = attenuationColor;
|
|||
|
#ifdef USE_TRANSMISSIONMAP
|
|||
|
material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
|
|||
|
#endif
|
|||
|
#ifdef USE_THICKNESSMAP
|
|||
|
material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
|
|||
|
#endif
|
|||
|
vec3 pos = vWorldPosition;
|
|||
|
vec3 v = normalize( cameraPosition - pos );
|
|||
|
vec3 n = inverseTransformDirection( normal, viewMatrix );
|
|||
|
vec4 transmitted = getIBLVolumeRefraction(
|
|||
|
n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
|
|||
|
pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,
|
|||
|
material.attenuationColor, material.attenuationDistance );
|
|||
|
material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
|
|||
|
totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
|
|||
|
#endif`,EOt=`#ifdef USE_TRANSMISSION
|
|||
|
uniform float transmission;
|
|||
|
uniform float thickness;
|
|||
|
uniform float attenuationDistance;
|
|||
|
uniform vec3 attenuationColor;
|
|||
|
#ifdef USE_TRANSMISSIONMAP
|
|||
|
uniform sampler2D transmissionMap;
|
|||
|
#endif
|
|||
|
#ifdef USE_THICKNESSMAP
|
|||
|
uniform sampler2D thicknessMap;
|
|||
|
#endif
|
|||
|
uniform vec2 transmissionSamplerSize;
|
|||
|
uniform sampler2D transmissionSamplerMap;
|
|||
|
uniform mat4 modelMatrix;
|
|||
|
uniform mat4 projectionMatrix;
|
|||
|
varying vec3 vWorldPosition;
|
|||
|
float w0( float a ) {
|
|||
|
return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
|
|||
|
}
|
|||
|
float w1( float a ) {
|
|||
|
return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );
|
|||
|
}
|
|||
|
float w2( float a ){
|
|||
|
return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
|
|||
|
}
|
|||
|
float w3( float a ) {
|
|||
|
return ( 1.0 / 6.0 ) * ( a * a * a );
|
|||
|
}
|
|||
|
float g0( float a ) {
|
|||
|
return w0( a ) + w1( a );
|
|||
|
}
|
|||
|
float g1( float a ) {
|
|||
|
return w2( a ) + w3( a );
|
|||
|
}
|
|||
|
float h0( float a ) {
|
|||
|
return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
|
|||
|
}
|
|||
|
float h1( float a ) {
|
|||
|
return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
|
|||
|
}
|
|||
|
vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
|
|||
|
uv = uv * texelSize.zw + 0.5;
|
|||
|
vec2 iuv = floor( uv );
|
|||
|
vec2 fuv = fract( uv );
|
|||
|
float g0x = g0( fuv.x );
|
|||
|
float g1x = g1( fuv.x );
|
|||
|
float h0x = h0( fuv.x );
|
|||
|
float h1x = h1( fuv.x );
|
|||
|
float h0y = h0( fuv.y );
|
|||
|
float h1y = h1( fuv.y );
|
|||
|
vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
|
|||
|
vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
|
|||
|
vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
|
|||
|
vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
|
|||
|
return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
|
|||
|
g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
|
|||
|
}
|
|||
|
vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
|
|||
|
vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
|
|||
|
vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
|
|||
|
vec2 fLodSizeInv = 1.0 / fLodSize;
|
|||
|
vec2 cLodSizeInv = 1.0 / cLodSize;
|
|||
|
vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
|
|||
|
vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
|
|||
|
return mix( fSample, cSample, fract( lod ) );
|
|||
|
}
|
|||
|
vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
|
|||
|
vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
|
|||
|
vec3 modelScale;
|
|||
|
modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
|
|||
|
modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
|
|||
|
modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
|
|||
|
return normalize( refractionVector ) * thickness * modelScale;
|
|||
|
}
|
|||
|
float applyIorToRoughness( const in float roughness, const in float ior ) {
|
|||
|
return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
|
|||
|
}
|
|||
|
vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
|
|||
|
float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
|
|||
|
return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
|
|||
|
}
|
|||
|
vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
|
|||
|
if ( isinf( attenuationDistance ) ) {
|
|||
|
return vec3( 1.0 );
|
|||
|
} else {
|
|||
|
vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
|
|||
|
vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;
|
|||
|
}
|
|||
|
}
|
|||
|
vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
|
|||
|
const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
|
|||
|
const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,
|
|||
|
const in vec3 attenuationColor, const in float attenuationDistance ) {
|
|||
|
vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
|
|||
|
vec3 refractedRayExit = position + transmissionRay;
|
|||
|
vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
|
|||
|
vec2 refractionCoords = ndcPos.xy / ndcPos.w;
|
|||
|
refractionCoords += 1.0;
|
|||
|
refractionCoords /= 2.0;
|
|||
|
vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
|
|||
|
vec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
|
|||
|
vec3 attenuatedColor = transmittance * transmittedLight.rgb;
|
|||
|
vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
|
|||
|
float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
|
|||
|
return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
|
|||
|
}
|
|||
|
#endif`,yOt=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
|||
|
varying vec2 vUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_MAP
|
|||
|
varying vec2 vMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_ALPHAMAP
|
|||
|
varying vec2 vAlphaMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_LIGHTMAP
|
|||
|
varying vec2 vLightMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_AOMAP
|
|||
|
varying vec2 vAoMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_BUMPMAP
|
|||
|
varying vec2 vBumpMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_NORMALMAP
|
|||
|
varying vec2 vNormalMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_EMISSIVEMAP
|
|||
|
varying vec2 vEmissiveMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_METALNESSMAP
|
|||
|
varying vec2 vMetalnessMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_ROUGHNESSMAP
|
|||
|
varying vec2 vRoughnessMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_ANISOTROPYMAP
|
|||
|
varying vec2 vAnisotropyMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_CLEARCOATMAP
|
|||
|
varying vec2 vClearcoatMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_CLEARCOAT_NORMALMAP
|
|||
|
varying vec2 vClearcoatNormalMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|||
|
varying vec2 vClearcoatRoughnessMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_IRIDESCENCEMAP
|
|||
|
varying vec2 vIridescenceMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
|||
|
varying vec2 vIridescenceThicknessMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_SHEEN_COLORMAP
|
|||
|
varying vec2 vSheenColorMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_SHEEN_ROUGHNESSMAP
|
|||
|
varying vec2 vSheenRoughnessMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_SPECULARMAP
|
|||
|
varying vec2 vSpecularMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_SPECULAR_COLORMAP
|
|||
|
varying vec2 vSpecularColorMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_SPECULAR_INTENSITYMAP
|
|||
|
varying vec2 vSpecularIntensityMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_TRANSMISSIONMAP
|
|||
|
uniform mat3 transmissionMapTransform;
|
|||
|
varying vec2 vTransmissionMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_THICKNESSMAP
|
|||
|
uniform mat3 thicknessMapTransform;
|
|||
|
varying vec2 vThicknessMapUv;
|
|||
|
#endif`,vOt=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
|||
|
varying vec2 vUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_MAP
|
|||
|
uniform mat3 mapTransform;
|
|||
|
varying vec2 vMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_ALPHAMAP
|
|||
|
uniform mat3 alphaMapTransform;
|
|||
|
varying vec2 vAlphaMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_LIGHTMAP
|
|||
|
uniform mat3 lightMapTransform;
|
|||
|
varying vec2 vLightMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_AOMAP
|
|||
|
uniform mat3 aoMapTransform;
|
|||
|
varying vec2 vAoMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_BUMPMAP
|
|||
|
uniform mat3 bumpMapTransform;
|
|||
|
varying vec2 vBumpMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_NORMALMAP
|
|||
|
uniform mat3 normalMapTransform;
|
|||
|
varying vec2 vNormalMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_DISPLACEMENTMAP
|
|||
|
uniform mat3 displacementMapTransform;
|
|||
|
varying vec2 vDisplacementMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_EMISSIVEMAP
|
|||
|
uniform mat3 emissiveMapTransform;
|
|||
|
varying vec2 vEmissiveMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_METALNESSMAP
|
|||
|
uniform mat3 metalnessMapTransform;
|
|||
|
varying vec2 vMetalnessMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_ROUGHNESSMAP
|
|||
|
uniform mat3 roughnessMapTransform;
|
|||
|
varying vec2 vRoughnessMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_ANISOTROPYMAP
|
|||
|
uniform mat3 anisotropyMapTransform;
|
|||
|
varying vec2 vAnisotropyMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_CLEARCOATMAP
|
|||
|
uniform mat3 clearcoatMapTransform;
|
|||
|
varying vec2 vClearcoatMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_CLEARCOAT_NORMALMAP
|
|||
|
uniform mat3 clearcoatNormalMapTransform;
|
|||
|
varying vec2 vClearcoatNormalMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|||
|
uniform mat3 clearcoatRoughnessMapTransform;
|
|||
|
varying vec2 vClearcoatRoughnessMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_SHEEN_COLORMAP
|
|||
|
uniform mat3 sheenColorMapTransform;
|
|||
|
varying vec2 vSheenColorMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_SHEEN_ROUGHNESSMAP
|
|||
|
uniform mat3 sheenRoughnessMapTransform;
|
|||
|
varying vec2 vSheenRoughnessMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_IRIDESCENCEMAP
|
|||
|
uniform mat3 iridescenceMapTransform;
|
|||
|
varying vec2 vIridescenceMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
|||
|
uniform mat3 iridescenceThicknessMapTransform;
|
|||
|
varying vec2 vIridescenceThicknessMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_SPECULARMAP
|
|||
|
uniform mat3 specularMapTransform;
|
|||
|
varying vec2 vSpecularMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_SPECULAR_COLORMAP
|
|||
|
uniform mat3 specularColorMapTransform;
|
|||
|
varying vec2 vSpecularColorMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_SPECULAR_INTENSITYMAP
|
|||
|
uniform mat3 specularIntensityMapTransform;
|
|||
|
varying vec2 vSpecularIntensityMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_TRANSMISSIONMAP
|
|||
|
uniform mat3 transmissionMapTransform;
|
|||
|
varying vec2 vTransmissionMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_THICKNESSMAP
|
|||
|
uniform mat3 thicknessMapTransform;
|
|||
|
varying vec2 vThicknessMapUv;
|
|||
|
#endif`,SOt=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
|||
|
vUv = vec3( uv, 1 ).xy;
|
|||
|
#endif
|
|||
|
#ifdef USE_MAP
|
|||
|
vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#ifdef USE_ALPHAMAP
|
|||
|
vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#ifdef USE_LIGHTMAP
|
|||
|
vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#ifdef USE_AOMAP
|
|||
|
vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#ifdef USE_BUMPMAP
|
|||
|
vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#ifdef USE_NORMALMAP
|
|||
|
vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#ifdef USE_DISPLACEMENTMAP
|
|||
|
vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#ifdef USE_EMISSIVEMAP
|
|||
|
vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#ifdef USE_METALNESSMAP
|
|||
|
vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#ifdef USE_ROUGHNESSMAP
|
|||
|
vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#ifdef USE_ANISOTROPYMAP
|
|||
|
vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#ifdef USE_CLEARCOATMAP
|
|||
|
vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#ifdef USE_CLEARCOAT_NORMALMAP
|
|||
|
vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|||
|
vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#ifdef USE_IRIDESCENCEMAP
|
|||
|
vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
|||
|
vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#ifdef USE_SHEEN_COLORMAP
|
|||
|
vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#ifdef USE_SHEEN_ROUGHNESSMAP
|
|||
|
vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#ifdef USE_SPECULARMAP
|
|||
|
vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#ifdef USE_SPECULAR_COLORMAP
|
|||
|
vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#ifdef USE_SPECULAR_INTENSITYMAP
|
|||
|
vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#ifdef USE_TRANSMISSIONMAP
|
|||
|
vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#ifdef USE_THICKNESSMAP
|
|||
|
vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
|
|||
|
#endif`,TOt=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
|
|||
|
vec4 worldPosition = vec4( transformed, 1.0 );
|
|||
|
#ifdef USE_BATCHING
|
|||
|
worldPosition = batchingMatrix * worldPosition;
|
|||
|
#endif
|
|||
|
#ifdef USE_INSTANCING
|
|||
|
worldPosition = instanceMatrix * worldPosition;
|
|||
|
#endif
|
|||
|
worldPosition = modelMatrix * worldPosition;
|
|||
|
#endif`;const xOt=`varying vec2 vUv;
|
|||
|
uniform mat3 uvTransform;
|
|||
|
void main() {
|
|||
|
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
|
|||
|
gl_Position = vec4( position.xy, 1.0, 1.0 );
|
|||
|
}`,COt=`uniform sampler2D t2D;
|
|||
|
uniform float backgroundIntensity;
|
|||
|
varying vec2 vUv;
|
|||
|
void main() {
|
|||
|
vec4 texColor = texture2D( t2D, vUv );
|
|||
|
#ifdef DECODE_VIDEO_TEXTURE
|
|||
|
texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
|
|||
|
#endif
|
|||
|
texColor.rgb *= backgroundIntensity;
|
|||
|
gl_FragColor = texColor;
|
|||
|
#include <tonemapping_fragment>
|
|||
|
#include <colorspace_fragment>
|
|||
|
}`,wOt=`varying vec3 vWorldDirection;
|
|||
|
#include <common>
|
|||
|
void main() {
|
|||
|
vWorldDirection = transformDirection( position, modelMatrix );
|
|||
|
#include <begin_vertex>
|
|||
|
#include <project_vertex>
|
|||
|
gl_Position.z = gl_Position.w;
|
|||
|
}`,ROt=`#ifdef ENVMAP_TYPE_CUBE
|
|||
|
uniform samplerCube envMap;
|
|||
|
#elif defined( ENVMAP_TYPE_CUBE_UV )
|
|||
|
uniform sampler2D envMap;
|
|||
|
#endif
|
|||
|
uniform float flipEnvMap;
|
|||
|
uniform float backgroundBlurriness;
|
|||
|
uniform float backgroundIntensity;
|
|||
|
varying vec3 vWorldDirection;
|
|||
|
#include <cube_uv_reflection_fragment>
|
|||
|
void main() {
|
|||
|
#ifdef ENVMAP_TYPE_CUBE
|
|||
|
vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
|
|||
|
#elif defined( ENVMAP_TYPE_CUBE_UV )
|
|||
|
vec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );
|
|||
|
#else
|
|||
|
vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
|
|||
|
#endif
|
|||
|
texColor.rgb *= backgroundIntensity;
|
|||
|
gl_FragColor = texColor;
|
|||
|
#include <tonemapping_fragment>
|
|||
|
#include <colorspace_fragment>
|
|||
|
}`,AOt=`varying vec3 vWorldDirection;
|
|||
|
#include <common>
|
|||
|
void main() {
|
|||
|
vWorldDirection = transformDirection( position, modelMatrix );
|
|||
|
#include <begin_vertex>
|
|||
|
#include <project_vertex>
|
|||
|
gl_Position.z = gl_Position.w;
|
|||
|
}`,NOt=`uniform samplerCube tCube;
|
|||
|
uniform float tFlip;
|
|||
|
uniform float opacity;
|
|||
|
varying vec3 vWorldDirection;
|
|||
|
void main() {
|
|||
|
vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
|
|||
|
gl_FragColor = texColor;
|
|||
|
gl_FragColor.a *= opacity;
|
|||
|
#include <tonemapping_fragment>
|
|||
|
#include <colorspace_fragment>
|
|||
|
}`,OOt=`#include <common>
|
|||
|
#include <batching_pars_vertex>
|
|||
|
#include <uv_pars_vertex>
|
|||
|
#include <displacementmap_pars_vertex>
|
|||
|
#include <morphtarget_pars_vertex>
|
|||
|
#include <skinning_pars_vertex>
|
|||
|
#include <logdepthbuf_pars_vertex>
|
|||
|
#include <clipping_planes_pars_vertex>
|
|||
|
varying vec2 vHighPrecisionZW;
|
|||
|
void main() {
|
|||
|
#include <uv_vertex>
|
|||
|
#include <batching_vertex>
|
|||
|
#include <skinbase_vertex>
|
|||
|
#ifdef USE_DISPLACEMENTMAP
|
|||
|
#include <beginnormal_vertex>
|
|||
|
#include <morphnormal_vertex>
|
|||
|
#include <skinnormal_vertex>
|
|||
|
#endif
|
|||
|
#include <begin_vertex>
|
|||
|
#include <morphtarget_vertex>
|
|||
|
#include <skinning_vertex>
|
|||
|
#include <displacementmap_vertex>
|
|||
|
#include <project_vertex>
|
|||
|
#include <logdepthbuf_vertex>
|
|||
|
#include <clipping_planes_vertex>
|
|||
|
vHighPrecisionZW = gl_Position.zw;
|
|||
|
}`,IOt=`#if DEPTH_PACKING == 3200
|
|||
|
uniform float opacity;
|
|||
|
#endif
|
|||
|
#include <common>
|
|||
|
#include <packing>
|
|||
|
#include <uv_pars_fragment>
|
|||
|
#include <map_pars_fragment>
|
|||
|
#include <alphamap_pars_fragment>
|
|||
|
#include <alphatest_pars_fragment>
|
|||
|
#include <alphahash_pars_fragment>
|
|||
|
#include <logdepthbuf_pars_fragment>
|
|||
|
#include <clipping_planes_pars_fragment>
|
|||
|
varying vec2 vHighPrecisionZW;
|
|||
|
void main() {
|
|||
|
#include <clipping_planes_fragment>
|
|||
|
vec4 diffuseColor = vec4( 1.0 );
|
|||
|
#if DEPTH_PACKING == 3200
|
|||
|
diffuseColor.a = opacity;
|
|||
|
#endif
|
|||
|
#include <map_fragment>
|
|||
|
#include <alphamap_fragment>
|
|||
|
#include <alphatest_fragment>
|
|||
|
#include <alphahash_fragment>
|
|||
|
#include <logdepthbuf_fragment>
|
|||
|
float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
|
|||
|
#if DEPTH_PACKING == 3200
|
|||
|
gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
|
|||
|
#elif DEPTH_PACKING == 3201
|
|||
|
gl_FragColor = packDepthToRGBA( fragCoordZ );
|
|||
|
#endif
|
|||
|
}`,MOt=`#define DISTANCE
|
|||
|
varying vec3 vWorldPosition;
|
|||
|
#include <common>
|
|||
|
#include <batching_pars_vertex>
|
|||
|
#include <uv_pars_vertex>
|
|||
|
#include <displacementmap_pars_vertex>
|
|||
|
#include <morphtarget_pars_vertex>
|
|||
|
#include <skinning_pars_vertex>
|
|||
|
#include <clipping_planes_pars_vertex>
|
|||
|
void main() {
|
|||
|
#include <uv_vertex>
|
|||
|
#include <batching_vertex>
|
|||
|
#include <skinbase_vertex>
|
|||
|
#ifdef USE_DISPLACEMENTMAP
|
|||
|
#include <beginnormal_vertex>
|
|||
|
#include <morphnormal_vertex>
|
|||
|
#include <skinnormal_vertex>
|
|||
|
#endif
|
|||
|
#include <begin_vertex>
|
|||
|
#include <morphtarget_vertex>
|
|||
|
#include <skinning_vertex>
|
|||
|
#include <displacementmap_vertex>
|
|||
|
#include <project_vertex>
|
|||
|
#include <worldpos_vertex>
|
|||
|
#include <clipping_planes_vertex>
|
|||
|
vWorldPosition = worldPosition.xyz;
|
|||
|
}`,kOt=`#define DISTANCE
|
|||
|
uniform vec3 referencePosition;
|
|||
|
uniform float nearDistance;
|
|||
|
uniform float farDistance;
|
|||
|
varying vec3 vWorldPosition;
|
|||
|
#include <common>
|
|||
|
#include <packing>
|
|||
|
#include <uv_pars_fragment>
|
|||
|
#include <map_pars_fragment>
|
|||
|
#include <alphamap_pars_fragment>
|
|||
|
#include <alphatest_pars_fragment>
|
|||
|
#include <alphahash_pars_fragment>
|
|||
|
#include <clipping_planes_pars_fragment>
|
|||
|
void main () {
|
|||
|
#include <clipping_planes_fragment>
|
|||
|
vec4 diffuseColor = vec4( 1.0 );
|
|||
|
#include <map_fragment>
|
|||
|
#include <alphamap_fragment>
|
|||
|
#include <alphatest_fragment>
|
|||
|
#include <alphahash_fragment>
|
|||
|
float dist = length( vWorldPosition - referencePosition );
|
|||
|
dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
|
|||
|
dist = saturate( dist );
|
|||
|
gl_FragColor = packDepthToRGBA( dist );
|
|||
|
}`,DOt=`varying vec3 vWorldDirection;
|
|||
|
#include <common>
|
|||
|
void main() {
|
|||
|
vWorldDirection = transformDirection( position, modelMatrix );
|
|||
|
#include <begin_vertex>
|
|||
|
#include <project_vertex>
|
|||
|
}`,LOt=`uniform sampler2D tEquirect;
|
|||
|
varying vec3 vWorldDirection;
|
|||
|
#include <common>
|
|||
|
void main() {
|
|||
|
vec3 direction = normalize( vWorldDirection );
|
|||
|
vec2 sampleUV = equirectUv( direction );
|
|||
|
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|||
|
#include <tonemapping_fragment>
|
|||
|
#include <colorspace_fragment>
|
|||
|
}`,POt=`uniform float scale;
|
|||
|
attribute float lineDistance;
|
|||
|
varying float vLineDistance;
|
|||
|
#include <common>
|
|||
|
#include <uv_pars_vertex>
|
|||
|
#include <color_pars_vertex>
|
|||
|
#include <fog_pars_vertex>
|
|||
|
#include <morphtarget_pars_vertex>
|
|||
|
#include <logdepthbuf_pars_vertex>
|
|||
|
#include <clipping_planes_pars_vertex>
|
|||
|
void main() {
|
|||
|
vLineDistance = scale * lineDistance;
|
|||
|
#include <uv_vertex>
|
|||
|
#include <color_vertex>
|
|||
|
#include <morphcolor_vertex>
|
|||
|
#include <begin_vertex>
|
|||
|
#include <morphtarget_vertex>
|
|||
|
#include <project_vertex>
|
|||
|
#include <logdepthbuf_vertex>
|
|||
|
#include <clipping_planes_vertex>
|
|||
|
#include <fog_vertex>
|
|||
|
}`,UOt=`uniform vec3 diffuse;
|
|||
|
uniform float opacity;
|
|||
|
uniform float dashSize;
|
|||
|
uniform float totalSize;
|
|||
|
varying float vLineDistance;
|
|||
|
#include <common>
|
|||
|
#include <color_pars_fragment>
|
|||
|
#include <uv_pars_fragment>
|
|||
|
#include <map_pars_fragment>
|
|||
|
#include <fog_pars_fragment>
|
|||
|
#include <logdepthbuf_pars_fragment>
|
|||
|
#include <clipping_planes_pars_fragment>
|
|||
|
void main() {
|
|||
|
#include <clipping_planes_fragment>
|
|||
|
if ( mod( vLineDistance, totalSize ) > dashSize ) {
|
|||
|
discard;
|
|||
|
}
|
|||
|
vec3 outgoingLight = vec3( 0.0 );
|
|||
|
vec4 diffuseColor = vec4( diffuse, opacity );
|
|||
|
#include <logdepthbuf_fragment>
|
|||
|
#include <map_fragment>
|
|||
|
#include <color_fragment>
|
|||
|
outgoingLight = diffuseColor.rgb;
|
|||
|
#include <opaque_fragment>
|
|||
|
#include <tonemapping_fragment>
|
|||
|
#include <colorspace_fragment>
|
|||
|
#include <fog_fragment>
|
|||
|
#include <premultiplied_alpha_fragment>
|
|||
|
}`,FOt=`#include <common>
|
|||
|
#include <batching_pars_vertex>
|
|||
|
#include <uv_pars_vertex>
|
|||
|
#include <envmap_pars_vertex>
|
|||
|
#include <color_pars_vertex>
|
|||
|
#include <fog_pars_vertex>
|
|||
|
#include <morphtarget_pars_vertex>
|
|||
|
#include <skinning_pars_vertex>
|
|||
|
#include <logdepthbuf_pars_vertex>
|
|||
|
#include <clipping_planes_pars_vertex>
|
|||
|
void main() {
|
|||
|
#include <uv_vertex>
|
|||
|
#include <color_vertex>
|
|||
|
#include <morphcolor_vertex>
|
|||
|
#include <batching_vertex>
|
|||
|
#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
|
|||
|
#include <beginnormal_vertex>
|
|||
|
#include <morphnormal_vertex>
|
|||
|
#include <skinbase_vertex>
|
|||
|
#include <skinnormal_vertex>
|
|||
|
#include <defaultnormal_vertex>
|
|||
|
#endif
|
|||
|
#include <begin_vertex>
|
|||
|
#include <morphtarget_vertex>
|
|||
|
#include <skinning_vertex>
|
|||
|
#include <project_vertex>
|
|||
|
#include <logdepthbuf_vertex>
|
|||
|
#include <clipping_planes_vertex>
|
|||
|
#include <worldpos_vertex>
|
|||
|
#include <envmap_vertex>
|
|||
|
#include <fog_vertex>
|
|||
|
}`,BOt=`uniform vec3 diffuse;
|
|||
|
uniform float opacity;
|
|||
|
#ifndef FLAT_SHADED
|
|||
|
varying vec3 vNormal;
|
|||
|
#endif
|
|||
|
#include <common>
|
|||
|
#include <dithering_pars_fragment>
|
|||
|
#include <color_pars_fragment>
|
|||
|
#include <uv_pars_fragment>
|
|||
|
#include <map_pars_fragment>
|
|||
|
#include <alphamap_pars_fragment>
|
|||
|
#include <alphatest_pars_fragment>
|
|||
|
#include <alphahash_pars_fragment>
|
|||
|
#include <aomap_pars_fragment>
|
|||
|
#include <lightmap_pars_fragment>
|
|||
|
#include <envmap_common_pars_fragment>
|
|||
|
#include <envmap_pars_fragment>
|
|||
|
#include <fog_pars_fragment>
|
|||
|
#include <specularmap_pars_fragment>
|
|||
|
#include <logdepthbuf_pars_fragment>
|
|||
|
#include <clipping_planes_pars_fragment>
|
|||
|
void main() {
|
|||
|
#include <clipping_planes_fragment>
|
|||
|
vec4 diffuseColor = vec4( diffuse, opacity );
|
|||
|
#include <logdepthbuf_fragment>
|
|||
|
#include <map_fragment>
|
|||
|
#include <color_fragment>
|
|||
|
#include <alphamap_fragment>
|
|||
|
#include <alphatest_fragment>
|
|||
|
#include <alphahash_fragment>
|
|||
|
#include <specularmap_fragment>
|
|||
|
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|||
|
#ifdef USE_LIGHTMAP
|
|||
|
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
|
|||
|
reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
|
|||
|
#else
|
|||
|
reflectedLight.indirectDiffuse += vec3( 1.0 );
|
|||
|
#endif
|
|||
|
#include <aomap_fragment>
|
|||
|
reflectedLight.indirectDiffuse *= diffuseColor.rgb;
|
|||
|
vec3 outgoingLight = reflectedLight.indirectDiffuse;
|
|||
|
#include <envmap_fragment>
|
|||
|
#include <opaque_fragment>
|
|||
|
#include <tonemapping_fragment>
|
|||
|
#include <colorspace_fragment>
|
|||
|
#include <fog_fragment>
|
|||
|
#include <premultiplied_alpha_fragment>
|
|||
|
#include <dithering_fragment>
|
|||
|
}`,GOt=`#define LAMBERT
|
|||
|
varying vec3 vViewPosition;
|
|||
|
#include <common>
|
|||
|
#include <batching_pars_vertex>
|
|||
|
#include <uv_pars_vertex>
|
|||
|
#include <displacementmap_pars_vertex>
|
|||
|
#include <envmap_pars_vertex>
|
|||
|
#include <color_pars_vertex>
|
|||
|
#include <fog_pars_vertex>
|
|||
|
#include <normal_pars_vertex>
|
|||
|
#include <morphtarget_pars_vertex>
|
|||
|
#include <skinning_pars_vertex>
|
|||
|
#include <shadowmap_pars_vertex>
|
|||
|
#include <logdepthbuf_pars_vertex>
|
|||
|
#include <clipping_planes_pars_vertex>
|
|||
|
void main() {
|
|||
|
#include <uv_vertex>
|
|||
|
#include <color_vertex>
|
|||
|
#include <morphcolor_vertex>
|
|||
|
#include <batching_vertex>
|
|||
|
#include <beginnormal_vertex>
|
|||
|
#include <morphnormal_vertex>
|
|||
|
#include <skinbase_vertex>
|
|||
|
#include <skinnormal_vertex>
|
|||
|
#include <defaultnormal_vertex>
|
|||
|
#include <normal_vertex>
|
|||
|
#include <begin_vertex>
|
|||
|
#include <morphtarget_vertex>
|
|||
|
#include <skinning_vertex>
|
|||
|
#include <displacementmap_vertex>
|
|||
|
#include <project_vertex>
|
|||
|
#include <logdepthbuf_vertex>
|
|||
|
#include <clipping_planes_vertex>
|
|||
|
vViewPosition = - mvPosition.xyz;
|
|||
|
#include <worldpos_vertex>
|
|||
|
#include <envmap_vertex>
|
|||
|
#include <shadowmap_vertex>
|
|||
|
#include <fog_vertex>
|
|||
|
}`,VOt=`#define LAMBERT
|
|||
|
uniform vec3 diffuse;
|
|||
|
uniform vec3 emissive;
|
|||
|
uniform float opacity;
|
|||
|
#include <common>
|
|||
|
#include <packing>
|
|||
|
#include <dithering_pars_fragment>
|
|||
|
#include <color_pars_fragment>
|
|||
|
#include <uv_pars_fragment>
|
|||
|
#include <map_pars_fragment>
|
|||
|
#include <alphamap_pars_fragment>
|
|||
|
#include <alphatest_pars_fragment>
|
|||
|
#include <alphahash_pars_fragment>
|
|||
|
#include <aomap_pars_fragment>
|
|||
|
#include <lightmap_pars_fragment>
|
|||
|
#include <emissivemap_pars_fragment>
|
|||
|
#include <envmap_common_pars_fragment>
|
|||
|
#include <envmap_pars_fragment>
|
|||
|
#include <fog_pars_fragment>
|
|||
|
#include <bsdfs>
|
|||
|
#include <lights_pars_begin>
|
|||
|
#include <normal_pars_fragment>
|
|||
|
#include <lights_lambert_pars_fragment>
|
|||
|
#include <shadowmap_pars_fragment>
|
|||
|
#include <bumpmap_pars_fragment>
|
|||
|
#include <normalmap_pars_fragment>
|
|||
|
#include <specularmap_pars_fragment>
|
|||
|
#include <logdepthbuf_pars_fragment>
|
|||
|
#include <clipping_planes_pars_fragment>
|
|||
|
void main() {
|
|||
|
#include <clipping_planes_fragment>
|
|||
|
vec4 diffuseColor = vec4( diffuse, opacity );
|
|||
|
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|||
|
vec3 totalEmissiveRadiance = emissive;
|
|||
|
#include <logdepthbuf_fragment>
|
|||
|
#include <map_fragment>
|
|||
|
#include <color_fragment>
|
|||
|
#include <alphamap_fragment>
|
|||
|
#include <alphatest_fragment>
|
|||
|
#include <alphahash_fragment>
|
|||
|
#include <specularmap_fragment>
|
|||
|
#include <normal_fragment_begin>
|
|||
|
#include <normal_fragment_maps>
|
|||
|
#include <emissivemap_fragment>
|
|||
|
#include <lights_lambert_fragment>
|
|||
|
#include <lights_fragment_begin>
|
|||
|
#include <lights_fragment_maps>
|
|||
|
#include <lights_fragment_end>
|
|||
|
#include <aomap_fragment>
|
|||
|
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
|
|||
|
#include <envmap_fragment>
|
|||
|
#include <opaque_fragment>
|
|||
|
#include <tonemapping_fragment>
|
|||
|
#include <colorspace_fragment>
|
|||
|
#include <fog_fragment>
|
|||
|
#include <premultiplied_alpha_fragment>
|
|||
|
#include <dithering_fragment>
|
|||
|
}`,zOt=`#define MATCAP
|
|||
|
varying vec3 vViewPosition;
|
|||
|
#include <common>
|
|||
|
#include <batching_pars_vertex>
|
|||
|
#include <uv_pars_vertex>
|
|||
|
#include <color_pars_vertex>
|
|||
|
#include <displacementmap_pars_vertex>
|
|||
|
#include <fog_pars_vertex>
|
|||
|
#include <normal_pars_vertex>
|
|||
|
#include <morphtarget_pars_vertex>
|
|||
|
#include <skinning_pars_vertex>
|
|||
|
#include <logdepthbuf_pars_vertex>
|
|||
|
#include <clipping_planes_pars_vertex>
|
|||
|
void main() {
|
|||
|
#include <uv_vertex>
|
|||
|
#include <color_vertex>
|
|||
|
#include <morphcolor_vertex>
|
|||
|
#include <batching_vertex>
|
|||
|
#include <beginnormal_vertex>
|
|||
|
#include <morphnormal_vertex>
|
|||
|
#include <skinbase_vertex>
|
|||
|
#include <skinnormal_vertex>
|
|||
|
#include <defaultnormal_vertex>
|
|||
|
#include <normal_vertex>
|
|||
|
#include <begin_vertex>
|
|||
|
#include <morphtarget_vertex>
|
|||
|
#include <skinning_vertex>
|
|||
|
#include <displacementmap_vertex>
|
|||
|
#include <project_vertex>
|
|||
|
#include <logdepthbuf_vertex>
|
|||
|
#include <clipping_planes_vertex>
|
|||
|
#include <fog_vertex>
|
|||
|
vViewPosition = - mvPosition.xyz;
|
|||
|
}`,HOt=`#define MATCAP
|
|||
|
uniform vec3 diffuse;
|
|||
|
uniform float opacity;
|
|||
|
uniform sampler2D matcap;
|
|||
|
varying vec3 vViewPosition;
|
|||
|
#include <common>
|
|||
|
#include <dithering_pars_fragment>
|
|||
|
#include <color_pars_fragment>
|
|||
|
#include <uv_pars_fragment>
|
|||
|
#include <map_pars_fragment>
|
|||
|
#include <alphamap_pars_fragment>
|
|||
|
#include <alphatest_pars_fragment>
|
|||
|
#include <alphahash_pars_fragment>
|
|||
|
#include <fog_pars_fragment>
|
|||
|
#include <normal_pars_fragment>
|
|||
|
#include <bumpmap_pars_fragment>
|
|||
|
#include <normalmap_pars_fragment>
|
|||
|
#include <logdepthbuf_pars_fragment>
|
|||
|
#include <clipping_planes_pars_fragment>
|
|||
|
void main() {
|
|||
|
#include <clipping_planes_fragment>
|
|||
|
vec4 diffuseColor = vec4( diffuse, opacity );
|
|||
|
#include <logdepthbuf_fragment>
|
|||
|
#include <map_fragment>
|
|||
|
#include <color_fragment>
|
|||
|
#include <alphamap_fragment>
|
|||
|
#include <alphatest_fragment>
|
|||
|
#include <alphahash_fragment>
|
|||
|
#include <normal_fragment_begin>
|
|||
|
#include <normal_fragment_maps>
|
|||
|
vec3 viewDir = normalize( vViewPosition );
|
|||
|
vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
|
|||
|
vec3 y = cross( viewDir, x );
|
|||
|
vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
|
|||
|
#ifdef USE_MATCAP
|
|||
|
vec4 matcapColor = texture2D( matcap, uv );
|
|||
|
#else
|
|||
|
vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
|
|||
|
#endif
|
|||
|
vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
|
|||
|
#include <opaque_fragment>
|
|||
|
#include <tonemapping_fragment>
|
|||
|
#include <colorspace_fragment>
|
|||
|
#include <fog_fragment>
|
|||
|
#include <premultiplied_alpha_fragment>
|
|||
|
#include <dithering_fragment>
|
|||
|
}`,qOt=`#define NORMAL
|
|||
|
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
|||
|
varying vec3 vViewPosition;
|
|||
|
#endif
|
|||
|
#include <common>
|
|||
|
#include <batching_pars_vertex>
|
|||
|
#include <uv_pars_vertex>
|
|||
|
#include <displacementmap_pars_vertex>
|
|||
|
#include <normal_pars_vertex>
|
|||
|
#include <morphtarget_pars_vertex>
|
|||
|
#include <skinning_pars_vertex>
|
|||
|
#include <logdepthbuf_pars_vertex>
|
|||
|
#include <clipping_planes_pars_vertex>
|
|||
|
void main() {
|
|||
|
#include <uv_vertex>
|
|||
|
#include <batching_vertex>
|
|||
|
#include <beginnormal_vertex>
|
|||
|
#include <morphnormal_vertex>
|
|||
|
#include <skinbase_vertex>
|
|||
|
#include <skinnormal_vertex>
|
|||
|
#include <defaultnormal_vertex>
|
|||
|
#include <normal_vertex>
|
|||
|
#include <begin_vertex>
|
|||
|
#include <morphtarget_vertex>
|
|||
|
#include <skinning_vertex>
|
|||
|
#include <displacementmap_vertex>
|
|||
|
#include <project_vertex>
|
|||
|
#include <logdepthbuf_vertex>
|
|||
|
#include <clipping_planes_vertex>
|
|||
|
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
|||
|
vViewPosition = - mvPosition.xyz;
|
|||
|
#endif
|
|||
|
}`,$Ot=`#define NORMAL
|
|||
|
uniform float opacity;
|
|||
|
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
|||
|
varying vec3 vViewPosition;
|
|||
|
#endif
|
|||
|
#include <packing>
|
|||
|
#include <uv_pars_fragment>
|
|||
|
#include <normal_pars_fragment>
|
|||
|
#include <bumpmap_pars_fragment>
|
|||
|
#include <normalmap_pars_fragment>
|
|||
|
#include <logdepthbuf_pars_fragment>
|
|||
|
#include <clipping_planes_pars_fragment>
|
|||
|
void main() {
|
|||
|
#include <clipping_planes_fragment>
|
|||
|
#include <logdepthbuf_fragment>
|
|||
|
#include <normal_fragment_begin>
|
|||
|
#include <normal_fragment_maps>
|
|||
|
gl_FragColor = vec4( packNormalToRGB( normal ), opacity );
|
|||
|
#ifdef OPAQUE
|
|||
|
gl_FragColor.a = 1.0;
|
|||
|
#endif
|
|||
|
}`,YOt=`#define PHONG
|
|||
|
varying vec3 vViewPosition;
|
|||
|
#include <common>
|
|||
|
#include <batching_pars_vertex>
|
|||
|
#include <uv_pars_vertex>
|
|||
|
#include <displacementmap_pars_vertex>
|
|||
|
#include <envmap_pars_vertex>
|
|||
|
#include <color_pars_vertex>
|
|||
|
#include <fog_pars_vertex>
|
|||
|
#include <normal_pars_vertex>
|
|||
|
#include <morphtarget_pars_vertex>
|
|||
|
#include <skinning_pars_vertex>
|
|||
|
#include <shadowmap_pars_vertex>
|
|||
|
#include <logdepthbuf_pars_vertex>
|
|||
|
#include <clipping_planes_pars_vertex>
|
|||
|
void main() {
|
|||
|
#include <uv_vertex>
|
|||
|
#include <color_vertex>
|
|||
|
#include <morphcolor_vertex>
|
|||
|
#include <batching_vertex>
|
|||
|
#include <beginnormal_vertex>
|
|||
|
#include <morphnormal_vertex>
|
|||
|
#include <skinbase_vertex>
|
|||
|
#include <skinnormal_vertex>
|
|||
|
#include <defaultnormal_vertex>
|
|||
|
#include <normal_vertex>
|
|||
|
#include <begin_vertex>
|
|||
|
#include <morphtarget_vertex>
|
|||
|
#include <skinning_vertex>
|
|||
|
#include <displacementmap_vertex>
|
|||
|
#include <project_vertex>
|
|||
|
#include <logdepthbuf_vertex>
|
|||
|
#include <clipping_planes_vertex>
|
|||
|
vViewPosition = - mvPosition.xyz;
|
|||
|
#include <worldpos_vertex>
|
|||
|
#include <envmap_vertex>
|
|||
|
#include <shadowmap_vertex>
|
|||
|
#include <fog_vertex>
|
|||
|
}`,WOt=`#define PHONG
|
|||
|
uniform vec3 diffuse;
|
|||
|
uniform vec3 emissive;
|
|||
|
uniform vec3 specular;
|
|||
|
uniform float shininess;
|
|||
|
uniform float opacity;
|
|||
|
#include <common>
|
|||
|
#include <packing>
|
|||
|
#include <dithering_pars_fragment>
|
|||
|
#include <color_pars_fragment>
|
|||
|
#include <uv_pars_fragment>
|
|||
|
#include <map_pars_fragment>
|
|||
|
#include <alphamap_pars_fragment>
|
|||
|
#include <alphatest_pars_fragment>
|
|||
|
#include <alphahash_pars_fragment>
|
|||
|
#include <aomap_pars_fragment>
|
|||
|
#include <lightmap_pars_fragment>
|
|||
|
#include <emissivemap_pars_fragment>
|
|||
|
#include <envmap_common_pars_fragment>
|
|||
|
#include <envmap_pars_fragment>
|
|||
|
#include <fog_pars_fragment>
|
|||
|
#include <bsdfs>
|
|||
|
#include <lights_pars_begin>
|
|||
|
#include <normal_pars_fragment>
|
|||
|
#include <lights_phong_pars_fragment>
|
|||
|
#include <shadowmap_pars_fragment>
|
|||
|
#include <bumpmap_pars_fragment>
|
|||
|
#include <normalmap_pars_fragment>
|
|||
|
#include <specularmap_pars_fragment>
|
|||
|
#include <logdepthbuf_pars_fragment>
|
|||
|
#include <clipping_planes_pars_fragment>
|
|||
|
void main() {
|
|||
|
#include <clipping_planes_fragment>
|
|||
|
vec4 diffuseColor = vec4( diffuse, opacity );
|
|||
|
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|||
|
vec3 totalEmissiveRadiance = emissive;
|
|||
|
#include <logdepthbuf_fragment>
|
|||
|
#include <map_fragment>
|
|||
|
#include <color_fragment>
|
|||
|
#include <alphamap_fragment>
|
|||
|
#include <alphatest_fragment>
|
|||
|
#include <alphahash_fragment>
|
|||
|
#include <specularmap_fragment>
|
|||
|
#include <normal_fragment_begin>
|
|||
|
#include <normal_fragment_maps>
|
|||
|
#include <emissivemap_fragment>
|
|||
|
#include <lights_phong_fragment>
|
|||
|
#include <lights_fragment_begin>
|
|||
|
#include <lights_fragment_maps>
|
|||
|
#include <lights_fragment_end>
|
|||
|
#include <aomap_fragment>
|
|||
|
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
|
|||
|
#include <envmap_fragment>
|
|||
|
#include <opaque_fragment>
|
|||
|
#include <tonemapping_fragment>
|
|||
|
#include <colorspace_fragment>
|
|||
|
#include <fog_fragment>
|
|||
|
#include <premultiplied_alpha_fragment>
|
|||
|
#include <dithering_fragment>
|
|||
|
}`,KOt=`#define STANDARD
|
|||
|
varying vec3 vViewPosition;
|
|||
|
#ifdef USE_TRANSMISSION
|
|||
|
varying vec3 vWorldPosition;
|
|||
|
#endif
|
|||
|
#include <common>
|
|||
|
#include <batching_pars_vertex>
|
|||
|
#include <uv_pars_vertex>
|
|||
|
#include <displacementmap_pars_vertex>
|
|||
|
#include <color_pars_vertex>
|
|||
|
#include <fog_pars_vertex>
|
|||
|
#include <normal_pars_vertex>
|
|||
|
#include <morphtarget_pars_vertex>
|
|||
|
#include <skinning_pars_vertex>
|
|||
|
#include <shadowmap_pars_vertex>
|
|||
|
#include <logdepthbuf_pars_vertex>
|
|||
|
#include <clipping_planes_pars_vertex>
|
|||
|
void main() {
|
|||
|
#include <uv_vertex>
|
|||
|
#include <color_vertex>
|
|||
|
#include <morphcolor_vertex>
|
|||
|
#include <batching_vertex>
|
|||
|
#include <beginnormal_vertex>
|
|||
|
#include <morphnormal_vertex>
|
|||
|
#include <skinbase_vertex>
|
|||
|
#include <skinnormal_vertex>
|
|||
|
#include <defaultnormal_vertex>
|
|||
|
#include <normal_vertex>
|
|||
|
#include <begin_vertex>
|
|||
|
#include <morphtarget_vertex>
|
|||
|
#include <skinning_vertex>
|
|||
|
#include <displacementmap_vertex>
|
|||
|
#include <project_vertex>
|
|||
|
#include <logdepthbuf_vertex>
|
|||
|
#include <clipping_planes_vertex>
|
|||
|
vViewPosition = - mvPosition.xyz;
|
|||
|
#include <worldpos_vertex>
|
|||
|
#include <shadowmap_vertex>
|
|||
|
#include <fog_vertex>
|
|||
|
#ifdef USE_TRANSMISSION
|
|||
|
vWorldPosition = worldPosition.xyz;
|
|||
|
#endif
|
|||
|
}`,jOt=`#define STANDARD
|
|||
|
#ifdef PHYSICAL
|
|||
|
#define IOR
|
|||
|
#define USE_SPECULAR
|
|||
|
#endif
|
|||
|
uniform vec3 diffuse;
|
|||
|
uniform vec3 emissive;
|
|||
|
uniform float roughness;
|
|||
|
uniform float metalness;
|
|||
|
uniform float opacity;
|
|||
|
#ifdef IOR
|
|||
|
uniform float ior;
|
|||
|
#endif
|
|||
|
#ifdef USE_SPECULAR
|
|||
|
uniform float specularIntensity;
|
|||
|
uniform vec3 specularColor;
|
|||
|
#ifdef USE_SPECULAR_COLORMAP
|
|||
|
uniform sampler2D specularColorMap;
|
|||
|
#endif
|
|||
|
#ifdef USE_SPECULAR_INTENSITYMAP
|
|||
|
uniform sampler2D specularIntensityMap;
|
|||
|
#endif
|
|||
|
#endif
|
|||
|
#ifdef USE_CLEARCOAT
|
|||
|
uniform float clearcoat;
|
|||
|
uniform float clearcoatRoughness;
|
|||
|
#endif
|
|||
|
#ifdef USE_IRIDESCENCE
|
|||
|
uniform float iridescence;
|
|||
|
uniform float iridescenceIOR;
|
|||
|
uniform float iridescenceThicknessMinimum;
|
|||
|
uniform float iridescenceThicknessMaximum;
|
|||
|
#endif
|
|||
|
#ifdef USE_SHEEN
|
|||
|
uniform vec3 sheenColor;
|
|||
|
uniform float sheenRoughness;
|
|||
|
#ifdef USE_SHEEN_COLORMAP
|
|||
|
uniform sampler2D sheenColorMap;
|
|||
|
#endif
|
|||
|
#ifdef USE_SHEEN_ROUGHNESSMAP
|
|||
|
uniform sampler2D sheenRoughnessMap;
|
|||
|
#endif
|
|||
|
#endif
|
|||
|
#ifdef USE_ANISOTROPY
|
|||
|
uniform vec2 anisotropyVector;
|
|||
|
#ifdef USE_ANISOTROPYMAP
|
|||
|
uniform sampler2D anisotropyMap;
|
|||
|
#endif
|
|||
|
#endif
|
|||
|
varying vec3 vViewPosition;
|
|||
|
#include <common>
|
|||
|
#include <packing>
|
|||
|
#include <dithering_pars_fragment>
|
|||
|
#include <color_pars_fragment>
|
|||
|
#include <uv_pars_fragment>
|
|||
|
#include <map_pars_fragment>
|
|||
|
#include <alphamap_pars_fragment>
|
|||
|
#include <alphatest_pars_fragment>
|
|||
|
#include <alphahash_pars_fragment>
|
|||
|
#include <aomap_pars_fragment>
|
|||
|
#include <lightmap_pars_fragment>
|
|||
|
#include <emissivemap_pars_fragment>
|
|||
|
#include <iridescence_fragment>
|
|||
|
#include <cube_uv_reflection_fragment>
|
|||
|
#include <envmap_common_pars_fragment>
|
|||
|
#include <envmap_physical_pars_fragment>
|
|||
|
#include <fog_pars_fragment>
|
|||
|
#include <lights_pars_begin>
|
|||
|
#include <normal_pars_fragment>
|
|||
|
#include <lights_physical_pars_fragment>
|
|||
|
#include <transmission_pars_fragment>
|
|||
|
#include <shadowmap_pars_fragment>
|
|||
|
#include <bumpmap_pars_fragment>
|
|||
|
#include <normalmap_pars_fragment>
|
|||
|
#include <clearcoat_pars_fragment>
|
|||
|
#include <iridescence_pars_fragment>
|
|||
|
#include <roughnessmap_pars_fragment>
|
|||
|
#include <metalnessmap_pars_fragment>
|
|||
|
#include <logdepthbuf_pars_fragment>
|
|||
|
#include <clipping_planes_pars_fragment>
|
|||
|
void main() {
|
|||
|
#include <clipping_planes_fragment>
|
|||
|
vec4 diffuseColor = vec4( diffuse, opacity );
|
|||
|
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|||
|
vec3 totalEmissiveRadiance = emissive;
|
|||
|
#include <logdepthbuf_fragment>
|
|||
|
#include <map_fragment>
|
|||
|
#include <color_fragment>
|
|||
|
#include <alphamap_fragment>
|
|||
|
#include <alphatest_fragment>
|
|||
|
#include <alphahash_fragment>
|
|||
|
#include <roughnessmap_fragment>
|
|||
|
#include <metalnessmap_fragment>
|
|||
|
#include <normal_fragment_begin>
|
|||
|
#include <normal_fragment_maps>
|
|||
|
#include <clearcoat_normal_fragment_begin>
|
|||
|
#include <clearcoat_normal_fragment_maps>
|
|||
|
#include <emissivemap_fragment>
|
|||
|
#include <lights_physical_fragment>
|
|||
|
#include <lights_fragment_begin>
|
|||
|
#include <lights_fragment_maps>
|
|||
|
#include <lights_fragment_end>
|
|||
|
#include <aomap_fragment>
|
|||
|
vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
|
|||
|
vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
|
|||
|
#include <transmission_fragment>
|
|||
|
vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
|
|||
|
#ifdef USE_SHEEN
|
|||
|
float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
|
|||
|
outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;
|
|||
|
#endif
|
|||
|
#ifdef USE_CLEARCOAT
|
|||
|
float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
|
|||
|
vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
|
|||
|
outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
|
|||
|
#endif
|
|||
|
#include <opaque_fragment>
|
|||
|
#include <tonemapping_fragment>
|
|||
|
#include <colorspace_fragment>
|
|||
|
#include <fog_fragment>
|
|||
|
#include <premultiplied_alpha_fragment>
|
|||
|
#include <dithering_fragment>
|
|||
|
}`,QOt=`#define TOON
|
|||
|
varying vec3 vViewPosition;
|
|||
|
#include <common>
|
|||
|
#include <batching_pars_vertex>
|
|||
|
#include <uv_pars_vertex>
|
|||
|
#include <displacementmap_pars_vertex>
|
|||
|
#include <color_pars_vertex>
|
|||
|
#include <fog_pars_vertex>
|
|||
|
#include <normal_pars_vertex>
|
|||
|
#include <morphtarget_pars_vertex>
|
|||
|
#include <skinning_pars_vertex>
|
|||
|
#include <shadowmap_pars_vertex>
|
|||
|
#include <logdepthbuf_pars_vertex>
|
|||
|
#include <clipping_planes_pars_vertex>
|
|||
|
void main() {
|
|||
|
#include <uv_vertex>
|
|||
|
#include <color_vertex>
|
|||
|
#include <morphcolor_vertex>
|
|||
|
#include <batching_vertex>
|
|||
|
#include <beginnormal_vertex>
|
|||
|
#include <morphnormal_vertex>
|
|||
|
#include <skinbase_vertex>
|
|||
|
#include <skinnormal_vertex>
|
|||
|
#include <defaultnormal_vertex>
|
|||
|
#include <normal_vertex>
|
|||
|
#include <begin_vertex>
|
|||
|
#include <morphtarget_vertex>
|
|||
|
#include <skinning_vertex>
|
|||
|
#include <displacementmap_vertex>
|
|||
|
#include <project_vertex>
|
|||
|
#include <logdepthbuf_vertex>
|
|||
|
#include <clipping_planes_vertex>
|
|||
|
vViewPosition = - mvPosition.xyz;
|
|||
|
#include <worldpos_vertex>
|
|||
|
#include <shadowmap_vertex>
|
|||
|
#include <fog_vertex>
|
|||
|
}`,XOt=`#define TOON
|
|||
|
uniform vec3 diffuse;
|
|||
|
uniform vec3 emissive;
|
|||
|
uniform float opacity;
|
|||
|
#include <common>
|
|||
|
#include <packing>
|
|||
|
#include <dithering_pars_fragment>
|
|||
|
#include <color_pars_fragment>
|
|||
|
#include <uv_pars_fragment>
|
|||
|
#include <map_pars_fragment>
|
|||
|
#include <alphamap_pars_fragment>
|
|||
|
#include <alphatest_pars_fragment>
|
|||
|
#include <alphahash_pars_fragment>
|
|||
|
#include <aomap_pars_fragment>
|
|||
|
#include <lightmap_pars_fragment>
|
|||
|
#include <emissivemap_pars_fragment>
|
|||
|
#include <gradientmap_pars_fragment>
|
|||
|
#include <fog_pars_fragment>
|
|||
|
#include <bsdfs>
|
|||
|
#include <lights_pars_begin>
|
|||
|
#include <normal_pars_fragment>
|
|||
|
#include <lights_toon_pars_fragment>
|
|||
|
#include <shadowmap_pars_fragment>
|
|||
|
#include <bumpmap_pars_fragment>
|
|||
|
#include <normalmap_pars_fragment>
|
|||
|
#include <logdepthbuf_pars_fragment>
|
|||
|
#include <clipping_planes_pars_fragment>
|
|||
|
void main() {
|
|||
|
#include <clipping_planes_fragment>
|
|||
|
vec4 diffuseColor = vec4( diffuse, opacity );
|
|||
|
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|||
|
vec3 totalEmissiveRadiance = emissive;
|
|||
|
#include <logdepthbuf_fragment>
|
|||
|
#include <map_fragment>
|
|||
|
#include <color_fragment>
|
|||
|
#include <alphamap_fragment>
|
|||
|
#include <alphatest_fragment>
|
|||
|
#include <alphahash_fragment>
|
|||
|
#include <normal_fragment_begin>
|
|||
|
#include <normal_fragment_maps>
|
|||
|
#include <emissivemap_fragment>
|
|||
|
#include <lights_toon_fragment>
|
|||
|
#include <lights_fragment_begin>
|
|||
|
#include <lights_fragment_maps>
|
|||
|
#include <lights_fragment_end>
|
|||
|
#include <aomap_fragment>
|
|||
|
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
|
|||
|
#include <opaque_fragment>
|
|||
|
#include <tonemapping_fragment>
|
|||
|
#include <colorspace_fragment>
|
|||
|
#include <fog_fragment>
|
|||
|
#include <premultiplied_alpha_fragment>
|
|||
|
#include <dithering_fragment>
|
|||
|
}`,ZOt=`uniform float size;
|
|||
|
uniform float scale;
|
|||
|
#include <common>
|
|||
|
#include <color_pars_vertex>
|
|||
|
#include <fog_pars_vertex>
|
|||
|
#include <morphtarget_pars_vertex>
|
|||
|
#include <logdepthbuf_pars_vertex>
|
|||
|
#include <clipping_planes_pars_vertex>
|
|||
|
#ifdef USE_POINTS_UV
|
|||
|
varying vec2 vUv;
|
|||
|
uniform mat3 uvTransform;
|
|||
|
#endif
|
|||
|
void main() {
|
|||
|
#ifdef USE_POINTS_UV
|
|||
|
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#include <color_vertex>
|
|||
|
#include <morphcolor_vertex>
|
|||
|
#include <begin_vertex>
|
|||
|
#include <morphtarget_vertex>
|
|||
|
#include <project_vertex>
|
|||
|
gl_PointSize = size;
|
|||
|
#ifdef USE_SIZEATTENUATION
|
|||
|
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
|
|||
|
if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
|
|||
|
#endif
|
|||
|
#include <logdepthbuf_vertex>
|
|||
|
#include <clipping_planes_vertex>
|
|||
|
#include <worldpos_vertex>
|
|||
|
#include <fog_vertex>
|
|||
|
}`,JOt=`uniform vec3 diffuse;
|
|||
|
uniform float opacity;
|
|||
|
#include <common>
|
|||
|
#include <color_pars_fragment>
|
|||
|
#include <map_particle_pars_fragment>
|
|||
|
#include <alphatest_pars_fragment>
|
|||
|
#include <alphahash_pars_fragment>
|
|||
|
#include <fog_pars_fragment>
|
|||
|
#include <logdepthbuf_pars_fragment>
|
|||
|
#include <clipping_planes_pars_fragment>
|
|||
|
void main() {
|
|||
|
#include <clipping_planes_fragment>
|
|||
|
vec3 outgoingLight = vec3( 0.0 );
|
|||
|
vec4 diffuseColor = vec4( diffuse, opacity );
|
|||
|
#include <logdepthbuf_fragment>
|
|||
|
#include <map_particle_fragment>
|
|||
|
#include <color_fragment>
|
|||
|
#include <alphatest_fragment>
|
|||
|
#include <alphahash_fragment>
|
|||
|
outgoingLight = diffuseColor.rgb;
|
|||
|
#include <opaque_fragment>
|
|||
|
#include <tonemapping_fragment>
|
|||
|
#include <colorspace_fragment>
|
|||
|
#include <fog_fragment>
|
|||
|
#include <premultiplied_alpha_fragment>
|
|||
|
}`,eIt=`#include <common>
|
|||
|
#include <batching_pars_vertex>
|
|||
|
#include <fog_pars_vertex>
|
|||
|
#include <morphtarget_pars_vertex>
|
|||
|
#include <skinning_pars_vertex>
|
|||
|
#include <logdepthbuf_pars_vertex>
|
|||
|
#include <shadowmap_pars_vertex>
|
|||
|
void main() {
|
|||
|
#include <batching_vertex>
|
|||
|
#include <beginnormal_vertex>
|
|||
|
#include <morphnormal_vertex>
|
|||
|
#include <skinbase_vertex>
|
|||
|
#include <skinnormal_vertex>
|
|||
|
#include <defaultnormal_vertex>
|
|||
|
#include <begin_vertex>
|
|||
|
#include <morphtarget_vertex>
|
|||
|
#include <skinning_vertex>
|
|||
|
#include <project_vertex>
|
|||
|
#include <logdepthbuf_vertex>
|
|||
|
#include <worldpos_vertex>
|
|||
|
#include <shadowmap_vertex>
|
|||
|
#include <fog_vertex>
|
|||
|
}`,tIt=`uniform vec3 color;
|
|||
|
uniform float opacity;
|
|||
|
#include <common>
|
|||
|
#include <packing>
|
|||
|
#include <fog_pars_fragment>
|
|||
|
#include <bsdfs>
|
|||
|
#include <lights_pars_begin>
|
|||
|
#include <logdepthbuf_pars_fragment>
|
|||
|
#include <shadowmap_pars_fragment>
|
|||
|
#include <shadowmask_pars_fragment>
|
|||
|
void main() {
|
|||
|
#include <logdepthbuf_fragment>
|
|||
|
gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
|
|||
|
#include <tonemapping_fragment>
|
|||
|
#include <colorspace_fragment>
|
|||
|
#include <fog_fragment>
|
|||
|
}`,nIt=`uniform float rotation;
|
|||
|
uniform vec2 center;
|
|||
|
#include <common>
|
|||
|
#include <uv_pars_vertex>
|
|||
|
#include <fog_pars_vertex>
|
|||
|
#include <logdepthbuf_pars_vertex>
|
|||
|
#include <clipping_planes_pars_vertex>
|
|||
|
void main() {
|
|||
|
#include <uv_vertex>
|
|||
|
vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
|
|||
|
vec2 scale;
|
|||
|
scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
|
|||
|
scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
|
|||
|
#ifndef USE_SIZEATTENUATION
|
|||
|
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
|
|||
|
if ( isPerspective ) scale *= - mvPosition.z;
|
|||
|
#endif
|
|||
|
vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
|
|||
|
vec2 rotatedPosition;
|
|||
|
rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
|
|||
|
rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
|
|||
|
mvPosition.xy += rotatedPosition;
|
|||
|
gl_Position = projectionMatrix * mvPosition;
|
|||
|
#include <logdepthbuf_vertex>
|
|||
|
#include <clipping_planes_vertex>
|
|||
|
#include <fog_vertex>
|
|||
|
}`,sIt=`uniform vec3 diffuse;
|
|||
|
uniform float opacity;
|
|||
|
#include <common>
|
|||
|
#include <uv_pars_fragment>
|
|||
|
#include <map_pars_fragment>
|
|||
|
#include <alphamap_pars_fragment>
|
|||
|
#include <alphatest_pars_fragment>
|
|||
|
#include <alphahash_pars_fragment>
|
|||
|
#include <fog_pars_fragment>
|
|||
|
#include <logdepthbuf_pars_fragment>
|
|||
|
#include <clipping_planes_pars_fragment>
|
|||
|
void main() {
|
|||
|
#include <clipping_planes_fragment>
|
|||
|
vec3 outgoingLight = vec3( 0.0 );
|
|||
|
vec4 diffuseColor = vec4( diffuse, opacity );
|
|||
|
#include <logdepthbuf_fragment>
|
|||
|
#include <map_fragment>
|
|||
|
#include <alphamap_fragment>
|
|||
|
#include <alphatest_fragment>
|
|||
|
#include <alphahash_fragment>
|
|||
|
outgoingLight = diffuseColor.rgb;
|
|||
|
#include <opaque_fragment>
|
|||
|
#include <tonemapping_fragment>
|
|||
|
#include <colorspace_fragment>
|
|||
|
#include <fog_fragment>
|
|||
|
}`,vt={alphahash_fragment:CAt,alphahash_pars_fragment:wAt,alphamap_fragment:RAt,alphamap_pars_fragment:AAt,alphatest_fragment:NAt,alphatest_pars_fragment:OAt,aomap_fragment:IAt,aomap_pars_fragment:MAt,batching_pars_vertex:kAt,batching_vertex:DAt,begin_vertex:LAt,beginnormal_vertex:PAt,bsdfs:UAt,iridescence_fragment:FAt,bumpmap_pars_fragment:BAt,clipping_planes_fragment:GAt,clipping_planes_pars_fragment:VAt,clipping_planes_pars_vertex:zAt,clipping_planes_vertex:HAt,color_fragment:qAt,color_pars_fragment:$At,color_pars_vertex:YAt,color_vertex:WAt,common:KAt,cube_uv_reflection_fragment:jAt,defaultnormal_vertex:QAt,displacementmap_pars_vertex:XAt,displacementmap_vertex:ZAt,emissivemap_fragment:JAt,emissivemap_pars_fragment:eNt,colorspace_fragment:tNt,colorspace_pars_fragment:nNt,envmap_fragment:sNt,envmap_common_pars_fragment:iNt,envmap_pars_fragment:rNt,envmap_pars_vertex:oNt,envmap_physical_pars_fragment:bNt,envmap_vertex:aNt,fog_vertex:lNt,fog_pars_vertex:cNt,fog_fragment:dNt,fog_pars_fragment:uNt,gradientmap_pars_fragment:pNt,lightmap_fragment:_Nt,lightmap_pars_fragment:hNt,lights_lambert_fragment:fNt,lights_lambert_pars_fragment:mNt,lights_pars_begin:gNt,lights_toon_fragment:ENt,lights_toon_pars_fragment:yNt,lights_phong_fragment:vNt,lights_phong_pars_fragment:SNt,lights_physical_fragment:TNt,lights_physical_pars_fragment:xNt,lights_fragment_begin:CNt,lights_fragment_maps:wNt,lights_fragment_end:RNt,logdepthbuf_fragment:ANt,logdepthbuf_pars_fragment:NNt,logdepthbuf_pars_vertex:ONt,logdepthbuf_vertex:INt,map_fragment:MNt,map_pars_fragment:kNt,map_particle_fragment:DNt,map_particle_pars_fragment:LNt,metalnessmap_fragment:PNt,metalnessmap_pars_fragment:UNt,morphcolor_vertex:FNt,morphnormal_vertex:BNt,morphtarget_pars_vertex:GNt,morphtarget_vertex:VNt,normal_fragment_begin:zNt,normal_fragment_maps:HNt,normal_pars_fragment:qNt,normal_pars_vertex:$Nt,normal_vertex:YNt,normalmap_pars_fragment:WNt,clearcoat_normal_fragment_begin:KNt,clearcoat_normal_fragment_maps:jNt,clearcoat_pars_fragment:QNt,iridescence_pars_fragment:XNt,opaque_fragment:ZNt,packing:JNt,premultiplied_alpha_fragment:eOt,project_vertex:tOt,dithering_fragment:nOt,dithering_pars_fragment:sOt,roughnessmap_fragment:iOt,roughnessmap_pars_fragment:rOt,shadowmap_pars_fragment:oOt,shadowmap_pars_vertex:aOt,shadowmap_vertex:lOt,shadowmask_pars_fragment:cOt,skinbase_vertex:dOt,skinning_pars_vertex:uOt,skinning_vertex:pOt,skinnormal_vertex:_Ot,specularmap_fragment:hOt,specularmap_pars_fragment:fOt,tonemapping_fragment:mOt,tonemapping_pars_fragment:gOt,transmission_fragment:bOt,transmission_pars_fragment:EOt,uv_pars_fragment:yOt,uv_pars_vertex:vOt,uv_vertex:SOt,worldpos_vertex:TOt,background_vert:xOt,background_frag:COt,backgroundCube_vert:wOt,backgroundCube_frag:ROt,cube_vert:AOt,cube_frag:NOt,depth_vert:OOt,depth_frag:IOt,distanceRGBA_vert:MOt,distanceRGBA_frag:kOt,equirect_vert:DOt,equirect_frag:LOt,linedashed_vert:POt,linedashed_frag:UOt,meshbasic_vert:FOt,meshbasic_frag:BOt,meshlambert_vert:GOt,meshlambert_frag:VOt,meshmatcap_vert:zOt,meshmatcap_frag:HOt,meshnormal_vert:qOt,meshnormal_frag:$Ot,meshphong_vert:YOt,meshphong_frag:WOt,meshphysical_vert:KOt,meshphysical_frag:jOt,meshtoon_vert:QOt,meshtoon_frag:XOt,points_vert:ZOt,points_frag:JOt,shadow_vert:eIt,shadow_frag:tIt,sprite_vert:nIt,sprite_frag:sIt},We={common:{diffuse:{value:new pt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new St},alphaMap:{value:null},alphaMapTransform:{value:new St},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new St}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new St}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new St}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new St},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new St},normalScale:{value:new Rt(1,1)}},displacementmap:{displacementMap:{value:
|
|||
|
|
|||
|
precision mediump float;
|
|||
|
precision mediump int;
|
|||
|
|
|||
|
varying vec3 vOutputDirection;
|
|||
|
|
|||
|
uniform sampler2D envMap;
|
|||
|
uniform int samples;
|
|||
|
uniform float weights[ n ];
|
|||
|
uniform bool latitudinal;
|
|||
|
uniform float dTheta;
|
|||
|
uniform float mipInt;
|
|||
|
uniform vec3 poleAxis;
|
|||
|
|
|||
|
#define ENVMAP_TYPE_CUBE_UV
|
|||
|
#include <cube_uv_reflection_fragment>
|
|||
|
|
|||
|
vec3 getSample( float theta, vec3 axis ) {
|
|||
|
|
|||
|
float cosTheta = cos( theta );
|
|||
|
// Rodrigues' axis-angle rotation
|
|||
|
vec3 sampleDirection = vOutputDirection * cosTheta
|
|||
|
+ cross( axis, vOutputDirection ) * sin( theta )
|
|||
|
+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
|
|||
|
|
|||
|
return bilinearCubeUV( envMap, sampleDirection, mipInt );
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
void main() {
|
|||
|
|
|||
|
vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
|
|||
|
|
|||
|
if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
|
|||
|
|
|||
|
axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
axis = normalize( axis );
|
|||
|
|
|||
|
gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
|
|||
|
gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
|
|||
|
|
|||
|
for ( int i = 1; i < n; i++ ) {
|
|||
|
|
|||
|
if ( i >= samples ) {
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
float theta = dTheta * float( i );
|
|||
|
gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
|
|||
|
gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
`,blending:cr,depthTest:!1,depthWrite:!1})}function pC(){return new to({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:LE(),fragmentShader:`
|
|||
|
|
|||
|
precision mediump float;
|
|||
|
precision mediump int;
|
|||
|
|
|||
|
varying vec3 vOutputDirection;
|
|||
|
|
|||
|
uniform sampler2D envMap;
|
|||
|
|
|||
|
#include <common>
|
|||
|
|
|||
|
void main() {
|
|||
|
|
|||
|
vec3 outputDirection = normalize( vOutputDirection );
|
|||
|
vec2 uv = equirectUv( outputDirection );
|
|||
|
|
|||
|
gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
|
|||
|
|
|||
|
}
|
|||
|
`,blending:cr,depthTest:!1,depthWrite:!1})}function _C(){return new to({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:LE(),fragmentShader:`
|
|||
|
|
|||
|
precision mediump float;
|
|||
|
precision mediump int;
|
|||
|
|
|||
|
uniform float flipEnvMap;
|
|||
|
|
|||
|
varying vec3 vOutputDirection;
|
|||
|
|
|||
|
uniform samplerCube envMap;
|
|||
|
|
|||
|
void main() {
|
|||
|
|
|||
|
gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
|
|||
|
|
|||
|
}
|
|||
|
`,blending:cr,depthTest:!1,depthWrite:!1})}function LE(){return`
|
|||
|
|
|||
|
precision mediump float;
|
|||
|
precision mediump int;
|
|||
|
|
|||
|
attribute float faceIndex;
|
|||
|
|
|||
|
varying vec3 vOutputDirection;
|
|||
|
|
|||
|
// RH coordinate system; PMREM face-indexing convention
|
|||
|
vec3 getDirection( vec2 uv, float face ) {
|
|||
|
|
|||
|
uv = 2.0 * uv - 1.0;
|
|||
|
|
|||
|
vec3 direction = vec3( uv, 1.0 );
|
|||
|
|
|||
|
if ( face == 0.0 ) {
|
|||
|
|
|||
|
direction = direction.zyx; // ( 1, v, u ) pos x
|
|||
|
|
|||
|
} else if ( face == 1.0 ) {
|
|||
|
|
|||
|
direction = direction.xzy;
|
|||
|
direction.xz *= -1.0; // ( -u, 1, -v ) pos y
|
|||
|
|
|||
|
} else if ( face == 2.0 ) {
|
|||
|
|
|||
|
direction.x *= -1.0; // ( -u, v, 1 ) pos z
|
|||
|
|
|||
|
} else if ( face == 3.0 ) {
|
|||
|
|
|||
|
direction = direction.zyx;
|
|||
|
direction.xz *= -1.0; // ( -1, v, -u ) neg x
|
|||
|
|
|||
|
} else if ( face == 4.0 ) {
|
|||
|
|
|||
|
direction = direction.xzy;
|
|||
|
direction.xy *= -1.0; // ( -u, -1, v ) neg y
|
|||
|
|
|||
|
} else if ( face == 5.0 ) {
|
|||
|
|
|||
|
direction.z *= -1.0; // ( u, v, -1 ) neg z
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
return direction;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
void main() {
|
|||
|
|
|||
|
vOutputDirection = getDirection( uv, faceIndex );
|
|||
|
gl_Position = vec4( position, 1.0 );
|
|||
|
|
|||
|
}
|
|||
|
`}function pIt(t){let e=new WeakMap,n=null;function s(a){if(a&&a.isTexture){const c=a.mapping,d=c===Fg||c===Bg,u=c===aa||c===la;if(d||u)if(a.isRenderTargetTexture&&a.needsPMREMUpdate===!0){a.needsPMREMUpdate=!1;let h=e.get(a);return n===null&&(n=new dC(t)),h=d?n.fromEquirectangular(a,h):n.fromCubemap(a,h),e.set(a,h),h.texture}else{if(e.has(a))return e.get(a).texture;{const h=a.image;if(d&&h&&h.height>0||u&&h&&i(h)){n===null&&(n=new dC(t));const f=d?n.fromEquirectangular(a):n.fromCubemap(a);return e.set(a,f),a.addEventListener("dispose",r),f.texture}else return null}}}return a}function i(a){let c=0;const d=6;for(let u=0;u<d;u++)a[u]!==void 0&&c++;return c===d}function r(a){const c=a.target;c.removeEventListener("dispose",r);const d=e.get(c);d!==void 0&&(e.delete(c),d.dispose())}function o(){e=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:s,dispose:o}}function _It(t){const e={};function n(s){if(e[s]!==void 0)return e[s];let i;switch(s){case"WEBGL_depth_texture":i=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=t.getExtension(s)}return e[s]=i,i}return{has:function(s){return n(s)!==null},init:function(s){s.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture")},get:function(s){const i=n(s);return i===null&&console.warn("THREE.WebGLRenderer: "+s+" extension not supported."),i}}}function hIt(t,e,n,s){const i={},r=new WeakMap;function o(h){const f=h.target;f.index!==null&&e.remove(f.index);for(const _ in f.attributes)e.remove(f.attributes[_]);for(const _ in f.morphAttributes){const b=f.morphAttributes[_];for(let E=0,g=b.length;E<g;E++)e.remove(b[E])}f.removeEventListener("dispose",o),delete i[f.id];const m=r.get(f);m&&(e.remove(m),r.delete(f)),s.releaseStatesOfGeometry(f),f.isInstancedBufferGeometry===!0&&delete f._maxInstanceCount,n.memory.geometries--}function a(h,f){return i[f.id]===!0||(f.addEventListener("dispose",o),i[f.id]=!0,n.memory.geometries++),f}function c(h){const f=h.attributes;for(const _ in f)e.update(f[_],t.ARRAY_BUFFER);const m=h.morphAttributes;for(const _ in m){const b=m[_];for(let E=0,g=b.length;E<g;E++)e.update(b[E],t.ARRAY_BUFFER)}}function d(h){const f=[],m=h.index,_=h.attributes.position;let b=0;if(m!==null){const y=m.array;b=m.version;for(let v=0,S=y.length;v<S;v+=3){const R=y[v+0],C=y[v+1],A=y[v+2];f.push(R,C,C,A,A,R)}}else if(_!==void 0){const y=_.array;b=_.version;for(let v=0,S=y.length/3-1;v<S;v+=3){const R=v+0,C=v+1,A=v+2;f.push(R,C,C,A,A,R)}}else return;const E=new(hO(f)?vO:yO)(f,1);E.version=b;const g=r.get(h);g&&e.remove(g),r.set(h,E)}function u(h){const f=r.get(h);if(f){const m=h.index;m!==null&&f.version<m.version&&d(h)}else d(h);return r.get(h)}return{get:a,update:c,getWireframeAttribute:u}}function fIt(t,e,n,s){const i=s.isWebGL2;let r;function o(m){r=m}let a,c;function d(m){a=m.type,c=m.bytesPerElement}function u(m,_){t.drawElements(r,_,a,m*c),n.update(_,r,1)}function h(m,_,b){if(b===0)return;let E,g;if(i)E=t,g="drawElementsInstanced";else if(E=e.get("ANGLE_instanced_arrays"),g="drawElementsInstancedANGLE",E===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support ex
|
|||
|
`),s=[],i=Math.max(e-6,0),r=Math.min(e+6,n.length);for(let o=i;o<r;o++){const a=o+1;s.push(`${a===e?">":" "} ${a}: ${n[o]}`)}return s.join(`
|
|||
|
`)}function h2t(t){const e=Pt.getPrimaries(Pt.workingColorSpace),n=Pt.getPrimaries(t);let s;switch(e===n?s="":e===Jd&&n===Zd?s="LinearDisplayP3ToLinearSRGB":e===Zd&&n===Jd&&(s="LinearSRGBToLinearDisplayP3"),t){case wn:case Yu:return[s,"LinearTransferOETF"];case en:case OE:return[s,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",t),[s,"LinearTransferOETF"]}}function vC(t,e,n){const s=t.getShaderParameter(e,t.COMPILE_STATUS),i=t.getShaderInfoLog(e).trim();if(s&&i==="")return"";const r=/ERROR: 0:(\d+)/.exec(i);if(r){const o=parseInt(r[1]);return n.toUpperCase()+`
|
|||
|
|
|||
|
`+i+`
|
|||
|
|
|||
|
`+_2t(t.getShaderSource(e),o)}else return i}function f2t(t,e){const n=h2t(e);return`vec4 ${t}( vec4 value ) { return ${n[0]}( ${n[1]}( value ) ); }`}function m2t(t,e){let n;switch(e){case pRt:n="Linear";break;case _Rt:n="Reinhard";break;case hRt:n="OptimizedCineon";break;case fRt:n="ACESFilmic";break;case mRt:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function g2t(t){return[t.extensionDerivatives||t.envMapCubeUVHeight||t.bumpMap||t.normalMapTangentSpace||t.clearcoatNormalMap||t.flatShading||t.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(t.extensionFragDepth||t.logarithmicDepthBuffer)&&t.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",t.extensionDrawBuffers&&t.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(t.extensionShaderTextureLOD||t.envMap||t.transmission)&&t.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(ll).join(`
|
|||
|
`)}function b2t(t){const e=[];for(const n in t){const s=t[n];s!==!1&&e.push("#define "+n+" "+s)}return e.join(`
|
|||
|
`)}function E2t(t,e){const n={},s=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let i=0;i<s;i++){const r=t.getActiveAttrib(e,i),o=r.name;let a=1;r.type===t.FLOAT_MAT2&&(a=2),r.type===t.FLOAT_MAT3&&(a=3),r.type===t.FLOAT_MAT4&&(a=4),n[o]={type:r.type,location:t.getAttribLocation(e,o),locationSize:a}}return n}function ll(t){return t!==""}function SC(t,e){const n=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function TC(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const y2t=/^[ \t]*#include +<([\w\d./]+)>/gm;function $g(t){return t.replace(y2t,S2t)}const v2t=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function S2t(t,e){let n=vt[e];if(n===void 0){const s=v2t.get(e);if(s!==void 0)n=vt[s],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,s);else throw new Error("Can not resolve #include <"+e+">")}return $g(n)}const T2t=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function xC(t){return t.replace(T2t,x2t)}function x2t(t,e,n,s){let i="";for(let r=parseInt(e);r<parseInt(n);r++)i+=s.replace(/\[\s*i\s*\]/g,"[ "+r+" ]").replace(/UNROLLED_LOOP_INDEX/g,r);return i}function CC(t){let e="precision "+t.precision+` float;
|
|||
|
precision `+t.precision+" int;";return t.precision==="highp"?e+=`
|
|||
|
#define HIGH_PRECISION`:t.precision==="mediump"?e+=`
|
|||
|
#define MEDIUM_PRECISION`:t.precision==="lowp"&&(e+=`
|
|||
|
#define LOW_PRECISION`),e}function C2t(t){let e="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===tO?e="SHADOWMAP_TYPE_PCF":t.shadowMapType===Gwt?e="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===yi&&(e="SHADOWMAP_TYPE_VSM"),e}function w2t(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case aa:case la:e="ENVMAP_TYPE_CUBE";break;case $u:e="ENVMAP_TYPE_CUBE_UV";break}return e}function R2t(t){let e="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case la:e="ENVMAP_MODE_REFRACTION";break}return e}function A2t(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case RE:e="ENVMAP_BLENDING_MULTIPLY";break;case dRt:e="ENVMAP_BLENDING_MIX";break;case uRt:e="ENVMAP_BLENDING_ADD";break}return e}function N2t(t){const e=t.envMapCubeUVHeight;if(e===null)return null;const n=Math.log2(e)-2,s=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,n),7*16)),texelHeight:s,maxMip:n}}function O2t(t,e,n,s){const i=t.getContext(),r=n.defines;let o=n.vertexShader,a=n.fragmentShader;const c=C2t(n),d=w2t(n),u=R2t(n),h=A2t(n),f=N2t(n),m=n.isWebGL2?"":g2t(n),_=b2t(r),b=i.createProgram();let E,g,y=n.glslVersion?"#version "+n.glslVersion+`
|
|||
|
`:"";n.isRawShaderMaterial?(E=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,_].filter(ll).join(`
|
|||
|
`),E.length>0&&(E+=`
|
|||
|
`),g=[m,"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,_].filter(ll).join(`
|
|||
|
`),g.length>0&&(g+=`
|
|||
|
`)):(E=[CC(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,_,n.batching?"#define USE_BATCHING":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+u:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&n.flatShading===!1?"#define USE_MORPHNORMALS":"",n.morphColors&&n.isWebGL2?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?
|
|||
|
`].filter(ll).join(`
|
|||
|
`),g=[m,CC(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,_,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+d:"",n.envMap?"#define "+u:"",n.envMap?"#define "+h:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+c:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.useLegacyLights?"#define LEGACY_LIGHTS":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==dr?"#define TONE_MAPPING":"",n.toneMapping!==dr?vt.tonemapping_pars_fragment:"",n.toneMapping!==dr?m2t("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",vt.colorspace_pars_fragment,f2t("linearToOutputTexel",n.outputColorSpace),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",`
|
|||
|
`].filter(ll).join(`
|
|||
|
`)),o=$g(o),o=SC(o,n),o=TC(o,n),a=$g(a),a=SC(a,n),a=TC(a,n),o=xC(o),a=xC(a),n.isWebGL2&&n.isRawShaderMaterial!==!0&&(y=`#version 300 es
|
|||
|
`,E=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(`
|
|||
|
`)+`
|
|||
|
`+E,g=["precision mediump sampler2DArray;","#define varying in",n.glslVersion===H1?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===H1?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
|
|||
|
`)+`
|
|||
|
`+g);const v=y+E+o,S=y+g+a,R=yC(i,i.VERTEX_SHADER,v),C=yC(i,i.FRAGMENT_SHADER,S);i.attachShader(b,R),i.attachShader(b,C),n.index0AttributeName!==void 0?i.bindAttribLocation(b,0,n.index0AttributeName):n.morphTargets===!0&&i.bindAttribLocation(b,0,"position"),i.linkProgram(b);function A(B){if(t.debug.checkShaderErrors){const z=i.getProgramInfoLog(b).trim(),ee=i.getShaderInfoLog(R).trim(),M=i.getShaderInfoLog(C).trim();let q=!0,H=!0;if(i.getProgramParameter(b,i.LINK_STATUS)===!1)if(q=!1,typeof t.debug.onShaderError=="function")t.debug.onShaderError(i,b,R,C);else{const P=vC(i,R,"vertex"),Y=vC(i,C,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(b,i.VALIDATE_STATUS)+`
|
|||
|
|
|||
|
Program Info Log: `+z+`
|
|||
|
`+P+`
|
|||
|
`+Y)}else z!==""?console.warn("THREE.WebGLProgram: Program Info Log:",z):(ee===""||M==="")&&(H=!1);H&&(B.diagnostics={runnable:q,programLog:z,vertexShader:{log:ee,prefix:E},fragmentShader:{log:M,prefix:g}})}i.deleteShader(R),i.deleteShader(C),k=new Sd(i,b),x=E2t(i,b)}let k;this.getUniforms=function(){return k===void 0&&A(this),k};let x;this.getAttributes=function(){return x===void 0&&A(this),x};let O=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return O===!1&&(O=i.getProgramParameter(b,u2t)),O},this.destroy=function(){s.releaseStatesOfProgram(this),i.deleteProgram(b),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=p2t++,this.cacheKey=e,this.usedTimes=1,this.program=b,this.vertexShader=R,this.fragmentShader=C,this}let I2t=0;class M2t{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const n=e.vertexShader,s=e.fragmentShader,i=this._getShaderStage(n),r=this._getShaderStage(s),o=this._getShaderCacheForMaterial(e);return o.has(i)===!1&&(o.add(i),i.usedTimes++),o.has(r)===!1&&(o.add(r),r.usedTimes++),this}remove(e){const n=this.materialCache.get(e);for(const s of n)s.usedTimes--,s.usedTimes===0&&this.shaderCache.delete(s.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const n=this.materialCache;let s=n.get(e);return s===void 0&&(s=new Set,n.set(e,s)),s}_getShaderStage(e){const n=this.shaderCache;let s=n.get(e);return s===void 0&&(s=new k2t(e),n.set(e,s)),s}}class k2t{constructor(e){this.id=I2t++,this.code=e,this.usedTimes=0}}function D2t(t,e,n,s,i,r,o){const a=new bO,c=new M2t,d=[],u=i.isWebGL2,h=i.logarithmicDepthBuffer,f=i.vertexTextures;let m=i.precision;const _={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function b(x){return x===0?"uv":`uv${x}`}function E(x,O,B,z,ee){const M=z.fog,q=ee.geometry,H=x.isMeshStandardMaterial?z.environment:null,P=(x.isMeshStandardMaterial?n:e).get(x.envMap||H),Y=P&&P.mapping===$u?P.image.height:null,te=_[x.type];x.precision!==null&&(m=i.getMaxPrecision(x.precision),m!==x.precision&&console.warn("THREE.WebGLProgram.getParameters:",x.precision,"not supported, using",m,"instead."));const oe=q.morphAttributes.position||q.morphAttributes.normal||q.morphAttributes.color,me=oe!==void 0?oe.length:0;let Se=0;q.morphAttributes.position!==void 0&&(Se=1),q.morphAttributes.normal!==void 0&&(Se=2),q.morphAttributes.color!==void 0&&(Se=3);let le,Ee,Oe,Me;if(te){const En=Hs[te];le=En.vertexShader,Ee=En.fragmentShader}else le=x.vertexShader,Ee=x.fragmentShader,c.update(x),Oe=c.getVertexShaderID(x),Me=c.getFragmentShaderID(x);const Q=t.getRenderTarget(),he=ee.isInstancedMesh===!0,_e=ee.isBatchedMesh===!0,Ce=!!x.map,Le=!!x.matcap,N=!!P,V=!!x.aoMap,$=!!x.lightMap,ae=!!x.bumpMap,ie=!!x.normalMap,Te=!!x.displacementMap,Ae=!!x.emissiveMap,se=!!x.metalnessMap,we=!!x.roughnessMap,ge=x.anisotropy>0,ke=x.clearcoat>0,L=x.iridescence>0,I=x.sheen>0,K=x.transmission>0,ye=ge&&!!x.anisotropyMap,j=ke&&!!x.clearcoatMap,ne=ke&&!!x.clearcoatNormalMap,Re=ke&&!!x.clearcoatRoughnessMap,xe=L&&!!x.iridescenceMap,Pe=L&&!!x.iridescenceThicknessMap,Ze=I&&!!x.sheenColorMap,ht=I&&!!x.sheenRoughnessMap,Ue=!!x.specularMap,ut=!!x.specularColorMap,nt=!!x.specularIntensityMap,Ye=K&&!!x.transmissionMap,tt=K&&!!x.thicknessMap,Ke=!!x.gradientMap,Et=!!x.alphaMap,J=x.alphaTest>0,Qe=!!x.alphaHash,Ve=!!x.extensions,Ne=!!q.attributes.uv1,He=!!q.attributes.uv2,lt=!!q.attributes.uv3;let At=dr;return x.toneMapped&&(Q===null||Q.isXRRenderTarget===!0)&&(At=t.toneMapping),{isWebGL2:
|
|||
|
gl_Position = vec4( position, 1.0 );
|
|||
|
}`,W2t=`uniform sampler2D shadow_pass;
|
|||
|
uniform vec2 resolution;
|
|||
|
uniform float radius;
|
|||
|
#include <packing>
|
|||
|
void main() {
|
|||
|
const float samples = float( VSM_SAMPLES );
|
|||
|
float mean = 0.0;
|
|||
|
float squared_mean = 0.0;
|
|||
|
float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
|
|||
|
float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
|
|||
|
for ( float i = 0.0; i < samples; i ++ ) {
|
|||
|
float uvOffset = uvStart + i * uvStride;
|
|||
|
#ifdef HORIZONTAL_PASS
|
|||
|
vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
|
|||
|
mean += distribution.x;
|
|||
|
squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
|
|||
|
#else
|
|||
|
float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
|
|||
|
mean += depth;
|
|||
|
squared_mean += depth * depth;
|
|||
|
#endif
|
|||
|
}
|
|||
|
mean = mean / samples;
|
|||
|
squared_mean = squared_mean / samples;
|
|||
|
float std_dev = sqrt( squared_mean - mean * mean );
|
|||
|
gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
|
|||
|
}`;function K2t(t,e,n){let s=new ME;const i=new Rt,r=new Rt,o=new $t,a=new q2t({depthPacking:NRt}),c=new $2t,d={},u=n.maxTextureSize,h={[Ii]:$n,[$n]:Ii,[$s]:$s},f=new to({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Rt},radius:{value:4}},vertexShader:Y2t,fragmentShader:W2t}),m=f.clone();m.defines.HORIZONTAL_PASS=1;const _=new li;_.setAttribute("position",new Bn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const b=new Fn(_,f),E=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=tO;let g=this.type;this.render=function(R,C,A){if(E.enabled===!1||E.autoUpdate===!1&&E.needsUpdate===!1||R.length===0)return;const k=t.getRenderTarget(),x=t.getActiveCubeFace(),O=t.getActiveMipmapLevel(),B=t.state;B.setBlending(cr),B.buffers.color.setClear(1,1,1,1),B.buffers.depth.setTest(!0),B.setScissorTest(!1);const z=g!==yi&&this.type===yi,ee=g===yi&&this.type!==yi;for(let M=0,q=R.length;M<q;M++){const H=R[M],P=H.shadow;if(P===void 0){console.warn("THREE.WebGLShadowMap:",H,"has no shadow.");continue}if(P.autoUpdate===!1&&P.needsUpdate===!1)continue;i.copy(P.mapSize);const Y=P.getFrameExtents();if(i.multiply(Y),r.copy(P.mapSize),(i.x>u||i.y>u)&&(i.x>u&&(r.x=Math.floor(u/Y.x),i.x=r.x*Y.x,P.mapSize.x=r.x),i.y>u&&(r.y=Math.floor(u/Y.y),i.y=r.y*Y.y,P.mapSize.y=r.y)),P.map===null||z===!0||ee===!0){const oe=this.type!==yi?{minFilter:gn,magFilter:gn}:{};P.map!==null&&P.map.dispose(),P.map=new eo(i.x,i.y,oe),P.map.texture.name=H.name+".shadowMap",P.camera.updateProjectionMatrix()}t.setRenderTarget(P.map),t.clear();const te=P.getViewportCount();for(let oe=0;oe<te;oe++){const me=P.getViewport(oe);o.set(r.x*me.x,r.y*me.y,r.x*me.z,r.y*me.w),B.viewport(o),P.updateMatrices(H,oe),s=P.getFrustum(),S(C,A,P.camera,H,this.type)}P.isPointLightShadow!==!0&&this.type===yi&&y(P,A),P.needsUpdate=!1}g=this.type,E.needsUpdate=!1,t.setRenderTarget(k,x,O)};function y(R,C){const A=e.update(b);f.defines.VSM_SAMPLES!==R.blurSamples&&(f.defines.VSM_SAMPLES=R.blurSamples,m.defines.VSM_SAMPLES=R.blurSamples,f.needsUpdate=!0,m.needsUpdate=!0),R.mapPass===null&&(R.mapPass=new eo(i.x,i.y)),f.uniforms.shadow_pass.value=R.map.texture,f.uniforms.resolution.value=R.mapSize,f.uniforms.radius.value=R.radius,t.setRenderTarget(R.mapPass),t.clear(),t.renderBufferDirect(C,null,A,f,b,null),m.uniforms.shadow_pass.value=R.mapPass.texture,m.uniforms.resolution.value=R.mapSize,m.uniforms.radius.value=R.radius,t.setRenderTarget(R.map),t.clear(),t.renderBufferDirect(C,null,A,m,b,null)}function v(R,C,A,k){let x=null;const O=A.isPointLight===!0?R.customDistanceMaterial:R.customDepthMaterial;if(O!==void 0)x=O;else if(x=A.isPointLight===!0?c:a,t.localClippingEnabled&&C.clipShadows===!0&&Array.isArray(C.clippingPlanes)&&C.clippingPlanes.length!==0||C.displacementMap&&C.displacementScale!==0||C.alphaMap&&C.alphaTest>0||C.map&&C.alphaTest>0){const B=x.uuid,z=C.uuid;let ee=d[B];ee===void 0&&(ee={},d[B]=ee);let M=ee[z];M===void 0&&(M=x.clone(),ee[z]=M),x=M}if(x.visible=C.visible,x.wireframe=C.wireframe,k===yi?x.side=C.shadowSide!==null?C.shadowSide:C.side:x.side=C.shadowSide!==null?C.shadowSide:h[C.side],x.alphaMap=C.alphaMap,x.alphaTest=C.alphaTest,x.map=C.map,x.clipShadows=C.clipShadows,x.clippingPlanes=C.clippingPlanes,x.clipIntersection=C.clipIntersection,x.displacementMap=C.displacementMap,x.displacementScale=C.displacementScale,x.displacementBias=C.displacementBias,x.wireframeLinewidth=C.wireframeLinewidth,x.linewidth=C.linewidth,A.isPointLight===!0&&x.isMeshDistanceMaterial===!0){const B=t.properties.get(x);B.light=A}return x}function S(R,C,A,k,x){if(R.visible===!1)return;if(R.layers.test(C.layers)&&(R.isMesh||R.isLine||R.isPoints)&&(R.castShadow||R.receiveShadow&&x===yi)&&(!R.frustumCulled||s.intersectsObject(R))){R.modelViewMatrix.multiplyMatrices(A.matrixWorldInverse,R.matrixWorld);const z=e.update(R),ee=R.material;if(Array.isArray(ee)){const M=z.groups;for(let q=0,H=M.length;q<H;q++){const P=M[q],Y=ee[P.materialIndex];if(Y&&Y.visible){const te=v(R,Y,k,x);R.onBeforeShadow(t,R,C,A,z,te,P),t.renderBufferDirect(A,null,z,te,R,P),R.onAfterShad
|
|||
|
Please check that you don't accidentally use the same token twice to register two different handlers for the same event/hook.`),this.unsubscribe(e)),this.listenerMap.set(e,n),this._listeners.push(n)}unsubscribe(e){if(this.listenerMap.has(e)){const n=this.listenerMap.get(e);this.listenerMap.delete(e);const s=this._listeners.indexOf(n);s>=0&&this._listeners.splice(s,1)}}registerProxy(e,n){this.proxyMap.has(e)&&(console.warn(`Already subscribed. Unsubscribing for you.
|
|||
|
Please check that you don't accidentally use the same token twice to register two different proxies for the same event/hook.`),this.unregisterProxy(e)),this.proxyMap.set(e,n),this.proxies.push(n)}unregisterProxy(e){if(!this.proxyMap.has(e))return;const n=this.proxyMap.get(e);this.proxyMap.delete(e);const s=this.proxies.indexOf(n);s>=0&&this.proxies.splice(s,1)}}class zt extends Kr{constructor(e){super(),this.entity=e}emit(e){this.listeners.forEach(n=>n(e,this.entity))}}class In extends Kr{constructor(e){super(),this.entity=e}emit(e){let n=!1;const s=()=>[n=!0];for(const i of Array.from(this.listeners.values()))if(i(e,s,this.entity),n)return{prevented:!0};return{prevented:!1}}}class HO extends Kr{execute(e,n){let s=e;for(const i of this.listeners)s=i(s,n);return s}}class ts extends HO{constructor(e){super(),this.entity=e}execute(e){return super.execute(e,this.entity)}}class sDt extends Kr{constructor(e){super(),this.entity=e}execute(e){const n=[];for(const s of this.listeners)n.push(s(e,this.entity));return n}}function Vs(){const t=Symbol(),e=new Map,n=new Set,s=(c,d)=>{d instanceof Kr&&d.registerProxy(t,()=>{var u,h;return(h=(u=e.get(c))===null||u===void 0?void 0:u.listeners)!==null&&h!==void 0?h:[]})},i=c=>{const d=new Kr;e.set(c,d),n.forEach(u=>s(c,u[c]))},r=c=>{n.add(c);for(const d of e.keys())s(d,c[d])},o=c=>{for(const d of e.keys())c[d]instanceof Kr&&c[d].unregisterProxy(t);n.delete(c)},a=()=>{n.forEach(c=>o(c)),e.clear()};return new Proxy({},{get(c,d){return d==="addTarget"?r:d==="removeTarget"?o:d==="destroy"?a:typeof d!="string"||d.startsWith("_")?c[d]:(e.has(d)||i(d),e.get(d))}})}class tw{constructor(e,n){if(this.destructed=!1,this.events={destruct:new zt(this)},!e||!n)throw new Error("Cannot initialize connection with null/undefined for 'from' or 'to' values");this.id=Ri(),this.from=e,this.to=n,this.from.connectionCount++,this.to.connectionCount++}destruct(){this.events.destruct.emit(),this.from.connectionCount--,this.to.connectionCount--,this.destructed=!0}}class qO{constructor(e,n){if(!e||!n)throw new Error("Cannot initialize connection with null/undefined for 'from' or 'to' values");this.id=Ri(),this.from=e,this.to=n}}function Qg(t,e){return Object.fromEntries(Object.entries(t).map(([n,s])=>[n,e(s)]))}class $O{constructor(){this._title="",this.id=Ri(),this.events={loaded:new zt(this),beforeAddInput:new In(this),addInput:new zt(this),beforeRemoveInput:new In(this),removeInput:new zt(this),beforeAddOutput:new In(this),addOutput:new zt(this),beforeRemoveOutput:new In(this),removeOutput:new zt(this),beforeTitleChanged:new In(this),titleChanged:new zt(this),update:new zt(this)},this.hooks={beforeLoad:new ts(this),afterSave:new ts(this)}}get graph(){return this.graphInstance}get title(){return this._title}set title(e){this.events.beforeTitleChanged.emit(e).prevented||(this._title=e,this.events.titleChanged.emit(e))}addInput(e,n){return this.addInterface("input",e,n)}addOutput(e,n){return this.addInterface("output",e,n)}removeInput(e){return this.removeInterface("input",e)}removeOutput(e){return this.removeInterface("output",e)}registerGraph(e){this.graphInstance=e}load(e){this.hooks.beforeLoad.execute(e),this.id=e.id,this._title=e.title,Object.entries(e.inputs).forEach(([n,s])=>{this.inputs[n]&&(this.inputs[n].load(s),this.inputs[n].nodeId=this.id)}),Object.entries(e.outputs).forEach(([n,s])=>{this.outputs[n]&&(this.outputs[n].load(s),this.outputs[n].nodeId=this.id)}),this.events.loaded.emit(this)}save(){const e=Qg(this.inputs,i=>i.save()),n=Qg(this.outputs,i=>i.save()),s={type:this.type,id:this.id,title:this.title,inputs:e,outputs:n};return this.hooks.afterSave.execute(s)}onPlaced(){}onDestroy(){}initializeIo(){Object.entries(this.inputs).forEach(([e,n])=>this.initializeIntf("input",e,n)),Object.entries(this.outputs).forEach(([e,n])=>this.initializeIntf("output",e,n))}initializeIntf(e,n,s){s.isInput=e==="input",s.nodeId=this.id,s.events.setValue.subscribe(this,()=>this.events.update.emit({type:e,name:n,intf:s}))}addInterface(e,n,s){const i=e==="input"?this.events.beforeAddInput:this.events.beforeAddOutput,r=e===
|
|||
|
This is likely a Baklava internal issue. Please report it on GitHub.`);const m=this.hooks.transferData.execute(d[f],u);u.to.allowMultipleConnections?n.has(u.to.id)?n.get(u.to.id).push(m):n.set(u.to.id,[m]):n.set(u.to.id,m)})}return o}async execute(e){this.recalculateOrder&&(this.order.clear(),this.recalculateOrder=!1);const n=this.getInputValues(this.editor.graph);return await this.runGraph(this.editor.graph,n,e)}getInputValues(e){const n=new Map;for(const s of e.nodes)Object.values(s.inputs).forEach(i=>{i.connectionCount===0&&n.set(i.id,i.value)}),s.calculate||Object.values(s.outputs).forEach(i=>{n.set(i.id,i.value)});return n}onChange(e){this.recalculateOrder=e||this.recalculateOrder,this.calculateWithoutData()}getInterfaceValue(e,n){if(!e.has(n))throw new Error(`Could not find value for interface ${n}
|
|||
|
This is likely a Baklava internal issue. Please report it on GitHub.`);return e.get(n)}}let Xg=null;function uDt(t){Xg=t}function vs(){if(!Xg)throw new Error("providePlugin() must be called before usePlugin()");return{viewModel:Xg}}function Bs(){const{viewModel:t}=vs();return{graph:Ad(t.value,"displayedGraph"),switchGraph:t.value.switchGraph}}function ZO(t){const{graph:e}=Bs(),n=ct(null),s=ct(null);return{dragging:et(()=>!!n.value),onPointerDown:c=>{n.value={x:c.pageX,y:c.pageY},s.value={x:t.value.x,y:t.value.y}},onPointerMove:c=>{if(n.value){const d=c.pageX-n.value.x,u=c.pageY-n.value.y;t.value.x=s.value.x+d/e.value.scaling,t.value.y=s.value.y+u/e.value.scaling}},onPointerUp:()=>{n.value=null,s.value=null}}}function JO(t,e,n){if(!e.template)return!1;if(Ea(e.template)===n)return!0;const s=t.graphTemplates.find(r=>Ea(r)===n);return s?s.nodes.filter(r=>r.type.startsWith(zl)).some(r=>JO(t,e,r.type)):!1}function eI(t){return et(()=>{const e=Array.from(t.value.editor.nodeTypes.entries()),n=new Set(e.map(([,i])=>i.category)),s=[];for(const i of n.values()){let r=e.filter(([,o])=>o.category===i);t.value.displayedGraph.template?r=r.filter(([o])=>!JO(t.value.editor,t.value.displayedGraph,o)):r=r.filter(([o])=>![ga,ba].includes(o)),r.length>0&&s.push({name:i,nodeTypes:Object.fromEntries(r)})}return s.sort((i,r)=>i.name==="default"?-1:r.name==="default"||i.name>r.name?1:-1),s})}function tI(){const{graph:t}=Bs();return{transform:(n,s)=>{const i=n/t.value.scaling-t.value.panning.x,r=s/t.value.scaling-t.value.panning.y;return[i,r]}}}function pDt(){const{graph:t}=Bs();let e=[],n=-1,s={x:0,y:0};const i=et(()=>t.value.panning),r=ZO(i),o=et(()=>({"transform-origin":"0 0",transform:`scale(${t.value.scaling}) translate(${t.value.panning.x}px, ${t.value.panning.y}px)`})),a=(m,_,b)=>{const E=[m/t.value.scaling-t.value.panning.x,_/t.value.scaling-t.value.panning.y],g=[m/b-t.value.panning.x,_/b-t.value.panning.y],y=[g[0]-E[0],g[1]-E[1]];t.value.panning.x+=y[0],t.value.panning.y+=y[1],t.value.scaling=b},c=m=>{m.preventDefault();let _=m.deltaY;m.deltaMode===1&&(_*=32);const b=t.value.scaling*(1-_/3e3);a(m.offsetX,m.offsetY,b)},d=()=>({ax:e[0].clientX,ay:e[0].clientY,bx:e[1].clientX,by:e[1].clientY});return{styles:o,...r,onPointerDown:m=>{if(e.push(m),r.onPointerDown(m),e.length===2){const{ax:_,ay:b,bx:E,by:g}=d();s={x:_+(E-_)/2,y:b+(g-b)/2}}},onPointerMove:m=>{for(let _=0;_<e.length;_++)if(m.pointerId==e[_].pointerId){e[_]=m;break}if(e.length==2){const{ax:_,ay:b,bx:E,by:g}=d(),y=_-E,v=b-g,S=Math.sqrt(y*y+v*v);if(n>0){const R=t.value.scaling*(1+(S-n)/500);a(s.x,s.y,R)}n=S}else r.onPointerMove(m)},onPointerUp:m=>{e=e.filter(_=>_.pointerId!==m.pointerId),n=-1,r.onPointerUp()},onMouseWheel:c}}var us=(t=>(t[t.NONE=0]="NONE",t[t.ALLOWED=1]="ALLOWED",t[t.FORBIDDEN=2]="FORBIDDEN",t))(us||{});const nI=Symbol();function _Dt(){const{graph:t}=Bs(),e=ct(null),n=ct(null),s=a=>{e.value&&(e.value.mx=a.offsetX/t.value.scaling-t.value.panning.x,e.value.my=a.offsetY/t.value.scaling-t.value.panning.y)},i=()=>{if(n.value){if(e.value)return;const a=t.value.connections.find(c=>c.to===n.value);n.value.isInput&&a?(e.value={status:us.NONE,from:a.from},t.value.removeConnection(a)):e.value={status:us.NONE,from:n.value},e.value.mx=void 0,e.value.my=void 0}},r=()=>{if(e.value&&n.value){if(e.value.from===n.value)return;t.value.addConnection(e.value.from,e.value.to)}e.value=null},o=a=>{if(n.value=a??null,a&&e.value){e.value.to=a;const c=t.value.checkConnection(e.value.from,e.value.to);if(e.value.status=c.connectionAllowed?us.ALLOWED:us.FORBIDDEN,c.connectionAllowed){const d=c.connectionsInDanger.map(u=>u.id);t.value.connections.forEach(u=>{d.includes(u.id)&&(u.isInDanger=!0)})}}else!a&&e.value&&(e.value.to=void 0,e.value.status=us.NONE,t.value.connections.forEach(c=>{c.isInDanger=!1}))};return zo(nI,{temporaryConnection:e,hoveredOver:o}),{temporaryConnection:e,onMouseMove:s,onMouseDown:i,onMouseUp:r,hoveredOver:o}}function hDt(t){const e=ct(!1),n=ct(0),s=ct(0),i=eI(t),{transform:r}=tI(),o=et(()=>{let u=[];const h={};for(const m of i.value){const _=Object.entries(m.nodeTypes).m
|
|||
|
This may take some time the first time as some libraries need to be installed.`),de.post("/apps/start_server",e).then(n=>{this.$store.state.messageBox.hideMessage(),console.log("Server start initiated:",n.data.message),this.$notify({type:"success",title:"Server Starting",text:n.data.message})}).catch(n=>{var s,i;this.$store.state.messageBox.hideMessage(),console.error("Error starting server:",n),this.$notify({type:"error",title:"Server Start Failed",text:((i=(s=n.response)==null?void 0:s.data)==null?void 0:i.detail)||"An error occurred while starting the server"})})},triggerFileInput(){this.$refs.fileInput.click()},onFileSelected(t){this.selectedFile=t.target.files[0],this.message="",this.error="",this.uploadApp()},async uploadApp(){var e,n;if(!this.selectedFile){this.error="Please select a file to upload.";return}this.isUploading=!0,this.message="",this.error="";const t=new FormData;t.append("file",this.selectedFile),t.append("client_id",this.$store.state.client_id);try{const s=await de.post("/upload_app",t,{headers:{"Content-Type":"multipart/form-data"}});this.message=s.data.message,this.$refs.fileInput.value="",this.selectedFile=null}catch(s){console.error("Error uploading app:",s),this.error=((n=(e=s.response)==null?void 0:e.data)==null?void 0:n.detail)||"Failed to upload the app. Please try again."}finally{this.isUploading=!1}},async fetchApps(){this.loading=!0;try{const t=await de.get("/apps");this.apps=t.data,this.showMessage("Refresh successful!",!0)}catch{this.showMessage("Failed to refresh apps.",!1)}finally{this.loading=!1}},async openAppsFolder(){this.loading=!0;try{console.log("opening apps folder");const t=await de.post("/show_apps_folder",{client_id:this.$store.state.client_id})}catch{this.showMessage("Failed to open apps folder.",!1)}finally{this.loading=!1}},async fetchGithubApps(){this.loading=!0;try{const t=await de.get("/github/apps");this.githubApps=t.data.apps,await this.fetchApps()}catch{this.showMessage("Failed to refresh GitHub apps.",!1)}finally{this.loading=!1}},async handleAppClick(t){if(t.installed){this.selectedApp=t;const e=await de.get(`/apps/${t.folder_name}/index.html`);this.appCode=e.data}else this.showMessage(`Please install ${t.folder_name} to view its code.`,!1)},backToZoo(){this.selectedApp=null,this.appCode=""},async installApp(t){this.loading=!0,this.$store.state.messageBox.showBlockingMessage(`Installing app ${t}`);try{await de.post(`/install/${t}`,{client_id:this.$store.state.client_id}),this.showMessage("Installation succeeded!",!0)}catch{this.showMessage("Installation failed.",!1)}finally{this.loading=!1,this.fetchApps(),this.fetchGithubApps(),this.$store.state.messageBox.hideMessage()}},async uninstallApp(t){this.loading=!0;try{await de.post(`/uninstall/${t}`,{client_id:this.$store.state.client_id}),this.showMessage("Uninstallation succeeded!",!0)}catch{this.showMessage("Uninstallation failed.",!1)}finally{this.loading=!1,this.fetchApps()}},async deleteApp(t){this.loading=!0;try{await de.post(`/delete/${t}`,{client_id:this.$store.state.client_id}),this.showMessage("Deletion succeeded!",!0)}catch{this.showMessage("Deletion failed.",!1)}finally{this.loading=!1,this.fetchApps()}},async editApp(t){this.loading=!0;try{const e=await de.post("/open_app_in_vscode",{client_id:this.$store.state.client_id,app_name:t.folder_name});this.showMessage(e.data.message,!0)}catch{this.showMessage("Failed to open folder in VSCode.",!1)}finally{this.loading=!1}},async downloadApp(t){this.isLoading=!0,this.error=null;try{const e=await de.post("/download_app",{client_id:this.$store.state.client_id,app_name:t},{responseType:"arraybuffer"}),n=e.headers["content-disposition"],s=n&&n.match(/filename="?(.+)"?/i),i=s?s[1]:"app.zip",r=new Blob([e.data],{type:"application/zip"}),o=window.URL.createObjectURL(r),a=document.createElement("a");a.style.display="none",a.href=o,a.download=i,document.body.appendChild(a),a.click(),window.URL.revokeObjectURL(o),document.body.removeChild(a)}catch(e){console.error("Error downloading app:",e),this.error="Failed to download the app. Please try again."}finally{this.isLoa
|