2024-02-10 20:35:27 +00:00
( function ( ) { const e = document . createElement ( "link" ) . relList ; if ( e && e . supports && e . supports ( "modulepreload" ) ) return ; for ( const s of document . querySelectorAll ( 'link[rel="modulepreload"]' ) ) i ( s ) ; new MutationObserver ( s => { for ( const r of s ) if ( r . type === "childList" ) for ( const o of r . addedNodes ) o . tagName === "LINK" && o . rel === "modulepreload" && i ( o ) } ) . observe ( document , { childList : ! 0 , subtree : ! 0 } ) ; function t ( s ) { const r = { } ; return s . integrity && ( r . integrity = s . integrity ) , s . referrerPolicy && ( r . referrerPolicy = s . referrerPolicy ) , s . crossOrigin === "use-credentials" ? r . credentials = "include" : s . crossOrigin === "anonymous" ? r . credentials = "omit" : r . credentials = "same-origin" , r } function i ( s ) { if ( s . ep ) return ; s . ep = ! 0 ; const r = t ( s ) ; fetch ( s . href , r ) } } ) ( ) ; function ob ( n , e ) { const t = Object . create ( null ) , i = n . split ( "," ) ; for ( let s = 0 ; s < i . length ; s ++ ) t [ i [ s ] ] = ! 0 ; return e ? s => ! ! t [ s . toLowerCase ( ) ] : s => ! ! t [ s ] } const Kt = { } , qo = [ ] , Ii = ( ) => { } , II = ( ) => ! 1 , MI = /^on[^a-z]/ , hu = n => MI . test ( n ) , ab = n => n . startsWith ( "onUpdate:" ) , sn = Object . assign , lb = ( n , e ) => { const t = n . indexOf ( e ) ; t > - 1 && n . splice ( t , 1 ) } , DI = Object . prototype . hasOwnProperty , Dt = ( n , e ) => DI . call ( n , e ) , nt = Array . isArray , Yo = n => Ia ( n ) === "[object Map]" , Oa = n => Ia ( n ) === "[object Set]" , ev = n => Ia ( n ) === "[object Date]" , kI = n => Ia ( n ) === "[object RegExp]" , mt = n => typeof n == "function" , rn = n => typeof n == "string" , kl = n => typeof n == "symbol" , Ht = n => n !== null && typeof n == "object" , TR = n => Ht ( n ) && mt ( n . then ) && mt ( n . catch ) , xR = Object . prototype . toString , Ia = n => xR . call ( n ) , LI = n => Ia ( n ) . slice ( 8 , - 1 ) , CR = n => Ia ( n ) === "[object Object]" , cb = n => rn ( n ) && n !== "NaN" && n [ 0 ] !== "-" && "" + parseInt ( n , 10 ) === n , bd = ob ( ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted" ) , fu = n => { const e = Object . create ( null ) ; return t => e [ t ] || ( e [ t ] = n ( t ) ) } , PI = /-(\w)/g , Qi = fu ( n => n . replace ( PI , ( e , t ) => t ? t . toUpperCase ( ) : "" ) ) , UI = /\B([A-Z])/g , ao = fu ( n => n . replace ( UI , "-$1" ) . toLowerCase ( ) ) , mu = fu ( n => n . charAt ( 0 ) . toUpperCase ( ) + n . slice ( 1 ) ) , ap = fu ( n => n ? ` on ${ mu ( n ) } ` : "" ) , Ll = ( n , e ) => ! Object . is ( n , e ) , $o = ( n , e ) => { for ( let t = 0 ; t < n . length ; t ++ ) n [ t ] ( e ) } , Dd = ( n , e , t ) => { Object . defineProperty ( n , e , { configurable : ! 0 , enumerable : ! 1 , value : t } ) } , kd = n => { const e = parseFloat ( n ) ; return isNaN ( e ) ? n : e } , FI = n => { const e = rn ( n ) ? Number ( n ) : NaN ; return isNaN ( e ) ? n : e } ; let tv ; const ig = ( ) => tv || ( tv = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : typeof global < "u" ? global : { } ) ; function Jt ( n ) { if ( nt ( n ) ) { const e = { } ; for ( let t = 0 ; t < n . length ; t ++ ) { const i = n [ t ] , s = rn ( i ) ? zI ( i ) : Jt ( i ) ; if ( s ) for ( const r in s ) e [ r ] = s [ r ] } return e } else { if ( rn ( n ) ) return n ; if ( Ht ( n ) ) return n } } const BI = /;(?![^(]*\))/g , GI = /:([^]+)/ , VI = /\/\*[^]*?\*\//g ; function zI ( n ) { const e = { } ; return n . replace ( VI , "" ) . split ( BI ) . forEach ( t => { if ( t ) { const i = t . split ( GI ) ; i . length > 1 && ( e [ i [ 0 ] . trim ( ) ] = i [ 1 ] . trim ( ) ) } } ) , e } function We ( n ) { let e = "" ; if ( rn ( n ) ) e = n ; else if ( nt ( n ) ) for ( let t = 0 ; t < n . length ; t ++ ) { const i = We ( n [ t ] ) ; i && ( e += i + " " ) } else if ( Ht ( n ) ) for ( const t in n ) n [ t ] && ( e += t + " " ) ; return e . trim ( ) } const HI = "itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly" , qI = ob ( HI ) ; function RR ( n ) { return ! ! n || n === "" } function YI ( n , e ) { if ( n . length !== e . length ) return ! 1 ; let t = ! 0 ; for ( let i = 0 ; t && i < n . length ; i ++ ) t = Jr ( n [ i ] , e [ i ] ) ; return t } function Jr ( n , e ) { if ( n === e ) return ! 0 ; let t = ev ( n ) , i = ev ( e ) ; if ( t || i ) return t && i ? n . getTime ( ) === e . getTime ( ) : ! 1 ; if ( t = kl ( n ) , i = kl ( e ) , t || i ) return n === e ; if ( t = nt ( n ) , i = nt ( e ) , t || i ) return t && i ? YI ( n , e ) : ! 1 ; if ( t = Ht ( n ) , i = Ht ( e ) , t || i ) { if ( ! t || ! i ) return ! 1 ; const s = Object . keys ( n ) . length , r = Object . keys ( e ) . length ; if ( s !== r ) return ! 1 ; for ( const o in n ) { const a = n . hasOwnProperty ( o ) , l = e . hasOwnProperty ( o ) ; if ( a && ! l || ! a && l || ! Jr ( n [ o ] , e [ o ] ) ) return ! 1 } } return String ( n ) === String ( e ) } function db ( n , e ) { return n . findIndex ( t => Jr ( t , e ) ) } const me = n => rn ( n ) ? n : n == null ? "" : nt ( n ) || Ht ( n ) && ( n . toString === xR || ! mt ( n . toString ) ) ? JSON . stringify ( n , AR , 2 ) : String ( n ) , AR = ( n , e ) => e && e . _ _v _isRef ? AR ( n , e . value ) : Yo ( e ) ? { [ ` Map( ${ e . size } ) ` ] : [ ... e . entries ( ) ] . reduce ( ( t , [ i , s ] ) => ( t [ ` ${ i } => ` ] = s , t ) , { } ) } : Oa ( e ) ? { [ ` Set( ${ e . size } ) ` ] : [ ... e . values ( ) ] } : Ht ( e ) && ! nt ( e ) && ! CR ( e ) ? String ( e ) : e ; let ei ; class wR { constructor ( e = ! 1 ) { this . detached = e , this . _active = ! 0 , this . effects = [ ] , this . cleanups = [ ] , this . parent = ei , ! e && ei && ( this . index = ( ei . scopes || ( ei . scopes = [ ] ) ) . pu
2024-01-11 01:32:21 +00:00
* vuex v4 . 1.0
* ( c ) 2022 Evan You
* @ license MIT
2024-02-10 10:33:09 +00:00
* /var xD="store";function La(n,e){Object.keys(n).forEach(function(t){return e(n[t],t)})}function CD(n){return n!==null&&typeof n=="object"}function RD(n){return n&&typeof n.then=="function"}function AD(n,e){return function(){return n(e)}}function IA(n,e,t){return e.indexOf(n)<0&&(t&&t.prepend?e.unshift(n):e.push(n)),function(){var i=e.indexOf(n);i>-1&&e.splice(i,1)}}function MA(n,e){n._actions=Object.create(null),n._mutations=Object.create(null),n._wrappedGetters=Object.create(null),n._modulesNamespaceMap=Object.create(null);var t=n.state;Iu(n,t,[],n._modules.root,!0),Ab(n,t,e)}function Ab(n,e,t){var i=n._state,s=n._scope;n.getters={},n._makeLocalGettersCache=Object.create(null);var r=n._wrappedGetters,o={},a={},l=$I(!0);l.run(function(){La(r,function(c,d){o[d]=AD(c,n),a[d]=et(function(){return o[d]()}),Object.defineProperty(n.getters,d,{get:function(){return a[d].value},enumerable:!0})})}),n._state=Qn({data:e}),n._scope=l,n.strict&&MD(n),i&&t&&n._withCommit(function(){i.data=null}),s&&s.stop()}function Iu(n,e,t,i,s){var r=!t.length,o=n._modules.getNamespace(t);if(i.namespaced&&(n._modulesNamespaceMap[o],n._modulesNamespaceMap[o]=i),!r&&!s){var a=wb(e,t.slice(0,-1)),l=t[t.length-1];n._withCommit(function(){a[l]=i.state})}var c=i.context=wD(n,o,t);i.forEachMutation(function(d,_){var h=o+_;ND(n,h,d,c)}),i.forEachAction(function(d,_){var h=d.root?_:o+_,m=d.handler||d;OD(n,h,m,c)}),i.forEachGetter(function(d,_){var h=o+_;ID(n,h,d,c)}),i.forEachChild(function(d,_){Iu(n,e,t.concat(_),d,s)})}function wD(n,e,t){var i=e==="",s={dispatch:i?n.dispatch:function(r,o,a){var l=Vd(r,o,a),c=l.payload,d=l.options,_=l.type;return(!d||!d.root)&&(_=e+_),n.dispatch(_,c)},commit:i?n.commit:function(r,o,a){var l=Vd(r,o,a),c=l.payload,d=l.options,_=l.type;(!d||!d.root)&&(_=e+_),n.commit(_,c,d)}};return Object.defineProperties(s,{getters:{get:i?function(){return n.getters}:function(){return DA(n,e)}},state:{get:function(){return wb(n.state,t)}}}),s}function DA(n,e){if(!n._makeLocalGettersCache[e]){var t={},i=e.length;Object.keys(n.getters).forEach(function(s){if(s.slice(0,i)===e){var r=s.slice(i);Object.defineProperty(t,r,{get:function(){return n.getters[s]},enumerable:!0})}}),n._makeLocalGettersCache[e]=t}return n._makeLocalGettersCache[e]}function ND(n,e,t,i){var s=n._mutations[e]||(n._mutations[e]=[]);s.push(function(o){t.call(n,i.state,o)})}function OD(n,e,t,i){var s=n._actions[e]||(n._actions[e]=[]);s.push(function(o){var a=t.call(n,{dispatch:i.dispatch,commit:i.commit,getters:i.getters,state:i.state,rootGetters:n.getters,rootState:n.state},o);return RD(a)||(a=Promise.resolve(a)),n._devtoolHook?a.catch(function(l){throw n._devtoolHook.emit("vuex:error",l),l}):a})}function ID(n,e,t,i){n._wrappedGetters[e]||(n._wrappedGetters[e]=function(r){return t(i.state,i.getters,r.state,r.getters)})}function MD(n){Bn(function(){return n._state.data},function(){},{deep:!0,flush:"sync"})}function wb(n,e){return e.reduce(function(t,i){return t[i]},n)}function Vd(n,e,t){return CD(n)&&n.type&&(t=e,e=n,n=n.type),{type:n,payload:e,options:t}}var DD="vuex bindings",Gv="vuex:mutations",mp="vuex:actions",bo="vuex",kD=0;function LD(n,e){TD({id:"org.vuejs.vuex",app:n,label:"Vuex",homepage:"https:/ / next . vuex . vuejs . org / ",logo:" https : //vuejs.org/images/icons/favicon-96x96.png",packageName:"vuex",componentStateTypes:[DD]},function(t){t.addTimelineLayer({id:Gv,label:"Vuex Mutations",color:Vv}),t.addTimelineLayer({id:mp,label:"Vuex Actions",color:Vv}),t.addInspector({id:bo,label:"Vuex",icon:"storage",treeFilterPlaceholder:"Filter stores..."}),t.on.getInspectorTree(function(i){if(i.app===n&&i.inspectorId===bo)if(i.filter){var s=[];UA(s,e._modules.root,i.filter,""),i.rootNodes=s}else i.rootNodes=[PA(e._modules.root,"")]}),t.on.getInspectorState(function(i){if(i.app===n&&i.inspectorId===bo){var s=i.nodeId;DA(e,s),i.state=FD(GD(e._modules,s),s==="root"?e.getters:e._makeLocalGettersCache,s)}}),t.on.editInspectorState(function(i){if(i.app===n&&i.inspectorId===bo){var s=i.nodeId,r=i.path;s!=="root"&&(r=s.split("/").filter(Boolean).concat(r)),e._withCommit(function(){i.set(e._st
` ).forEach(function(o){s=o.indexOf(":"),t=o.substring(0,s).trim().toLowerCase(),i=o.substring(s+1).trim(),!(!t||e[t]&&Fk[t])&&(t==="set-cookie"?e[t]?e[t].push(i):e[t]=[i]:e[t]=e[t]?e[t]+", "+i:i)}),e},Wv=Symbol("internals");function tl(n){return n&&String(n).trim().toLowerCase()}function yd(n){return n===!1||n==null?n:Me.isArray(n)?n.map(yd):String(n)}function Gk(n){const e=Object.create(null),t=/([^ \s ,;=]+) \s *(?:= \s *([^,;]+))?/g;let i;for(;i=t.exec(n);)e[i[1]]=i[2];return e}const Vk=n=>/^[-_a-zA-Z0-9^ ` | ~ , ! # $ % & ' * + . ] + $ / . test ( n . trim ( ) ) ; function bp ( n , e , t , i , s ) { if ( Me . isFunction ( i ) ) return i . call ( this , e , t ) ; if ( s && ( e = t ) , ! ! Me . isString ( e ) ) { if ( Me . isString ( i ) ) return e . indexOf ( i ) !== - 1 ; if ( Me . isRegExp ( i ) ) return i . test ( e ) } } function zk ( n ) { return n . trim ( ) . toLowerCase ( ) . replace ( /([a-z\d])(\w*)/g , ( e , t , i ) => t . toUpperCase ( ) + i ) } function Hk ( n , e ) { const t = Me . toCamelCase ( " " + e ) ; [ "get" , "set" , "has" ] . forEach ( i => { Object . defineProperty ( n , i + t , { value : function ( s , r , o ) { return this [ i ] . call ( this , e , s , r , o ) } , configurable : ! 0 } ) } ) } class Pu { constructor ( e ) { e && this . set ( e ) } set ( e , t , i ) { const s = this ; function r ( a , l , c ) { const d = tl ( l ) ; if ( ! d ) throw new Error ( "header name must be a non-empty string" ) ; const _ = Me . findKey ( s , d ) ; ( ! _ || s [ _ ] === void 0 || c === ! 0 || c === void 0 && s [ _ ] !== ! 1 ) && ( s [ _ || l ] = yd ( a ) ) } const o = ( a , l ) => Me . forEach ( a , ( c , d ) => r ( c , d , l ) ) ; return Me . isPlainObject ( e ) || e instanceof this . constructor ? o ( e , t ) : Me . isString ( e ) && ( e = e . trim ( ) ) && ! Vk ( e ) ? o ( Bk ( e ) , t ) : e != null && r ( t , e , i ) , this } get ( e , t ) { if ( e = tl ( e ) , e ) { const i = Me . findKey ( this , e ) ; if ( i ) { const s = this [ i ] ; if ( ! t ) return s ; if ( t === ! 0 ) return Gk ( s ) ; if ( Me . isFunction ( t ) ) return t . call ( this , s , i ) ; if ( Me . isRegExp ( t ) ) return t . exec ( s ) ; throw new TypeError ( "parser must be boolean|regexp|function" ) } } } has ( e , t ) { if ( e = tl ( e ) , e ) { const i = Me . findKey ( this , e ) ; return ! ! ( i && this [ i ] !== void 0 && ( ! t || bp ( this , this [ i ] , i , t ) ) ) } return ! 1 } delete ( e , t ) { const i = this ; let s = ! 1 ; function r ( o ) { if ( o = tl ( o ) , o ) { const a = Me . findKey ( i , o ) ; a && ( ! t || bp ( i , i [ a ] , a , t ) ) && ( delete i [ a ] , s = ! 0 ) } } return Me . isArray ( e ) ? e . forEach ( r ) : r ( e ) , s } clear ( e ) { const t = Object . keys ( this ) ; let i = t . length , s = ! 1 ; for ( ; i -- ; ) { const r = t [ i ] ; ( ! e || bp ( this , this [ r ] , r , e , ! 0 ) ) && ( delete this [ r ] , s = ! 0 ) } return s } normalize ( e ) { const t = this , i = { } ; return Me . forEach ( this , ( s , r ) => { const o = Me . findKey ( i , r ) ; if ( o ) { t [ o ] = yd ( s ) , delete t [ r ] ; return } const a = e ? zk ( r ) : String ( r ) . trim ( ) ; a !== r && delete t [ r ] , t [ a ] = yd ( s ) , i [ a ] = ! 0 } ) , this } concat ( ... e ) { return this . constructor . concat ( this , ... e ) } toJSON ( e ) { const t = Object . create ( null ) ; return Me . forEach ( this , ( i , s ) => { i != null && i !== ! 1 && ( t [ s ] = e && Me . isArray ( i ) ? i . join ( ", " ) : i ) } ) , t } [ Symbol . iterator ] ( ) { return Object . entries ( this . toJSON ( ) ) [ Symbol . iterator ] ( ) } toString ( ) { return Object . entries ( this . toJSON ( ) ) . map ( ( [ e , t ] ) => e + ": " + t ) . join ( `
` )}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const i=new this(e);return t.forEach(s=>i.set(s)),i}static accessor(e){const i=(this[Wv]=this[Wv]={accessors:{}}).accessors,s=this.prototype;function r(o){const a=tl(o);i[a]||(Hk(s,o),i[a]=!0)}return Me.isArray(e)?e.forEach(r):r(e),this}}Pu.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Me.reduceDescriptors(Pu.prototype,({value:n},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>n,set(i){this[t]=i}}});Me.freezeMethods(Pu);const Ts=Pu;function Ep(n,e){const t=this||Db,i=e||t,s=Ts.from(i.headers);let r=i.data;return Me.forEach(n,function(a){r=a.call(t,r,s.normalize(),e?e.status:void 0)}),s.normalize(),r}function nw(n){return!!(n&&n.__CANCEL__)}function rc(n,e,t){It.call(this,n??"canceled",It.ERR_CANCELED,e,t),this.name="CanceledError"}Me.inherits(rc,It,{__CANCEL__:!0});function qk(n,e,t){const i=t.config.validateStatus;!t.status||!i||i(t.status)?n(t):e(new It("Request failed with status code "+t.status,[It.ERR_BAD_REQUEST,It.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}const Yk=Yi.hasStandardBrowserEnv?{write(n,e,t,i,s,r){const o=[n+"="+encodeURIComponent(e)];Me.isNumber(t)&&o.push("expires="+new Date(t).toGMTString()),Me.isString(i)&&o.push("path="+i),Me.isString(s)&&o.push("domain="+s),r===!0&&o.push("secure"),document.cookie=o.join("; ")},read(n){const e=document.cookie.match(new RegExp("(^|; \\ s*)("+n+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(n){this.write(n,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function $ k(n){return/^([a-z][a-z \d + \- .]*:)? \/ \/ /i.test(n)}function Wk(n,e){return e?n.replace(/ \/ + $ /,"")+"/"+e.replace(/^ \/ +/,""):n}function iw(n,e){return n&&! $ k(e)?Wk(n,e):e}const Kk=Yi.hasStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let i;function s(r){let o=r;return e&&(t.setAttribute("href",o),o=t.href),t.setAttribute("href",o),{href:t.href,protocol:t.protocol?t.protocol.replace(/: $ /,""):"",host:t.host,search:t.search?t.search.replace(/^ \? /,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:t.pathname.charAt(0)==="/"?t.pathname:"/"+t.pathname}}return i=s(window.location.href),function(o){const a=Me.isString(o)?s(o):o;return a.protocol===i.protocol&&a.host===i.host}}():function(){return function(){return!0}}();function jk(n){const e=/^([-+ \w ]{1,25})(:? \/ \/ |:)/.exec(n);return e&&e[1]||""}function Qk(n,e){n=n||10;const t=new Array(n),i=new Array(n);let s=0,r=0,o;return e=e!==void 0?e:1e3,function(l){const c=Date.now(),d=i[r];o||(o=c),t[s]=l,i[s]=c;let _=r,h=0;for(;_!==s;)h+=t[_++],_=_%n;if(s=(s+1)%n,s===r&&(r=(r+1)%n),c-o<e)return;const m=d&&c-d;return m?Math.round(h*1e3/m):void 0}}function Kv(n,e){let t=0;const i=Qk(50,250);return s=>{const r=s.loaded,o=s.lengthComputable?s.total:void 0,a=r-t,l=i(a),c=r<=o;t=r;const d={loaded:r,total:o,progress:o?r/o:void 0,bytes:a,rate:l||void 0,estimated:l&&o&&c?(o-r)/l:void 0,event:s};d[e?"download":"upload"]=!0,n(d)}}const Xk=typeof XMLHttpRequest<"u",Zk=Xk&&function(n){return new Promise(function(t,i){let s=n.data;const r=Ts.from(n.headers).normalize();let{responseType:o,withXSRFToken:a}=n,l;function c(){n.cancelToken&&n.cancelToken.unsubscribe(l),n.signal&&n.signal.removeEventListener("abort",l)}let d;if(Me.isFormData(s)){if(Yi.hasStandardBrowserEnv||Yi.hasStandardBrowserWebWorkerEnv)r.setContentType(!1);else if((d=r.getContentType())!==!1){const[E,...b]=d?d.split(";").map(g=>g.trim()).filter(Boolean):[];r.setContentType([E||"multipart/form-data",...b].join("; "))}}let _=new XMLHttpRequest;if(n.auth){const E=n.auth.username||"",b=n.auth.password?unescape(encodeURIComponent(n.auth.password)):"";r.set("Authorization","Basic "+btoa(E+":"+b))}const h=iw(n.baseURL,n.url);_.open(n.method.toUpperCase(),ZA(h,n.params,n.paramsSerializer),!0),_.timeout=n.timeout;function m(){if(!_)return;const E=Ts.from("getAllResponseHeaders"in _&&_.getAllR
2024-02-10 00:32:22 +00:00
` +r.map(jv).join( `
2024-02-10 10:33:09 +00:00
` ):" "+jv(r[0]):"as no adapter specified";throw new It("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return i},adapters:Eg};function vp(n){if(n.cancelToken&&n.cancelToken.throwIfRequested(),n.signal&&n.signal.aborted)throw new rc(null,n)}function Qv(n){return vp(n),n.headers=Ts.from(n.headers),n.data=Ep.call(n,n.transformRequest),["post","put","patch"].indexOf(n.method)!==-1&&n.headers.setContentType("application/x-www-form-urlencoded",!1),sw.getAdapter(n.adapter||Db.adapter)(n).then(function(i){return vp(n),i.data=Ep.call(n,n.transformResponse,i),i.headers=Ts.from(i.headers),i},function(i){return nw(i)||(vp(n),i&&i.response&&(i.response.data=Ep.call(n,n.transformResponse,i.response),i.response.headers=Ts.from(i.response.headers))),Promise.reject(i)})}const Xv=n=>n instanceof Ts?n.toJSON():n;function oa(n,e){e=e||{};const t={};function i(c,d,_){return Me.isPlainObject(c)&&Me.isPlainObject(d)?Me.merge.call({caseless:_},c,d):Me.isPlainObject(d)?Me.merge({},d):Me.isArray(d)?d.slice():d}function s(c,d,_){if(Me.isUndefined(d)){if(!Me.isUndefined(c))return i(void 0,c,_)}else return i(c,d,_)}function r(c,d){if(!Me.isUndefined(d))return i(void 0,d)}function o(c,d){if(Me.isUndefined(d)){if(!Me.isUndefined(c))return i(void 0,c)}else return i(void 0,d)}function a(c,d,_){if(_ in e)return i(c,d);if(_ in n)return i(void 0,c)}const l={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:(c,d)=>s(Xv(c),Xv(d),!0)};return Me.forEach(Object.keys(Object.assign({},n,e)),function(d){const _=l[d]||s,h=_(n[d],e[d],d);Me.isUndefined(h)&&_!==a||(t[d]=h)}),t}const rw="1.6.2",kb={};["object","boolean","number","function","string","symbol"].forEach((n,e)=>{kb[n]=function(i){return typeof i===n||"a"+(e<1?"n ":" ")+n}});const Zv={};kb.transitional=function(e,t,i){function s(r,o){return"[Axios v"+rw+"] Transitional option '"+r+"'"+o+(i?". "+i:"")}return(r,o,a)=>{if(e===!1)throw new It(s(o," has been removed"+(t?" in "+t:"")),It.ERR_DEPRECATED);return t&&!Zv[o]&&(Zv[o]=!0,console.warn(s(o," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(r,o,a):!0}};function eL(n,e,t){if(typeof n!="object")throw new It("options must be an object",It.ERR_BAD_OPTION_VALUE);const i=Object.keys(n);let s=i.length;for(;s-- >0;){const r=i[s],o=e[r];if(o){const a=n[r],l=a===void 0||o(a,r,n);if(l!==!0)throw new It("option "+r+" must be "+l,It.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new It("Unknown option "+r,It.ERR_BAD_OPTION)}}const vg={assertOptions:eL,validators:kb},Gs=vg.validators;class zd{constructor(e){this.defaults=e,this.interceptors={request:new $ v,response:new $ v}}request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=oa(this.defaults,t);const{transitional:i,paramsSerializer:s,headers:r}=t;i!==void 0&&vg.assertOptions(i,{silentJSONParsing:Gs.transitional(Gs.boolean),forcedJSONParsing:Gs.transitional(Gs.boolean),clarifyTimeoutError:Gs.transitional(Gs.boolean)},!1),s!=null&&(Me.isFunction(s)?t.paramsSerializer={serialize:s}:vg.assertOptions(s,{encode:Gs.function,serialize:Gs.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=r&&Me.merge(r.common,r[t.method]);r&&Me.forEach(["delete","get","head","post","put","patch","common"],f=>{delete r[f]}),t.headers=Ts.concat(o,r);const a=[];let l=!0;this.interceptors.request.forEach(function(E){typeof E.runWhen=="function"&&E.runWhen(t)===!1||(l=l&&E.synchronous,a.unshift(E.fulfilled,E.rejected))});const c=[];this.interceptors.response.forEach(function(E){c.push(E.fulfilled,E.rejected)});let d,_=0,h;if(!l){const f=[Qv.bind(this),void 0];for(f.unshift.apply(f,a),f.push.apply(f,c),h=f.length,d=Promise.resolve(t);_<h;)d=d.then(f[_++],f[_++]);return d}h=a.length;let
2024-01-11 01:32:21 +00:00
* vue - router v4 . 2.5
* ( c ) 2023 Eduardo San Martin Morote
* @ license MIT
2024-02-10 20:35:27 +00:00
* /const Bo=typeof window<"u";function rL(n){return n.__esModule||n[Symbol.toStringTag]==="Module"}const Ut=Object.assign;function Sp(n,e){const t={};for(const i in e){const s=e[i];t[i]=Li(s)?s.map(n):n(s)}return t}const Tl=()=>{},Li=Array.isArray,oL=/ \ / $ / , aL = n => n . replace ( oL , "" ) ; function yp ( n , e , t = "/" ) { let i , s = { } , r = "" , o = "" ; const a = e . indexOf ( "#" ) ; let l = e . indexOf ( "?" ) ; return a < l && a >= 0 && ( l = - 1 ) , l > - 1 && ( i = e . slice ( 0 , l ) , r = e . slice ( l + 1 , a > - 1 ? a : e . length ) , s = n ( r ) ) , a > - 1 && ( i = i || e . slice ( 0 , a ) , o = e . slice ( a , e . length ) ) , i = uL ( i ? ? e , t ) , { fullPath : i + ( r && "?" ) + r + o , path : i , query : s , hash : o } } function lL ( n , e ) { const t = e . query ? n ( e . query ) : "" ; return e . path + ( t && "?" ) + t + ( e . hash || "" ) } function Jv ( n , e ) { return ! e || ! n . toLowerCase ( ) . startsWith ( e . toLowerCase ( ) ) ? n : n . slice ( e . length ) || "/" } function cL ( n , e , t ) { const i = e . matched . length - 1 , s = t . matched . length - 1 ; return i > - 1 && i === s && aa ( e . matched [ i ] , t . matched [ s ] ) && aw ( e . params , t . params ) && n ( e . query ) === n ( t . query ) && e . hash === t . hash } function aa ( n , e ) { return ( n . aliasOf || n ) === ( e . aliasOf || e ) } function aw ( n , e ) { if ( Object . keys ( n ) . length !== Object . keys ( e ) . length ) return ! 1 ; for ( const t in n ) if ( ! dL ( n [ t ] , e [ t ] ) ) return ! 1 ; return ! 0 } function dL ( n , e ) { return Li ( n ) ? eS ( n , e ) : Li ( e ) ? eS ( e , n ) : n === e } function eS ( n , e ) { return Li ( e ) ? n . length === e . length && n . every ( ( t , i ) => t === e [ i ] ) : n . length === 1 && n [ 0 ] === e } function uL ( n , e ) { if ( n . startsWith ( "/" ) ) return n ; if ( ! n ) return e ; const t = e . split ( "/" ) , i = n . split ( "/" ) , s = i [ i . length - 1 ] ; ( s === ".." || s === "." ) && i . push ( "" ) ; let r = t . length - 1 , o , a ; for ( o = 0 ; o < i . length ; o ++ ) if ( a = i [ o ] , a !== "." ) if ( a === ".." ) r > 1 && r -- ; else break ; return t . slice ( 0 , r ) . join ( "/" ) + "/" + i . slice ( o - ( o === i . length ? 1 : 0 ) ) . join ( "/" ) } var ql ; ( function ( n ) { n . pop = "pop" , n . push = "push" } ) ( ql || ( ql = { } ) ) ; var xl ; ( function ( n ) { n . back = "back" , n . forward = "forward" , n . unknown = "" } ) ( xl || ( xl = { } ) ) ; function pL ( n ) { if ( ! n ) if ( Bo ) { const e = document . querySelector ( "base" ) ; n = e && e . getAttribute ( "href" ) || "/" , n = n . replace ( /^\w+:\/\/[^\/]+/ , "" ) } else n = "/" ; return n [ 0 ] !== "/" && n [ 0 ] !== "#" && ( n = "/" + n ) , aL ( n ) } const _L = /^[^#]+#/ ; function hL ( n , e ) { return n . replace ( _L , "#" ) + e } function fL ( n , e ) { const t = document . documentElement . getBoundingClientRect ( ) , i = n . getBoundingClientRect ( ) ; return { behavior : e . behavior , left : i . left - t . left - ( e . left || 0 ) , top : i . top - t . top - ( e . top || 0 ) } } const Uu = ( ) => ( { left : window . pageXOffset , top : window . pageYOffset } ) ; function mL ( n ) { let e ; if ( "el" in n ) { const t = n . el , i = typeof t == "string" && t . startsWith ( "#" ) , s = typeof t == "string" ? i ? document . getElementById ( t . slice ( 1 ) ) : document . querySelector ( t ) : t ; if ( ! s ) return ; e = fL ( s , n ) } else e = n ; "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 tS ( n , e ) { return ( history . state ? history . state . position - e : - 1 ) + n } const yg = new Map ; function gL ( n , e ) { yg . set ( n , e ) } function bL ( n ) { const e = yg . get ( n ) ; return yg . delete ( n ) , e } let EL = ( ) => location . protocol + "//" + location . host ; function lw ( n , e ) { const { pathname : t , search : i , hash : s } = e , r = n . indexOf ( "#" ) ; if ( r > - 1 ) { let a = s . includes ( n . slice ( r ) ) ? n . slice ( r ) . length : 1 , l = s . slice ( a ) ; return l [ 0 ] !== "/" && ( l = "/" + l ) , Jv ( l , "" ) } return Jv ( t , n ) + i + s } function vL ( n , e , t , i ) { let s = [ ] , r = [ ] , o = null ; const a = ( { state : h } ) => { const m = lw ( n , location ) , f = t . value , E = e . value ; let b = 0 ; if ( h ) { if ( t . value = m , e . value = h , o && o === f ) { o = null ; return } b = E ? h . position - E . position : 0 } else i ( m ) ; s . forEach ( g => { g ( t . value , f , { delta : b , type : ql . pop , direction : b ? b > 0 ? xl . forward : xl . back : xl . unknown } ) } ) } ; function l ( ) { o = t . value } function c ( h ) { s . push ( h ) ; const m = ( ) => { const f = s . indexOf ( h ) ; f > - 1 && s . splice ( f , 1 ) } ; return r . push ( m ) , m } function d ( ) { const { history : h } = window ; h . state && h . replaceState ( Ut ( { } , h . state , { scroll : Uu ( ) } ) , "" ) } function _ ( ) { for ( const h of r ) h ( ) ; r = [ ] , window . removeEventListener ( "popstate" , a ) , window . removeEventListener ( "beforeunload" , d ) } return window . addEventListener ( "popstate" , a ) , window . addEventListener ( "beforeunload" , d , { passive : ! 0 } ) , { pauseListeners : l , listen : c , destroy : _ } } function nS ( n , e , t , i = ! 1 , s = ! 1 ) { return { back : n , current : e , forward : t , replaced : i , position : window . history . length , scroll : s ? Uu ( ) : null } } function SL ( n ) { const { history : e , location : t } = window , i = { value : lw ( n , t ) } , s = { value : e . state } ; s . value || r ( i . value , { back : null , current : i . value , forward : null , position : e . length - 1 , replace
2024-01-11 01:32:21 +00:00
Copyright ( c ) 2016 Jed Watson .
Licensed under the MIT License ( MIT ) , see
http : //jedwatson.github.io/classnames
2024-02-10 20:35:27 +00:00
* /(function(){var a=function(){function l(){}l.prototype=Object.create(null);function c(g,v){for(var y=v.length,T=0;T<y;++T)E(g,v[T])}var d={}.hasOwnProperty;function _(g,v){g[v]=!0}function h(g,v){for(var y in v)d.call(v,y)&&(g[y]=!!v[y])}var m=/ \ s + / ; f u n c t i o n f ( g , v ) { f o r ( v a r y = v . s p l i t ( m ) , T = y . l e n g t h , C = 0 ; C < T ; + + C ) g [ y [ C ] ] = ! 0 } f u n c t i o n E ( g , v ) { i f ( v ) { v a r y = t y p e o f v ; y = = = " s t r i n g " ? f ( g , v ) : A r r a y . i s A r r a y ( v ) ? c ( g , v ) : y = = = " o b j e c t " ? h ( g , v ) : y = = = " n u m b e r " & & _ ( g , v ) } } f u n c t i o n b ( ) { f o r ( v a r g = a r g u m e n t s . l e n g t h , v = A r r a y ( g ) , y = 0 ; y < g ; y + + ) v [ y ] = a r g u m e n t s [ y ] ; v a r T = n e w l ; c ( T , v ) ; v a r C = [ ] ; f o r ( v a r x i n T ) T [ x ] & & C . p u s h ( x ) ; r e t u r n C . j o i n ( " " ) } r e t u r n b } ( ) ; t y p e o f t < " u " & & t . e x p o r t s ? t . e x p o r t s = a : ( r = [ ] , o = ( f u n c t i o n ( ) { r e t u r n a } ) . a p p l y ( i , r ) , o ! = = v o i d 0 & & ( t . e x p o r t s = o ) ) } ) ( ) } , " . / n o d e _ m o d u l e s / c o r e - j s / e s / a r r a y / f r o m . j s " : f u n c t i o n ( t , i , s ) { s ( " . / n o d e _ m o d u l e s / c o r e - j s / m o d u l e s / e s . s t r i n g . i t e r a t o r . j s " ) , s ( " . / n o d e _ m o d u l e s / c o r e - j s / m o d u l e s / e s . a r r a y . f r o m . j s " ) ; v a r r = s ( " . / n o d e _ m o d u l e s / c o r e - j s / i n t e r n a l s / p a t h . j s " ) ; t . e x p o r t s = r . A r r a y . f r o m } , " . / n o d e _ m o d u l e s / c o r e - j s / i n t e r n a l s / a - f u n c t i o n . j s " : f u n c t i o n ( t , i ) { t . e x p o r t s = f u n c t i o n ( s ) { i f ( t y p e o f s ! = " f u n c t i o n " ) t h r o w T y p e E r r o r ( S t r i n g ( s ) + " i s n o t a f u n c t i o n " ) ; r e t u r n s } } , " . / n o d e _ m o d u l e s / c o r e - j s / i n t e r n a l s / a n - o b j e c t . j s " : f u n c t i o n ( t , i , s ) { v a r r = s ( " . / n o d e _ m o d u l e s / c o r e - j s / i n t e r n a l s / i s - o b j e c t . j s " ) ; t . e x p o r t s = f u n c t i o n ( o ) { i f ( ! r ( o ) ) t h r o w T y p e E r r o r ( S t r i n g ( o ) + " i s n o t a n o b j e c t " ) ; r e t u r n o } } , " . / n o d e _ m o d u l e s / c o r e - j s / i n t e r n a l s / a r r a y - f r o m . j s " : f u n c t i o n ( t , i , s ) { v a r r = s ( " . / n o d e _ m o d u l e s / c o r e - j s / i n t e r n a l s / b i n d - c o n t e x t . j s " ) , o = s ( " . / n o d e _ m o d u l e s / c o r e - j s / i n t e r n a l s / t o - o b j e c t . j s " ) , a = s ( " . / n o d e _ m o d u l e s / c o r e - j s / i n t e r n a l s / c a l l - w i t h - s a f e - i t e r a t i o n - c l o s i n g . j s " ) , l = s ( " . / n o d e _ m o d u l e s / c o r e - j s / i n t e r n a l s / i s - a r r a y - i t e r a t o r - m e t h o d . j s " ) , c = s ( " . / n o d e _ m o d u l e s / c o r e - j s / i n t e r n a l s / t o - l e n g t h . j s " ) , d = s ( " . / n o d e _ m o d u l e s / c o r e - j s / i n t e r n a l s / c r e a t e - p r o p e r t y . j s " ) , _ = s ( " . / n o d e _ m o d u l e s / c o r e - j s / i n t e r n a l s / g e t - i t e r a t o r - m e t h o d . j s " ) ; t . e x p o r t s = f u n c t i o n ( m ) { v a r f = o ( m ) , E = t y p e o f t h i s = = " f u n c t i o n " ? t h i s : A r r a y , b = a r g u m e n t s . l e n g t h , g = b > 1 ? a r g u m e n t s [ 1 ] : v o i d 0 , v = g ! = = v o i d 0 , y = 0 , T = _ ( f ) , C , x , w , R ; i f ( v & & ( g = r ( g , b > 2 ? a r g u m e n t s [ 2 ] : v o i d 0 , 2 ) ) , T ! = n u l l & & ! ( E = = A r r a y & & l ( T ) ) ) f o r ( R = T . c a l l ( f ) , x = n e w E ; ! ( w = R . n e x t ( ) ) . d o n e ; y + + ) d ( x , y , v ? a ( R , g , [ w . v a l u e , y ] , ! 0 ) : w . v a l u e ) ; e l s e f o r ( C = c ( f . l e n g t h ) , x = n e w E ( C ) ; C > y ; y + + ) d ( x , y , v ? g ( f [ y ] , y ) : f [ y ] ) ; r e t u r n x . l e n g t h = y , x } } , " . / n o d e _ m o d u l e s / c o r e - j s / i n t e r n a l s / a r r a y - i n c l u d e s . j s " : f u n c t i o n ( t , i , s ) { v a r r = s ( " . / n o d e _ m o d u l e s / c o r e - j s / i n t e r n a l s / t o - i n d e x e d - o b j e c t . j s " ) , o = s ( " . / n o d e _ m o d u l e s / c o r e - j s / i n t e r n a l s / t o - l e n g t h . j s " ) , a = s ( " . / n o d e _ m o d u l e s / c o r e - j s / i n t e r n a l s / t o - a b s o l u t e - i n d e x . j s " ) ; t . e x p o r t s = f u n c t i o n ( l ) { r e t u r n f u n c t i o n ( c , d , _ ) { v a r h = r ( c ) , m = o ( h . l e n g t h ) , f = a ( _ , m ) , E ; i f ( l & & d ! = d ) { f o r ( ; m > f ; ) i f ( E = h [ f + + ] , E ! = E ) r e t u r n ! 0 } e l s e f o r ( ; m > f ; f + + ) i f ( ( l | | f i n h ) & & h [ f ] = = = d ) r e t u r n l | | f | | 0 ; r e t u r n ! l & & - 1 } } } , " . / n o d e _ m o d u l e s / c o r e - j s / i n t e r n a l s / b i n d - c o n t e x t . j s " : f u n c t i o n ( t , i , s ) { v a r r = s ( " . / n o d e _ m o d u l e s / c o r e - j s / i n t e r n a l s / a - f u n c t i o n . j s " ) ; t . e x p o r t s = f u n c t i o n ( o , a , l ) { i f ( r ( o ) , a = = = v o i d 0 ) r e t u r n o ; s w i t c h ( l ) { c a s e 0 : r e t u r n f u n c t i o n ( ) { r e t u r n o . c a l l ( a ) } ; c a s e 1 : r e t u r n f u n c t i o n ( c ) { r e t u r n o . c a l l ( a , c ) } ; c a s e 2 : r e t u r n f u n c t i o n ( c , d ) { r e t u r n o . c a l l ( a , c , d ) } ; c a s e 3 : r e t u r n f u n c t i o n ( c , d , _ ) { r e t u r n o . c a l l ( a , c , d , _ ) } } r e t u r n f u n c t i o n ( ) { r e t u r n o . a p p l y ( a , a r g u m e n t s ) } } } , " . / n o d e _ m o d u l e s / c o r e - j s / i n t e r n a l s / c a l l - w i t h - s a f e - i t e r a t i o n - c l o s i n g . j s " : f u n c t i o n ( t , i , s ) { v a r r = s ( " . / n o d e _ m o d u l e s / c o r e - j s / i n t e r n a l s / a n - o b j e c t . j s " ) ; t . e x p o r t s = f u n c t i o n ( o , a , l , c ) { t r y { r e t u r n c ? a ( r ( l ) [ 0 ] , l [ 1 ] ) : a ( l ) } c a t c h ( _ ) { v a r d = o . r e t u r n ; t h r o w d ! = = v o i d 0 & & r ( d . c a l l ( o ) ) , _ } } } , " . / n o d e _ m o d u l e s / c o r e - j s / i n t e r n a l s / c h e c k - c o r r e c t n e s s - o f - i t e r a t i o n . j s " : f u n c t i o n ( t , i , s ) { v a r r = s ( " . / n o d e _ m o d u l e s / c o r e - j s / i n t e r n a l s / w e l l - k n o w n - s y m b o l . j s " ) , o = r ( " i t e r a t o r " ) , a = ! 1 ; t r y { v a r l = 0 , c = { n e x t : f u n c t i o n ( ) { r e t u r n { d o n e : ! ! l + + } } , r e t u r n : f u n c t i o n ( ) { a = ! 0 } } ; c [ o ] = f u n c t i o n ( ) { r e t u r n t h i s } , A r r a y . f r o m ( c , f u n c t i o n ( ) { t h r o w 2 } ) } c a t c h { } t . e x p o r t s = f u n c t i o n ( d , _ ) { i f ( ! _ & & ! a ) r e t u r n ! 1 ; v a r h = ! 1 ; t r y { v a r m = { } ; m [ o ] = f u n c t i o n ( ) { r e t u r n { n e x t : f u n c t i o n ( ) { r e t u r n { d o n e : h = ! 0 } } } } , d ( m ) } c a t c h { } r e t u r n h } } , " . / n o d e _ m o d u l e s / c o r e - j s / i n t e r n a l s / c l a s s o f - r a w . j s " : f u n c t i o n ( t , i ) { v a r s = { } . t o S t r i n g ; t . e x p o r t s = f u n c t i o n ( r ) { r e t u r n s . c a l l ( r ) . s l i c e ( 8 , - 1 ) } } , " . / n o d e _ m o d u l e s / c o r e - j s / i n t e r n a l s / c l a s s o f . j s " : f u n c t i o n ( t , i , s ) { v a r r = s ( " . / n o d e _ m o d u l e s / c o r e - j s / i n t e r n a l s / c l a s s o f
2024-02-10 10:33:09 +00:00
` ,fQ="∄",mQ="∄",gQ="𝔑 ",bQ="𝔫 ",EQ="≧̸",vQ="≱",SQ="≱",yQ="≧̸",TQ="⩾̸",xQ="⩾̸",CQ="⋙̸",RQ="≵",AQ="≫⃒",wQ="≯",NQ="≯",OQ="≫̸",IQ="↮",MQ="⇎",DQ="⫲",kQ="∋",LQ="⋼",PQ="⋺",UQ="∋",FQ="Њ",BQ="њ",GQ="↚",VQ="⇍",zQ="‥",HQ="≦̸",qQ="≰",YQ="↚", $ Q="⇍",WQ="↮",KQ="⇎",jQ="≰",QQ="≦̸",XQ="⩽̸",ZQ="⩽̸",JQ="≮",eX="⋘̸",tX="≴",nX="≪⃒",iX="≮",sX="⋪",rX="⋬",oX="≪̸",aX="∤",lX=" ",cX=" ",dX="𝕟 ",uX="ℕ ",pX="⫬",_X="¬",hX="≢",fX="≭",mX="∦",gX="∉",bX="≠",EX="≂̸",vX="∄",SX="≯",yX="≱",TX="≧̸",xX="≫̸",CX="≹",RX="⩾̸",AX="≵",wX="≎̸",NX="≏̸",OX="∉",IX="⋵̸",MX="⋹̸",DX="∉",kX="⋷",LX="⋶",PX="⧏̸",UX="⋪",FX="⋬",BX="≮",GX="≰",VX="≸",zX="≪̸",HX="⩽̸",qX="≴",YX="⪢̸", $ X="⪡̸",WX="∌",KX="∌",jX="⋾",QX="⋽",XX="⊀",ZX="⪯̸",JX="⋠",eZ="∌",tZ="⧐̸",nZ="⋫",iZ="⋭",sZ="⊏̸",rZ="⋢",oZ="⊐̸",aZ="⋣",lZ="⊂⃒",cZ="⊈",dZ="⊁",uZ="⪰̸",pZ="⋡",_Z="≿̸",hZ="⊃⃒",fZ="⊉",mZ="≁",gZ="≄",bZ="≇",EZ="≉",vZ="∤",SZ="∦",yZ="∦",TZ="⫽⃥",xZ="∂̸",CZ="⨔",RZ="⊀",AZ="⋠",wZ="⊀",NZ="⪯̸",OZ="⪯̸",IZ="⤳̸",MZ="↛",DZ="⇏",kZ="↝̸",LZ="↛",PZ="⇏",UZ="⋫",FZ="⋭",BZ="⊁",GZ="⋡",VZ="⪰̸",zZ="𝒩 ",HZ="𝓃 ",qZ="∤",YZ="∦", $ Z="≁",WZ="≄",KZ="≄",jZ="∤",QZ="∦",XZ="⋢",ZZ="⋣",JZ="⊄",eJ="⫅̸",tJ="⊈",nJ="⊂⃒",iJ="⊈",sJ="⫅̸",rJ="⊁",oJ="⪰̸",aJ="⊅",lJ="⫆̸",cJ="⊉",dJ="⊃⃒",uJ="⊉",pJ="⫆̸",_J="≹",hJ="Ñ",fJ="ñ",mJ="≸",gJ="⋪",bJ="⋬",EJ="⋫",vJ="⋭",SJ="Ν ",yJ="ν ",TJ="#",xJ="№",CJ=" ",RJ="≍⃒",AJ="⊬",wJ="⊭",NJ="⊮",OJ="⊯",IJ="≥⃒",MJ=">⃒",DJ="⤄",kJ="⧞",LJ="⤂",PJ="≤⃒",UJ="<⃒",FJ="⊴⃒",BJ="⤃",GJ="⊵⃒",VJ="∼⃒",zJ="⤣",HJ="↖",qJ="⇖",YJ="↖", $ J="⤧",WJ="Ó",KJ="ó",jJ="⊛",QJ="Ô",XJ="ô",ZJ="⊚",JJ="О ",eee="о ",tee="⊝",nee="Ő",iee="ő",see="⨸",ree="⊙",oee="⦼",aee="Œ",lee="œ",cee="⦿",dee="𝔒 ",uee="𝔬 ",pee="˛ ",_ee="Ò",hee="ò",fee="⧁",mee="⦵",gee="Ω",bee="∮",Eee="↺",vee="⦾",See="⦻",yee="‾",Tee="⧀",xee="Ō",Cee="ō",Ree="Ω",Aee="ω",wee="Ο ",Nee="ο ",Oee="⦶",Iee="⊖",Mee="𝕆 ",Dee="𝕠 ",kee="⦷",Lee="“",Pee="‘ ",Uee="⦹",Fee="⊕",Bee="↻",Gee="⩔",Vee="∨ ",zee="⩝",Hee="ℴ ",qee="ℴ ",Yee="ª", $ ee="º",Wee="⊶",Kee="⩖",jee="⩗",Qee="⩛",Xee="Ⓢ",Zee="𝒪 ",Jee="ℴ ",ete="Ø",tte="ø",nte="⊘",ite="Õ",ste="õ",rte="⨶",ote="⨷",ate="⊗",lte="Ö",cte="ö",dte="⌽",ute="‾",pte="⏞",_te="⎴",hte="⏜",fte="¶",mte="∥",gte="∥",bte="⫳",Ete="⫽",vte="∂",Ste="∂",yte="П",Tte="п",xte="%",Cte=".",Rte="‰",Ate="⊥",wte="‱",Nte="𝔓 ",Ote="𝔭 ",Ite="Φ",Mte="φ",Dte="ϕ",kte="ℳ ",Lte="☎",Pte="Π",Ute="π",Fte="⋔",Bte="ϖ",Gte="ℏ",Vte="ℎ ",zte="ℏ",Hte="⨣",qte="⊞",Yte="⨢", $ te="+",Wte="∔",Kte="⨥",jte="⩲",Qte="±",Xte="±",Zte="⨦",Jte="⨧",ene="±",tne="ℌ ",nne="⨕",ine="𝕡 ",sne="ℙ ",rne="£",one="⪷",ane="⪻",lne="≺",cne="≼",dne="⪷",une="≺",pne="≼",_ne="≺",hne="⪯",fne="≼",mne="≾",gne="⪯",bne="⪹",Ene="⪵",vne="⋨",Sne="⪯",yne="⪳",Tne="≾",xne="′ ",Cne="″",Rne="ℙ ",Ane="⪹",wne="⪵",Nne="⋨",One="∏",Ine="∏",Mne="⌮",Dne="⌒",kne="⌓",Lne="∝",Pne="∝",Une="∷",Fne="∝",Bne="≾",Gne="⊰",Vne="𝒫 ",zne="𝓅 ",Hne="Ψ",qne="ψ",Yne=" ", $ ne="𝔔 ",Wne="𝔮 ",Kne="⨌",jne="𝕢 ",Qne="ℚ ",Xne="⁗",Zne="𝒬 ",Jne="𝓆 ",eie="ℍ ",tie="⨖",nie="?",iie="≟",sie='"',rie='"',oie="⇛",aie="∽̱",lie="Ŕ",cie="ŕ",die="√",uie="⦳",pie="⟩",_ie="⟫",hie="⦒",fie="⦥",mie="⟩",gie="»",bie="⥵",Eie="⇥",vie="⤠",Sie="⤳",yie="→",Tie="↠",xie="⇒",Cie="⤞",Rie="↪",Aie="↬",wie="⥅",Nie="⥴",Oie="⤖",Iie="↣",Mie="↝",Die="⤚",kie="⤜",Lie="∶ ",Pie="ℚ ",Uie="⤍",Fie="⤏",Bie="⤐",Gie="❳ ",Vie="}",zie="]",Hie="⦌",qie="⦎",Yie="⦐", $ ie="Ř",Wie="ř",Kie="Ŗ",jie="ŗ",Qie="⌉",Xie="}",Zie="Р ",Jie="р ",ese="⤷",tse="⥩",nse="”",ise="”",sse="↳",rse="<22> <>
` ," "],hfe=["{","}","|"," \\ ","^"," ` "].concat(_fe),ffe=[" '"].concat(hfe),bS=["%","/","?",";","#"].concat(ffe),ES=["/","?","#"],mfe=255,vS=/^[+a-z0-9A-Z_-]{0,63}$/,gfe=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,SS={javascript:!0,"javascript:":!0},yS={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function bfe(n,e){if(n&&n instanceof qd)return n;var t=new qd;return t.parse(n,e),t}qd.prototype.parse=function(n,e){var t,i,s,r,o,a=n;if(a=a.trim(),!e&&n.split("#").length===1){var l=pfe.exec(a);if(l)return this.pathname=l[1],l[2]&&(this.search=l[2]),this}var c=dfe.exec(a);if(c&&(c=c[0],s=c.toLowerCase(),this.protocol=c,a=a.substr(c.length)),(e||c||a.match(/^\/\/[^@\/]+@[^@\/]+/))&&(o=a.substr(0,2)==="//",o&&!(c&&SS[c])&&(a=a.substr(2),this.slashes=!0)),!SS[c]&&(o||c&&!yS[c])){var d=-1;for(t=0;t<ES.length;t++)r=a.indexOf(ES[t]),r!==-1&&(d===-1||r<d)&&(d=r);var _,h;for(d===-1?h=a.lastIndexOf("@"):h=a.lastIndexOf("@",d),h!==-1&&(_=a.slice(0,h),a=a.slice(h+1),this.auth=_),d=-1,t=0;t<bS.length;t++)r=a.indexOf(bS[t]),r!==-1&&(d===-1||r<d)&&(d=r);d===-1&&(d=a.length),a[d-1]===":"&&d--;var m=a.slice(0,d);a=a.slice(d),this.parseHost(m),this.hostname=this.hostname||"";var f=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!f){var E=this.hostname.split(/\./);for(t=0,i=E.length;t<i;t++){var b=E[t];if(b&&!b.match(vS)){for(var g="",v=0,y=b.length;v<y;v++)b.charCodeAt(v)>127?g+="x":g+=b[v];if(!g.match(vS)){var T=E.slice(0,t),C=E.slice(t+1),x=b.match(gfe);x&&(T.push(x[1]),C.unshift(x[2])),C.length&&(a=C.join(".")+a),this.hostname=T.join(".");break}}}}this.hostname.length>mfe&&(this.hostname=""),f&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}var w=a.indexOf("#");w!==-1&&(this.hash=a.substr(w),a=a.slice(0,w));var R=a.indexOf("?");return R!==-1&&(this.search=a.substr(R),a=a.slice(0,R)),a&&(this.pathname=a),yS[s]&&this.hostname&&!this.pathname&&(this.pathname=""),this};qd.prototype.parseHost=function(n){var e=ufe.exec(n);e&&(e=e[0],e!==":"&&(this.port=e.substr(1)),n=n.substr(0,n.length-e.length)),n&&(this.hostname=n)};var Efe=bfe;Ua.encode=ofe;Ua.decode=lfe;Ua.format=cfe;Ua.parse=Efe;var Rr={},Cp,TS;function yw(){return TS||(TS=1,Cp=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/),Cp}var Rp,xS;function Tw(){return xS||(xS=1,Rp=/[\0-\x1F\x7F-\x9F]/),Rp}var Ap,CS;function vfe(){return CS||(CS=1,Ap=/[\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]/),Ap}var wp,RS;function xw(){return RS||(RS=1,wp=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/),wp}var AS;function Sfe(){return AS||(AS=1,Rr.Any=yw(),Rr.Cc=Tw(),Rr.Cf=vfe(),Rr.P=Fb,Rr.Z=xw()),Rr}(function(n){function e(k){return Object.prototype.toString.call(k)}function t(k){return e(k)==="[object String]"}var i=Object.prototype.hasOwnProperty;function s(k,H){return i.call(k,H)}function r(k){var H=Array.prototype.slice.call(arguments,1);return H.forEach(function(B){if(B){if(typeof B!="object")throw new TypeError(B+"must be object");Object.keys(B).forEach(function(L){k[L]=B[L]})}}),k}function o(k,H,B){return[].concat(k.slice(0,H),B,k.slice(H+1))}function a(k){return!(k>=55296&&k<=57343||k>=64976&&k<=65007||(k&65535)===65535||(k&65535)===65534||k>=0&&k<=8||k===11||k>=14&&k<=31||k>=127&&k<=159||k>1114111)}function l(k){if(k>65535){k-=65536;var H=55296+(k>>10),B=56320+(k&1023);return String.fromCharCode(H,B)}return String.fromCharCode(k)}var c=/\\([!"#$%&' ( ) * + , \ - . \ / : ; <= > ? @ [ \ \ \ ] ^ _ ` {|}~])/g,d=/&([a-z#][a-z0-9]{1,31});/gi,_=new RegExp(c.source+"|"+d.source,"gi"),h=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8})) $ /i,m=Sw;function f(k,H){var B;return s(m,H)?m[H]:H.charCodeAt(0)===35&&h.test(H)&&(B=H[1].toLowerCase()==="x"?parseInt(H.slice(2),16):parseInt(H.slice(1),10),a(B))?l(B):k}function E(k){return k.indexOf(" \\ ")<0?k:k.replace(c," $ 1")}function b(k){return k.indexOf(" \\ ")<0&&k.indexOf("&"
` };es.fence=function(n,e,t,i,s){var r=n[e],o=r.info?Afe(r.info).trim():"",a="",l="",c,d,_,h,m;return o&&(_=o.split(/( \s +)/g),a=_[0],l=_.slice(2).join("")),t.highlight?c=t.highlight(r.content,a,l)||eo(r.content):c=eo(r.content),c.indexOf("<pre")===0?c+ `
2024-01-11 01:32:21 +00:00
` :o?(d=r.attrIndex("class"),h=r.attrs?r.attrs.slice():[],d<0?h.push(["class",t.langPrefix+a]):(h[d]=h[d].slice(),h[d][1]+=" "+t.langPrefix+a),m={attrs:h},"<pre><code"+s.renderAttrs(m)+">"+c+ ` < / c o d e > < / p r e >
` ):"<pre><code"+s.renderAttrs(r)+">"+c+ ` < / c o d e > < / p r e >
` };es.image=function(n,e,t,i,s){var r=n[e];return r.attrs[r.attrIndex("alt")][1]=s.renderInlineAsText(r.children,t,i),s.renderToken(n,e,t)};es.hardbreak=function(n,e,t){return t.xhtmlOut? ` < br / >
` : ` < br >
` };es.softbreak=function(n,e,t){return t.breaks?t.xhtmlOut? ` < br / >
` : ` < br >
` : `
2024-02-10 10:33:09 +00:00
` };es.text=function(n,e){return eo(n[e].content)};es.html_block=function(n,e){return n[e].content};es.html_inline=function(n,e){return n[e].content};function Fa(){this.rules=Rfe({},es)}Fa.prototype.renderAttrs=function(e){var t,i,s;if(!e.attrs)return"";for(s="",t=0,i=e.attrs.length;t<i;t++)s+=" "+eo(e.attrs[t][0])+'="'+eo(e.attrs[t][1])+'"';return s};Fa.prototype.renderToken=function(e,t,i){var s,r="",o=!1,a=e[t];return a.hidden?"":(a.block&&a.nesting!==-1&&t&&e[t-1].hidden&&(r+= `
2024-01-11 01:32:21 +00:00
` ),r+=(a.nesting===-1?"</":"<")+a.tag,r+=this.renderAttrs(a),a.nesting===0&&i.xhtmlOut&&(r+=" /"),a.block&&(o=!0,a.nesting===1&&t+1<e.length&&(s=e[t+1],(s.type==="inline"||s.hidden||s.nesting===-1&&s.tag===a.tag)&&(o=!1))),r+=o? ` >
2024-01-14 11:12:53 +00:00
` :">",r)};Fa.prototype.renderInline=function(n,e,t){for(var i,s="",r=this.rules,o=0,a=n.length;o<a;o++)i=n[o].type,typeof r[i]<"u"?s+=r[i](n,o,e,t,this):s+=this.renderToken(n,o,e);return s};Fa.prototype.renderInlineAsText=function(n,e,t){for(var i="",s=0,r=n.length;s<r;s++)n[s].type==="text"?i+=n[s].content:n[s].type==="image"?i+=this.renderInlineAsText(n[s].children,e,t):n[s].type==="softbreak"&&(i+= `
2024-02-10 10:33:09 +00:00
` );return i};Fa.prototype.render=function(n,e,t){var i,s,r,o="",a=this.rules;for(i=0,s=n.length;i<s;i++)r=n[i].type,r==="inline"?o+=this.renderInline(n[i].children,e,t):typeof a[r]<"u"?o+=a[r](n,i,e,t,this):o+=this.renderToken(n,i,e,t);return o};var wfe=Fa;function Ui(){this.__rules__=[],this.__cache__=null}Ui.prototype.__find__=function(n){for(var e=0;e<this.__rules__.length;e++)if(this.__rules__[e].name===n)return e;return-1};Ui.prototype.__compile__=function(){var n=this,e=[""];n.__rules__.forEach(function(t){t.enabled&&t.alt.forEach(function(i){e.indexOf(i)<0&&e.push(i)})}),n.__cache__={},e.forEach(function(t){n.__cache__[t]=[],n.__rules__.forEach(function(i){i.enabled&&(t&&i.alt.indexOf(t)<0||n.__cache__[t].push(i.fn))})})};Ui.prototype.at=function(n,e,t){var i=this.__find__(n),s=t||{};if(i===-1)throw new Error("Parser rule not found: "+n);this.__rules__[i].fn=e,this.__rules__[i].alt=s.alt||[],this.__cache__=null};Ui.prototype.before=function(n,e,t,i){var s=this.__find__(n),r=i||{};if(s===-1)throw new Error("Parser rule not found: "+n);this.__rules__.splice(s,0,{name:e,enabled:!0,fn:t,alt:r.alt||[]}),this.__cache__=null};Ui.prototype.after=function(n,e,t,i){var s=this.__find__(n),r=i||{};if(s===-1)throw new Error("Parser rule not found: "+n);this.__rules__.splice(s+1,0,{name:e,enabled:!0,fn:t,alt:r.alt||[]}),this.__cache__=null};Ui.prototype.push=function(n,e,t){var i=t||{};this.__rules__.push({name:n,enabled:!0,fn:e,alt:i.alt||[]}),this.__cache__=null};Ui.prototype.enable=function(n,e){Array.isArray(n)||(n=[n]);var t=[];return n.forEach(function(i){var s=this.__find__(i);if(s<0){if(e)return;throw new Error("Rules manager: invalid rule name "+i)}this.__rules__[s].enabled=!0,t.push(i)},this),this.__cache__=null,t};Ui.prototype.enableOnly=function(n,e){Array.isArray(n)||(n=[n]),this.__rules__.forEach(function(t){t.enabled=!1}),this.enable(n,e)};Ui.prototype.disable=function(n,e){Array.isArray(n)||(n=[n]);var t=[];return n.forEach(function(i){var s=this.__find__(i);if(s<0){if(e)return;throw new Error("Rules manager: invalid rule name "+i)}this.__rules__[s].enabled=!1,t.push(i)},this),this.__cache__=null,t};Ui.prototype.getRules=function(n){return this.__cache__===null&&this.__compile__(),this.__cache__[n]||[]};var Bb=Ui,Nfe=/ \r \n ?| \n /g,Ofe=/ \0 /g,Ife=function(e){var t;t=e.src.replace(Nfe, `
` ),t=t.replace(Ofe,"<22> "),e.src=t},Mfe=function(e){var t;e.inlineMode?(t=new e.Token("inline","",0),t.content=e.src,t.map=[0,1],t.children=[],e.tokens.push(t)):e.md.block.parse(e.src,e.md,e.env,e.tokens)},Dfe=function(e){var t=e.tokens,i,s,r;for(s=0,r=t.length;s<r;s++)i=t[s],i.type==="inline"&&e.md.inline.parse(i.content,e.md,e.env,i.children)},kfe=kt.arrayReplaceAt;function Lfe(n){return/^<a[> \s ]/i.test(n)}function Pfe(n){return/^< \/ a \s *>/i.test(n)}var Ufe=function(e){var t,i,s,r,o,a,l,c,d,_,h,m,f,E,b,g,v=e.tokens,y;if(e.md.options.linkify){for(i=0,s=v.length;i<s;i++)if(!(v[i].type!=="inline"||!e.md.linkify.pretest(v[i].content)))for(r=v[i].children,f=0,t=r.length-1;t>=0;t--){if(a=r[t],a.type==="link_close"){for(t--;r[t].level!==a.level&&r[t].type!=="link_open";)t--;continue}if(a.type==="html_inline"&&(Lfe(a.content)&&f>0&&f--,Pfe(a.content)&&f++),!(f>0)&&a.type==="text"&&e.md.linkify.test(a.content)){for(d=a.content,y=e.md.linkify.match(d),l=[],m=a.level,h=0,y.length>0&&y[0].index===0&&t>0&&r[t-1].type==="text_special"&&(y=y.slice(1)),c=0;c<y.length;c++)E=y[c].url,b=e.md.normalizeLink(E),e.md.validateLink(b)&&(g=y[c].text,y[c].schema?y[c].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: \/ \/ /,""),_=y[c].index,_>h&&(o=new e.Token("text","",0),o.content=d.slice(h,_),o.level=m,l.push(o)),o=new e.Token("link_open","a",1),o.attrs=[["href",b]],o.level=m++,o.markup="linkify",o.info="auto",l.push(o),o=new e.Token("text","",0),o.content=g,o.level=m,l.push(o),o=new e.Token("link_close","a",-1),o.level=--m,o.markup="linkify",o.info="auto",l.push(o),h=y[c].lastIndex);h<d.length&&(o=new e.Token("text","",0),o.content=d.slice(h),o.level=m,l.push(o)),v[i].children=r=kfe(r,t,l)}}}},Cw=/ \+ -| \. \. | \? \? \? \? |!!!!|,,|--/,Ffe=/ \( (c|tm|r) \) /i,Bfe=/ \( (c|tm|r) \) /ig,Gfe={c:"©",r:"®",tm:"™"};function Vfe(n,e){return Gfe[e.toLowerCase()]}function zfe(n){var e,t,i=0;for(e=n.length-1;e>=0;e--)t=n[e],t.type==="text"&&!i&&(t.content=t.content.replace(Bfe,Vfe)),t.type==="link_open"&&t.info==="auto"&&i--,t.type==="link_close"&&t.info==="auto"&&i++}function Hfe(n){var e,t,i=0;for(e=n.length-1;e>=0;e--)t=n[e],t.type==="text"&&!i&&Cw.test(t.content)&&(t.content=t.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– ")),t.type==="link_open"&&t.info==="auto"&&i--,t.type==="link_close"&&t.info==="auto"&&i++}var qfe=function(e){var t;if(e.md.options.typographer)for(t=e.tokens.length-1;t>=0;t--)e.tokens[t].type==="inline"&&(Ffe.test(e.tokens[t].content)&&zfe(e.tokens[t].children),Cw.test(e.tokens[t].content)&&Hfe(e.tokens[t].children))},NS=kt.isWhiteSpace,OS=kt.isPunctChar,IS=kt.isMdAsciiPunct,Yfe=/['"]/,MS=/['"]/g,DS="’ ";function wc(n,e,t){return n.slice(0,e)+t+n.slice(e+1)}function $ fe(n,e){var t,i,s,r,o,a,l,c,d,_,h,m,f,E,b,g,v,y,T,C,x;for(T=[],t=0;t<n.length;t++){for(i=n[t],l=n[t].level,v=T.length-1;v>=0&&!(T[v].level<=l);v--);if(T.length=v+1,i.type==="text"){s=i.content,o=0,a=s.length;e:for(;o<a&&(MS.lastIndex=o,r=MS.exec(s),!!r);){if(b=g=!0,o=r.index+1,y=r[0]==="'",d=32,r.index-1>=0)d=s.charCodeAt(r.index-1);else for(v=t-1;v>=0&&!(n[v].type==="softbreak"||n[v].type==="hardbreak");v--)if(n[v].content){d=n[v].content.charCodeAt(n[v].content.length-1);break}if(_=32,o<a)_=s.charCodeAt(o);else for(v=t+1;v<n.length&&!(n[v].type==="softbreak"||n[v].type==="hardbreak");v++)if(n[v].content){_=n[v].content.charCodeAt(0);break}if(h=IS(d)||OS(String.fromCharCode(d)),m=IS(_)||OS(String.fromCharCode(_)),f=NS(d),E=NS(_),E?b=!1:m&&(f||h||(b=!1)),f?g=!1:h&&(E||m||(g=!1)),_===34&&r[0]==='"'&&d>=48&&d<=57&&(g=b=!1),b&&g&&(b=h,g=m),!b&&!g){y&&(i.content=wc(i.content,r.index,DS));continue}if(g){for(v=T.length-1;v>=0&&(c=T[v],!(T[v].level<l));v--)if(c.single===y&&T[v].level===l){c=T[v],y?(C=e.md.options.quotes[2],x=e.md.options.quotes[
` ,o.map=[t,e.line],!0},tme=function(e,t,i,s){var r,o,a,l,c,d,_,h=!1,m=e.bMarks[t]+e.tShift[t],f=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||m+3>f||(r=e.src.charCodeAt(m),r!==126&&r!==96)||(c=m,m=e.skipChars(m,r),o=m-c,o<3)||(_=e.src.slice(c,m),a=e.src.slice(m,f),r===96&&a.indexOf(String.fromCharCode(r))>=0))return!1;if(s)return!0;for(l=t;l++,!(l>=i||(m=c=e.bMarks[l]+e.tShift[l],f=e.eMarks[l],m<f&&e.sCount[l]<e.blkIndent));)if(e.src.charCodeAt(m)===r&&!(e.sCount[l]-e.blkIndent>=4)&&(m=e.skipChars(m,r),!(m-c<o)&&(m=e.skipSpaces(m),!(m<f)))){h=!0;break}return o=e.sCount[t],e.line=l+(h?1:0),d=e.push("fence","code",0),d.info=a,d.content=e.getLines(t+1,l,o,!0),d.markup=_,d.map=[t,e.line],!0},nme=kt.isSpace,ime=function(e,t,i,s){var r,o,a,l,c,d,_,h,m,f,E,b,g,v,y,T,C,x,w,R,S=e.lineMax,A=e.bMarks[t]+e.tShift[t],P=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||e.src.charCodeAt(A)!==62)return!1;if(s)return!0;for(f=[],E=[],v=[],y=[],x=e.md.block.ruler.getRules("blockquote"),g=e.parentType,e.parentType="blockquote",h=t;h<i&&(R=e.sCount[h]<e.blkIndent,A=e.bMarks[h]+e.tShift[h],P=e.eMarks[h],!(A>=P));h++){if(e.src.charCodeAt(A++)===62&&!R){for(l=e.sCount[h]+1,e.src.charCodeAt(A)===32?(A++,l++,r=!1,T=!0):e.src.charCodeAt(A)===9?(T=!0,(e.bsCount[h]+l)%4===3?(A++,l++,r=!1):r=!0):T=!1,m=l,f.push(e.bMarks[h]),e.bMarks[h]=A;A<P&&(o=e.src.charCodeAt(A),nme(o));){o===9?m+=4-(m+e.bsCount[h]+(r?1:0))%4:m++;A++}d=A>=P,E.push(e.bsCount[h]),e.bsCount[h]=e.sCount[h]+1+(T?1:0),v.push(e.sCount[h]),e.sCount[h]=m-l,y.push(e.tShift[h]),e.tShift[h]=A-e.bMarks[h];continue}if(d)break;for(C=!1,a=0,c=x.length;a<c;a++)if(x[a](e,h,i,!0)){C=!0;break}if(C){e.lineMax=h,e.blkIndent!==0&&(f.push(e.bMarks[h]),E.push(e.bsCount[h]),y.push(e.tShift[h]),v.push(e.sCount[h]),e.sCount[h]-=e.blkIndent);break}f.push(e.bMarks[h]),E.push(e.bsCount[h]),y.push(e.tShift[h]),v.push(e.sCount[h]),e.sCount[h]=-1}for(b=e.blkIndent,e.blkIndent=0,w=e.push("blockquote_open","blockquote",1),w.markup=">",w.map=_=[t,0],e.md.block.tokenize(e,t,h),w=e.push("blockquote_close","blockquote",-1),w.markup=">",e.lineMax=S,e.parentType=g,_[1]=e.line,a=0;a<y.length;a++)e.bMarks[a+t]=f[a],e.tShift[a+t]=y[a],e.sCount[a+t]=v[a],e.bsCount[a+t]=E[a];return e.blkIndent=b,!0},sme=kt.isSpace,rme=function(e,t,i,s){var r,o,a,l,c=e.bMarks[t]+e.tShift[t],d=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||(r=e.src.charCodeAt(c++),r!==42&&r!==45&&r!==95))return!1;for(o=1;c<d;){if(a=e.src.charCodeAt(c++),a!==r&&!sme(a))return!1;a===r&&o++}return o<3?!1:(s||(e.line=t+1,l=e.push("hr","hr",0),l.map=[t,e.line],l.markup=Array(o+1).join(String.fromCharCode(r))),!0)},Aw=kt.isSpace;function LS(n,e){var t,i,s,r;return i=n.bMarks[e]+n.tShift[e],s=n.eMarks[e],t=n.src.charCodeAt(i++),t!==42&&t!==45&&t!==43||i<s&&(r=n.src.charCodeAt(i),!Aw(r))?-1:i}function PS(n,e){var t,i=n.bMarks[e]+n.tShift[e],s=i,r=n.eMarks[e];if(s+1>=r||(t=n.src.charCodeAt(s++),t<48||t>57))return-1;for(;;){if(s>=r)return-1;if(t=n.src.charCodeAt(s++),t>=48&&t<=57){if(s-i>=10)return-1;continue}if(t===41||t===46)break;return-1}return s<r&&(t=n.src.charCodeAt(s),!Aw(t))?-1:s}function ome(n,e){var t,i,s=n.level+2;for(t=e+2,i=n.tokens.length-2;t<i;t++)n.tokens[t].level===s&&n.tokens[t].type==="paragraph_open"&&(n.tokens[t+2].hidden=!0,n.tokens[t].hidden=!0,t+=2)}var ame=function(e,t,i,s){var r,o,a,l,c,d,_,h,m,f,E,b,g,v,y,T,C,x,w,R,S,A,P,U,Y,k,H,B=t,L=!1, $ =!0;if(e.sCount[B]-e.blkIndent>=4||e.listIndent>=0&&e.sCount[B]-e.listIndent>=4&&e.sCount[B]<e.blkIndent)return!1;if(s&&e.parentType==="paragraph"&&e.sCount[B]>=e.blkIndent&&(L=!0),(A=PS(e,B))>=0){if(_=!0,U=e.bMarks[B]+e.tShift[B],g=Number(e.src.slice(U,A-1)),L&&g!==1)return!1}else if((A=LS(e,B))>=0)_=!1;else return!1;if(L&&e.skipSpaces(A)>=e.eMarks[B])return!1;if(s)return!0;for(b=e.src.charCodeAt(A-1),E=e.tokens.length,_?(H=e.push("ordered_list_open","ol",1),g!==1&&(H.attrs=[["start",g]])):H=e.push("bullet_list_open","ul",1),H.map=f=[B,0],H.markup=String.fromCharCode(b),P=!1,k=e.md.block.ruler.getRules("list"),C=e.parentType,e.parentType="list";B<i;){for(S=A,v=e.eMarks[B],d=y=e.sCount[B]+A-(e.bMarks[B]+e.tShift[B]);S<v;){
2024-01-11 01:32:21 +00:00
` })),i.tokens.splice(s+3+d.length+1,0,Object.assign(new i.Token("html_block","",0),{content:e.wrapper[1]+ `
2024-02-10 20:35:27 +00:00
` })))});function ey(n,e,t,i){var s=n,r=i;if(t&&Object.prototype.hasOwnProperty.call(e,s))throw new Error("User defined ` id ` attribute ` "+n+" ` is not unique. Please fix it in your Markdown to continue.");for(;Object.prototype.hasOwnProperty.call(e,s);)s=n+"-"+r,r+=1;return e[s]=!0,s}function Vo(n,e){e=Object.assign({},Vo.defaults,e),n.core.ruler.push("anchor",function(t){for(var i,s={},r=t.tokens,o=Array.isArray(e.level)?(i=e.level,function(_){return i.includes(_)}):function(_){return function(h){return h>=_}}(e.level),a=0;a<r.length;a++){var l=r[a];if(l.type==="heading_open"&&o(Number(l.tag.substr(1)))){var c=e.getTokensText(r[a+1].children),d=l.attrGet("id");d=d==null?ey(e.slugify(c),s,!1,e.uniqueSlugStartIndex):ey(d,s,!0,e.uniqueSlugStartIndex),l.attrSet("id",d),e.tabIndex!==!1&&l.attrSet("tabindex",""+e.tabIndex),typeof e.permalink=="function"?e.permalink(d,e,t,a):(e.permalink||e.renderPermalink&&e.renderPermalink!==Ag)&&e.renderPermalink(d,e,t,a),a=r.indexOf(l),e.callback&&e.callback(l,{slug:d,title:c})}}})}Object.assign(JS.defaults,{style:"visually-hidden",space:!0,placement:"after",wrapper:null}),Vo.permalink={__proto__:null,legacy:Ag,renderHref:zw,renderAttrs:Hw,makePermalink:cc,linkInsideHeader:Wu,ariaHidden:Mr,headerLink:qw,linkAfterHeader:JS},Vo.defaults={level:1,slugify:function(n){return encodeURIComponent(String(n).trim().toLowerCase().replace(/ \s +/g,"-"))},uniqueSlugStartIndex:1,tabIndex:"-1",getTokensText:function(n){return n.filter(function(e){return["text","code_inline"].includes(e.type)}).map(function(e){return e.content}).join("")},permalink:!1,renderPermalink:Ag,permalinkClass:Mr.defaults.class,permalinkSpace:Mr.defaults.space,permalinkSymbol:"¶",permalinkBefore:Mr.defaults.placement==="before",permalinkHref:Mr.defaults.renderHref,permalinkAttrs:Mr.defaults.renderAttrs},Vo.default=Vo;Object.assign||Object.defineProperty(Object,"assign",{enumerable:!1,configurable:!0,writable:!0,value:function(n){if(typeof n>"u"||n===null)throw new TypeError("Cannot convert first argument to object");for(var e=Object(n),t=1;t<arguments.length;t++){var i=arguments[t];if(!(typeof i>"u"||i===null))for(var s=Object.keys(Object(i)),r=0,o=s.length;r<o;r++){var a=s[r],l=Object.getOwnPropertyDescriptor(i,a);typeof l<"u"&&l.enumerable&&(e[a]=i[a])}}return e}});var vo={},il={},sl={},Dn={},ty;function Yw(){if(ty)return Dn;ty=1,Object.defineProperty(Dn,"__esModule",{value:!0}),Dn.accents=Dn.fonts=Dn.groupings=Dn.operators=Dn.identifiers=Dn.numbers=void 0;var n={};Dn.numbers=n;var e="[0-9²³¹¼-¾٠-٩۰-۹߀-߉०-९০-৯৴-৹੦-੯૦-૯୦-୯୲-୷௦-௲౦-౯౸-౾೦-೯൦-൵๐-๙໐-໙༠-༳၀-၉႐-႙፩-፼ᛮ-ᛰ០-៩៰-៹᠐-᠙᥆-᥏᧐-᧚᪀-᪉᪐-᪙᭐-᭙᮰-᮹᱀-᱉᱐-᱙⁰⁴-⁹₀-₉⅐-ↂↅ-↋①-⒛⓪-⓿❶-➓⳽〇〡-〩〸-〺㆒-㆕㈠-㈩㉈-㉏㉑-㉟㊀-㊉㊱-㊿零一二三四五六七八九十百千万億兆京垓𥝱秭穣溝澗正載割分厘毛糸忽微繊沙塵埃꘠-꘩ꛦ-ꛯ꠰-꠵꣐-꣙꤀-꤉꧐-꧙꩐-꩙꯰-꯹0-9 ]",t=new RegExp(e);Object.defineProperties(n,{digitRange:{value:e},digitRE:{value:t},isdigit:{value:function(_){return _.match(t)}}});var i=["sin","cos","tan","csc","sec","cot","sinh","cosh","tanh","log","ln","det","dim","lim","mod","gcd","lcm","min","max"],s={Gamma:"Γ",Delta:"Δ",Theta:"Θ",Lambda:"Λ",Xi:"Ξ",Pi:"Π",Sigma:"Σ",Phi:"Φ",Psi:"Ψ",Omega:"Ω",alpha:"α ",beta:"β",gamma:"γ ",delta:"δ",epsilon:"ɛ",zeta:"ζ",eta:"η",theta:"θ",iota:"ι ",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν ",xi:"ξ",pi:"π",rho:"ρ ",sigma:"σ ",tau:"τ",upsilon:"υ ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",oo:"∞","O/":"∅",CC:"ℂ ",NN:"ℕ ",QQ:"ℚ ",RR:"ℝ ",ZZ:"ℤ "};Dn.identifiers=s,i.forEach(function(d){s[d]=d}),Object.defineProperty(s,"contains",{value:function(_){return typeof s[_]<"u"}}),Object.defineProperty(s,"funs",{value:i}),Object.defineProperty(s,"isfun",{value:function(_){return i.indexOf(_)>=0}});var r={"*":"·","**":"∗ ","***":"⋆","//":"/","|":"|",":":":","'":"′ ","''":"″","'''":"‴","''''":"⁗",xx:"× ","-:":"÷","|><":"⋉","><|
` );function Ce(V){return function(ce){for(var ie=[],re=0,I=0,N=0;N<ce.length;N+=1){var z=ce.slice(N),de=ce[N];z.startsWith(V)&&!ce.slice(0,N).match(/ \\ ( \\ {2})* $ /)?re===0&&(ie.push(ce.slice(I,N)),I=N+V.length):de.match(e.groupings.open.regexp)?re+=1:de.match(e.groupings.close.regexp)&&(re-=1)}return ie.push(ce.slice(I)),ie}}var X=function V(ce,ie,re,I){if(!ce)return ie;if(ce.match(/^ \s /)){if(ce.match(/^ \s +( \/ [^ \/ ]|^[^ \^ ]|_[^_|])/))return V(ce.trim(),ie);var N=ce.match(/^ +/),z=N?N[0].length:0;if(z>1){var de='<mspace width="'.concat(z-1,'ex" />');return V(ce.trim(),ie+de)}return V(ce.trim(),ie)}var Q=Z(ce,I),te=i(Q,2),Re=te[0],Se=te[1];if((Se&&Se.trimLeft().startsWith("/")||Se.trimLeft().startsWith("./"))&&!Se.trimLeft().match(/^ \. ? \/ \/ /)){var ke=q(Re,Se),ze=i(ke,2);Re=ze[0],Se=ze[1]}return V(Se,ie+Re)};function _e(V){if(V.trim().length===0)return"";var ce=X(V,"",!1,!0);return ce===Y(ce)?ce:y(ce)}function Z(V,ce,ie){if(!V)return["",""];var re,I,N=V[0],z=V.slice(1),de=N+(z.match(/^[A-Za-z]+/)||"");if(V.startsWith("sqrt")){var Q=Z(V.slice(4).trim(),ce);re=T(Q[0]?U(Q[0]):y("")),I=Q[1]}else if(V.startsWith("root")){var te=Z(V.slice(4).trimLeft(),ce),Re=te[0]?U(te[0]):y(""),Se=Z(te[1].trimLeft(),ce),ke=Se[0]?U(Se[0]):y("");re=C(ke+Re),I=Se[1]}else if(N===" \\ "&&V.length>1)if(V[1].match(/[( \[ ]/)){var ze=k(z);re=d(V.slice(2,ze)),I=V.slice(ze+1)}else re=d(V[1]),I=V.slice(2);else if(e.accents.contains(de)){var it=e.accents.get(de),De=V.slice(de.length).trimLeft(),st=De.match(/^ \s * \( ?([ij]) \) ?/),Xe=Z(De);switch(it.type){case"over":st?(re=b(l(st[1]==="i"?"ı ":"ȷ")+d(it.accent,{accent:!0})),I=De.slice(st[0].length)):(re=b(U(Xe[0])+d(it.accent,{accent:!0})),I=Xe[1]);break;case"under":re=E(U(Xe[0])+d(it.accent)),I=Xe[1];break;case"enclose":re=v(U(Xe[0]),it.attrs),I=Xe[1];break;default:throw new Error("Invalid config for accent "+de)}}else if(n.default.isfontCommand(V)){var Ve=n.default.splitfont(V);re=a(Ve.tagname)(Ve.text,Ve.font&&{mathvariant:Ve.font}),I=Ve.rest}else if(e.groupings.complex.contains(de)){var Ze=e.groupings.complex.get(de),Ke=V.slice(de.length).trimLeft(),ht=Z(Ke);re=x(U(ht[0]),Ze),I=ht[1]}else if(n.default.isgroupStart(V)||n.default.isvertGroupStart(V)){var ae=n.default.isgroupStart(V)?n.default.splitNextGroup(V):n.default.splitNextVert(V),Ye=i(ae,5),Pe=Ye[1],Ne=Ye[2],Fe=Ye[3],ot=Ye[4];I=e.groupings.open.get(ot);var bt=function(){var Rn=be(Ne);return Rn.length>1?Rn:fe(Ne)}();if(n.default.ismatrixInterior(Ne.trim(),W.colSep,W.rowSep)){Ne.trim().endsWith(W.colSep)&&(Ne=Ne.trimRight().slice(0,-1));var tn=Pe==="{"&&Fe==="",un=ne(Ne,tn&&{columnalign:"center left"});re=x(un,{open:Pe,close:Fe})}else if(bt.length>1)if(bt.length===2&&Pe==="("&&Fe===")"){var Lt=_(bt.map(_e).join(""),{linethickness:0});re=x(Lt,{open:Pe,close:Fe})}else{var Xt=bt.map(ee);L(Xt).length===1&&L(Xt)[0].match(/^ \s * $ /)&&(Xt=Xt.slice(0,-1));var Vn=Xt.map(function(Rn){return R(Rn.map( $ (S,_e)).join(""))}).join("");re=x(w(Vn),{open:Pe,close:Fe})}else{var _o=ee(Ne),Wa=_o.map(_e).join(""),rs={open:Pe,close:Fe};W.colSep!==","&&(rs.separators=W.colSep),re=x(Wa,rs)}}else if(!ce&&n.default.isgroupable(V,W)){var Er=oe(V);re=_e(Er[0]),I=Er[1]}else if(e.numbers.isdigit(N)){var os=V.match(J)[0];re=c(os),I=z.slice(os.length-1)}else if(V.match(/^# ` [ ^ ` ]+ ` / ) ) { var vr = V . match ( /^#`([^`]+)`/ ) [ 1 ] ; re = c ( vr ) , I = V . slice ( vr . length + 3 ) } else if ( V . match ( new RegExp ( "^" + e . operators . regexp . source ) ) && ! e . identifiers . contains ( de ) ) { var ho = n . default . splitNextOperator ( V ) , fo = i ( ho , 2 ) , Sr = fo [ 0 ] , Ka = fo [ 1 ] , F = V . startsWith ( "'" ) , ge = B ( [ "∂" , "∇" ] , Sr ) , xe = B ( [ "|" ] , Sr ) , Ae = V . startsWith ( "| " ) , ve = { } ; F && ( ve . lspace = 0 , ve . rspace = 0 ) , ge && ( ve . rspace = 0 ) , xe && ( ve . stretchy = ! 0 ) , Ae && ( ve . lspace = "veryverythickmathspace" , ve . rspace = "veryverythickmathspace" ) , re = d ( Sr , ! H ( ve ) && ve ) , I = Ka } else if ( e . identifiers . contains ( de ) ) { var je = e . identifiers [ de ] , Je = je . match ( /[\u0391-\u03A9\u2100-\u214F\u2200-\u22FF]/ ) ; re = Je ? l ( je , { mathvariant : "normal" } ) : l ( je ) , I = z . slice ( de . length - 1 ) } else N === "O" && z [ 0 ] === "/" ? ( re = l ( e . identifiers [ "O/" ] , { mathvariant : "normal" } ) , I = z . slice ( 1 ) ) : ( re = l ( N ) , I = z ) ; if ( I && I . trimLeft ( ) . match ( /\.?[\^_]/ ) ) { if ( ( ! ie || ! ie . match ( / m ( s u p | o v e
2024-02-10 10:33:09 +00:00
` :"")+i.getLines(s+1,d,l,!0)+(m&&m.trim()?m:""),_.info=c,_.map=[s,i.line],_.markup=n,!0}}function oy(n){if(Bp===null)try{Bp=iHe().default}catch{return n&&n.display==="block"?function(i,s){return'<div class="math block">'+i[s].content+"</div>"}:function(i,s){return'<span class="math inline">'+i[s].content+"</span>"}}var e=Bp(Object.assign({},n));return n&&n.display==="block"?function(t,i){return e(t[i].content)+ `
` }:function(t,i){return e(t[i].content)}}var oHe=function(e,t){t=typeof t=="object"?t:{};var i=t.inlineOpen||" $ $ ",s=t.inlineClose||" $ $ ",r=t.blockOpen||" $ $ $ ",o=t.blockClose||" $ $ $ ",a=t.inlineRenderer?function(_,h){return t.inlineRenderer(_[h].content,_[h])}:oy(t.renderingOptions),l=t.blockRenderer?function(_,h){return t.blockRenderer(_[h].content,_[h])+ `
` }:oy(Object.assign({display:"block"},t.renderingOptions)),c=sHe(i,s),d=rHe(r,o);e.inline.ruler.before("escape","math_inline",c),e.block.ruler.after("blockquote","math_block",d,{alt:["paragraph","reference","blockquote","list"]}),e.renderer.rules.math_inline=a,e.renderer.rules.math_block=l};const aHe=Ds(oHe);function ks(){this.__highest_alphabet__=0,this.__match_alphabets__={},this.__initial_state__=0,this.__accept_states__={},this.__transitions__={},this.__actions__={}}ks.prototype.set_highest_alphabet=function(n){this.__highest_alphabet__=n};ks.prototype.set_match_alphabets=function(n){this.__match_alphabets__=n};ks.prototype.set_initial_state=function(n){this.__initial_state__=n};ks.prototype.set_accept_states=function(n){for(var e=0;e<n.length;e++)this.__accept_states__[n[e]]=!0};ks.prototype.set_transitions=function(n){this.__transitions__=n};ks.prototype.set_actions=function(n){this.__actions__=n};ks.prototype.update_transition=function(n,e){this.__transitions__[n]=Object.assign(this.__transitions__[n]||Object(),e)};ks.prototype.execute=function(n,e){var t,i,s;for(t=this.__initial_state__,i=n;t&&i<e;i++){for(s=this.__highest_alphabet__;s>0&&!(t&s&&this.__match_alphabets__[s].call(this,i,t,s));s>>=4);if(this.__actions__(i,t,s),s===0)break;t=this.__transitions__[t][s]||0}return!!this.__accept_states__[t]};var lHe=ks,cHe=lHe,dHe=function(e,t){var i={multiline:!1,rowspan:!1,headerless:!1,multibody:!0,autolabel:!0};t=e.utils.assign({},i,t||{});function s(d,_){var h=d.bMarks[_]+d.sCount[_],m=d.bMarks[_]+d.blkIndent,f=d.skipSpacesBack(d.eMarks[_],m),E=[],b,g,v=!1,y=!1,T=0;for(b=h;b<f;b++)switch(d.src.charCodeAt(b)){case 92:v=!0;break;case 96:g=d.skipChars(b,96)-1,g>b?(y||(T===0?T=g-b:T===g-b&&(T=0)),b=g):(y||!v&&!T)&&(y=!y),v=!1;break;case 124:!y&&!v&&E.push(b),v=!1;break;default:v=!1;break}return E.length===0||(E[0]>m&&E.unshift(m-1),E[E.length-1]<f-1&&E.push(f)),E}function r(d,_,h){var m={text:null,label:null},f=d.bMarks[h]+d.sCount[h],E=d.eMarks[h],b=/^ \[ (.+?) \] ( \[ ([^ \[ \] ]+) \] )? \s * $ /,g=d.src.slice(f,E).match(b);return g?_?!0:(m.text=g[1],!t.autolabel&&!g[2]||(m.label=g[2]||g[1],m.label=m.label.toLowerCase().replace(/ \W +/g,"")),m):!1}function o(d,_,h){var m={bounds:null,multiline:null},f=s(d,h),E,b,g;return f.length<2?!1:_?!0:(m.bounds=f,t.multiline&&(E=d.bMarks[h]+d.sCount[h],b=d.eMarks[h]-1,m.multiline=d.src.charCodeAt(b)===92,m.multiline&&(g=d.eMarks[h],d.eMarks[h]=d.skipSpacesBack(b,E),m.bounds=s(d,h),d.eMarks[h]=g)),m)}function a(d,_,h){var m={aligns:[],wraps:[]},f=s(d,h),E=/^:?(-+|=+):? \+ ? $ /,b,g,v;if(d.sCount[h]-d.blkIndent>=4||f.length===0)return!1;for(b=0;b<f.length-1;b++){if(g=d.src.slice(f[b]+1,f[b+1]).trim(),!E.test(g))return!1;switch(m.wraps.push(g.charCodeAt(g.length-1)===43),v=(g.charCodeAt(0)===58)<<4|g.charCodeAt(g.length-1-m.wraps[b])===58,v){case 0:m.aligns.push("");break;case 1:m.aligns.push("right");break;case 16:m.aligns.push("left");break;case 17:m.aligns.push("center");break}}return _?!0:m}function l(d,_,h){return d.isEmpty(h)}function c(d,_,h,m){var f=new cHe,E=16,b=-1,g,v,y,T,C,x,w=[],R,S,A,P,U,Y,k,H,B,L;if(_+2>h||(v=new d.Token("table_open","table",1),v.meta={sep:null,cap:null,tr:[]},f.set_highest_alphabet(65536),f.set_initial_state(65792),f.set_accept_states([65552,65553,0]),f.set_match_alphabets({65536:r.bind(this,d,!0),4096:a.bind(this,d,!0),256:o.bind(this,d,!0),16:o.bind(this,d,!0),1:l.bind(this,d,!0)}),f.set_transitions({65792:{65536:256,256:4352},256:{256:4352},4352:{4096:65552,256:4352},65552:{65536:0,16:65553},65553:{65536:0,16:65553,1:65552}}),t.headerless&&(f.set_initial_state(69888),f.update_transition(69888,{65536:4352,4096:65552,256:4352}),y=new d.Token("tr_placeholder","tr",0),y.meta=Object()),t.multibody||f.update_transition(65552,{65536:0,16:65552}),f.set_actions(function(W,le,J){switch(J){case 65536:if(v.meta.cap)break;v.meta.cap=r(d,!1,W),v.meta.cap.map=[W,W+1],v.meta.cap.first=W===_;break;case 4096:v.meta.sep=a(d,!1,W),v.meta.sep.map=[W,W+1],y.meta.grp|=1,E=16;break;case 256:case 16:y=new d.Token("tr_open","tr",1),y.map=[W,W+1],y.meta=o(d,!1,W),y.meta.type=J,y.meta.grp=E,E=
2024-02-10 20:35:27 +00:00
` ),d.md,d.env,[]),L.level=y.level+1,d.md.block.tokenize(L,y.map[0],L.lineMax),B=0;B<L.tokens.length;B++)d.tokens.push(L.tokens[B])}else g=d.push("inline","",0),g.content=P.trim(),g.map=y.map,g.level=y.level+1,g.children=[];g=d.push(A+"_close",A,-1)}d.push("tr_close","tr",-1),y.meta.grp&1&&(A=y.meta.type===256?"thead":"tbody",g=d.push(A+"_close",A,-1),S[1]=y.map[1])}return R[1]=Math.max(S[1],v.meta.sep.map[1],v.meta.cap?v.meta.cap.map[1]:-1),g=d.push("table_close","table",-1),d.line=R[1],!0}e.block.ruler.at("table",c,{alt:["paragraph","reference"]})};const uHe=Ds(dHe);var pHe=function(e,t){t=t||{};function i(s){for(var r=1,o=1,a=s.tokens.length;o<a-1;++o){var l=s.tokens[o];if(l.type==="inline"&&!(!l.children||l.children.length!==1&&l.children.length!==3)&&!(l.children.length===1&&l.children[0].type!=="image")&&!(l.children.length===3&&(l.children[0].type!=="link_open"||l.children[1].type!=="image"||l.children[2].type!=="link_close"))&&!(o!==0&&s.tokens[o-1].type!=="paragraph_open")&&!(o!==a-1&&s.tokens[o+1].type!=="paragraph_close")){var c=s.tokens[o-1];c.type="figure_open",c.tag="figure",s.tokens[o+1].type="figure_close",s.tokens[o+1].tag="figure",t.dataType==!0&&s.tokens[o-1].attrPush(["data-type","image"]);var d;if(t.link==!0&&l.children.length===1&&(d=l.children[0],l.children.unshift(new s.Token("link_open","a",1)),l.children[0].attrPush(["href",d.attrGet("src")]),l.children.push(new s.Token("link_close","a",-1))),d=l.children.length===1?l.children[0]:l.children[1],t.figcaption==!0&&d.children&&d.children.length&&(l.children.push(new s.Token("figcaption_open","figcaption",1)),l.children.splice(l.children.length,0,...d.children),l.children.push(new s.Token("figcaption_close","figcaption",-1)),d.children.length=0),t.copyAttrs&&d.attrs){const _=t.copyAttrs===!0?"":t.copyAttrs;c.attrs=d.attrs.filter(([h,m])=>h.match(_))}t.tabindex==!0&&(s.tokens[o-1].attrPush(["tabindex",r]),r++),t.lazyLoading==!0&&d.attrPush(["loading","lazy"])}}}e.core.ruler.before("linkify","implicit_figures",i)};const _He=Ds(pHe);var mr={};mr.getAttrs=function(n,e,t){const i=/[^ \t \n \f />"'=]/,s=" ",r="=",o=".",a="#",l=[];let c="",d="",_=!0,h=!1;for(let m=e+t.leftDelimiter.length;m<n.length;m++){if(n.slice(m,m+t.rightDelimiter.length)===t.rightDelimiter){c!==""&&l.push([c,d]);break}const f=n.charAt(m);if(f===r&&_){_=!1;continue}if(f===o&&c===""){n.charAt(m+1)===o?(c="css-module",m+=1):c="class",_=!1;continue}if(f===a&&c===""){c="id",_=!1;continue}if(f==='"'&&d===""&&!h){h=!0;continue}if(f==='"'&&h){h=!1;continue}if(f===s&&!h){if(c==="")continue;l.push([c,d]),c="",d="",_=!0;continue}if(!(_&&f.search(i)===-1)){if(_){c+=f;continue}d+=f}}if(t.allowedAttributes&&t.allowedAttributes.length){const m=t.allowedAttributes;return l.filter(function(f){const E=f[0];function b(g){return E===g||g instanceof RegExp&&g.test(E)}return m.some(b)})}return l};mr.addAttrs=function(n,e){for(let t=0,i=n.length;t<i;++t){const s=n[t][0];s==="class"?e.attrJoin("class",n[t][1]):s==="css-module"?e.attrJoin("css-module",n[t][1]):e.attrPush(n[t])}return e};mr.hasDelimiters=function(n,e){if(!n)throw new Error('Parameter ` where ` not passed. Should be "start", "end" or "only".');return function(t){const i=e.leftDelimiter.length+1+e.rightDelimiter.length;if(!t||typeof t!="string"||t.length<i)return!1;function s(d){const _=d.charAt(e.leftDelimiter.length)===".",h=d.charAt(e.leftDelimiter.length)==="#";return _||h?d.length>=i+1:d.length>=i}let r,o,a,l;const c=i-e.rightDelimiter.length;switch(n){case"start":a=t.slice(0,e.leftDelimiter.length),r=a===e.leftDelimiter?0:-1,o=r===-1?-1:t.indexOf(e.rightDelimiter,c),l=t.charAt(o+e.rightDelimiter.length),l&&e.rightDelimiter.indexOf(l)!==-1&&(o=-1);break;case"end":r=t.lastIndexOf(e.leftDelimiter),o=r===-1?-1:t.indexOf(e.rightDelimiter,r+c),o=o===t.length-e.rightDelimiter.length?o:-1;break;case"only":a=t.slice(0,e.leftDelimiter.length),r=a===e.leftDelimiter?0:-1,a=t.slice(t.length-e.rightDelimiter.length),o=a===e.rightDelimiter?t.length-e.rightDelimiter.length:-1;break;default:throw new Error( ` Unexpected case $ { n } , 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",n)}]}],transform:(t,i,s)=>{const r=t[i].children[s],o=xt.getAttrs(r.content,0,n);let a=i+1;for(;t[a+1]&&t[a+1].nesting===-1;)a++;const l=xt.getMatchingOpeningToken(t,a);xt.addAttrs(o,l),t[i].children=t[i].children.slice(0,-2)}},{name:"horizontal rule",tests:[{shift:0,type:"paragraph_open"},{shift:1,type:"inline",children:t=>t.length===1,content:t=>t.match(e)!==null},{shift:2,type:"paragraph_close"}],transform:(t,i)=>{const s=t[i];s.type="hr",s.tag="hr",s.nesting=0;const r=t[i+1].content,o=r.lastIndexOf(n.leftDelimiter),a=xt.getAttrs(r,o,n);xt.addAttrs(a,s),s.markup=r,t.splice(i+1,2)}},{name:"end of block",tests:[{shift:0,type:"inline",children:[{position:-1,content:xt.hasDelimiters("end",n),type:t=>t!=="code_inline"&&t!=="math_inline"}]}],transform:(t,i,s)=>{const r=t[i].children[s],o=r.content,a=xt.getAttrs(o,o.lastIndexOf(n.leftDelimiter),n);let l=i+1;for(;t[l+1]&&t[l+1].nesting===-1;)l++;const c=xt.getMatchingOpeningToken(t,l);xt.addAttrs(a,c);const d=o.slice(0,o.lastIndexOf(n.leftDelimiter));r.content=ay(d)!==" "?d:d.slice(0,-1)}}]};function ay(n){return n.slice(-1)[0]}const EHe=bHe,vHe={leftDelimiter:"{",rightDelimiter:"}",allowedAttributes:[]};var SHe=function(e,t){let i=Object.assign({},vHe);i=Object.assign(i,t);const s=EHe(i);function r(o){const a=o.tokens;for(let l=0;l<a.length;l++)for(let c=0;c<s.length;c++){const d=s[c];let _=null;d.tests.every(m=>{const f=Ng(a,l,m);return f.j!==null&&(_=f.j),f.match})&&(d.transform(a,l,_),(d.name==="inline attributes"||d.name==="inline nesting 0")&&c--)}}e.core.ruler.before("linkify","curly_attributes",r)};function Ng(n,e,t){const i={match:!1,j:null},s=t.shift!==void 0?e+t.shift:t.position;if(t.shift!==void 0&&s<0)return i;const r=xHe(n,s);if(r===void 0)return i;for(const o of Object.keys(t))if(!(o==="shift"||o==="position")){if(r[o]===void 0)return i;if(o==="children"&&yHe(t.children)){if(r.children.length===0)return i;let a;const l=t.children,c=r.children;if(l.every(d=>d.position!==void 0)){if(a=l.every(d=>Ng(c,d.position,d).match),a){const d=CHe(l).position;i.j=d>=0?d:c.length+d}}else for(let d=0;d<c.length;d++)if(a=l.every(_=>Ng(c,d,_).match),a){i.j=d;break}if(a===!1)return i;continue}switch(typeof t[o]){case"boolean":case"number":case"string":if(r[o]!==t[o])return i;break;case"function":if(!t[o](r[o]))return i;break;case"object":if(THe(t[o])){if(t[o].every(l=>l(r[o]))===!1)return i;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 i.match=!0,i}function yHe(n){return Array.isArray(n)&&n.length&&n.every(e=>typeof e=="object")}function THe(n){return Array.isArray(n)&&n.length&&n.every(e=>typeof e=="function")}function xHe(n,e){return e>=0?n[e]:n[n.length+e]}function CHe(n){return n.slice(-1)[0]||{}}const RHe=Ds(SHe);function $ w(n){return n instanceof Map?n.clear=n.delete=n.set=function(){throw new Error("map is read-only")}:n instanceof Set&&(n.add=n.clear=n.delete=function(){throw new Error("set is read-only")}),Object.freeze(n),Object.getOwnPropertyNames(n).forEach(e=>{const t=n[e],i=typeof t;(i==="object"||i==="function")&&!Object.isFrozen(t)&& $ w(t)}),n}let ly=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function Ww(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function sr(n,...e){const t=Object.create(null);for(const i in n)t[i]=n[i];return e.forEach(function(i){for(const s in i)t[s]=i[s]}),t}const AHe="</span>",cy=n=>!!n.scope,wHe=(n,{prefix:e})=>{if(n.startsWith("language:"))return n.replace("language:","language-");if(n.includes(".")){const t=n.split(".");return[ ` $ { e } $ { t . shift ( ) } ` ,...t.map((i,s)=> ` $ { i } $ { "_" . repeat ( s + 1 ) } ` )].join(" ")}return ` $ { e } $ { n } ` };class NHe{constructor(e,t){this.buffer="",this.classPrefix=t.classPrefix,e.walk(this)}ad
https : //github.com/highlightjs/highlight.js/issues/2277`),le=L,W=$),j===void 0&&(j=!0);const J={code:W,language:le};H("before:highlight",J);const ee=J.result?J.result:_(J.language,J.code,j);return ee.code=J.code,H("after:highlight",ee),ee}function _(L,$,j,W){const le=Object.create(null);function J(Q,te){return Q.keywords[te]}function ee(){if(!V.keywords){ie.addText(re);return}let Q=0;V.keywordPatternRe.lastIndex=0;let te=V.keywordPatternRe.exec(re),Re="";for(;te;){Re+=re.substring(Q,te.index);const Se=ne.case_insensitive?te[0].toLowerCase():te[0],ke=J(V,Se);if(ke){const[ze,it]=ke;if(ie.addText(Re),Re="",le[Se]=(le[Se]||0)+1,le[Se]<=b7e&&(I+=it),ze.startsWith("_"))Re+=te[0];else{const De=ne.classNameAliases[ze]||ze;Ce(te[0],De)}}else Re+=te[0];Q=V.keywordPatternRe.lastIndex,te=V.keywordPatternRe.exec(re)}Re+=re.substring(Q),ie.addText(Re)}function fe(){if(re==="")return;let Q=null;if(typeof V.subLanguage=="string"){if(!e[V.subLanguage]){ie.addText(re);return}Q=_(V.subLanguage,re,!0,ce[V.subLanguage]),ce[V.subLanguage]=Q._top}else Q=m(re,V.subLanguage.length?V.subLanguage:null);V.relevance>0&&(I+=Q.relevance),ie.__addSublanguage(Q._emitter,Q.language)}function be(){V.subLanguage!=null?fe():ee(),re=""}function Ce(Q,te){Q!==""&&(ie.startScope(te),ie.addText(Q),ie.endScope())}function X(Q,te){let Re=1;const Se=te.length-1;for(;Re<=Se;){if(!Q._emit[Re]){Re++;continue}const ke=ne.classNameAliases[Q[Re]]||Q[Re],ze=te[Re];ke?Ce(ze,ke):(re=ze,ee(),re=""),Re++}}function _e(Q,te){return Q.scope&&typeof Q.scope=="string"&&ie.openNode(ne.classNameAliases[Q.scope]||Q.scope),Q.beginScope&&(Q.beginScope._wrap?(Ce(re,ne.classNameAliases[Q.beginScope._wrap]||Q.beginScope._wrap),re=""):Q.beginScope._multi&&(X(Q.beginScope,te),re="")),V=Object.create(Q,{parent:{value:V}}),V}function Z(Q,te,Re){let Se=kHe(Q.endRe,Re);if(Se){if(Q["on:end"]){const ke=new ly(Q);Q["on:end"](te,ke),ke.isMatchIgnored&&(Se=!1)}if(Se){for(;Q.endsParent&&Q.parent;)Q=Q.parent;return Q}}if(Q.endsWithParent)return Z(Q.parent,te,Re)}function Ee(Q){return V.matcher.regexIndex===0?(re+=Q[0],1):(de=!0,0)}function Ie(Q){const te=Q[0],Re=Q.rule,Se=new ly(Re),ke=[Re.__beforeBegin,Re["on:begin"]];for(const ze of ke)if(ze&&(ze(Q,Se),Se.isMatchIgnored))return Ee(te);return Re.skip?re+=te:(Re.excludeBegin&&(re+=te),be(),!Re.returnBegin&&!Re.excludeBegin&&(re=te)),_e(Re,Q),Re.returnBegin?0:te.length}function M(Q){const te=Q[0],Re=$.substring(Q.index),Se=Z(V,Q,Re);if(!Se)return hy;const ke=V;V.endScope&&V.endScope._wrap?(be(),Ce(te,V.endScope._wrap)):V.endScope&&V.endScope._multi?(be(),X(V.endScope,Q)):ke.skip?re+=te:(ke.returnEnd||ke.excludeEnd||(re+=te),be(),ke.excludeEnd&&(re=te));do V.scope&&ie.closeNode(),!V.skip&&!V.subLanguage&&(I+=V.relevance),V=V.parent;while(V!==Se.parent);return Se.starts&&_e(Se.starts,Q),ke.returnEnd?0:te.length}function G(){const Q=[];for(let te=V;te!==ne;te=te.parent)te.scope&&Q.unshift(te.scope);Q.forEach(te=>ie.openNode(te))}let q={};function oe(Q,te){const Re=te&&te[0];if(re+=Q,Re==null)return be(),0;if(q.type==="begin"&&te.type==="end"&&q.index===te.index&&Re===""){if(re+=$.slice(te.index,te.index+1),!s){const Se=new Error(`0 width match regex (${L})`);throw Se.languageName=L,Se.badRule=q.rule,Se}return 1}if(q=te,te.type==="begin")return Ie(te);if(te.type==="illegal"&&!j){const Se=new Error('Illegal lexeme "'+Re+'" for mode "'+(V.scope||"<unnamed>")+'"');throw Se.mode=V,Se}else if(te.type==="end"){const Se=M(te);if(Se!==hy)return Se}if(te.type==="illegal"&&Re==="")return 1;if(z>1e5&&z>te.index*3)throw new Error("potential infinite loop, way more iterations than matches");return re+=Re,Re.length}const ne=S(L);if(!ne)throw Wr(r.replace("{}",L)),new Error('Unknown language: "'+L+'"');const Te=h7e(ne);let we="",V=W||Te;const ce={},ie=new a.__emitter(a);G();let re="",I=0,N=0,z=0,de=!1;try{if(ne.__emitTokens)ne.__emitTokens($,ie);else{for(V.matcher.considerAll();;){z++,de?de=!1:V.matcher.considerAll(),V.matcher.lastIndex=N;const Q=V.matcher.exec($);if(!Q)break;const te=$.substring(N,Q.index),Re=oe(te,Q);N=Q.index+Re}oe($.substring(N))}return ie.finalize(
2024-02-10 10:33:09 +00:00
` },f]}}return Ch=s,Ch}var Rh,eT;function rYe(){if(eT)return Rh;eT=1;function n(e){const t="[a-zA-Z_][ \\ w.]*",i="< \\ ?(lasso(script)?|=)",s=" \\ ]| \\ ?>",r={ $ pattern:t+"|&[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]}},l={className:"meta",begin:" \\ [/noprocess|"+i},c={className:"symbol",begin:"'"+t+"'"},d=[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:"[# $ ]"+t},{begin:"#",end:" \\ d+",illegal:" \\ W"}]},{className:"type",begin:":: \\ s*",end:t,illegal:" \\ W"},{className:"params",variants:[{begin:"-(?!infinity)"+t,relevance:0},{begin:"( \\ . \\ . \\ .)"}]},{begin:/(->| \. ) \s */,relevance:0,contains:[c]},{className:"class",beginKeywords:"define",returnEnd:!0,end:" \\ (|=>",contains:[e.inherit(e.TITLE_MODE,{begin:t+"(=(?!>))?|[-+*/%](?!>)"})]}];return{name:"Lasso",aliases:["ls","lassoscript"],case_insensitive:!0,keywords:r,contains:[{className:"meta",begin:s,relevance:0,starts:{end:" \\ [|"+i,returnEnd:!0,relevance:0,contains:[o]}},a,l,{className:"meta",begin:" \\ [no_square_brackets",starts:{end:" \\ [/no_square_brackets \\ ]",keywords:r,contains:[{className:"meta",begin:s,relevance:0,starts:{end:" \\ [noprocess \\ ]|"+i,returnEnd:!0,contains:[o]}},a,l].concat(d)}},{className:"meta",begin:" \\ [",relevance:0},{className:"meta",begin:"^#!",end:"lasso9 $ ",relevance:10}].concat(d)}}return Rh=n,Rh}var Ah,tT;function oYe(){if(tT)return Ah;tT=1;function n(e){const i=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(P=>P+"(?![a-zA-Z@:_])")),s=new RegExp(["(?:__)?[a-zA-Z]{2,}_[a-zA-Z](?:_?[a-zA-Z])+:[a-zA-Z]*","[lgc]__?[a-zA-Z](?:_?[a-zA-
] ` ,f={scope:"string",variants:[d,c,_,h]},E={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},b=["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"],v=["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"],T={keyword:g,literal:(k=>{const H=[];return k.forEach(B=>{H.push(B),B.toLowerCase()===B?H.push(B.toUpperCase()):H.push(B.toLowerCase())}),H})(b),built_in:v},C=k=>k.map(H=>H.replace(/ \| \d + $ /,"")),x={variants:[{match:[/new/,t.concat(m,"+"),t.concat("(?!",C(v).join(" \\ b|")," \\ b)"),r],scope:{1:"keyword",4:"title.class"}}]},w=t.concat(s," \\ b(?! \\ ()"),R={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class \b )/)),w],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[r,t.concat(/::/,t.lookahead(/(?!class \b )/)),w],scope:{1:"title.class",3:"variable.constant"}},{match:[r,t.concat("::",t.lookahead(/(?!class \b )/))],scope:{1:"title.class"}},{match:[r,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},S={scope:"attr",match:t.concat(s,t.lookahead(":"),t.lookahead(/(?!::)/))},A={relevance:0,begin:/ \( /,end:/ \) /,keywords:T,contains:[S,o,R,e.C_BLOCK_COMMENT_MODE,f,E,x]},P={relevance:0,match:[/ \b /,t.concat("(?!fn \\ b|function \\ b|",C(g).join(" \\ b|"),"|",C(v).join(" \\ b|")," \\ b)"),s,t.concat(m,"*"),t.lookahead(/(?= \( )/)],scope:{3:"title.function.invoke"},contains:[A]};A.contains.push(P);const U=[S,R,e.C_BLOCK_COMMENT_MODE,f,E,x],Y={begin:t.concat(/# \[ \s */,r),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:b,keyword:["new","array"]},contains:[{begin:/ \[ /,end:/]/,keywords:{literal:b,keyword:["new","array"]},contains:["self",...U]},...U,{s
] * ; ` ,relevance:0},{begin:"[vp][0-9]+"}]}}return Gf=n,Gf}var Vf,hx;function E $ e(){if(hx)return Vf;hx=1;function n(e){const t="[a-z][a-zA-Z0-9_]*",i={className:"string",begin:" \\ $ .{1}"},s={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:t+":",relevance:0},e.C_NUMBER_MODE,s,i,{begin:" \\ |[ ]*"+t+"([ ]+"+t+")*[ ]* \\ |",returnBegin:!0,end:/ \| /,illegal:/ \S /,contains:[{begin:"( \\ |[ ]*)?"+t}]},{begin:"# \\ (",end:" \\ )",contains:[e.APOS_STRING_MODE,i,e.C_NUMBER_MODE,s]}]}}return Vf=n,Vf}var zf,fx;function v $ e(){if(fx)return zf;fx=1;function n(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 zf=n,zf}var Hf,mx;function S$e(){if(mx)return Hf;mx=1;function n(e){const t={className:" variable ",begin:/\b_+[a-zA-Z]\w*/},i={className:" title ",begin:/[a-zA-Z][a-zA-Z_0-9]*_fnc_[a-zA-Z_0-9]+/},s={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
2024-01-11 01:32:21 +00:00
] * ? "'`},{begin:`" [ ^ \ r
2024-02-10 10:33:09 +00:00
"]*" ` }]},{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 $ f=n, $ f}var Wf,vx;function C $ e(){if(vx)return Wf;vx=1;function n(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 Wf=n,Wf}var Kf,Sx;function R $ e(){if(Sx)return Kf;Sx=1;const n=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"],t=["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"],i=["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","
2024-01-11 01:32:21 +00:00
( multipart ) ? ` ,end: ` \ \ ]
2024-02-10 20:35:27 +00:00
` },{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 jf=n,jf}var Qf,Tx;function w $ e(){if(Tx)return Qf;Tx=1;function n(R){return R?typeof R=="string"?R:R.source:null}function e(R){return t("(?=",R,")")}function t(...R){return R.map(A=>n(A)).join("")}function i(R){const S=R[R.length-1];return typeof S=="object"&&S.constructor===Object?(R.splice(R.length-1,1),S):{}}function s(...R){return"("+(i(R).capture?"":"?:")+R.map(P=>n(P)).join("|")+")"}const r=R=>t(/ \b /,R,/ \w $ /.test(R)?/ \b /:/ \B /),o=["Protocol","Type"].map(r),a=["init","self"].map(r),l=["Any","Self"],c=["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"],d=["false","nil","true"],_=["assignment","associativity","higherThan","left","lowerThan","none","right"],h=["#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"],f=s(/[/= \- +!*%<>&|^~?]/,/[ \u 00A1- \u 00A7]/,/[ \u 00A9 \u 00AB]/,/[ \u 00AC \u 00AE]/,/[ \u 00B0 \u 00B1]/,/[ \u 00B6 \u 00BB \u 00BF \u 00D7 \u 00F7]/,/[ \u 2016- \u 2017]/,/[ \u 2020- \u 2027]/,/[ \u 2030- \u 203E]/,/[ \u 2041- \u 2053]/,/[ \u 2055- \u 205E]/,/[ \u 2190- \u 23FF]/,/[ \u 2500- \u 2775]/,/[ \u 2794- \u 2BFF]/,/[ \u 2E00- \u 2E7F]/,/[ \u 3001- \u 3003]/,/[ \u 3008- \u 3020]/,/[ \u 3030]/),E=s(f,/[ \u 0300- \u 036F]/,/[ \u 1DC0- \u 1DFF]/,/[ \u 20D0- \u 20FF]/,/[ \u FE00- \u FE0F]/,/[ \u FE20- \u FE2F]/),b=t(f,E,"*"),g=s(/[a-zA-Z_]/,/[ \u 00A8 \u 00AA \u 00AD \u 00AF \u 00B2- \u 00B5 \u 00B7- \u 00BA]/,/[ \u 00BC- \u 00BE \u 00C0- \u 00D6 \u 00D8- \u 00F6 \u 00F8- \u 00FF]/,/[ \u 0100- \u 02FF \u 0370- \u 167F \u 1681- \u 180D \u 180F- \u 1DBF]/,/[ \u 1E00- \u 1FFF]/,/[ \u 200B- \u 200D \u 202A- \u 202E \u 203F- \u 2040 \u 2054 \u 2060- \u 206F]/,/[ \u 2070- \u 20CF \u 2100- \u 218F \u 2460- \u 24FF \u 2776- \u 2793]/,/[ \u 2C00- \u 2DFF \u 2E80- \u 2FFF]/,/[ \u 3004- \u 3007 \u 3021- \u 302F \u 3031- \u 303F \u 3040- \u D7FF]/,/[ \u F900- \u FD3D \u FD40- \u FDCF \u FDF0- \u FE1F \u FE30- \u FE44]/,/[ \u FE47- \u FEFE \u FF00- \u FFFD]/),v=s(g,/ \d /,/[ \u 0300- \u 036F \u 1DC0- \u 1DFF \u 20D0- \u 20FF \u FE20- \u FE2F]/),y=t(g,v,"*"),T=t(/[A-Z]/,v,"*"),C=["attached","autoclosure",t(/convention \( /,s("swift","block","c"),/ \) /),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",t(/objc \( /,y,/ \) /),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain",
` ),i=t.length.toString().length,s=t.map((c,d)=>(d+1).toString().padStart(i," ")),r=document.createElement("div");r.classList.add("line-numbers"),r.innerHTML=s.join("<br>");const o=document.createElement("div");o.classList.add("code-container");const a=document.createElement("pre"),l=document.createElement("code");return l.classList.add("code-content"),l.innerHTML=to.highlight(e,{language:n,ignoreIllegals:!0}).value,a.appendChild(l),o.appendChild(r),o.appendChild(a),o.outerHTML}},methods:{copyCode(){this.isCopied=!0,console.log("Copying code");const n=document.createElement("textarea");n.value=this.code,document.body.appendChild(n),n.select(),document.execCommand("copy"),document.body.removeChild(n),Be(()=>{Ge.replace()})},executeCode(){this.isExecuting=!0;const n=JSON.stringify({code:this.code,discussion_id:this.discussion_id,message_id:this.message_id,language:this.language});console.log(n),fetch( ` $ { this . host } / execute _code ` ,{method:"POST",headers:{"Content-Type":"application/json"},body:n}).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 n=JSON.stringify({code:this.code,discussion_id:this.discussion_id,message_id:this.message_id,language:this.language});console.log(n),fetch( ` $ { this . host } / open _code _in _vs _code ` ,{method:"POST",headers:{"Content-Type":"application/json"},body:n}).then(e=>e.json()).then(e=>{console.log(e)}).catch(e=>{console.error("Fetch error:",e)})},openVsCode(){const n=JSON.stringify({code:this.code,discussion_id:this.discussion_id,message_id:this.message_id,language:this.language});console.log(n),fetch( ` $ { this . host } / open _code _folder _in _vs _code ` ,{method:"POST",headers:{"Content-Type":"application/json"},body:n}).then(e=>e.json()).then(e=>{console.log(e)}).catch(e=>{console.error("Fetch error:",e)})},openFolder(){const n=JSON.stringify({discussion_id:this.discussion_id});console.log(n),fetch( ` $ { this . host } / open _code _folder ` ,{method:"POST",headers:{"Content-Type":"application/json"},body:n}).then(e=>e.json()).then(e=>{console.log(e)}).catch(e=>{console.error("Fetch error:",e)})}}},eWe={class:"bg-bg-light-tone-panel dark:bg-bg-dark-tone-panel p-2 rounded-lg shadow-sm"},tWe={class:"flex flex-row bg-bg-light-tone-panel dark:bg-bg-dark-tone-panel p-2 rounded-lg shadow-sm"},nWe={class:"text-2xl"},iWe=u("i",{"data-feather":"copy"},null,-1),sWe=[iWe],rWe=u("i",{"data-feather":"play-circle"},null,-1),oWe=[rWe],aWe=u("i",{"data-feather":"folder"},null,-1),lWe=[aWe],cWe=u("img",{src:X $ e,width:"25",height:"25"},null,-1),dWe=[cWe],uWe=u("img",{src:Z $ e,width:"25",height:"25"},null,-1),pWe=[uWe],_We={class:"hljs p-1 rounded-md break-all grid grid-cols-1"},hWe={class:"code-container"},fWe=["innerHTML"],mWe={key:0,class:"text-2xl"},gWe={key:1,class:"hljs mt-0 p-1 rounded-md break-all grid grid-cols-1"},bWe={class:"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"},EWe=["innerHTML"];function vWe(n,e,t,i,s,r){return O(),D("div",eWe,[u("div",tWe,[u("span",nWe,me(t.language),1),u("button",{onClick:e[0]||(e[0]=(...o)=>r.copyCode&&r.copyCode(...o)),title:"copy",class:We([s.isCopied?"bg-green-500":"bg-bg-dark-tone-panel dark:bg-bg-dark-tone","px-2 py-1 ml-2 text-left p-2 text-sm font-medium rounded-lg hover:bg-primary dark:hover:bg-primary text-white text-xs transition-colors duration-200"])},sWe,2),["python","sh","shell","bash","cmd","powershell","latex","mermaid","graphviz","dot","javascript","html","html5","svg"].includes(t.language)?(O(),D("button",{key:0,ref:"btn_code_exec",onClick:e[1]||(e[1]=(...o)=>r.executeCode&&r.executeCode(...o)),title:"execute",class:We(["px-2 py-1 ml-2 text-left p-2 text-sm font-medium bg-bg-dark-tone-panel dark:bg-bg-dark-tone rounded-lg hover:bg-primary dark:hover:bg-primary text-white text-xs transition-colors duration-200",s.isExecuti
2024-02-10 10:33:09 +00:00
` ),u("code",{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},null,8,fWe),Qe( `
2024-02-06 23:38:14 +00:00
` )]),Qe( `
2024-02-10 10:33:09 +00:00
` )]),s.executionOutput?(O(),D("span",mWe,"Execution output")):K("",!0),s.executionOutput?(O(),D("pre",gWe,[Qe(" "),u("div",bWe,[Qe( `
` ),u("div",{ref:"execution_output",innerHTML:s.executionOutput},null,8,EWe),Qe( `
2024-02-06 23:38:14 +00:00
` )]),Qe( `
2024-02-10 10:33:09 +00:00
` )])):K("",!0)])}const SWe=gt(J $ e,[["render",vWe]]);function yWe(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const TWe={name:"MarkdownRenderer",props:{host:{type:String,required:!1,default:"http://localhost:9600"},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:SWe},setup(n){const e=new jge({html:!0,highlight:(s,r)=>{const o=r&&to.getLanguage(r)?r:"plaintext";return to.highlight(o,s).value},renderInline:!0,breaks:!0}).use(Jze).use(Vo).use(_He,{figcaption:!0}).use(RHe).use(aHe,{inlineOpen:" $ ",inlineClose:" $ ",blockOpen:" $ $ ",blockClose:" $ $ "}).use(uHe,{enableRowspan:!0,enableColspan:!0,enableGridTables:!0,enableGridTablesExtra:!0,enableTableIndentation:!0,tableCellPadding:" ",tableCellJoiner:"|",multilineCellStartMarker:"|>",multilineCellEndMarker:"<|",multilineCellPadding:" ",multilineCellJoiner: `
2024-02-10 20:35:27 +00:00
` }),t=dt([]),i=()=>{if(n.markdownText){let s=e.parse(n.markdownText,{}),r=[];t.value=[];for(let o=0;o<s.length;o++)s[o].type!=="fence"?r.push(s[o]):(r.length>0&&(t.value.push({type:"html",html:e.renderer.render(r,e.options,{})}),r=[]),t.value.push({type:"code",language:yWe(s[o].info),code:s[o].content}));r.length>0&&(t.value.push({type:"html",html:e.renderer.render(r,e.options,{})}),r=[])}else t.value=[];Be(()=>{Ge.replace()})};return Bn(()=>n.markdownText,i),Ms(i),{markdownItems:t}}},xWe={class:"break-all"},CWe={ref:"mdRender",class:"markdown-content"},RWe=["innerHTML"];function AWe(n,e,t,i,s,r){const o=ut("code-block");return O(),D("div",xWe,[u("div",CWe,[(O(!0),D(qe,null,lt(i.markdownItems,(a,l)=>(O(),D("div",{key:l},[a.type==="code"?(O(),Nt(o,{key:0,host:t.host,language:a.language,code:a.code,discussion_id:t.discussion_id,message_id:t.message_id},null,8,["host","language","code","discussion_id","message_id"])):(O(),D("div",{key:1,innerHTML:a.html},null,8,RWe))]))),128))],512)])}const Zb=gt(TWe,[["render",AWe]]),wWe={data(){return{show:!1,has_button:!0,message:""}},components:{MarkdownRenderer:Zb},methods:{hide(){this.show=!1,this. $ emit("ok")},showMessage(n){this.message=n,this.has_button=!0,this.show=!0},showBlockingMessage(n){this.message=n,this.has_button=!1,this.show=!0},updateMessage(n){this.message=n,this.show=!0},hideMessage(){this.show=!1}}},NWe={key:0,class:"fixed top-0 left-0 right-0 bottom-0 flex items-center justify-center bg-black bg-opacity-50 z-50"},OWe={class:"pl-10 pr-10 bg-bg-light dark:bg-bg-dark p-8 rounded-lg shadow-lg"},IWe={class:"container max-h-500 overflow-y-auto"},MWe={class:"text-lg font-medium"},DWe={class:"mt-4 flex justify-center"},kWe={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"},LWe=u("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),PWe=u("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),UWe=[LWe,PWe];function FWe(n,e,t,i,s,r){const o=ut("MarkdownRenderer");return s.show?(O(),D("div",NWe,[u("div",OWe,[u("div",IWe,[u("div",MWe,[Oe(o,{ref:"mdRender",host:"","markdown-text":s.message,message_id:0,discussion_id:0},null,8,["markdown-text"])])]),u("div",DWe,[s.has_button?(O(),D("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 ")):K("",!0),s.has_button?K("",!0):(O(),D("svg",kWe,UWe))])])])):K("",!0)}const sN=gt(wWe,[["render",FWe]]);const BWe={props:{progress:{type:Number,required:!0}}},GWe={class:"progress-bar-container"};function VWe(n,e,t,i,s,r){return O(),D("div",GWe,[u("div",{class:"progress-bar",style:Jt({width: ` $ { t . progress } % ` })},null,4)])}const Kl=gt(BWe,[["render",VWe]]),zWe={setup(){return{}},name:"UniversalForm",data(){return{show:!1,resolve:null,controls_array:[],title:"Universal form",ConfirmButtonText:"Submit",DenyButtonText:"Cancel"}},mounted(){Be(()=>{Ge.replace()})},methods:{hide(n){this.show=!1,this.resolve&&n&&(this.resolve(this.controls_array),this.resolve=null)},showForm(n,e,t,i){this.ConfirmButtonT
h - 87.51 l - 313.51 , 338.7 l - 253.31 - 338.7 H283 . 94 z M412 . 63 , 231.77 h136 . 81 l604 . 13 , 807.76 h - 136.81 L412 . 63 , 231.77 z ` })],-1),SQe=[vQe],yQe={href:"https://discord.com/channels/1092918764925882418",target:"_blank"},TQe={class:"text-2xl hover:text-primary duration-150",title:"Visit my discord channel"},xQe=["src"],CQe=u("i",{"data-feather":"sun"},null,-1),RQe=[CQe],AQe=u("i",{"data-feather":"moon"},null,-1),wQe=[AQe],NQe={role:"status",class:"fixed m-0 p-2 left-2 bottom-2 min-w-[24rem] max-w-[24rem] h-20 flex flex-col justify-center items-center pb-4 bg-blue-500 rounded-lg shadow-lg z-50 background-a"},OQe={class:"text-2xl animate-pulse mt-2 text-white"},IQe=u("body",null,null,-1),MQe={name:"TopBar",computed:{currentPersonConfig(){try{return this. $ store.state.currentPersonConfig}catch{console.log("Error finding current personality configuration");return}},selectedPersonality(){try{return this. $ store.state.selectedPersonality}catch{console.log("Error finding current personality configuration");return}},loading_infos(){return this. $ store.state.loading_infos},isModelOK(){return this. $ store.state.isModelOk},isGenerating(){return this. $ store.state.isGenerating},isConnected(){return this. $ store.state.isConnected}},components:{Toast:oc,MessageBox:sN,ProgressBar:Kl,UniversalForm:dc,YesNoDialog:rN,Navigation:cN,PersonalityEditor:oN},watch:{isConnected(){this.isConnected?(console.log("this.is_first_connection"),console.log(this.is_first_connection),this.is_first_connection||(this. $ store.state.messageBox.hideMessage(),this. $ store.state.messageBox.showMessage("Server connected."),this. $ store.state.config.activate_audio_infos&&this.connection_recovered_audio.play())):(this. $ store.state.messageBox.showBlockingMessage("Server suddenly disconnected. Please reboot the server to recover the connection"),this.is_first_connection=!1,console.log("this.is_first_connection set to false"),console.log(this.is_first_connection),this. $ store.state.config.activate_audio_infos&&this.connection_lost_audio.play()),Be(()=>{Ge.replace()})}},data(){return{is_first_connection:!0,discord:lN,FastAPI:aN,rebooting_audio:new Audio("rebooting.wav"),connection_lost_audio:new Audio("connection_lost.wav"),connection_recovered_audio:new Audio("connection_recovered.wav"),database_selectorDialogVisible:!1,progress_visibility:!1,progress_value:0,codeBlockStylesheet:"",sunIcon:document.querySelector(".sun"),moonIcon:document.querySelector(".moon"),userTheme:localStorage.getItem("theme"),systemTheme:window.matchMedia("prefers-color-scheme: dark").matches}},mounted(){this. $ store.state.toast=this. $ refs.toast,this. $ store.state.messageBox=this. $ refs.messageBox,this. $ store.state.universalForm=this. $ refs.universalForm,this. $ store.state.yesNoDialog=this. $ refs.yesNoDialog,this. $ store.state.personality_editor=this. $ refs.personality_editor,this.sunIcon=document.querySelector(".sun"),this.moonIcon=document.querySelector(".moon"),this.userTheme=localStorage.getItem("theme"),this.systemTheme=window.matchMedia("prefers-color-scheme: dark").matches,this.themeCheck(),Be(()=>{Ge.replace()})},created(){this.sunIcon=document.querySelector(".sun"),this.moonIcon=document.querySelector(".moon"),this.userTheme=localStorage.getItem("theme"),this.systemTheme=window.matchMedia("prefers-color-scheme: dark").matches},methods:{restartProgram(n){n.preventDefault(),this. $ store.state.api_get_req("restart_program"),this.rebooting_audio.play(),this. $ store.state.toast.showToast("Rebooting the app. Please wait...",410,!1),console.log("this. $ store.state.api_get_req",this. $ store.state.api_get_req),setTimeout(()=>{window.close()},2e3)},refreshPage(){window.location.href="/"},handleOk(n){console.log("Input text:",n)},themeCheck(){if(this.userTheme=="dark"||!this.userTheme&&this.systemTheme){document.documentElement.classList.add("dark"),this.moonIcon.classList.add("display-none"),Be(()=>{xp(()=>Promise.resolve({}),["assets/stackoverflow-dark-57af98f5.css"])});return}Be(()=>{xp(()=>Promise.resolve({}),["assets/stackoverflow-light-077a2b3c.css"])}),this.sunIcon.classList.add("display-none")},them
2024-01-11 01:32:21 +00:00
< div class = "bg-white p-6 rounded-md shadow-md w-80" >
< h2 class = "text-lg font-semibold mb-3" > $ { n } < / h 2 >
< textarea id = "replacementInput" class = "w-full h-32 border rounded p-2 mb-3" > $ { e } < / t e x t a r e a >
< div class = "flex justify-end" >
< button id = "cancelButton" class = "mr-2 px-4 py-2 border rounded" > Cancel < / b u t t o n >
< button id = "okButton" class = "px-4 py-2 bg-blue-500 text-white rounded" > OK < / b u t t o n >
< / d i v >
< / d i v >
` :r.innerHTML= `
< div class = "bg-white p-6 rounded-md shadow-md w-80" >
< h2 class = "text-lg font-semibold mb-3" > $ { n } < / h 2 >
< select id = "options_selector" class = "form-control w-full h-25 border rounded p-2 mb-3" >
$ { t . map ( l => ` <option value=" ${ l } "> ${ l } </option> ` ) }
< / s e l e c t >
< div class = "flex justify-end" >
< button id = "cancelButton" class = "mr-2 px-4 py-2 border rounded" > Cancel < / b u t t o n >
< button id = "okButton" class = "px-4 py-2 bg-blue-500 text-white rounded" > OK < / b u t t o n >
< / d i v >
< / d i v >
2024-02-10 20:35:27 +00:00
` ,document.body.appendChild(r);const o=r.querySelector("#cancelButton"),a=r.querySelector("#okButton");o.addEventListener("click",()=>{document.body.removeChild(r),i(null)}),a.addEventListener("click",()=>{if(t.length===0){const c=r.querySelector("#replacementInput").value.trim();document.body.removeChild(r),i(c)}else{const c=r.querySelector("#options_selector").value.trim();document.body.removeChild(r),i(c)}})})}function HXe(n,e){console.log(n);let t={},i=/@<([^>]+)>@/g,s=[],r;for(;(r=i.exec(n))!==null;)s.push("@<"+r[1]+">@");console.log("matches"),console.log(s),s=[...new Set(s)];async function o(l){console.log(l);let c=l.toLowerCase().substring(2,l.length-2);if(c!=="generation_placeholder")if(c.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(([b,g])=>{console.log( ` Key : $ { b } , Value : $ { g } ` );function v(C){return C.replace(/[.*+?^ ${ } ()|[ \] \\ ]/g," \\ $ &")}const y=v(b),T=new RegExp(y,"g");c=c.replace(T,g)});let _=c.split(":"),h=_[0],m=_[1]||"",f=[];_.length>2&&(f=_.slice(1));let E=await tC(h,m,f);E!==null&&(t[l]=E)}else{let d=await tC(c);d!==null&&(t[l]=d)}}let a=Promise.resolve();s.forEach(l=>{a=a.then(()=>o(l)).then(c=>{console.log(c)})}),a.then(()=>{Object.entries(t).forEach(([l,c])=>{console.log( ` Key : $ { l } , Value : $ { c } ` );function d(m){return m.replace(/[.*+?^ ${ } ()|[ \] \\ ]/g," \\ $ &")}const _=d(l),h=new RegExp(_,"g");n=n.replace(h,c)}),e(n)})}const qXe={name:"PlayGroundView",data(){return{pending:!1,is_recording:!1,cpp_block:NN,html5_block:ON,LaTeX_block:IN,javascript_block:AN,json_block:wN,code_block:CN,python_block:RN,bash_block:MN,rec_off:VXe,rec_on:GXe,loading_icon:DN,isSynthesizingVoice:!1,audio_url:null,mdRenderHeight:300,selecting_model:!1,tab_id:"source",generating:!1,isSpeaking:!1,voices:[],isLesteningToVoice:!1,presets:[],selectedPreset:"",cursorPosition:0,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:oc,MarkdownRenderer:Zb,ClipBoardTextInput:rE,Card:uc},mounted(){Le.get("./get_presets").then(n=>{console.log(n.data),this.presets=n.data,this.selectedPreset=this.presets[0]}).catch(n=>{this. $ refs.toast.showToast( ` Error : $ { n } ` ,4,!1)}), $ e.on("text_chunk",n=>{this.appendToOutput(n.chunk)}), $ e.on("text_generated",n=>{this.generating=!1}), $ e.on("generation_error",n=>{console.log("gener
2024-01-11 01:32:21 +00:00
` ?(this.message.content=this.message.content.slice(0,e)+" ` ` ` "+n+" \ n \ n ` ` ` \n "+this.message.content.slice(e),e=e+4+n.length):(this.message.content=this.message.content.slice(0,e)+" \n ` ` ` "+n+" \ n \ n ` ` ` \n "+this.message.content.slice(e),e=e+3+n.length):speechSynthesis==0||this.message.content[e-1]== `
` ?(this.message.content=this.message.content.slice(0,e)+" ` ` ` " + n + `
` +this.message.content.slice(e,t)+" \n ` ` ` \ n "+this.message.content.slice(t),e=e+4+n.length):(this.message.content=this.message.content.slice(0,e)+" \ n ` ` ` "+n+ `
2024-02-10 10:33:09 +00:00
` +this.message.content.slice(e,t)+" \n ` ` ` \ n "+this.message.content.slice(t),p=p+3+n.length),this.$refs.mdTextarea.focus(),this.$refs.mdTextarea.selectionStart=this.$refs.mdTextarea.selectionEnd=p},insertTab(n){const e=n.target,t=e.selectionStart,i=e.selectionEnd,s=e.value.substring(0,t),r=e.value.substring(i),o=s+" "+r;this.text=o,this.$nextTick(()=>{e.selectionStart=e.selectionEnd=t+4}),n.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,Le.post(" / update _setting ",{setting_name:" model _name ",setting_value:this.selectedModel}).then(n=>{console.log(n),n.status&&this.$refs.toast.showToast(`Model changed to ${this.selectedModel}`,4,!0),this.selecting_model=!1}).catch(n=>{this.$refs.toast.showToast(`Error ${n}`,4,!0),this.selecting_model=!1})},onVoicesChanged(){this.voices=this.speechSynthesis.getVoices()},read(){this.isSynthesizingVoice=!0;let n=this.$refs.mdTextarea.selectionStart,e=this.$refs.mdTextarea.selectionEnd,t=this.text;n!=e&&(t=t.slice(n,e)),Le.post(" . / text2Audio ",{text:t}).then(i=>{console.log(i.data.url);let s=i.data.url;this.audio_url=zXe+s,this.isSynthesizingVoice=!1,Be(()=>{Ge.replace()})}).catch(i=>{this.$refs.toast.showToast(`Error: ${i}`,4,!1),this.isSynthesizingVoice=!1,Be(()=>{Ge.replace()})})},speak(){if(this.msg){this.speechSynthesis.cancel(),this.msg=null,this.isSpeaking=!1;return}let n=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(s=>s.name===this.$store.state.config.audio_out_voice)[0]);const t=s=>{let r=this.text.substring(s,s+e);const o=[" . "," ! "," ? " , `
2024-02-10 20:35:27 +00:00
` ];let a=-1;return o.forEach(l=>{const c=r.lastIndexOf(l);c>a&&(a=c)}),a==-1&&(a=r.length),console.log(a),a+s+1},i=()=>{const s=t(n),r=this.text.substring(n,s);this.msg.text=r,n=s+1,this.msg.onend=o=>{n<this.text.length-2?setTimeout(()=>{i()},1):(this.isSpeaking=!1,console.log("voice off :",this.text.length," ",s))},this.speechSynthesis.speak(this.msg)};i()},getCursorPosition(){return this. $ refs.mdTextarea.selectionStart},appendToOutput(n){this.pre_text+=n,this.text=this.pre_text+this.post_text},generate_in_placeholder(){console.log("Finding cursor position");let n=this.text.indexOf("@<generation_placeholder>@");if(n<0){this. $ refs.toast.showToast("No generation placeholder found",4,!1);return}this.text=this.text.substring(0,n)+this.text.substring(n+26,this.text.length),this.pre_text=this.text.substring(0,n),this.post_text=this.text.substring(n,this.text.length);var e=this.text.substring(0,n);console.log(e), $ e.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},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 n=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 : $ { n } ` ), $ e.emit("generate_text",{prompt:n,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(){ $ e.emit("cancel_text_generation",{})},exportText(){const n=this.text,e=document.createElement("a"),t=new Blob([n],{type:"text/plain"});e.href=URL.createObjectURL(t),e.download="exported_text.txt",document.body.appendChild(e),e.click(),document.body.removeChild(e)},importText(){const n=document.getElementById("import-input");n&&(n.addEventListener("change",e=>{if(e.target.files&&e.target.files[0]){const t=new FileReader;t.onload=()=>{this.text=t.result},t.readAsText(e.target.files[0])}else alert("Please select a file.")}),n.click())},setPreset(){console.log("Setting preset"),console.log(this.selectedPreset),this.tab_id="render",this.text=HXe(this.selectedPreset.content,n=>{console.log("Done"),console.log(n),this.text=n})},addPreset(){let n=prompt("Enter the title of the preset:");this.presets[n]={name:n,content:this.text},Le.post("./add_preset",this.presets[n]).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(){Le.get("./get_presets").then(n=>{console.log(n.data),this.presets=n.data,this.selectedPreset=this.presets[0]}).catch(n=>{this. $ refs.toast.showToast( ` Error : $ { n } ` ,4,!1)})},startRecording(){this.pending=!0,this.is_recording?Le.get("/stop_recording").then(n=>{this.is_recording=!1,this.pending=!1,console.log(n),this.text+=n.data,console.log(n.data),this.presets=n.data,this.selectedPreset=this.presets[0]}).catch(n=>{this. $ refs.toast.showToast( ` Error : $ { n } ` ,4,!1)}):Le.get("/start_recording").then(n=>{this.is_recording=!0,this.pending=!1,console.log(n.data),this.presets=n.data,this.selectedPreset=this.presets[0]}).catch(n=>{this. $ refs.toast.showToast( ` Error : $ { n } ` ,4,!1)})},startSpeechRecognition(){"SpeechRecognition"in window||"webkitSpeechRecognition"in window?(this.recognition=new(window.SpeechRecognition||window.webkitSpeechRecognition),this.recognition.lang=this. $ store.state.config.audio_in_language,this.recognition.interimResults=!0,this.recognition.onstart=()=>{this.isLesteningToVoice=!0,this.silenceTimer=setTimeout(()=>{this.recognition.stop()},this.silenceTimeout)},th
` ,36),[[Ue,s.text]]),u("span",null,"Cursor position "+me(s.cursorPosition),1)])):K("",!0),s.audio_url!=null?(O(),D("audio",{controls:"",autoplay:"",key:s.audio_url},[u("source",{src:s.audio_url,type:"audio/wav",ref:"audio_player"},null,8,MZe),Qe(" Your browser does not support the audio element. ")])):K("",!0),s.tab_id==="render"?(O(),D("div",DZe,[Oe(o,{ref:"mdRender","markdown-text":s.text,class:"mt-4 p-2 rounded shadow-lg dark:bg-bg-dark"},null,8,["markdown-text"])])):K("",!0)],2)]),Oe(a,{title:"settings",class:"slider-container ml-0 mr-0 max-width",isHorizontal:!1,disableHoverAnimation:!0,disableFocus:!0},{default:tt(()=>[Oe(a,{title:"Model",class:"slider-container ml-0 mr-0",is_subcard:!0,isHorizontal:!1,disableHoverAnimation:!0,disableFocus:!0},{default:tt(()=>[ue(u("select",{"onUpdate:modelValue":e[24]||(e[24]=c=>r.selectedModel=c),onChange:e[25]||(e[25]=(...c)=>r.setModel&&r.setModel(...c)),class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},[(O(!0),D(qe,null,lt(r.models,c=>(O(),D("option",{key:c,value:c},me(c),9,kZe))),128))],544),[[qn,r.selectedModel]]),s.selecting_model?(O(),D("div",LZe,UZe)):K("",!0)]),_:1}),Oe(a,{title:"Presets",class:"slider-container ml-0 mr-0",is_subcard:!0,isHorizontal:!1,disableHoverAnimation:!0,disableFocus:!0},{default:tt(()=>[ue(u("select",{"onUpdate:modelValue":e[26]||(e[26]=c=>s.selectedPreset=c),class:"bg-white dark:bg-black mb-2 border-2 rounded-md shadow-sm w-full"},[(O(!0),D(qe,null,lt(s.presets,c=>(O(),D("option",{key:c,value:c},me(c.name),9,FZe))),128))],512),[[qn,s.selectedPreset]]),BZe,u("button",{class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer",onClick:e[27]||(e[27]=(...c)=>r.setPreset&&r.setPreset(...c)),title:"Use preset"},VZe),u("button",{class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer",onClick:e[28]||(e[28]=(...c)=>r.addPreset&&r.addPreset(...c)),title:"Add this text as a preset"},HZe),u("button",{class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer",onClick:e[29]||(e[29]=(...c)=>r.removePreset&&r.removePreset(...c)),title:"Remove preset"},YZe),u("button",{class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer",onClick:e[30]||(e[30]=(...c)=>r.reloadPresets&&r.reloadPresets(...c)),title:"Reload presets list"},WZe)]),_:1}),Oe(a,{title:"Generation params",class:"slider-container ml-0 mr-0",is_subcard:!0,isHorizontal:!1,disableHoverAnimation:!0,disableFocus:!0},{default:tt(()=>[u("div",KZe,[jZe,ue(u("input",{type:"range","onUpdate:modelValue":e[31]||(e[31]=c=>s.temperature=c),min:"0",max:"5",step:"0.1",class:"w-full"},null,512),[[Ue,s.temperature]]),u("span",QZe,"Current value: "+me(s.temperature),1)]),u("div",XZe,[ZZe,ue(u("input",{type:"range","onUpdate:modelValue":e[32]||(e[32]=c=>s.top_k=c),min:"1",max:"100",step:"1",class:"w-full"},null,512),[[Ue,s.top_k]]),u("span",JZe,"Current value: "+me(s.top_k),1)]),u("div",eJe,[tJe,ue(u("input",{type:"range","onUpdate:modelValue":e[33]||(e[33]=c=>s.top_p=c),min:"0",max:"1",step:"0.1",class:"w-full"},null,512),[[Ue,s.top_p]]),u("span",nJe,"Current value: "+me(s.top_p),1)]),u("div",iJe,[sJe,ue(u("input",{type:"range","onUpdate:modelValue":e[34]||(e[34]=c=>s.repeat_penalty=c),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),[[Ue,s.repeat_penalty]]),u("span",rJe,"Current value: "+me(s.repeat_penalty),1)]),u("div",oJe,[aJe,ue(u("input",{type:"range","onUpdate:modelValue":e[35]||(e[35]=c=>s.repeat_last_n=c),min:"0",max:"100",step:"1",class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},null,512),[[Ue,s.repeat_last_n]]),u("span",lJe,"Current value: "+me(s.repeat_last_n),1)]),u("div",cJe,[dJe,ue(u("input",{type:"number","onUpdate:modelValue":e[36]||(e[36]=c=>s.n_crop=c),class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},null,512),[[Ue,s.n_crop]]),u("span",uJe,"Current value: "+me(s.n_crop),1)]),u("div",pJe,[_Je,ue(u("input",{type:"number","onUpdate:modelValue":e[37]||(e[37]=c=>s.n_pred
2024-01-11 01:32:21 +00:00
Papa Parse
v5 . 4.1
https : //github.com/mholt/PapaParse
License : MIT
2024-02-10 10:33:09 +00:00
* / ( f u n c t i o n ( n , e ) { ( f u n c t i o n ( t , i ) { n . e x p o r t s = i ( ) } ) ( E w , f u n c t i o n t ( ) { v a r i = t y p e o f s e l f < " u " ? s e l f : t y p e o f w i n d o w < " u " ? w i n d o w : i ! = = v o i d 0 ? i : { } , s = ! i . d o c u m e n t & & ! ! i . p o s t M e s s a g e , r = i . I S _ P A P A _ W O R K E R | | ! 1 , o = { } , a = 0 , l = { p a r s e : f u n c t i o n ( R , S ) { v a r A = ( S = S | | { } ) . d y n a m i c T y p i n g | | ! 1 ; i f ( w ( A ) & & ( S . d y n a m i c T y p i n g F u n c t i o n = A , A = { } ) , S . d y n a m i c T y p i n g = A , S . t r a n s f o r m = ! ! w ( S . t r a n s f o r m ) & & S . t r a n s f o r m , S . w o r k e r & & l . W O R K E R S _ S U P P O R T E D ) { v a r P = f u n c t i o n ( ) { i f ( ! l . W O R K E R S _ S U P P O R T E D ) r e t u r n ! 1 ; v a r Y = ( H = i . U R L | | i . w e b k i t U R L | | n u l l , B = t . t o S t r i n g ( ) , l . B L O B _ U R L | | ( l . B L O B _ U R L = H . c r e a t e O b j e c t U R L ( n e w B l o b ( [ " v a r g l o b a l = ( f u n c t i o n ( ) { i f ( t y p e o f s e l f ! = = ' u n d e f i n e d ' ) { r e t u r n s e l f ; } i f ( t y p e o f w i n d o w ! = = ' u n d e f i n e d ' ) { r e t u r n w i n d o w ; } i f ( t y p e o f g l o b a l ! = = ' u n d e f i n e d ' ) { r e t u r n g l o b a l ; } r e t u r n { } ; } ) ( ) ; g l o b a l . I S _ P A P A _ W O R K E R = t r u e ; " , " ( " , B , " ) ( ) ; " ] , { t y p e : " t e x t / j a v a s c r i p t " } ) ) ) ) , k = n e w i . W o r k e r ( Y ) , H , B ; r e t u r n k . o n m e s s a g e = v , k . i d = a + + , o [ k . i d ] = k } ( ) ; r e t u r n P . u s e r S t e p = S . s t e p , P . u s e r C h u n k = S . c h u n k , P . u s e r C o m p l e t e = S . c o m p l e t e , P . u s e r E r r o r = S . e r r o r , S . s t e p = w ( S . s t e p ) , S . c h u n k = w ( S . c h u n k ) , S . c o m p l e t e = w ( S . c o m p l e t e ) , S . e r r o r = w ( S . e r r o r ) , d e l e t e S . w o r k e r , v o i d P . p o s t M e s s a g e ( { i n p u t : R , c o n f i g : S , w o r k e r I d : P . i d } ) } v a r U = n u l l ; r e t u r n l . N O D E _ S T R E A M _ I N P U T , t y p e o f R = = " s t r i n g " ? ( R = f u n c t i o n ( Y ) { r e t u r n Y . c h a r C o d e A t ( 0 ) = = = 6 5 2 7 9 ? Y . s l i c e ( 1 ) : Y } ( R ) , U = S . d o w n l o a d ? n e w _ ( S ) : n e w m ( S ) ) : R . r e a d a b l e = = = ! 0 & & w ( R . r e a d ) & & w ( R . o n ) ? U = n e w f ( S ) : ( i . F i l e & & R i n s t a n c e o f F i l e | | R i n s t a n c e o f O b j e c t ) & & ( U = n e w h ( S ) ) , U . s t r e a m ( R ) } , u n p a r s e : f u n c t i o n ( R , S ) { v a r A = ! 1 , P = ! 0 , U = " , " , Y = ` \ r
2024-02-10 20:35:27 +00:00
` ,k='"',H=k+k,B=!1,L=null, $ =!1;(function(){if(typeof S=="object"){if(typeof S.delimiter!="string"||l.BAD_DELIMITERS.filter(function(J){return S.delimiter.indexOf(J)!==-1}).length||(U=S.delimiter),(typeof S.quotes=="boolean"||typeof S.quotes=="function"||Array.isArray(S.quotes))&&(A=S.quotes),typeof S.skipEmptyLines!="boolean"&&typeof S.skipEmptyLines!="string"||(B=S.skipEmptyLines),typeof S.newline=="string"&&(Y=S.newline),typeof S.quoteChar=="string"&&(k=S.quoteChar),typeof S.header=="boolean"&&(P=S.header),Array.isArray(S.columns)){if(S.columns.length===0)throw new Error("Option columns is empty");L=S.columns}S.escapeChar!==void 0&&(H=S.escapeChar+k),(typeof S.escapeFormulae=="boolean"||S.escapeFormulae instanceof RegExp)&&( $ =S.escapeFormulae instanceof RegExp?S.escapeFormulae:/^[=+ \- @ \t \r ].* $ /)}})();var j=new RegExp(b(k),"g");if(typeof R=="string"&&(R=JSON.parse(R)),Array.isArray(R)){if(!R.length||Array.isArray(R[0]))return W(null,R,B);if(typeof R[0]=="object")return W(L||Object.keys(R[0]),R,B)}else if(typeof R=="object")return typeof R.data=="string"&&(R.data=JSON.parse(R.data)),Array.isArray(R.data)&&(R.fields||(R.fields=R.meta&&R.meta.fields||L),R.fields||(R.fields=Array.isArray(R.data[0])?R.fields:typeof R.data[0]=="object"?Object.keys(R.data[0]):[]),Array.isArray(R.data[0])||typeof R.data[0]=="object"||(R.data=[R.data])),W(R.fields||[],R.data||[],B);throw new Error("Unable to serialize unrecognized input");function W(J,ee,fe){var be="";typeof J=="string"&&(J=JSON.parse(J)),typeof ee=="string"&&(ee=JSON.parse(ee));var Ce=Array.isArray(J)&&0<J.length,X=!Array.isArray(ee[0]);if(Ce&&P){for(var _e=0;_e<J.length;_e++)0<_e&&(be+=U),be+=le(J[_e],_e);0<ee.length&&(be+=Y)}for(var Z=0;Z<ee.length;Z++){var Ee=Ce?J.length:ee[Z].length,Ie=!1,M=Ce?Object.keys(ee[Z]).length===0:ee[Z].length===0;if(fe&&!Ce&&(Ie=fe==="greedy"?ee[Z].join("").trim()==="":ee[Z].length===1&&ee[Z][0].length===0),fe==="greedy"&&Ce){for(var G=[],q=0;q<Ee;q++){var oe=X?J[q]:q;G.push(ee[Z][oe])}Ie=G.join("").trim()===""}if(!Ie){for(var ne=0;ne<Ee;ne++){0<ne&&!M&&(be+=U);var Te=Ce&&X?J[ne]:ne;be+=le(ee[Z][Te],ne)}Z<ee.length-1&&(!fe||0<Ee&&!M)&&(be+=Y)}}return be}function le(J,ee){if(J==null)return"";if(J.constructor===Date)return JSON.stringify(J).slice(1,25);var fe=!1; $ &&typeof J=="string"&& $ .test(J)&&(J="'"+J,fe=!0);var be=J.toString().replace(j,H);return(fe=fe||A===!0||typeof A=="function"&&A(J,ee)||Array.isArray(A)&&A[ee]||function(Ce,X){for(var _e=0;_e<X.length;_e++)if(-1<Ce.indexOf(X[_e]))return!0;return!1}(be,l.BAD_DELIMITERS)||-1<be.indexOf(U)||be.charAt(0)===" "||be.charAt(be.length-1)===" ")?k+be+k:be}}};if(l.RECORD_SEP=String.fromCharCode(30),l.UNIT_SEP=String.fromCharCode(31),l.BYTE_ORDER_MARK=" \u FEFF",l.BAD_DELIMITERS=[" \r ", `
` ,'"',l.BYTE_ORDER_MARK],l.WORKERS_SUPPORTED=!s&&!!i.Worker,l.NODE_STREAM_INPUT=1,l.LocalChunkSize=10485760,l.RemoteChunkSize=5242880,l.DefaultDelimiter=",",l.Parser=g,l.ParserHandle=E,l.NetworkStreamer=_,l.FileStreamer=h,l.StringStreamer=m,l.ReadableStreamStreamer=f,i.jQuery){var c=i.jQuery;c.fn.parse=function(R){var S=R.config||{},A=[];return this.each(function(Y){if(!(c(this).prop("tagName").toUpperCase()==="INPUT"&&c(this).attr("type").toLowerCase()==="file"&&i.FileReader)||!this.files||this.files.length===0)return!0;for(var k=0;k<this.files.length;k++)A.push({file:this.files[k],inputElem:this,instanceConfig:c.extend({},S)})}),P(),this;function P(){if(A.length!==0){var Y,k,H,B,L=A[0];if(w(R.before)){var $ =R.before(L.file,L.inputElem);if(typeof $ =="object"){if( $ .action==="abort")return Y="AbortError",k=L.file,H=L.inputElem,B= $ .reason,void(w(R.error)&&R.error({name:Y},k,H,B));if( $ .action==="skip")return void U();typeof $ .config=="object"&&(L.instanceConfig=c.extend(L.instanceConfig, $ .config))}else if( $ ==="skip")return void U()}var j=L.instanceConfig.complete;L.instanceConfig.complete=function(W){w(j)&&j(W,L.file,L.inputElem),U()},l.parse(L.file,L.instanceConfig)}else w(R.complete)&&R.complete()}function U(){A.splice(0,1),P()}}}function d(R){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(S){var A=C(S);A.chunkSize=parseInt(A.chunkSize),S.step||S.chunk||(A.chunkSize=null),this._handle=new E(A),(this._handle.streamer=this)._config=A}).call(this,R),this.parseChunk=function(S,A){if(this.isFirstChunk&&w(this._config.beforeFirstChunk)){var P=this._config.beforeFirstChunk(S);P!==void 0&&(S=P)}this.isFirstChunk=!1,this._halted=!1;var U=this._partialLine+S;this._partialLine="";var Y=this._handle.parse(U,this._baseIndex,!this._finished);if(!this._handle.paused()&&!this._handle.aborted()){var k=Y.meta.cursor;this._finished||(this._partialLine=U.substring(k-this._baseIndex),this._baseIndex=k),Y&&Y.data&&(this._rowCount+=Y.data.length);var H=this._finished||this._config.preview&&this._rowCount>=this._config.preview;if(r)i.postMessage({results:Y,workerId:l.WORKER_ID,finished:H});else if(w(this._config.chunk)&&!A){if(this._config.chunk(Y,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);Y=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(Y.data),this._completeResults.errors=this._completeResults.errors.concat(Y.errors),this._completeResults.meta=Y.meta),this._completed||!H||!w(this._config.complete)||Y&&Y.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),H||Y&&Y.meta.paused||this._nextChunk(),Y}this._halted=!0},this._sendError=function(S){w(this._config.error)?this._config.error(S):r&&this._config.error&&i.postMessage({workerId:l.WORKER_ID,error:S,finished:!1})}}function _(R){var S;(R=R||{}).chunkSize||(R.chunkSize=l.RemoteChunkSize),d.call(this,R),this._nextChunk=s?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(A){this._input=A,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(S=new XMLHttpRequest,this._config.withCredentials&&(S.withCredentials=this._config.withCredentials),s||(S.onload=x(this._chunkLoaded,this),S.onerror=x(this._chunkError,this)),S.open(this._config.downloadRequestBody?"POST":"GET",this._input,!s),this._config.downloadRequestHeaders){var A=this._config.downloadRequestHeaders;for(var P in A)S.setRequestHeader(P,A[P])}if(this._config.chunkSize){var U=this._start+this._config.chunkSize-1;S.setRequestHeader("Range","bytes="+this._start+"-"+U)}try{S.send(this._config.downloadRequestBody)}catch(Y){this._chunkError(Y.message)}s&&S.status===0&&this._chunkError()}},this._chunkLoaded=function(){S.readyState===4&&(S.status<200||400<=S.status?this._chu
2024-01-11 01:32:21 +00:00
` ),ce=1<V.length&&V[0].length<we[0].length;if(we.length===1||ce)return `
` ;for(var ie=0,re=0;re<we.length;re++)we[re][0]=== `
` &&ie++;return ie>=we.length/2? ` \ r
2024-02-10 10:33:09 +00:00
` :" \r "}(Z,M)),P=!1,R.delimiter)w(R.delimiter)&&(R.delimiter=R.delimiter(Z),J.meta.delimiter=R.delimiter);else{var G=function(oe,ne,Te,we,V){var ce,ie,re,I;V=V||[","," ","|",";",l.RECORD_SEP,l.UNIT_SEP];for(var N=0;N<V.length;N++){var z=V[N],de=0,Q=0,te=0;re=void 0;for(var Re=new g({comments:we,delimiter:z,newline:ne,preview:10}).parse(oe),Se=0;Se<Re.data.length;Se++)if(Te&&fe(Re.data[Se]))te++;else{var ke=Re.data[Se].length;Q+=ke,re!==void 0?0<ke&&(de+=Math.abs(ke-re),re=ke):re=ke}0<Re.data.length&&(Q/=Re.data.length-te),(ie===void 0||de<=ie)&&(I===void 0||I<Q)&&1.99<Q&&(ie=de,ce=z,I=Q)}return{successful:!!(R.delimiter=ce),bestDelimiter:ce}}(Z,R.newline,R.skipEmptyLines,R.comments,R.delimitersToGuess);G.successful?R.delimiter=G.bestDelimiter:(P=!0,R.delimiter=l.DefaultDelimiter),J.meta.delimiter=R.delimiter}var q=C(R);return R.preview&&R.header&&q.preview++,S=Z,A=new g(q),J=A.parse(S,Ee,Ie),be(),j?{meta:{paused:!0}}:J||{meta:{paused:!1}}},this.paused=function(){return j},this.pause=function(){j=!0,A.abort(),S=w(R.chunk)?"":S.substring(A.getCharIndex())},this.resume=function(){B.streamer._halted?(j=!1,B.streamer.parseChunk(S,!0)):setTimeout(B.resume,3)},this.aborted=function(){return W},this.abort=function(){W=!0,A.abort(),J.meta.aborted=!0,w(R.complete)&&R.complete(J),S=""}}function b(R){return R.replace(/[.*+?^ ${ } ()|[ \] \\ ]/g," \\ $ &")}function g(R){var S,A=(R=R||{}).delimiter,P=R.newline,U=R.comments,Y=R.step,k=R.preview,H=R.fastMode,B=S=R.quoteChar===void 0||R.quoteChar===null?'"':R.quoteChar;if(R.escapeChar!==void 0&&(B=R.escapeChar),(typeof A!="string"||-1<l.BAD_DELIMITERS.indexOf(A))&&(A=","),U===A)throw new Error("Comment character same as delimiter");U===!0?U="#":(typeof U!="string"||-1<l.BAD_DELIMITERS.indexOf(U))&&(U=!1),P!== `
2024-01-11 01:32:21 +00:00
` &&P!==" \r "&&P!== ` \ r
` &&(P= `
2024-02-10 20:35:27 +00:00
` );var L=0, $ =!1;this.parse=function(j,W,le){if(typeof j!="string")throw new Error("Input must be a string");var J=j.length,ee=A.length,fe=P.length,be=U.length,Ce=w(Y),X=[],_e=[],Z=[],Ee=L=0;if(!j)return ze();if(R.header&&!W){var Ie=j.split(P)[0].split(A),M=[],G={},q=!1;for(var oe in Ie){var ne=Ie[oe];w(R.transformHeader)&&(ne=R.transformHeader(ne,oe));var Te=ne,we=G[ne]||0;for(0<we&&(q=!0,Te=ne+"_"+we),G[ne]=we+1;M.includes(Te);)Te=Te+"_"+we;M.push(Te)}if(q){var V=j.split(P);V[0]=M.join(A),j=V.join(P)}}if(H||H!==!1&&j.indexOf(S)===-1){for(var ce=j.split(P),ie=0;ie<ce.length;ie++){if(Z=ce[ie],L+=Z.length,ie!==ce.length-1)L+=P.length;else if(le)return ze();if(!U||Z.substring(0,be)!==U){if(Ce){if(X=[],te(Z.split(A)),it(), $ )return ze()}else te(Z.split(A));if(k&&k<=ie)return X=X.slice(0,k),ze(!0)}}return ze()}for(var re=j.indexOf(A,L),I=j.indexOf(P,L),N=new RegExp(b(B)+b(S),"g"),z=j.indexOf(S,L);;)if(j[L]!==S)if(U&&Z.length===0&&j.substring(L,L+be)===U){if(I===-1)return ze();L=I+fe,I=j.indexOf(P,L),re=j.indexOf(A,L)}else if(re!==-1&&(re<I||I===-1))Z.push(j.substring(L,re)),L=re+ee,re=j.indexOf(A,L);else{if(I===-1)break;if(Z.push(j.substring(L,I)),ke(I+fe),Ce&&(it(), $ ))return ze();if(k&&X.length>=k)return ze(!0)}else for(z=L,L++;;){if((z=j.indexOf(S,z+1))===-1)return le||_e.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:X.length,index:L}),Se();if(z===J-1)return Se(j.substring(L,z).replace(N,S));if(S!==B||j[z+1]!==B){if(S===B||z===0||j[z-1]!==B){re!==-1&&re<z+1&&(re=j.indexOf(A,z+1)),I!==-1&&I<z+1&&(I=j.indexOf(P,z+1));var de=Re(I===-1?re:Math.min(re,I));if(j.substr(z+1+de,ee)===A){Z.push(j.substring(L,z).replace(N,S)),j[L=z+1+de+ee]!==S&&(z=j.indexOf(S,L)),re=j.indexOf(A,L),I=j.indexOf(P,L);break}var Q=Re(I);if(j.substring(z+1+Q,z+1+Q+fe)===P){if(Z.push(j.substring(L,z).replace(N,S)),ke(z+1+Q+fe),re=j.indexOf(A,L),z=j.indexOf(S,L),Ce&&(it(), $ ))return ze();if(k&&X.length>=k)return ze(!0);break}_e.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:X.length,index:L}),z++}}else z++}return Se();function te(De){X.push(De),Ee=L}function Re(De){var st=0;if(De!==-1){var Xe=j.substring(z+1,De);Xe&&Xe.trim()===""&&(st=Xe.length)}return st}function Se(De){return le||(De===void 0&&(De=j.substring(L)),Z.push(De),L=J,te(Z),Ce&&it()),ze()}function ke(De){L=De,te(Z),Z=[],I=j.indexOf(P,L)}function ze(De){return{data:X,errors:_e,meta:{delimiter:A,linebreak:P,aborted: $ ,truncated:!!De,cursor:Ee+(W||0)}}}function it(){Y(ze()),X=[],_e=[]}},this.abort=function(){ $ =!0},this.getCharIndex=function(){return L}}function v(R){var S=R.data,A=o[S.workerId],P=!1;if(S.error)A.userError(S.error,S.file);else if(S.results&&S.results.data){var U={abort:function(){P=!0,y(S.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:T,resume:T};if(w(A.userStep)){for(var Y=0;Y<S.results.data.length&&(A.userStep({data:S.results.data[Y],errors:S.results.errors,meta:S.results.meta},U),!P);Y++);delete S.results}else w(A.userChunk)&&(A.userChunk(S.results,U,S.file),delete S.results)}S.finished&&!P&&y(S.workerId,S.results)}function y(R,S){var A=o[R];w(A.userComplete)&&A.userComplete(S),A.terminate(),delete o[R]}function T(){throw new Error("Not implemented.")}function C(R){if(typeof R!="object"||R===null)return R;var S=Array.isArray(R)?[]:{};for(var A in R)S[A]=C(R[A]);return S}function x(R,S){return function(){R.apply(S,arguments)}}function w(R){return typeof R=="function"}return r&&(i.onmessage=function(R){var S=R.data;if(l.WORKER_ID===void 0&&S&&(l.WORKER_ID=S.workerId),typeof S.input=="string")i.postMessage({workerId:l.WORKER_ID,results:l.parse(S.input,S.config),finished:!0});else if(i.File&&S.input instanceof File||S.input instanceof Object){var A=l.parse(S.input,S.config);A&&i.postMessage({workerId:l.WORKER_ID,results:A,finished:!0})}}),(_.prototype=Object.create(d.prototype)).constructor=_,(h.prototype=Object.create(d.prototype)).constructor=h,(m.prototype=Object.create(m.prototype)).constructor=m,(f.prototype=Object.create(d.prototype)).constructor=f,l})})(kN);var IJe=kN.exports;const MJe
2024-01-11 01:32:21 +00:00
` +e.model.name+ `
2024-02-10 20:35:27 +00:00
installed ! ` ,4,!0),this. $ store.dispatch("refreshDiskUsage")}}else $ e.off("install_progress",i),console.log("Install failed"),e.installing=!1,this.showProgress=!1,console.error("Installation failed:",s.error),this. $ store.state.toast.showToast( ` Model :
2024-01-11 01:32:21 +00:00
` +e.model.name+ `
2024-02-10 20:35:27 +00:00
failed to install ! ` ,4,!1),this. $ store.dispatch("refreshDiskUsage");console.log("Here")}; $ e.on("install_progress",i), $ e.emit("install_model",{path:t,name:e.model.name,variant_name:this.selected_variant.name,type:e.model.type}),console.log("Started installation, please wait")},uploadAvatar(n){const e=n.target.files[0],t=new FormData;t.append("avatar",e),console.log("Uploading avatar"),Le.post("/upload_avatar",t).then(i=>{console.log("Avatar uploaded successfully"),this. $ store.state.toast.showToast("Avatar uploaded successfully!",4,!0);const s=i.data.fileName;console.log("response",i),this.user_avatar=s,this.update_setting("user_avatar",s,()=>{}).then(()=>{})}).catch(i=>{console.error("Error uploading avatar:",i)})},async update_software(){console.log("Posting");const n=await this.api_get_req("update_software");console.log("Posting done"),n.status?this. $ store.state.toast.showToast("Success!",4,!0):this. $ store.state.toast.showToast("Failure!",4,!1)},async restart_software(){console.log("Posting");const n=await this.api_get_req("restart_program");console.log("Posting done"),n.status?this. $ store.state.toast.showToast("Success!",4,!0):this. $ store.state.toast.showToast("Failure!",4,!1)},on_loading_text(n){console.log("Loading text",n),this.loading_text=n},async load_everything(){for(this.isLoading=!0,Be(()=>{Ge.replace()});this.isReady===!1;)await new Promise(n=>setTimeout(n,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");try{this.extCatgArr=await this.api_get_req("list_extensions_categories"),this.extension_category=this.extCatgArr[0],console.log(this.extCatgArr)}catch{console.log("Couldn't list catergories"),this.extCatgArr=[]}try{console.log("Loading extension category content"),this.extArr=await this.api_get_req("list_extensions?category="+this.extension_category),console.log(this.extArr)}catch{console.log("Couldn't list extensions"),this.extCatgArr=[]}this.personality_category=this.configFile.personality_category,this.personalitiesFiltered=this.personalities.filter(n=>n.category===this.configFile.personality_category),this.modelsFiltered=[],this.extension_category=this.configFile.extension_category,this.extensionsFiltered=this. $ store.state.extensionsZoo.filter(n=>n.category===this.configFile.extension_category),this.updateModelsZoo(),this.isLoading=!1,this.isMounted=!0,this.extension_category=this.configFile.extension_category,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(n){if(console.log("received something"),n.status==="progress"){if(this. $ refs.modelZoo){const e=this. $ refs.modelZoo.findIndex(i=>i.model.name==n.model_name&&this.configFile.binding_name==n.binding_folder),t=this.models_zoo[e];t&&(console.log("model entry",t),t.installing=!0,t.progress=n.progress,console.log( ` Progress = $ { n . progress } ` ),n.progress>=100&&(t.installing=!1,t.isInstalled=!0))}}else if(n.status==="succeeded"){if(console.log("Received succeeded"),console.log("Installed successfully"),this. $ refs.modelZoo){const e=this. $ refs.modelZoo.findIndex(i=>i.model.name==n.model_name&&this.configFile.binding_name==n.binding_folder),t=this.models_zoo[e];t&&(t.installing=!1,t.isInstalled=!0)}this. $ store.state.toast.showToast( ` Model :
2024-01-11 01:32:21 +00:00
` +model_object.name+ `
installed ! ` ,4,!0),this. $ store.dispatch("refreshDiskUsage")}else if(n.status==="failed"&&(console.log("Install failed"),this. $ refs.modelZoo)){const e=this. $ refs.modelZoo.findIndex(i=>i.model.name==n.model_name&&this.configFile.binding_name==n.binding_folder),t=this.models_zoo[e];t&&(t.installing=!1,t.isInstalled=!1),console.error("Installation failed:",n.error),this. $ store.state.toast.showToast( ` Model :
` +model_object.name+ `
2024-02-10 20:35:27 +00:00
failed to install ! ` ,4,!1),this. $ store.dispatch("refreshDiskUsage")}},showAddModelDialog(){this. $ refs.addmodeldialog.showDialog("").then(()=>{console.log(this. $ refs.addmodeldialog.model_path);const n=this. $ refs.addmodeldialog.model_path; $ e.emit("install_model",{path:n,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(n){this.servers_conf_collapsed=n,this.minconf_collapsed=n,this.bec_collapsed=n,this.mzc_collapsed=n,this.pzc_collapsed=n,this.bzc_collapsed=n,this.pc_collapsed=n,this.mc_collapsed=n,this.sc_collapsed=n,this.mzdc_collapsed=n},fetchPersonalities(){this.api_get_req("list_personalities_categories").then(n=>{this.persCatgArr=n,this.persCatgArr.sort()}),this.api_get_req("list_personalities").then(n=>{this.persArr=n,this.persArr.sort(),console.log( ` Listed personalities :
2024-01-11 01:32:21 +00:00
$ { n } ` )})},fetchExtensions(){this.api_get_req("list_extensions_categories").then(n=>{this.extCatgArr=n,this.extCatgArr.sort()}),this.api_get_req("list_extensions").then(n=>{this.extArr=n,this.extArr.sort(),console.log( ` Listed extensions :
$ { n } ` )})},fetchHardwareInfos(){this. $ store.dispatch("refreshDiskUsage"),this. $ store.dispatch("refreshRamUsage")},async onPersonalitySelected(n){if(console.log("on pers",n),this.isLoading&&this. $ store.state.toast.showToast("Loading... please wait",4,!1),this.isLoading=!0,console.log("selecting ",n),n){if(n.selected){this. $ store.state.toast.showToast("Personality already selected",4,!0),this.isLoading=!1;return}let e=n.language==null?n.full_path:n.full_path+":"+n.language;if(console.log("pth",e),n.isMounted&&this.configFile.personalities.includes(e)){const t=await this.select_personality(n);console.log("pers is mounted",t),t&&t.status&&t.active_personality_id>-1?this. $ store.state.toast.showToast( ` Selected personality :
` +n.name,4,!0):this. $ store.state.toast.showToast( ` Error on select personality :
2024-02-10 10:33:09 +00:00
` +n.name,4,!1),this.isLoading=!1}else console.log("mounting pers"),this.mountPersonality(n);Be(()=>{Ge.replace()})}},onModelSelected(n,e=!1){if(this.isLoading){this. $ store.state.toast.showToast("Loading... please wait",4,!1);return}n&&(n.isInstalled?(this.configFile.model_name!=n.model.name||e)&&this.update_model(n.model.name).then(t=>{console.log("update_model",t),this.configFile.model_name=n.model.name,t.status?(this. $ store.state.toast.showToast( ` Selected model :
` +n.name,4,!0),Be(()=>{Ge.replace(),this.is_loading_zoo=!1}),self.updateModelsZoo(),this.api_get_req("get_model_status").then(i=>{this. $ store.commit("setIsModelOk",i)})):(this. $ store.state.toast.showToast( ` Couldn ' t select model :
` +n.name,4,!1),Be(()=>{Ge.replace()})),this.settingsChanged=!0,this.isModelSelected=!0}):this. $ store.state.toast.showToast( ` Model :
2024-01-11 01:32:21 +00:00
` +n.model.name+ `
2024-02-10 10:33:09 +00:00
is not installed ` ,4,!1),Be(()=>{Ge.replace()}))},onCopy(n){let e;n.model.isCustomModel?e= ` Model name : $ { n . name }
2024-01-11 01:32:21 +00:00
File size : $ { n . fileSize }
Manually downloaded model ` :e= ` Model name : $ { n . name }
File size : $ { n . fileSize }
Download : $ { "https://huggingface.co/" + n . quantizer + "/" + n . name }
License : $ { n . license }
Owner : $ { n . quantizer }
Website : $ { "https://huggingface.co/" + n . quantizer }
2024-02-10 20:35:27 +00:00
Description : $ { n . description } ` ,this. $ store.state.toast.showToast("Copied model info to clipboard!",4,!0),navigator.clipboard.writeText(e.trim())},onCopyLink(n){this. $ store.state.toast.showToast("Copied link to clipboard!",4,!0),navigator.clipboard.writeText("https://huggingface.co/"+n.model.quantizer+"/"+n.model.name)},onCopyPersonalityName(n){this. $ store.state.toast.showToast("Copied name to clipboard!",4,!0),navigator.clipboard.writeText(n.name)},onCancelInstall(){const n=this.addModel;console.log("cancel install",n),this.modelDownlaodInProgress=!1,this.addModel={}, $ e.emit("cancel_install",{model_name:n.model_name,binding_folder:n.binding_folder,model_url:n.model_url,patreon:n.patreon?n.patreon:"None"}),this. $ store.state.toast.showToast("Model installation aborted",4,!1)},onInstall(n){this.variant_choices=n.model.variants,this.currenModelToInstall=n,console.log("variant_choices"),console.log(this.variant_choices),console.log(n),this.variantSelectionDialogVisible=!0},onCreateReference(){Le.post("/add_reference_to_local_model",{path:this.reference_path}).then(n=>{n.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 n=this.addModel.url;this.addModel.progress=0,console.log("installing..."),console.log("value ",this.addModel.url),this.modelDownlaodInProgress=!0;const e=t=>{console.log("received something"),t.status&&t.progress<=100?(console.log("Progress",t),this.addModel=t,this.addModel.url=n,this.addModel.progress==100&&(this.modelDownlaodInProgress=!1,console.log("Received succeeded"), $ e.off("install_progress",e),console.log("Installed successfully"),this.addModel={},this. $ store.state.toast.showToast( ` Model :
2024-01-11 01:32:21 +00:00
` +this.addModel.model_name+ `
2024-02-10 20:35:27 +00:00
installed ! ` ,4,!0),this. $ store.dispatch("refreshDiskUsage"))):( $ e.off("install_progress",e),console.log("Install failed"),this.modelDownlaodInProgress=!1,console.error("Installation failed:",t.error),this. $ store.state.toast.showToast( ` Model :
2024-01-11 01:32:21 +00:00
` +this.addModel.model_name+ `
2024-02-10 20:35:27 +00:00
failed to install ! ` ,4,!1),this. $ store.dispatch("refreshDiskUsage"))}; $ e.on("install_progress",e), $ e.emit("install_model",{path:n,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 n=this.addModel.url;this.addModel.progress=0,console.log("installing..."),console.log("value ",this.addModel.url),this.modelDownlaodInProgress=!0;const e=t=>{console.log("received something"),t.status&&t.progress<=100?(console.log("Progress",t),this.addModel=t,this.addModel.url=n,this.addModel.progress==100&&(this.modelDownlaodInProgress=!1,console.log("Received succeeded"), $ e.off("progress",e),console.log("Installed successfully"),this.addModel={},this. $ store.state.toast.showToast( ` Model :
2024-01-11 01:32:21 +00:00
` +this.addModel.model_name+ `
2024-02-10 20:35:27 +00:00
installed ! ` ,4,!0),this. $ store.dispatch("refreshDiskUsage"))):( $ e.off("progress",e),console.log("Install failed"),this.modelDownlaodInProgress=!1,console.error("Installation failed:",t.error),this. $ store.state.toast.showToast( ` Model :
2024-01-11 01:32:21 +00:00
` +this.addModel.model_name+ `
2024-02-10 20:35:27 +00:00
failed to install ! ` ,4,!1),this. $ store.dispatch("refreshDiskUsage"))}; $ e.on("progress",e),console.log("Started installation, please wait")},setFileList(n){this.uploadData=n.target.files,console.log("set file list",this.uploadData)},onUninstall(n){this. $ store.state.yesNoDialog.askQuestion( ` Are you sure you want to delete this model ?
[ ` +n.name+"]","Yes","Cancel").then(e=>{if(e){console.log("uninstalling model...");const t=i=>{console.log("uninstalling res",i),i.status?(console.log("uninstalling success",i),n.uninstalling=!1, $ e.off("install_progress",t),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 :
2024-01-11 01:32:21 +00:00
` +n.model.name+ `
2024-02-10 20:35:27 +00:00
was uninstalled ! ` ,4,!0),this. $ store.dispatch("refreshDiskUsage")):(console.log("uninstalling failed",i),n.uninstalling=!1,this.showProgress=!1, $ e.off("uninstall_progress",t),console.error("Uninstallation failed:",i.error),this. $ store.state.toast.showToast( ` Model :
2024-01-11 01:32:21 +00:00
` +n.model.name+ `
2024-02-10 20:35:27 +00:00
failed to uninstall ! ` ,4,!1),this. $ store.dispatch("refreshDiskUsage"))}; $ e.on("uninstall_progress",t),self.selected_variant!=null? $ e.emit("uninstall_model",{path:"https://huggingface.co/"+n.model.quantizer+"/"+n.model.name+"/resolve/main/"+this.selected_variant.name,type:n.model.type}): $ e.emit("uninstall_model",{path:"https://huggingface.co/"+n.model.quantizer+"/"+n.model.name,type:n.model.type})}})},onBindingSelected(n){if(console.log("Binding selected"),!n.binding.installed){this. $ store.state.toast.showToast( ` Binding is not installed :
2024-02-10 00:32:22 +00:00
` +n.binding.name,4,!1);return}this.mzc_collapsed=!0,this.configFile.binding_name!=n.binding.folder&&(this.update_binding(n.binding.folder),this.binding_changed=!0),this.api_get_req("get_model_status").then(e=>{this. $ store.commit("setIsModelOk",e)})},onInstallBinding(n){this.configFile.binding_name!=n.binding.folder?(this.isLoading=!0,n.disclaimer&&this. $ store.state.yesNoDialog.askQuestion(n.disclaimer,"Proceed","Cancel"),Le.post("/install_binding",{name:n.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 .
2024-01-13 10:01:42 +00:00
Page will refresh in 5 s . ` ),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
2024-02-10 00:32:22 +00:00
` +e.message,4,!1),{status:!1}))):this.update_binding(n.binding.folder)},onUnInstallBinding(n){this.isLoading=!0,Le.post("/unInstall_binding",{name:n.binding.folder}).then(e=>{if(e){if(this.isLoading=!1,console.log("unInstall_binding",e),e.data.status){const t=this.bindingsZoo.findIndex(s=>s.folder==n.binding.folder),i=this.bindingsZoo[t];i?i.installed=!0:i.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,n.isInstalled=False}).catch(e=>(this.isLoading=!1,this. $ store.state.toast.showToast( ` Could not uninstall binding
` +e.message,4,!1),{status:!1}))},onReinstallBinding(n){this.isLoading=!0,Le.post("/reinstall_binding",{name:n.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}))},onSettingsExtension(n){try{this.isLoading=!0,Le.get("/get_extension_settings",{name:n.name}).then(e=>{this.isLoading=!1,e&&(console.log("ext sett",e),e.data&&Object.keys(e.data).length>0?this. $ store.state.universalForm.showForm(e.data,"Extension settings - "+n.extension.name,"Save changes","Cancel").then(t=>{try{Le.post("/set_extension_settings",{name:n.name,config:t}).then(i=>{i&&i.data?(console.log("extension set with new settings",i.data),this. $ store.state.toast.showToast("Extension settings updated successfully!",4,!0)):(this. $ store.state.toast.showToast( ` Did not get Extension settings responses .
2024-01-11 01:32:21 +00:00
` +i,4,!1),this.isLoading=!1)})}catch(i){this. $ store.state.toast.showToast( ` Did not get Extension settings responses .
2024-02-10 00:32:22 +00:00
Endpoint error : ` +i.message,4,!1),this.isLoading=!1}}):(this. $ store.state.toast.showToast("Extension 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)}},onSettingsBinding(n){try{this.isLoading=!0,Le.get("/get_active_binding_settings").then(e=>{this.isLoading=!1,e&&(console.log("binding sett",e),e.data&&Object.keys(e.data).length>0?this. $ store.state.universalForm.showForm(e.data,"Binding settings - "+n.binding.name,"Save changes","Cancel").then(t=>{try{Le.post("/set_active_binding_settings",t).then(i=>{i&&i.data?(console.log("binding set with new settings",i.data),this. $ store.state.toast.showToast("Binding settings updated successfully!",4,!0),Le.get("/update_binding_settings").then(s=>{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 .
2024-01-11 01:32:21 +00:00
` +i,4,!1),this.isLoading=!1)})}catch(i){this. $ store.state.toast.showToast( ` Did not get binding settings responses .
2024-02-10 00:32:22 +00:00
Endpoint error : ` +i.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(n){console.log("Reloading binding"),this.isLoading=!0,Le.post("/reload_binding",{name:n.binding.folder}).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(n){try{this.isLoading=!0,Le.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 - "+n.personality.name,"Save changes","Cancel").then(t=>{try{Le.post("/set_active_personality_settings",t).then(i=>{i&&i.data?(console.log("personality set with new settings",i.data),this. $ store.state.toast.showToast("Personality settings updated successfully!",4,!0)):(this. $ store.state.toast.showToast( ` Did not get Personality settings responses .
2024-01-11 01:32:21 +00:00
` +i,4,!1),this.isLoading=!1)})}catch(i){this. $ store.state.toast.showToast( ` Did not get Personality settings responses .
2024-02-10 00:32:22 +00:00
Endpoint error : ` +i.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(n,e){this.personality_category=n,e()},update_extension_category(n,e){this.extension_category=n,e()},refresh(){console.log("Refreshing"),this. $ store.dispatch("refreshConfig").then(()=>{console.log(this.personality_category),this.api_get_req("list_personalities_categories").then(n=>{console.log("cats",n),this.persCatgArr=n,this.personalitiesFiltered=this.personalities.filter(e=>e.category===this.personality_category),this.personalitiesFiltered.sort()}),this.api_get_req("list_extensions_categories").then(n=>{console.log("cats",n),this.extCatgArr=n,console.log("this. $ store.state.extensionsZoo",this. $ store.state.extensionsZoo),console.log("this.extension_category",this.extension_category),this.extensionsFiltered=this. $ store.state.extensionsZoo.filter(e=>e.category===this.extension_category),this.extensionsFiltered.sort(),console.log("this.extensionsFiltered",this.extensionsFiltered)})})},toggleAccordion(){this.showAccordion=!this.showAccordion},async update_setting(n,e,t){this.isLoading=!0;const i={setting_name:n,setting_value:e};console.log("Updating setting",n,":",e);let s=await Le.post("/update_setting",i);if(s)return this.isLoading=!1,console.log("update_setting",s),s.status?this. $ store.state.toast.showToast( ` Setting updated successfully .
2024-01-11 01:32:21 +00:00
` ,4,!0):this. $ store.state.toast.showToast( ` Setting update failed .
2024-02-10 10:33:09 +00:00
Please view the console for more details . ` ,4,!1),t!==void 0&&t(s),s.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 n=this. $ store.state.modelsZoo;if(n.length!=0){console.log( ` REFRESHING models using sorting $ { this . sort _type } ` ),n.length>1?(this.sort_type==0?(n.sort((e,t)=>{const i=new Date(e.last_commit_time);return new Date(t.last_commit_time)-i}),console.log("Sorted")):this.sort_type==1?n.sort((e,t)=>t.rank-e.rank):this.sort_type==2?n.sort((e,t)=>e.name.localeCompare(t.name)):this.sort_type==3&&n.sort((e,t)=>e.name.localeCompare(t.name)),console.log("Sorted")):console.log("No sorting needed"),n.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 t=this. $ store.state.modelsArr[e];let i=n.findIndex(s=>s.name==t);if(i==-1)for(let s=0;s<n.length;s++){let r=n[s].variants;if(r!=null&&(i=r.findIndex(o=>o.name==t),i!=-1)){i=s,console.log( ` Found $ { t } at index $ { i } ` );break}}if(i==-1){let s={};s.name=t,s.icon=this.imgBinding,s.isCustomModel=!0,s.isInstalled=!0,n.push(s)}else n[i].isInstalled=!0}console.log("Determined models"),n.sort((e,t)=>e.isInstalled&&!t.isInstalled?-1:!e.isInstalled&&t.isInstalled?1:0),console.log("Done"),this.models_zoo=this. $ store.state.modelsZoo}},update_binding(n){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",n,async e=>{console.log("updated binding_name"),await this. $ store.dispatch("refreshConfig"),this.models_zoo=[],this.mzc_collapsed=!0;const t=this.bindingsZoo.findIndex(s=>s.folder==n),i=this.bindingsZoo[t];i?i.installed=!0:i.installed=!1,this.settingsChanged=!0,this.isLoading=!1,Be(()=>{Ge.replace()}),console.log("updating model"),this.update_model(null).then(()=>{}),Be(()=>{Ge.replace()})}),Be(()=>{Ge.replace()})},async update_model(n){n||(this.isModelSelected=!1),this.isLoading=!0;let e=await this.update_setting("model_name",n);return this.isLoading=!1,Be(()=>{Ge.replace()}),e},applyConfiguration(){this.isLoading=!0,Le.post("/apply_settings",{config:this.configFile}).then(n=>{this.isLoading=!1,n.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),Be(()=>{Ge.replace()})})},save_configuration(){this.showConfirmation=!1,Le.post("/save_settings",{}).then(n=>{if(n)return n.status||this. $ store.state.messageBox.showMessage("Error: Couldn't save settings!"),n.data}).catch(n=>(console.log(n.message,"save_configuration"),this. $ store.state.messageBox.showMessage("Couldn't save settings!"),{status:!1}))},reset_configuration(){this. $ store.state.yesNoDialog.askQuestion( ` Are you sure ?
2024-02-10 00:32:22 +00:00
This will delete all your configurations and get back to default configuration . ` ).then(n=>{n&&Le.post("/reset_settings",{}).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(n){try{const e=await Le.get("/"+n);if(e)return e.data}catch(e){console.log(e.message,"api_get_req - settings");return}},closeToast(){this.showToast=!1},async getPersonalitiesArr(){this.isLoading=!0,this.personalities=[];const n=await this.api_get_req("get_all_personalities"),e=this. $ store.state.config,t=Object.keys(n);for(let i=0;i<t.length;i++){const s=t[i],o=n[s].map(a=>{const l=e.personalities.includes(s+"/"+a.folder);let c={};return c=a,c.category=s,c.language="",c.full_path=s+"/"+a.folder,c.isMounted=l,c});this.personalities.length==0?this.personalities=o:this.personalities=this.personalities.concat(o)}this.personalities.sort((i,s)=>i.name.localeCompare(s.name)),this.personalitiesFiltered=this.personalities.filter(i=>i.category===this.configFile.personality_category),this.personalitiesFiltered.sort(),console.log("per filtered",this.personalitiesFiltered),this.isLoading=!1},async getExtensionsArr(){this.isLoading=!0,this.extensions=[];const n=await this.api_get_req("get_all_extensions"),e=this. $ store.state.config,t=Object.keys(n);for(let i=0;i<t.length;i++){const s=t[i],o=n[s].map(a=>{const l=e.extensions.includes(s+"/"+a.folder);let c={};return c=a,c.category=s,c.language="",c.full_path=s+"/"+a.folder,c.isMounted=l,c});this.extensions.length==0?this.extensions=o:this.extensions=this.extensions.concat(o)}this.extensions.sort((i,s)=>i.name.localeCompare(s.name)),this.extensions=this.extensions.filter(i=>i.category===this.configFile.personality_category),this.extensions.sort(),console.log("per filtered",this.extensionsFiltered),this.isLoading=!1},async filterPersonalities(){if(!this.searchPersonality){this.personalitiesFiltered=this.personalities.filter(t=>t.category===this.configFile.personality_category),this.personalitiesFiltered.sort(),this.searchPersonalityInProgress=!1;return}const n=this.searchPersonality.toLowerCase(),e=this.personalities.filter(t=>{if(t.name&&t.name.toLowerCase().includes(n)||t.description&&t.description.toLowerCase().includes(n)||t.full_path&&t.full_path.toLowerCase().includes(n))return t});e.length>0?this.personalitiesFiltered=e.sort():(this.personalitiesFiltered=this.personalities.filter(t=>t.category===this.configFile.personality_category),this.personalitiesFiltered.sort()),this.searchPersonalityInProgress=!1},async filterExtensions(){if(!this.searchExtension){this.personalitiesFiltered=this.extensions.filter(t=>t.category===this.extension_category),this.personalitiesFiltered.sort(),this.searchExtensionInProgress=!1;return}const n=this.searchExtension.toLowerCase(),e=this.personalities.filter(t=>{if(t.name&&t.name.toLowerCase().includes(n)||t.description&&t.description.toLowerCase().includes(n)||t.full_path&&t.full_path.toLowerCase().includes(n))return t});e.length>0?this.personalitiesFiltered=e.sort():(this.personalitiesFiltered=this.personalities.filter(t=>t.category===this.configFile.personality_category),this.personalitiesFiltered.sort()),this.searchExtensionInProgress=!1},async filterModels(){const n=this.searchModel.toLowerCase();this.is_loading_zoo=!0,console.log("filtering models"),console.log(this.models_zoo);const e=this.models_zoo.filter(t=>{if(t.name&&t.name.toLowerCase().includes(n)||t.description&&t.description.toLowerCase().includes(n)||t.category&&t.category.toLowerCase().includes(n))return t});this.is_loading_zoo=!1,e.length>0?this.modelsFiltered=e:this.modelsFiltered=[],this.searchModelInProgress=!1},computedFileSize(n){return Ki(n)},async mount_personality(n){if(!n)return{status:!1,error:"no personality - mount_personality"};try{const e={language:n.language?n.language:"",category:n.category?n.category:"",fold
2024-01-11 01:32:21 +00:00
` +n.personality.name,4,!0),this. $ store.dispatch("refreshMountedPersonalities")):(n.isMounted=!1,this. $ store.state.toast.showToast( ` Could not mount personality
Error : ` +e.error+ `
Response :
2024-02-10 00:32:22 +00:00
` +e,4,!1)),this.isLoading=!1},async unmountAll(){await Le.get("/unmount_all_personalities"),this. $ store.dispatch("refreshMountedPersonalities"),this. $ store.dispatch("refreshConfig"),this. $ store.state.toast.showToast("All personas unmounted",4,!0)},async unmountPersonality(n){if(this.isLoading=!0,!n)return;const e=await this.unmount_personality(n.personality||n);if(e.status){this.configFile.personalities=e.personalities,this. $ store.state.toast.showToast("Personality unmounted",4,!0);const t=this.personalities.findIndex(a=>a.full_path==n.full_path),i=this.personalitiesFiltered.findIndex(a=>a.full_path==n.full_path),s=this. $ refs.personalitiesZoo.findIndex(a=>a.full_path==n.full_path);console.log("ppp",this.personalities[t]),this.personalities[t].isMounted=!1,i>-1&&(this.personalitiesFiltered[i].isMounted=!1),s>-1&&(this. $ refs.personalitiesZoo[s].isMounted=!1),this. $ store.dispatch("refreshMountedPersonalities");const r=this.mountedPersArr[this.mountedPersArr.length-1];console.log(r,this.mountedPersArr.length),(await this.select_personality(n.personality)).status&&this. $ store.state.toast.showToast( ` Selected personality :
2024-01-11 01:32:21 +00:00
` +r.name,4,!0)}else this. $ store.state.toast.showToast( ` Could not unmount personality
2024-02-10 00:32:22 +00:00
Error : ` +e.error,4,!1);this.isLoading=!1},editPersonality(n){n=n.personality,Le.post("/get_personality_config",{category:n.category,name:n.folder}).then(e=>{const t=e.data;console.log("Done"),t.status?(this. $ store.state.currentPersonConfig=t.config,this. $ store.state.showPersonalityEditor=!0,this. $ store.state.personality_editor.showPanel(),this. $ store.state.selectedPersonality=n):console.error(t.error)}).catch(e=>{console.error(e)})},async remountPersonality(n){await this.unmountPersonality(n),await this.mountPersonality(n)},async mountExtension(n){if(this.isLoading=!0,console.log("mount ext",n),!n)return;if(this.configFile.personalities.includes(n.extension.full_path)){this.isLoading=!1,this. $ store.state.toast.showToast("Extension already mounted",4,!1);return}const e=await this.mount_extension(n.extension);console.log("mount_extension res",e),e&&e.status&&e.extensions.includes(n.extension.full_path)?(this.configFile.extensions=e.extensions,this. $ store.state.toast.showToast("Extension mounted",4,!0),n.isMounted=!0,this. $ store.dispatch("refreshMountedExtensions")):(n.isMounted=!1,this. $ store.state.toast.showToast( ` Could not mount extension
2024-01-11 01:32:21 +00:00
Error : ` +e.error+ `
Response :
` +e,4,!1)),this.isLoading=!1},async unmountExtension(n){if(this.isLoading=!0,!n)return;const e=await this.p_unmount_extension(n.extension||n);if(e.status){this.configFile.extensions=e.extensions,this. $ store.state.toast.showToast("Extension unmounted",4,!0);const t=this.extensions.findIndex(o=>o.full_path==n.full_path),i=this.extensionsFiltered.findIndex(o=>o.full_path==n.full_path),s=this. $ refs.extensionsZoo.findIndex(o=>o.full_path==n.full_path);console.log("ext",this.extensions[t]),this.extensions[t].isMounted=!1,i>-1&&(this.extensionsFiltered[i].isMounted=!1),s>-1&&(this. $ refs.extensionsZoo[s].isMounted=!1),this. $ store.dispatch("refreshMountedPersonalities");const r=this.mountedExtensions[this.mountedExtensions.length-1];console.log(r,this.mountedExtensions.length)}else this. $ store.state.toast.showToast( ` Could not unmount extension
2024-02-10 00:32:22 +00:00
Error : ` +e.error,4,!1);this.isLoading=!1},async remountExtension(n){await this.unmountExtension(n),await this.mountExtension(n)},onExtensionReinstall(n){console.log("on reinstall ",n),this.isLoading=!0,console.log(n),Le.post("/reinstall_extension",{name:n.extension.full_path}).then(e=>{if(e)return this.isLoading=!1,console.log("reinstall_extension",e),e.data.status?this. $ store.state.toast.showToast("Extension reinstalled successfully!",4,!0):this. $ store.state.toast.showToast("Could not reinstall extension",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}))},onPersonalityReinstall(n){console.log("on reinstall ",n),this.isLoading=!0,Le.post("/reinstall_personality",{name:n.personality.path}).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
2024-02-10 10:33:09 +00:00
` +e.message,4,!1),{status:!1}))},personalityImgPlacehodler(n){n.target.src=ca},extensionImgPlacehodler(n){n.target.src=uit},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()},activated(){},computed:{rendered_models_zoo:{get(){return this.searchModel?this.show_only_installed_models?this.modelsFiltered.filter(n=>n.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(n=>n.isInstalled===!0):this.models_zoo.slice(0,Math.min(this.models_zoo.length,this.models_zoo_initialLoadCount)))}},imgBinding:{get(){if(!this.isMounted)return Ai;try{return this. $ refs.bindingZoo[this. $ refs.bindingZoo.findIndex(n=>n.binding.folder==this.configFile.binding_name)]. $ refs.imgElement.src}catch{return Ai}}},imgModel:{get(){try{let n=this. $ store.state.modelsZoo.findIndex(e=>e.name==this. $ store.state.selectedModel);return n>=0?this. $ store.state.modelsZoo[n].avatar:Ai}catch{console.log("error")}if(!this.isMounted)return Ai;try{return this. $ refs.bindingZoo[this. $ refs.bindingZoo.findIndex(n=>n.binding.folder==this.configFile.binding_name)]. $ refs.imgElement.src}catch{return Ai}}},isReady:{get(){return this. $ store.state.ready}},audio_out_voice:{get(){return this. $ store.state.config.audio_out_voice},set(n){this. $ store.state.config.audio_out_voice=n}},whisperModels(){return["base","base.en","base.fr","base.es","small","small.en","small.fr","small.es","medium","medium.en","medium.fr","medium.es","large","large.en","large.fr","large.es"]},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(n){this. $ store.commit("s
2024-02-10 20:35:27 +00:00
You need to apply changes before you leave , or else . ` ,"Apply configuration","Cancel")&&this.applyConfiguration(),!1}},pe=n=>(lo("data-v-9f4aacb1"),n=n(),co(),n),wst={class:"container overflow-y-scroll flex flex-row shadow-lg p-10 pt-0 overflow-y-scroll w-full dark:bg-bg-dark 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"},Nst={class:"sticky top-0 z-10 flex flex-row mb-2 p-3 gap-3 w-full rounded-b-lg bg-bg-light-tone dark:bg-bg-dark-tone shadow-lg"},Ost={key:0,class:"flex gap-3 flex-1 items-center duration-75"},Ist=pe(()=>u("i",{"data-feather":"x"},null,-1)),Mst=[Ist],Dst=pe(()=>u("i",{"data-feather":"check"},null,-1)),kst=[Dst],Lst={key:1,class:"flex gap-3 flex-1 items-center"},Pst=pe(()=>u("i",{"data-feather":"save"},null,-1)),Ust=[Pst],Fst=pe(()=>u("i",{"data-feather":"refresh-ccw"},null,-1)),Bst=[Fst],Gst=pe(()=>u("i",{"data-feather":"list"},null,-1)),Vst=[Gst],zst={class:"flex gap-3 flex-1 items-center justify-end"},Hst=pe(()=>u("i",{"data-feather":"trash-2"},null,-1)),qst=[Hst],Yst=pe(()=>u("i",{"data-feather":"refresh-ccw"},null,-1)), $ st=[Yst],Wst=pe(()=>u("i",{"data-feather":"arrow-up-circle"},null,-1)),Kst={key:0},jst=pe(()=>u("i",{"data-feather":"alert-circle"},null,-1)),Qst=[jst],Xst={class:"flex gap-3 items-center"},Zst={key:0,class:"flex gap-3 items-center"},Jst=pe(()=>u("p",{class:"text-red-600 font-bold"},"Apply changes:",-1)),ert=pe(()=>u("i",{"data-feather":"check"},null,-1)),trt=[ert],nrt={key:1,role:"status"},irt=pe(()=>u("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"},[u("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"}),u("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)),srt=pe(()=>u("span",{class:"sr-only"},"Loading...",-1)),rrt={class:"flex flex-col mb-2 rounded-lg bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-bg-light-tone-panel hover:dark:bg-bg-dark-tone-panel duration-150 shadow-lg"},ort={class:"flex flex-row p-3"},art=pe(()=>u("i",{"data-feather":"chevron-right"},null,-1)),lrt=[art],crt=pe(()=>u("i",{"data-feather":"chevron-down"},null,-1)),drt=[crt],urt=pe(()=>u("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," System status",-1)),prt=pe(()=>u("div",{class:"mr-2"},"|",-1)),_rt={class:"text-base font-semibold cursor-pointer select-none items-center"},hrt={class:"flex gap-2 items-center"},frt={key:0},mrt={class:"flex gap-2 items-center"},grt=["src"],brt={class:"font-bold font-large text-lg"},Ert={key:1},vrt={class:"flex gap-2 items-center"},Srt=["src"],yrt={class:"font-bold font-large text-lg"},Trt=pe(()=>u("i",{"data-feather":"cpu",title:"CPU Ram",class:"w-5 h-5 mx-1 flex-shrink-0"},null,-1)),xrt={class:"font-bold font-large text-lg"},Crt=pe(()=>u("i",{"data-feather":"hard-drive",title:"Hard drive",class:"w-5 h-5 mx-1 flex-shrink-0"},null,-1)),Rrt={class:"font-bold font-large text-lg"},Art={class:"mb-2"},wrt=pe(()=>u("label",{class:"flex items-center gap-1 ml-2 mb-2 te
2024-01-14 11:12:53 +00:00
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 .
2024-02-10 20:35:27 +00:00
< 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 > ` ) ) } , k l t ) ] ) ] ) , u ( " t r " , n u l l , [ L l t , u ( " t d " , n u l l , [ u ( " d i v " , P l t , [ u ( " b u t t o n " , { c l a s s : " h o v e r : t e x t - p r i m a r y b g - g r e e n - 2 0 0 r o u n d e d - l g p - 4 m - 4 w - f u l l t e x t - c e n t e r i t e m s - c e n t e r " , o n C l i c k : e [ 1 3 6 ] | | ( e [ 1 3 6 ] = ( . . . f ) = > r . r e i n s t a l l O L L A M A S e r v i c e & & r . r e i n s t a l l O L L A M A S e r v i c e ( . . . f ) ) } , " i n s t a l l o l a m a s e r v i c e " ) ] ) ] ) ] ) , u ( " t r " , n u l l , [ U l t , u ( " t d " , n u l l , [ u ( " d i v " , F l t , [ u e ( u ( " i n p u t " , { t y p e : " t e x t " , i d : " o l l a m a _ b a s e _ u r l " , r e q u i r e d : " " , " o n U p d a t e : m o d e l V a l u e " : e [ 1 3 7 ] | | ( e [ 1 3 7 ] = f = > r . c o n f i g F i l e . o l l a m a _ b a s e _ u r l = f ) , o n C h a n g e : e [ 1 3 8 ] | | ( e [ 1 3 8 ] = f = > s . s e t t i n g s C h a n g e d = ! 0 ) , c l a s s : " m t - 1 p x - 2 p y - 1 b o r d e r b o r d e r - g r a y - 3 0 0 r o u n d e d d a r k : b g - g r a y - 6 0 0 " } , n u l l , 5 4 4 ) , [ [ U e , r . c o n f i g F i l e . o l l a m a _ b a s e _ u r l ] ] ) ] ) ] ) ] ) ] ) ] ) , _ : 1 } ) , O e ( o , { t i t l e : " v L L M s e r v i c e " , i s _ s u b c a r d : ! 0 , c l a s s : " p b - 2 m - 2 " } , { d e f a u l t : t t ( ( ) = > [ u ( " t a b l e " , B l t , [ u ( " t r " , n u l l , [ G l t , u ( " t d " , n u l l , [ u ( " d i v " , V l t , [ u e ( u ( " i n p u t " , { t y p e : " c h e c k b o x " , i d : " e n a b l e _ v l l m _ s e r v i c e " , r e q u i r e d : " " , " o n U p d a t e : m o d e l V a l u e " : e [ 1 3 9 ] | | ( e [ 1 3 9 ] = f = > r . c o n f i g F i l e . e n a b l e _ v l l m _ s e r v i c e = f ) , o n C h a n g e : e [ 1 4 0 ] | | ( e [ 1 4 0 ] = f = > s . s e t t i n g s C h a n g e d = ! 0 ) , c l a s s : " m t - 1 p x - 2 p y - 1 b o r d e r b o r d e r - g r a y - 3 0 0 r o u n d e d d a r k : b g - g r a y - 6 0 0 " } , n u l l , 5 4 4 ) , [ [ S t , r . c o n f i g F i l e . e n a b l e _ v l l m _ s e r v i c e ] ] ) ] ) ] ) , u ( " t d " , n u l l , [ u ( " d i v " , { c l a s s : " h o v e r : t e x t - s e c o n d a r y d u r a t i o n - 7 5 a c t i v e : s c a l e - 9 0 p e e r - c h e c k e d : t e x t - p r i m a r y " , o n C l i c k : e [ 1 4 1 ] | | ( e [ 1 4 1 ] = f = > t h i s . $ s t o r e . s t a t e . m e s s a g e B o x . s h o w M e s s a g e ( ` A c t i v a t e s o l l a m a s e r v i c e . T h e s e r v i c e w i l l b e a u t o m a t i c a l l y l o a d e d a t s t a r t u p a l o w i n g y o u t o u s e t h e o l l a m a b i n d i n g .
2024-01-25 00:10:11 +00:00
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 .
2024-02-10 20:35:27 +00:00
< 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 > ` ) ) } , H l t ) ] ) ] ) , u ( " t r " , n u l l , [ q l t , u ( " t d " , n u l l , [ u ( " d i v " , Y l t , [ u ( " b u t t o n " , { c l a s s : " h o v e r : t e x t - p r i m a r y b g - g r e e n - 2 0 0 r o u n d e d - l g p - 4 m - 4 w - f u l l t e x t - c e n t e r i t e m s - c e n t e r " , o n C l i c k : e [ 1 4 2 ] | | ( e [ 1 4 2 ] = ( . . . f ) = > r . r e i n s t a l l v L L M S e r v i c e & & r . r e i n s t a l l v L L M S e r v i c e ( . . . f ) ) } , " i n s t a l l v L L M s e r v i c e " ) , u ( " b u t t o n " , { c l a s s : " h o v e r : t e x t - p r i m a r y b g - g r e e n - 2 0 0 r o u n d e d - l g p - 4 m - 4 w - f u l l t e x t - c e n t e r i t e m s - c e n t e r " , o n C l i c k : e [ 1 4 3 ] | | ( e [ 1 4 3 ] = ( . . . f ) = > r . s t a r t v L L M S e r v i c e & & r . s t a r t v L L M S e r v i c e ( . . . f ) ) } , " s t a r t v L L M s e r v i c e " ) ] ) ] ) ] ) , u ( " t r " , n u l l , [ $ l t , u ( " t d " , n u l l , [ u ( " d i v " , W l t , [ u e ( u ( " i n p u t " , { t y p e : " t e x t " , i d : " v l l m _ u r l " , r e q u i r e d : " " , " o n U p d a t e : m o d e l V a l u e " : e [ 1 4 4 ] | | ( e [ 1 4 4 ] = f = > r . c o n f i g F i l e . v l l m _ u r l = f ) , o n C h a n g e : e [ 1 4 5 ] | | ( e [ 1 4 5 ] = f = > s . s e t t i n g s C h a n g e d = ! 0 ) , c l a s s : " m t - 1 p x - 2 p y - 1 b o r d e r b o r d e r - g r a y - 3 0 0 r o u n d e d d a r k : b g - g r a y - 6 0 0 " } , n u l l , 5 4 4 ) , [ [ U e , r . c o n f i g F i l e . v l l m _ u r l ] ] ) ] ) ] ) ] ) , u ( " t r " , n u l l , [ K l t , u ( " t d " , n u l l , [ u ( " d i v " , j l t , [ u e ( u ( " i n p u t " , { t y p e : " t e x t " , i d : " v l l m _ m o d e l _ p a t h " , r e q u i r e d : " " , " o n U p d a t e : m o d e l V a l u e " : e [ 1 4 6 ] | | ( e [ 1 4 6 ] = f = > r . c o n f i g F i l e . v l l m _ m o d e l _ p a t h = f ) , o n C h a n g e : e [ 1 4 7 ] | | ( e [ 1 4 7 ] = f = > s . s e t t i n g s C h a n g e d = ! 0 ) , c l a s s : " m t - 1 p x - 2 p y - 1 b o r d e r b o r d e r - g r a y - 3 0 0 r o u n d e d d a r k : b g - g r a y - 6 0 0 " } , n u l l , 5 4 4 ) , [ [ U e , r . c o n f i g F i l e . v l l m _ m o d e l _ p a t h ] ] ) ] ) ] ) ] ) ] ) ] ) , _ : 1 } ) , O e ( o , { t i t l e : " P e t a l s s e r v i c e " , i s _ s u b c a r d : ! 0 , c l a s s : " p b - 2 m - 2 " } , { d e f a u l t : t t ( ( ) = > [ u ( " t a b l e " , Q l t , [ u ( " t r " , n u l l , [ X l t , u ( " t d " , n u l l , [ u ( " d i v " , Z l t , [ u e ( u ( " i n p u t " , { t y p e : " c h e c k b o x " , i d : " e n a b l e _ p e t a l s _ s e r v i c e " , r e q u i r e d : " " , " o n U p d a t e : m o d e l V a l u e " : e [ 1 4 8 ] | | ( e [ 1 4 8 ] = f = > r . c o n f i g F i l e . e n a b l e _ p e t a l s _ s e r v i c e = f ) , o n C h a n g e : e [ 1 4 9 ] | | ( e [ 1 4 9 ] = f = > s . s e t t i n g s C h a n g e d = ! 0 ) , c l a s s : " m t - 1 p x - 2 p y - 1 b o r d e r b o r d e r - g r a y - 3 0 0 r o u n d e d d a r k : b g - g r a y - 6 0 0 " } , n u l l , 5 4 4 ) , [ [ S t , r . c o n f i g F i l e . e n a b l e _ p e t a l s _ s e r v i c e ] ] ) ] ) ] ) , u ( " t d " , n u l l , [ u ( " d i v " , { c l a s s : " h o v e r : t e x t - s e c o n d a r y d u r a t i o n - 7 5 a c t i v e : s c a l e - 9 0 p e e r - c h e c k e d : t e x t - p r i m a r y " , o n C l i c k : e [ 1 5 0 ] | | ( e [ 1 5 0 ] = f = > t h i s . $ s t o r e . s t a t e . m e s s a g e B o x . s h o w M e s s a g e ( ` A c t i v a t e s P e t a l s s e r v i c e . T h e s e r v i c e w i l l b e a u t o m a t i c a l l y l o a d e d a t s t a r t u p a l o w i n g y o u t o u s e t h e p e t a l s e n d p o i n t t o g e n e r a t e t e x t i n a d i s t r i b u t e d n e t w o r k .
2024-01-14 11:12:53 +00:00
If You are using windows , this will install wsl so you need to activate it .
2024-02-10 21:10:19 +00:00
< 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 > ` ) ) } , e c t ) ] ) ] ) , u ( " t r " , n u l l , [ t c t , u ( " t d " , n u l l , [ u ( " d i v " , n c t , [ u ( " b u t t o n " , { c l a s s : " h o v e r : t e x t - p r i m a r y b g - g r e e n - 2 0 0 r o u n d e d - l g p - 4 m - 4 w - f u l l t e x t - c e n t e r i t e m s - c e n t e r " , o n C l i c k : e [ 1 5 1 ] | | ( e [ 1 5 1 ] = ( . . . f ) = > r . r e i n s t a l l P e t a l s S e r v i c e & & r . r e i n s t a l l P e t a l s S e r v i c e ( . . . f ) ) } , " i n s t a l l p e t a l s s e r v i c e " ) ] ) ] ) ] ) , u ( " t r " , n u l l , [ i c t , u ( " t d " , n u l l , [ u ( " d i v " , s c t , [ u e ( u ( " i n p u t " , { t y p e : " t e x t " , i d : " p e t a l s _ b a s e _ u r l " , r e q u i r e d : " " , " o n U p d a t e : m o d e l V a l u e " : e [ 1 5 2 ] | | ( e [ 1 5 2 ] = f = > r . c o n f i g F i l e . p e t a l s _ b a s e _ u r l = f ) , o n C h a n g e : e [ 1 5 3 ] | | ( e [ 1 5 3 ] = f = > s . s e t t i n g s C h a n g e d = ! 0 ) , c l a s s : " m t - 1 p x - 2 p y - 1 b o r d e r b o r d e r - g r a y - 3 0 0 r o u n d e d d a r k : b g - g r a y - 6 0 0 " } , n u l l , 5 4 4 ) , [ [ U e , r . c o n f i g F i l e . p e t a l s _ b a s e _ u r l ] ] ) ] ) ] ) ] ) ] ) ] ) , _ : 1 } ) , O e ( o , { t i t l e : " E l a s t i c s e a r c h S e r v i c e ( u n d e r c o n s t r u c t i o n ) " , i s _ s u b c a r d : ! 0 , c l a s s : " p b - 2 m - 2 " } , { d e f a u l t : t t ( ( ) = > [ u ( " t a b l e " , r c t , [ u ( " t r " , n u l l , [ o c t , u ( " t d " , n u l l , [ u ( " d i v " , a c t , [ u e ( u ( " i n p u t " , { t y p e : " c h e c k b o x " , i d : " e l a s t i c _ s e a r c h _ s e r v i c e " , r e q u i r e d : " " , " o n U p d a t e : m o d e l V a l u e " : e [ 1 5 4 ] | | ( e [ 1 5 4 ] = f = > r . c o n f i g F i l e . e l a s t i c _ s e a r c h _ s e r v i c e = f ) , o n C h a n g e : e [ 1 5 5 ] | | ( e [ 1 5 5 ] = f = > s . s e t t i n g s C h a n g e d = ! 0 ) , c l a s s : " m t - 1 p x - 2 p y - 1 b o r d e r b o r d e r - g r a y - 3 0 0 r o u n d e d d a r k : b g - g r a y - 6 0 0 " } , n u l l , 5 4 4 ) , [ [ S t , r . c o n f i g F i l e . e l a s t i c _ s e a r c h _ s e r v i c e ] ] ) ] ) ] ) ] ) , u ( " t r " , n u l l , [ l c t , u ( " t d " , n u l l , [ u ( " d i v " , c c t , [ u ( " b u t t o n " , { c l a s s : " h o v e r : t e x t - p r i m a r y b g - g r e e n - 2 0 0 r o u n d e d - l g p - 4 m - 4 w - f u l l t e x t - c e n t e r i t e m s - c e n t e r " , o n C l i c k : e [ 1 5 6 ] | | ( e [ 1 5 6 ] = ( . . . f ) = > r . r e i n s t a l l E l a s t i c S e a r c h S e r v i c e & & r . r e i n s t a l l E l a s t i c S e a r c h S e r v i c e ( . . . f ) ) } , " i n s t a l l E l a s t i c S e a r c h s e r v i c e " ) ] ) ] ) ] ) , u ( " t r " , n u l l , [ d c t , u ( " t d " , n u l l , [ u ( " d i v " , u c t , [ u e ( u ( " i n p u t " , { t y p e : " t e x t " , i d : " e l a s t i c _ s e a r c h _ u r l " , r e q u i r e d : " " , " o n U p d a t e : m o d e l V a l u e " : e [ 1 5 7 ] | | ( e [ 1 5 7 ] = f = > r . c o n f i g F i l e . e l a s t i c _ s e a r c h _ u r l = f ) , o n C h a n g e : e [ 1 5 8 ] | | ( e [ 1 5 8 ] = f = > s . s e t t i n g s C h a n g e d = ! 0 ) , c l a s s : " m t - 1 p x - 2 p y - 1 b o r d e r b o r d e r - g r a y - 3 0 0 r o u n d e d d a r k : b g - g r a y - 6 0 0 " } , n u l l , 5 4 4 ) , [ [ U e , r . c o n f i g F i l e . e l a s t i c _ s e a r c h _ u r l ] ] ) ] ) ] ) ] ) ] ) ] ) , _ : 1 } ) , O e ( o , { t i t l e : " X T T S s e r v i c e " , i s _ s u b c a r d : ! 0 , c l a s s : " p b - 2 m - 2 " } , { d e f a u l t : t t ( ( ) = > [ u ( " t a b l e " , p c t , [ u ( " t r " , n u l l , [ _ c t , u ( " t d " , n u l l , [ u ( " d i v " , h c t , [ u e ( u ( " i n p u t " , { t y p e : " c h e c k b o x " , i d : " e n a b l e _ v o i c e _ s e r v i c e " , r e q u i r e d : " " , " o n U p d a t e : m o d e l V a l u e " : e [ 1 5 9 ] | | ( e [ 1 5 9 ] = f = > r . c o n f i g F i l e . e n a b l e _ v o i c e _ s e r v i c e = f ) , o n C h a n g e : e [ 1 6 0 ] | | ( e [ 1 6 0 ] = f = > s . s e t t i n g s C h a n g e d = ! 0 ) , c l a s s : " m t - 1 p x - 2 p y - 1 b o r d e r b o r d e r - g r a y - 3 0 0 r o u n d e d d a r k : b g - g r a y - 6 0 0 " } , n u l l , 5 4 4 ) , [ [ S t , r . c o n f i g F i l e . e n a b l e _ v o i c e _ s e r v i c e ] ] ) ] ) ] ) ] ) , u ( " t r " , n u l l , [ f c t , u ( " t d " , n u l l , [ u ( " d i v " , m c t , [ u ( " b u t t o n " , { c l a s s : " h o v e r : t e x t - p r i m a r y b g - g r e e n - 2 0 0 r o u n d e d - l g p - 4 m - 4 w - f u l l t e x t - c e n t e r i t e m s - c e n t e r " , o n C l i c k : e [ 1 6 1 ] | | ( e [ 1 6 1 ] = ( . . . f ) = > r . r e i n s t a l l A u d i o S e r v i c e & & r . r e i n s t a l l A u d i o S e r v i c e ( . . . f ) ) } , " i n s t a l l x t t s s e r v i c e " ) ] ) ] ) ] ) , u ( " t r " , n u l l , [ g c t , u ( " t d " , n u l l , [ u ( " d i v " , b c t , [ u e ( u ( " i n p u t " , { t y p e : " t e x t " , i d : " x t t s _ b a s e _ u r l " , r e q u i r e d : " " , " o n U p d a t e : m o d e l V a l u e " : e [ 1 6 2 ] | | ( e [ 1 6 2 ] = f = > r . c o n f i g F i l e . x t t s _ b a s e _ u r l = f ) , o n C h a n g e : e [ 1 6 3 ] | | ( e [ 1 6 3 ] = f = > s . s e t t i n g s C h a n g e d = ! 0 ) , c l a s s : " m t - 1 p x - 2 p y - 1 b o r d e r b o r d e r - g r a y - 3 0 0 r o u n d e d d a r k : b g - g r a y - 6 0 0 " } , n u l l , 5 4 4 ) , [ [ U e , r . c o n f i g F i l e . x t t s _ b a s e _ u r l ] ] ) ] ) ] ) ] ) , u ( " t r " , n u l l , [ E c t , u ( " t d " , n u l l , [ u ( " d i v " , v c t , [ u e ( u ( " s e l e c t " , { " o n U p d a t e : m o d e l V a l u e " : e [ 1 6 4 ] | | ( e [ 1 6 4 ] = f = > r . c u r r e n t _ l a n g u a g e = f ) , o n C h a n g e : e [ 1 6 5 ] | | ( e [ 1 6 5 ] = f = > s . s e t t i n g s C h a n g e d = ! 0 ) , d i s a b l e d : ! r . e n a b l e _ v o i c e _ s e r v i c e } , [ ( O ( ! 0 ) , D ( q e , n u l l , l t ( s . v o i c e _ l a n g u a g e s , ( f , E ) = > ( O ( ) , D ( " o p t i o n " , { k e y : E , v a l u e : f } , m e ( E ) , 9 , y c t ) ) ) , 1 2 8 ) ) ] , 4 0 , S c t ) , [ [ q n , r . c u r r e n t _ l a n g u a g e ] ] ) ] ) ] ) ] ) , u ( " t r " , n u l l , [ T c t , u ( " t d " , n u l l , [ u ( " d i v " , x c t , [ u e ( u ( " s e l e c t " , { " o n U p d a t e : m o d e l V a l u e " : e [ 1 6 6 ] | | ( e [ 1 6 6 ] = f = > r . c u r r e n t _ v o i c e = f ) , o n C h a n g e : e [ 1 6 7 ] | | ( e [ 1 6 7 ] = f = > s . s e t t i n g s C h a n g e d = ! 0 ) , d i s a b l e d : ! r . e n a b l e _ v o i c e _ s e r v i c e } , [ ( O ( ! 0 ) , D ( q e , n u l l , l t ( s . v o i c e s , f = > ( O ( ) , D ( " o p t i o n " , { k e y : f , v a l u e : f } , m e ( f ) , 9 , R c t ) ) ) , 1 2 8 ) ) ] , 4 0 , C c t ) , [ [ q n , r . c u r r e n t _ v o i c e ] ] ) ] ) ] ) ] ) , u ( " t r " , n u l l , [ A c t , u ( " t d " , n u l l , [ u ( " d i v " , w c t , [ u e ( u ( " i n p u t " , { t y p e : " c h e c k b o x " , i d : " a u t o _ r e a d " , r e q u i r e d : " " , " o n U p d a t e : m o d e l V a l u e " : e [ 1 6 8 ] | | ( e [ 1 6 8 ] = f = > r . c o n f i g F i l e . a u t o _ r e a d = f ) , o n C h a n g e : e [ 1 6 9 ] | | ( e [ 1 6 9 ] = f = > s . s e t t i n g s C h a n g e d = ! 0 ) , c l a s s : " m t - 1 p x - 2 p y - 1 b o r d e r b o r d e r - g r a y - 3 0 0 r o u n d e d d a r k : b g - g r a y - 6 0 0 " , d i s a b l e d : ! r . e n a b l e _ v o i c e _ s e r v i c e } , n u l l , 4 0 , N c t ) , [ [ S t , r . c o n f i g F i l e . a u t o _ r e a d ] ] ) ] ) ] ) ] ) ] ) ] ) , _ :
2024-01-11 01:32:21 +00:00
` ).map(d=>d.trim()===""?d:s?d.startsWith(" ")?d.substring(4):d:" "+d),a=e.value.substring(0,t),l=e.value.substring(i),c=a+o.join( `
2024-02-10 00:32:22 +00:00
` )+l;this.message.content=c,this. $ nextTick(()=>{e.selectionStart=t,e.selectionEnd=i+o.length*4})}n.preventDefault()},onVoicesChanged(){this.voices=this.speechSynthesis.getVoices()},read(){this.isSynthesizingVoice?(this.isSynthesizingVoice=!1,this. $ refs.audio_player.pause()):(this.isSynthesizingVoice=!0,Le.post("./text2Audio",{text:this.message.content}).then(n=>{let e=n.data.url;console.log(e),this.audio_url=e,this. $ emit("updateMessage",this.message.id,this.message.content,this.audio_url)}).catch(n=>{this. $ store.state.toast.showToast( ` Error : $ { n } ` ,4,!1),this.isSynthesizingVoice=!1}))},speak(){if(this.msg){this.speechSynthesis.cancel(),this.msg=null,this.isSpeaking=!1;return}let n=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(s=>s.name===this. $ store.state.config.audio_out_voice)[0]);const t=s=>{let r=this.message.content.substring(s,s+e);const o=[".","!","?", `
2024-01-11 01:32:21 +00:00
` ];let a=-1;return o.forEach(l=>{const c=r.lastIndexOf(l);c>a&&(a=c)}),a==-1&&(a=r.length),console.log(a),a+s+1},i=()=>{if(this.message.content.includes(".")){const s=t(n),r=this.message.content.substring(n,s);this.msg.text=r,n=s+1,this.msg.onend=o=>{n<this.message.content.length-2?setTimeout(()=>{i()},1):(this.isSpeaking=!1,console.log("voice off :",this.message.content.length," ",s))},this.speechSynthesis.speak(this.msg)}else setTimeout(()=>{i()},1)};i()},toggleModel(){this.expanded=!this.expanded},addBlock(n){let e=this. $ refs.mdTextarea.selectionStart,t=this. $ refs.mdTextarea.selectionEnd;e==t?speechSynthesis==0||this.message.content[e-1]== `
` ?(this.message.content=this.message.content.slice(0,e)+" ` ` ` "+n+" \ n \ n ` ` ` \n "+this.message.content.slice(e),e=e+4+n.length):(this.message.content=this.message.content.slice(0,e)+" \n ` ` ` "+n+" \ n \ n ` ` ` \n "+this.message.content.slice(e),e=e+3+n.length):speechSynthesis==0||this.message.content[e-1]== `
` ?(this.message.content=this.message.content.slice(0,e)+" ` ` ` " + n + `
` +this.message.content.slice(e,t)+" \n ` ` ` \ n "+this.message.content.slice(t),e=e+4+n.length):(this.message.content=this.message.content.slice(0,e)+" \ n ` ` ` "+n+ `
2024-02-10 20:35:27 +00:00
` +this.message.content.slice(e,t)+" \n ` ` ` \ n "+this.message.content.slice(t),p=p+3+n.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(n){this.$emit(" resendMessage ",this.message.id,this.message.content,n)},continueMessage(){this.$emit(" continueMessage ",this.message.id,this.message.content)},getImgUrl(){return this.avatar?(console.log(" Avatar : ",nC+this.avatar),nC+this.avatar):(console.log(" No avatar found "),ca)},defaultImg(n){n.target.src=ca},parseDate(n){let e=new Date(Date.parse(n)),i=Math.floor((new Date-e)/1e3);return i<=1?" just now ":i<20?i+" seconds ago ":i<40?" half a minute ago ":i<60?" less than a minute ago ":i<=90?" one minute ago ":i<=3540?Math.round(i/60)+" minutes ago ":i<=5400?" 1 hour ago ":i<=86400?Math.round(i/3600)+" hours ago ":i<=129600?" 1 day ago ":i<604800?Math.round(i/86400)+" days ago ":i<=777600?" 1 week ago ":n},prettyDate(n){let e=new Date((n||" ").replace(/-/g," / ").replace(/[TZ]/g," ")),t=(new Date().getTime()-e.getTime())/1e3,i=Math.floor(t/86400);if(!(isNaN(i)||i<0||i>=31))return i==0&&(t<60&&" just now "||t<120&&" 1 minute ago "||t<3600&&Math.floor(t/60)+" minutes ago "||t<7200&&" 1 hour ago "||t<86400&&Math.floor(t/3600)+" hours ago ")||i==1&&" Yesterday "||i<7&&i+" days ago "||i<31&&Math.ceil(i/7)+" weeks ago "},checkForFullSentence(){if(this.message.content.trim().split(" ").length>3){this.speak();return}}},watch:{audio_url(n){n&&(this.$refs.audio_player.src=n)}," message . content ":function(n){this.$store.state.config.auto_speak&&(this.isSpeaking||this.checkForFullSentence())}," message . ui ":function(n){console.log(" ui changed "),console.log(this.message.ui)},showConfirmation(){Be(()=>{Ge.replace()})},deleteMsgMode(){Be(()=>{Ge.replace()})}},computed:{editMsgMode:{get(){return this.message.hasOwnProperty(" open ")?this.editMsgMode_||this.message.open:this.editMsgMode_},set(n){this.message.open=n,this.editMsgMode_=n,Be(()=>{Ge.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 n=new Date(Date.parse(this.message.created_at)),e=new Date(Date.parse(this.message.finished_generating_at));if(e.getTime()===n.getTime()||!e.getTime())return;let i=e.getTime()-n.getTime();const s=Math.floor(i/(1e3*60*60));i-=s*(1e3*60*60);const r=Math.floor(i/(1e3*60));i-=r*(1e3*60);const o=Math.floor(i/1e3);i-=o*1e3;function a(c){return c<10&&(c=" 0 "+c),c}return a(s)+" h : "+a(r)+" m : "+a(o)+" s "}}},ift={class:" relative w - full group rounded - lg m - 2 shadow - lg hover : border - primary dark : hover : border - primary hover : border - solid hover : border - 2 border - 2 border - transparent even : bg - bg - light - discussion - odd dark : even : bg - bg - dark - discussion - odd flex flex - col flex - grow flex - wrap overflow - visible p - 4 pb - 2 "},sft={class:" flex flex - row gap - 2 "},rft={class:" flex - shrink - 0 "},oft={class:" group / avatar "},aft=[" src "," data - popover - target "],lft={class:" flex flex - col w - full flex - grow - 0 "},cft={class:" flex flex - row flex - grow items - start "},dft={class:" flex flex - col mb - 2 "},uft={class:" drop - shadow - sm text - lg text - opacity - 95 font - bold grow "},pft=[" title "],_ft=u(" div ",{class:" flex - grow "},null,-1),hft={class:" flex - row justify - end mx - 2 "},fft={class:" invisible group - hover : visible flex flex - row "},mft={key:0,class:" flex items - center duration - 75 "},gft=u(" i ",{" data - feather ":" x "},null,-1),bft=[gft],Eft=u(" i ",{" data - feather ":" check "},null,-1),vft=[Eft],Sft=u(" i ",{" data - feather ":" edit "},null,-1),yft=[Sft],Tft=[" src "],xft=[" src "],Cft=[" src "],Rft=[" src "],Aft=[" src "],wft=[" src "],Nft=[" src "],Oft=[" src "],Ift=u(" i ",{" d
` ,36)),[[Ue,t.message.content]]):K("",!0)]),t.message.metadata!==null?(O(),D("div",Smt,[(O(!0),D(qe,null,lt(t.message.metadata,(_,h)=>(O(),D("div",{key:"json-"+t.message.id+"-"+h,class:"json font-bold"},[Oe(c,{jsonFormText:_.title,jsonData:_.content},null,8,["jsonFormText","jsonData"])]))),128))])):K("",!0),t.message.ui!==null&&t.message.ui!==void 0&&t.message.ui!==""?(O(),Nt(d,{key:2,class:"w-full h-full",code:t.message.ui},null,8,["code"])):K("",!0),s.audio_url!=null?(O(),D("audio",{controls:"",autoplay:"",key:s.audio_url},[u("source",{src:s.audio_url,type:"audio/wav",ref:"audio_player"},null,8,ymt),Qe(" Your browser does not support the audio element. ")])):K("",!0)]),u("div",Tmt,[u("div",xmt,[t.message.binding?(O(),D("p",Cmt,[Qe("Binding: "),u("span",Rmt,me(t.message.binding),1)])):K("",!0),t.message.model?(O(),D("p",Amt,[Qe("Model: "),u("span",wmt,me(t.message.model),1)])):K("",!0),t.message.seed?(O(),D("p",Nmt,[Qe("Seed: "),u("span",Omt,me(t.message.seed),1)])):K("",!0),r.time_spent?(O(),D("p",Imt,[Qe("Time spent: "),u("span",{class:"font-thin",title:"Finished generating: "+r.finished_generating_at_parsed},me(r.time_spent),9,Mmt)])):K("",!0)])])])])])}const BN=gt(nft,[["render",Dmt]]),kmt="/";Le.defaults.baseURL="/";const Lmt={name:"MountedPersonalities",props:{onShowPersList:Function,onReady:Function},components:{Toast:oc,UniversalForm:dc},data(){return{bUrl:kmt,isMounted:!1,show:!1}},async mounted(){await this.constructor(),this.isMounted=!0},async activated(){this.isMounted&&await this.constructor()},computed:{configFile:{get(){return this. $ store.state.config},set(n){this. $ store.commit("setConfig",n)}},mountedPers:{get(){return this. $ store.state.mountedPers},set(n){this. $ store.commit("setMountedPers",n)}},personalities:{get(){return this. $ store.state.personalities},set(n){this. $ store.commit("setPersonalities",n)}},mountedPersArr:{get(){return this. $ store.state.mountedPersArr},set(n){this. $ store.commit("setMountedPers",n)}}},methods:{onSettingsPersonality(n){try{Le.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 - "+n.name,"Save changes","Cancel").then(t=>{try{Le.post("/set_active_personality_settings",t).then(i=>{i&&i.data?(console.log("personality set with new settings",i.data),this. $ refs.toast.showToast("Personality settings updated successfully!",4,!0)):this. $ refs.toast.showToast( ` Did not get Personality settings responses .
2024-01-11 01:32:21 +00:00
` +i,4,!1)})}catch(i){this. $ refs.toast.showToast( ` Did not get Personality settings responses .
2024-02-10 20:35:27 +00:00
Endpoint error : ` +i.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(Be(()=>{Ge.replace()});this. $ store.state.ready===!1;)await new Promise(n=>setTimeout(n,100));this.onReady()},async api_get_req(n){try{const e=await Le.get("/"+n);if(e)return e.data}catch(e){console.log(e.message,"api_get_req - mountedPersonalities");return}},personalityImgPlacehodler(n){n.target.src=_c}}},Pmt={class:"w-fit select-none"},Umt={key:0,class:"flex -space-x-4"},Fmt=["src","title"],Bmt={key:1,class:"flex -space-x-4"},Gmt=["src","title"],Vmt={key:2,title:"Loading personalities"},zmt=u("div",{role:"status"},[u("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"},[u("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"}),u("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"})]),u("span",{class:"sr-only"},"Loading...")],-1),Hmt=[zmt];function qmt(n,e,t,i,s,r){const o=ut("UniversalForm");return O(),D(qe,null,[u("div",Pmt,[r.mountedPersArr.length>1?(O(),D("div",Umt,[u("img",{src:s.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 border-2 active:scale-90 hover:z-20 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,Fmt),u("div",{class:"flex items-center justify-center w-8 h-8 cursor-pointer text-xs font-medium bg-bg-light dark:bg-bg-dark border-2 hover:border-secondary rounded-full hover:bg-bg-light-tone dark:hover:bg-bg-dark-tone dark:border-gray-800 hover:z-20 hover:-translate-y-2 duration-150 active:scale-90",onClick:e[2]||(e[2]=ye((...a)=>r.toggleShowPersList&&r.toggleShowPersList(...a),["stop"])),title:"Click to show more"},"+"+me(r.mountedPersArr.length-1),1)])):K("",!0),r.mountedPersArr.length==1?(O(),D("div",Bmt,[u("img",{src:s.bUrl+this. $ store.state.mountedPers.avatar,onError:e[3]||(e[3]=(...a)=>r.personalityImgPlacehodler&&r.personalityImgPlacehodler(...a)),class:"w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 hover:z-20 cursor-pointer border-secondary",title:"Active personality: "+this. $ store.state.mountedPers.name,onClick:e[4]||(e[4]=ye((...a)=>r.toggleShowPersList&&r.toggleShowPersList(...a),["stop"]))},null,40,Gmt)])):K("",!0),r.mountedPersArr.length==0?(O(),D("div",Vmt,Hmt)):K("",!0)]),Oe(o,{ref:"universalForm",class:"z-20"},null,512)],64)}const Ymt=gt(Lmt,[["render",qmt]]);const $ mt="/";Le.defaults.baseURL="/";const Wmt={props:{onTalk:Function,onMounted:Function,onUnmounted:Function,onRemounted:Function,discussionPersonalities:Array,onShowPersList:Function},components:{PersonalityEntry:LN,Toast:oc,UniversalForm:dc},name:"MountedPersonalitiesList",data(){return{bUrl: $ mt,isMounted:!1,isLoading:!1}},async mounted(){await this.constructor(),this.isMounted=!0},async activ
2024-02-10 00:32:22 +00:00
` +e.message,4,!1),{status:!1}))},editPersonality(n){n=n.personality,Le.post("/get_personality_config",{category:n.category,name:n.folder}).then(e=>{const t=e.data;console.log("Done"),t.status?(this. $ store.state.currentPersonConfig=t.config,this. $ store.state.showPersonalityEditor=!0,this. $ store.state.personality_editor.showPanel(),this. $ store.state.selectedPersonality=n):console.error(t.error)}).catch(e=>{console.error(e)})},onPersonalityMounted(n){this.mountPersonality(n)},onPersonalityUnMounted(n){this.unmountPersonality(n)},onPersonalityRemount(n){this.reMountPersonality(n)},async handleOnTalk(n){if(Ge.replace(),console.log("ppa",n),n){if(n.isMounted){const e=await this.select_personality(n);e&&e.status&&(await this.constructor(),this. $ refs.toast.showToast( ` Selected personality :
2024-02-06 23:38:14 +00:00
` +n.name,4,!0))}else this.onPersonalityMounted(n);this.onTalk(n)}},async onPersonalitySelected(n){if(Ge.replace(),console.log("Selected personality : ",JSON.stringify(n.personality)),n){if(n.selected){this. $ refs.toast.showToast("Personality already selected",4,!0);return}if(n.isMounted){const e=await this.select_personality(n);e&&e.status&&(await this.constructor(),this. $ refs.toast.showToast( ` Selected personality :
2024-02-10 00:32:22 +00:00
` +n.name,4,!0))}else this.onPersonalityMounted(n)}},onSettingsPersonality(n){try{Le.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 - "+n.personality.name,"Save changes","Cancel").then(t=>{try{Le.post("/set_active_personality_settings",t).then(i=>{i&&i.data?(console.log("personality set with new settings",i.data),this. $ refs.toast.showToast("Personality settings updated successfully!",4,!0)):this. $ refs.toast.showToast( ` Did not get Personality settings responses .
2024-01-11 01:32:21 +00:00
` +i,4,!1)})}catch(i){this. $ refs.toast.showToast( ` Did not get Personality settings responses .
2024-02-10 00:32:22 +00:00
Endpoint error : ` +i.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(n){if(!n)return{status:!1,error:"no personality - mount_personality"};try{const e={category:n.category,folder:n.folder,language:n.language},t=await Le.post("/mount_personality",e);if(t)return t.data}catch(e){console.log(e.message,"mount_personality - settings");return}},async remount_personality(n){if(!n)return{status:!1,error:"no personality - mount_personality"};try{const e={category:n.category,folder:n.folder,language:n.language},t=await Le.post("/remount_personality",e);if(t)return t.data}catch(e){console.log(e.message,"remount_personality - settings");return}},async unmount_personality(n){if(!n)return{status:!1,error:"no personality - unmount_personality"};const e={category:n.category,folder:n.folder,language:n.language};try{const t=await Le.post("/unmount_personality",e);if(t)return t.data}catch(t){console.log(t.message,"unmount_personality - settings");return}},async select_personality(n){if(!n)return{status:!1,error:"no personality - select_personality"};let e=-1;if(console.log("Personality full path : ",n.full_path),console.log("Personality language : ",n.personality.language),n.personality.language!=null&&n.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: ",n.full_path+":"+n.personality.language),e=this.configFile.personalities.findIndex(t=>t===n.full_path+":"+n.personality.language)):(console.log("Mounted personalities :",JSON.stringify(this.configFile.personalities)),e=this.configFile.personalities.findIndex(t=>t===n.full_path)),e>-1){console.log("Selecting personality with id:",JSON.stringify(e));const t={id:e};try{const i=await Le.post("/select_personality",t);if(i)return this. $ store.dispatch("refreshConfig").then(()=>{console.log("recovered config",this.configFile.active_personality_id),this. $ store.dispatch("refreshPersonalitiesZoo").then(()=>{this. $ store.dispatch("refreshMountedPersonalities")})}),i.data}catch(i){console.log(i,"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(n){if(console.log("mount pers",n),!n)return;if(this.configFile.personalities.includes(n.personality.full_path)){this. $ refs.toast.showToast("Personality already mounted",4,!1);return}const e=await this.mount_personality(n.personality);console.log("mount_personality res",e),e.status?(this.configFile.personalities=e.personalities,this. $ refs.toast.showToast("Personality mounted",4,!0),n.isMounted=!0,this.onMounted(this),(await this.select_personality(n.personality)).status&&this. $ refs.toast.showToast( ` Selected personality :
2024-01-11 01:32:21 +00:00
` +n.personality.name,4,!0),this.getMountedPersonalities()):(n.isMounted=!1,this. $ refs.toast.showToast( ` Could not mount personality
Error : ` +e.error,4,!1))},async reMountPersonality(n){if(console.log("remount pers",n),!n)return;if(!this.configFile.personalities.includes(n.personality.full_path)){this. $ refs.toast.showToast("Personality not mounted",4,!1);return}const e=await this.remount_personality(n.personality);console.log("remount_personality res",e),e.status?(this.configFile.personalities=e.personalities,this. $ refs.toast.showToast("Personality remounted",4,!0),n.isMounted=!0,this.onMounted(this),(await this.select_personality(n.personality)).status&&this. $ refs.toast.showToast( ` Selected personality :
` +n.personality.name,4,!0),this.getMountedPersonalities()):(n.isMounted=!1,this. $ refs.toast.showToast( ` Could not mount personality
2024-02-06 23:38:14 +00:00
Error : ` +e.error,4,!1))},async unmountPersonality(n){if(!n)return;console.log( ` Unmounting $ { JSON . stringify ( n . personality ) } ` );const e=await this.unmount_personality(n.personality);if(e.status){console.log("unmount response",e),this.configFile.active_personality_id=e.active_personality_id,this.configFile.personalities=e.personalities;const t=this.configFile.personalities[this.configFile.active_personality_id],i=this.personalities.findIndex(a=>a.full_path==t),s=this. $ refs.personalitiesZoo.findIndex(a=>a.full_path==n.full_path),r=this.personalities[i];r.isMounted=!1,r.selected=!0,this. $ refs.personalitiesZoo[s].isMounted=!1,this.getMountedPersonalities(),(await this.select_personality(r)).status&&Ge.replace(),this. $ refs.toast.showToast("Personality unmounted",4,!0),this.onUnMounted(this)}else this. $ refs.toast.showToast( ` Could not unmount personality
2024-02-10 20:35:27 +00:00
Error : ` +e.error,4,!1)},getMountedPersonalities(){this.isLoading=!0;let n=[];console.log(this.configFile.personalities.length);for(let e=0;e<this.configFile.personalities.length;e++){const t=this.configFile.personalities[e],i=this.personalities.findIndex(r=>r.full_path==t),s=this.personalities[i];if(s)console.log("adding from config"),n.push(s);else{console.log("adding default");const r=this.personalities.findIndex(a=>a.full_path=="english/generic/lollms"),o=this.personalities[r];n.push(o)}}if(this.mountedPersArr=[],this.mountedPersArr=n,console.log("discussionPersonalities",this.discussionPersonalities),this.discussionPersonalities!=null&&this.discussionPersonalities.length>0)for(let e=0;e<this.discussionPersonalities.length;e++){const t=this.discussionPersonalities[e];console.log("discussionPersonalities - per",t);const i=this.mountedPersArr.findIndex(s=>s.full_path==t);if(console.log("discussionPersonalities -includes",i),console.log("discussionPersonalities -mounted list",this.mountedPersArr),i==-1){const s=this.personalities.findIndex(o=>o.full_path==t),r=this.personalities[s];console.log("adding discucc121",r,t),r&&(this.mountedPersArr.push(r),console.log("adding discucc",r))}}this.isLoading=!1,console.log("getMountedPersonalities",this.mountedPersArr),console.log("fig",this.configFile)}}},aE=n=>(lo("data-v-0bdaf3b5"),n=n(),co(),n),Kmt={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"},jmt={key:0,role:"status",class:"flex justify-center overflow-y-hidden"},Qmt=aE(()=>u("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"},[u("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"}),u("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)),Xmt=aE(()=>u("span",{class:"sr-only"},"Loading...",-1)),Zmt=[Qmt,Xmt],Jmt=aE(()=>u("i",{"data-feather":"chevron-down"},null,-1)),egt=[Jmt],tgt={class:"block my-2 text-sm font-medium text-gray-900 dark:text-white"},ngt={class:"overflow-y-auto no-scrollbar pb-0 grid lg:grid-cols-3 md:grid-cols-2 gap-4 max-h-96"};function igt(n,e,t,i,s,r){const o=ut("personality-entry"),a=ut("Toast"),l=ut("UniversalForm");return O(),D("div",Kmt,[s.isLoading?(O(),D("div",jmt,Zmt)):K("",!0),u("div",null,[r.mountedPersArr.length>0?(O(),D("div",{key:0,class:We(s.isLoading?"pointer-events-none opacity-30 cursor-default":"")},[u("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]=ye((...c)=>r.toggleShowPersList&&r.toggleShowPersList(...c),["stop"]))},egt),u("label",tgt," Mounted Personalities: ("+me(r.mountedPersArr.length)+") ",1),u("div",ngt,[Oe(ys,{name:"bounce"},{default:tt(()=>[(O(!0),D(qe,null,lt(this. $ store.state.mountedPersArr,(c,
` +i.error,4,!1),this.loading=!1, $ e.off("file_received")}), $ e.emit("send_file",t)},e.readAsDataURL(this.selectedFile)},async constructor(){nextTick(()=>{Ge.replace()})},toggleMenu(){this.showMenu=!this.showMenu},execute_cmd(n){this.showMenu=!this.showMenu,n.hasOwnProperty("is_file")?(console.log("Need to send a file."),this.selectFile(n.hasOwnProperty("file_types")?n.file_types:"*",()=>{this.selectedFile!=null&&this.uploadFile()})):this.sendCommand(n.value)},handleClickOutside(n){const e=this. $ el.querySelector(".commands-menu-items-wrapper");e&&!e.contains(n.target)&&(this.showMenu=!1)}},mounted(){this.commands=this.commandsList,document.addEventListener("click",this.handleClickOutside)},beforeUnmount(){document.removeEventListener("click",this.handleClickOutside)}},ogt=n=>(lo("data-v-52cfa09c"),n=n(),co(),n),agt={key:0,title:"Loading..",class:"flex flex-row flex-grow justify-end"},lgt=ogt(()=>u("div",{role:"status"},[u("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"},[u("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"}),u("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"})]),u("span",{class:"sr-only"},"Loading...")],-1)),cgt=[lgt];function dgt(n,e,t,i,s,r){const o=ut("InteractiveMenu");return s.loading?(O(),D("div",agt,cgt)):(O(),Nt(o,{key:1,commands:t.commandsList,execute_cmd:r.execute_cmd},null,8,["commands","execute_cmd"]))}const ugt=gt(rgt,[["render",dgt],["__scopeId","data-v-52cfa09c"]]),pgt="/assets/loader_v0-16906488.svg";console.log("modelImgPlaceholder:",Ai);const _gt="/",hgt={name:"ChatBox",emits:["messageSentEvent","sendCMDEvent","stopGenerating","loaded","createEmptyUserMessage","createEmptyAIMessage","personalitySelected","addWebLink"],props:{onTalk:Function,discussionList:Array,loading:!1,onShowToastMessage:Function},components:{UniversalForm:dc,MountedPersonalities:Ymt,MountedPersonalitiesList:sgt,PersonalitiesCommands:ugt,InteractiveMenu:pc},setup(){},data(){return{loader_v0:pgt,modelImgPlaceholder:Ai,bUrl:_gt,message:"",selecting_model:!1,selectedModel:"",isLesteningToVoice:!1,filesList:[],isFileSentList:[],totalSize:0,showfilesList:!0,showPersonalities:!1,personalities_ready:!1,models_menu_icon:""}},computed:{currentModel(){if(this. $ store.state.currentModel!=null)return console.log("Model found"),this. $ store.state.currentModel;{console.log("No model found");let n={};return n.name="unknown",n}},installedModels(){return this. $ store.state.installedModels},model_name(){return this. $ store.state.config.model_name},config(){return this. $ store.state.config},mountedPers(){return this. $ store.state.mountedPers},allDiscussionPersonalities(){if(this.discussionList.length>0){let n=[];for(let e=0;e<this.discussionList.length;e++)!n.includes(this.discussionList[e].personality)&&!this.discussionList[e].personality==""&&n.push(this.discussionList[e].personality);return console.log("conputer pers",n),console.log("dis conputer pers",this.discussionList),n}return null}},methods:{toggleSwitch(){this. $ store.state.config.activate_internet_search=!this. $ store.state.config.activate_internet_search,this.isLoading=!0,Le.post("/apply_sett
2024-01-11 01:32:21 +00:00
` +t,4,!1),this.isLoading=!1)})}catch(t){this. $ store.state.toast.showToast( ` Did not get binding settings responses .
Endpoint error : ` +t.message,4,!1),this.isLoading=!1}}):(this. $ store.state.toast.showToast("Binding has no settings",4,!1),this.isLoading=!1))})}catch(n){this.isLoading=!1,this. $ store.state.toast.showToast("Could not open binding settings. Endpoint error: "+n.message,4,!1)}},async unmountPersonality(n){if(this.loading=!0,!n)return;const e=await this.unmount_personality(n.personality||n);if(e.status){this. $ store.state.config.personalities=e.personalities,this. $ store.state.toast.showToast("Personality unmounted",4,!0),this. $ store.dispatch("refreshMountedPersonalities");const t=this. $ store.state.mountedPersArr[this. $ store.state.mountedPersArr.length-1];console.log(t,this. $ store.state.mountedPersArr.length),(await this.select_personality(n.personality)).status&&this. $ store.state.toast.showToast( ` Selected personality :
` +t.name,4,!0)}else this. $ store.state.toast.showToast( ` Could not unmount personality
2024-02-10 00:32:22 +00:00
Error : ` +e.error,4,!1);this.loading=!1},async unmount_personality(n){if(!n)return{status:!1,error:"no personality - unmount_personality"};const e={language:n.language,category:n.category,folder:n.folder};try{const t=await Le.post("/unmount_personality",e);if(t)return t.data}catch(t){console.log(t.message,"unmount_personality - settings");return}},async onPersonalitySelected(n){if(console.log("on pers",n),console.log("selecting ",n),n){if(n.selected){this. $ store.state.toast.showToast("Personality already selected",4,!0);return}const e=n.language===null?n.full_path:n.full_path+":"+n.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 t=await this.select_personality(n);console.log("pers is mounted",t),t&&t.status&&t.active_personality_id>-1?this. $ store.state.toast.showToast( ` Selected personality :
2024-01-11 01:32:21 +00:00
` +n.name,4,!0):this. $ store.state.toast.showToast( ` Error on select personality :
2024-02-10 20:35:27 +00:00
` +n.name,4,!1)}else console.log("mounting pers");this. $ emit("personalitySelected"),Be(()=>{Ge.replace()})}},async select_personality(n){if(!n)return{status:!1,error:"no personality - select_personality"};const e=n.language===null?n.full_path:n.full_path+":"+n.language;console.log("Selecting personality ",e);const i={id:this. $ store.state.config.personalities.findIndex(s=>s===e)};try{const s=await Le.post("/select_personality",i);if(s)return this. $ store.dispatch("refreshConfig").then(()=>{this. $ store.dispatch("refreshPersonalitiesZoo").then(()=>{this. $ store.dispatch("refreshMountedPersonalities")})}),s.data}catch(s){console.log(s.message,"select_personality - settings");return}},emitloaded(){this. $ emit("loaded")},showModels(n){n.preventDefault();const e=this. $ refs.modelsSelectionList;console.log(e);const t=new MouseEvent("click");e.dispatchEvent(t)},setModel(n){console.log("Setting model to "+n.name),this.selecting_model=!0,this.selectedModel=n,Le.post("/update_setting",{setting_name:"model_name",setting_value:n.name}).then(async e=>{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.toast.showToast( ` Error $ { e } ` ,4,!0),this.selecting_model=!1})},download_database(){Le.get("/download_database")},remove_file(n){Le.get("/remove_file",{name:n}).then(e=>{console.log(e)})},clear_files(){Le.get("/clear_personality_files_list").then(n=>{console.log(n),n.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(n,e){const t=new FileReader,i=24*1024;let s=0,r=0;t.onloadend=()=>{if(t.error){console.error("Error reading file:",t.error);return}const a=t.result,l=s+a.byteLength>=n.size; $ e.emit("send_file_chunk",{filename:n.name,chunk:a,offset:s,isLastChunk:l,chunkIndex:r}),s+=a.byteLength,r++,l?(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=n.slice(s,s+i);t.readAsArrayBuffer(a)}console.log("Uploading file"),o()},makeAnEmptyUserMessage(){this. $ emit("createEmptyUserMessage",this.message),this.message=""},makeAnEmptyAIMessage(){this. $ emit("createEmptyAIMessage")},startSpeechRecognition(){"SpeechRecognition"in window||"webkitSpeechRecognition"in window?(this.recognition=new(window.SpeechRecognition||window.webkitSpeechRecognition),this.recognition.lang=this. $ store.state.config.audio_in_language,this.recognition.interimResults=!0,this.recognition.onstart=()=>{this.isLesteningToVoice=!0,this.silenceTimer=setTimeout(()=>{this.recognition.stop()},this.silenceTimeout)},this.recognition.onresult=n=>{let e="";for(let t=n.resultIndex;t<n.results.length;t++)e+=n.results[t][0].transcript;this.message=e,clearTimeout(this.silenceTimer),this.silenceTimer=setTimeout(()=>{this.recognition.stop()},this.silenceTimeout)},this.recognition.onerror=n=>{console.error("Speech recognition error:",n.error),this.isLesteningToVoice=!1,clearTimeout(this.silenceTimer)},this.recognition.onend=()=>{console.log("Speech recognition ended."),this.isLesteningToVoice=!1,clearTimeout(this.silenceTimer),this.submit()},this.recognition.start()):console.error("Speech recognition is not supported in this browser.")},onPersonalitiesReadyFun(){this.personalities_ready=!0},onShowPersListFun(n){this.showPersonalities=!this.showPersonalities},handleOnTalk(n){this.showPersonalities=!1,this.onTalk(n)},onMountFun(n){console.log("Mounting personality"),this. $ refs.mountedPers.constructor()},onUnmountFun(n){console.log("Unmounting personality"),this. $ refs.mountedPers.constructor()},onRemount(n){console.log("Remounting chat"),this. $ refs.mountedPers.constructor()},computedFileSize(n){return Be(()=>{Ge.replace()}),Ki(n)},removeItem(n){this.file
2024-02-10 21:10:19 +00:00
` ,544),[[Ue,s.message]])]),u("div",gbt,[u("button",{onClick:e[8]||(e[8]=ye((...d)=>r.toggleSwitch&&r.toggleSwitch(...d),["prevent"]))},[(O(),D("svg",bbt,[u("rect",{x:"10",y:"15",width:"40",height:"20",rx:"12",ry:"12",fill:r.config.activate_internet_search?"green":"red"},null,8,Ebt),u("circle",{cx:"20",cy:"25",r:"7",visibility:r.config.activate_internet_search?"hidden":"visible"},null,8,vbt),u("circle",{cx:"38",cy:"25",r:"7",visibility:r.config.activate_internet_search?"visible":"hidden"},null,8,Sbt)]))]),ybt]),u("div",Tbt,[t.loading?K("",!0):(O(),D("button",{key:0,type:"button",onClick:e[9]||(e[9]=(...d)=>r.submit&&r.submit(...d)),title:"Send",class:"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer transform transition-transform hover:translate-y-[-5px] active:scale-90"},Cbt)),Rbt]),u("div",Abt,[t.loading?K("",!0):(O(),D("button",{key:0,type:"button",onClick:e[10]||(e[10]=(...d)=>r.startSpeechRecognition&&r.startSpeechRecognition(...d)),class:We([{"text-red-500":s.isLesteningToVoice},"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer transform transition-transform hover:translate-y-[-5px] active:scale-90"])},Nbt,2)),Obt]),u("div",Ibt,[u("input",{type:"file",ref:"fileDialog",style:{display:"none"},onChange:e[11]||(e[11]=(...d)=>r.addFiles&&r.addFiles(...d)),multiple:""},null,544),u("button",{type:"button",onClick:e[12]||(e[12]=ye(d=>n. $ refs.fileDialog.click(),["stop"])),class:"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer transform transition-transform hover:translate-y-[-5px] active:scale-90"},Dbt),kbt]),u("div",Lbt,[u("button",{type:"button",onClick:e[13]||(e[13]=ye((...d)=>r.takePicture&&r.takePicture(...d),["stop"])),class:"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer transform transition-transform hover:translate-y-[-5px] active:scale-90"},Ubt),Fbt]),u("div",Bbt,[u("button",{type:"button",onClick:e[14]||(e[14]=ye((...d)=>r.addWebLink&&r.addWebLink(...d),["stop"])),class:"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer transform transition-transform hover:translate-y-[-5px] active:scale-90"},Vbt),zbt]),u("div",Hbt,[t.loading?K("",!0):(O(),D("button",{key:0,type:"button",onClick:e[15]||(e[15]=(...d)=>r.makeAnEmptyUserMessage&&r.makeAnEmptyUserMessage(...d)),class:"w-6 text-blue-400 hover:text-secondary duration-75 active:scale-90"},Ybt)), $ bt]),u("div",Wbt,[t.loading?K("",!0):(O(),D("button",{key:0,type:"button",onClick:e[16]||(e[16]=(...d)=>r.makeAnEmptyAIMessage&&r.makeAnEmptyAIMessage(...d)),class:"w-6 text-red-400 hover:text-secondary duration-75 active:scale-90"},jbt)),Qbt])]),Xbt])])]),Oe(c,{ref:"universalForm",class:"z-20"},null,512)],64)}const GN=gt(hgt,[["render",Zbt],["__scopeId","data-v-bc913420"]]),Jbt={name:"WelcomeComponent",setup(){return{}}},eEt={class:"flex flex-col text-center"},tEt=Nu('<div class="flex flex-col text-center items-center"><div class="flex items-center gap-3 text-5xl drop-shadow-md align-middle pt-24"><img class="w-24 animate-bounce" title="LoLLMS WebUI" src="'+ca+'" alt="Logo"><div class="flex flex-col items-start"><p class="text-2xl">LoLLMS</p><p class="text-gray-400 text-base">One tool to rule them all</p></div></div><hr class="mt-1 w-96 h-1 mx-auto my-2 md:my-2 dark:bg-bg-dark-tone-panel bg-bg-light-tone-panel border-0 rounded"><p class="text-2xl">Welcome</p><p class="text-lg">Please create a new discussion or select existing one to start</p></div>',1),nEt=[tEt];function iEt(n,e,t,i,s,r){return O(),D("div",eEt,nEt)}const VN=gt(Jbt,[["render",iEt]]);var sEt=function(){function n(e,t){t===void 0&&(t=[]),this._eventType=e,this._eventFunctions=t}return n.prototype.init=function(){var e=this;this._eventFunctions.forEach(function(t){typeof window<"u"&&window.addEventListener(e._eventType,t)})},n}(),Kd=globalThis&&globalThis.__assign||function(){return Kd=Object.assign||function(n){for(var e,t=1,i=arguments.length;t<i;t++){e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=e[s])}return n},Kd.apply(this,arguments)},jd={alwaysOp
2024-01-11 01:32:21 +00:00
` +t,4,!1),this.isLoading=!1)})}catch(t){this. $ store.state.toast.showToast( ` Did not get binding settings responses .
2024-02-10 21:10:19 +00:00
Endpoint error : ` +t.message,4,!1),this.isLoading=!1}}):(this. $ store.state.toast.showToast("Binding has no settings",4,!1),this.isLoading=!1))})}catch(n){this.isLoading=!1,this. $ store.state.toast.showToast("Could not open binding settings. Endpoint error: "+n.message,4,!1)}},showDatabaseSelector(){this.database_selectorDialogVisible=!0},async ondatabase_selectorDialogSelected(n){console.log("Selected:",n)},onclosedatabase_selectorDialog(){this.database_selectorDialogVisible=!1},async onvalidatedatabase_selectorChoice(n){if(this.database_selectorDialogVisible=!1,(await Le.post("/select_database",{name:n})).status){console.log("Selected database"),this. $ store.state.config=await Le.get("/get_config"),console.log("new config loaded :",this. $ store.state.config);let t=await Le.get("/list_databases").data;console.log("New list of database: ",t),this. $ store.state.databases=t,console.log("New list of database: ",this. $ store.state.databases),location.reload()}},async toggleLTM(){this. $ store.state.config.activate_ltm=!this. $ store.state.config.activate_ltm,await this.applyConfiguration(), $ e.emit("upgrade_vectorization")},async applyConfiguration(){this.loading=!0;const n=await Le.post("/apply_settings",{config:this. $ store.state.config});this.loading=!1,n.data.status?this. $ store.state.toast.showToast("Configuration changed successfully.",4,!0):this. $ store.state.toast.showToast("Configuration change failed.",4,!1),Be(()=>{Ge.replace()})},save_configuration(){this.showConfirmation=!1,Le.post("/save_settings",{}).then(n=>{if(n)return n.status?this. $ store.state.toast.showToast("Settings saved!",4,!0):this. $ store.state.messageBox.showMessage("Error: Couldn't save settings!"),n.data}).catch(n=>(console.log(n.message,"save_configuration"),this. $ store.state.messageBox.showMessage("Couldn't save settings!"),{status:!1}))},showToastMessage(n,e,t){console.log("sending",n),this. $ store.state.toast.showToast(n,e,t)},togglePanel(){this.panelCollapsed=!this.panelCollapsed},toggleDropdown(){this.isOpen=!this.isOpen},importChatGPT(){},async api_get_req(n){try{const e=await Le.get("/"+n);if(e)return e.data}catch(e){console.log(e.message,"api_get_req");return}},async list_discussions(){try{const n=await Le.get("/list_discussions");if(n)return this.createDiscussionList(n.data),n.data}catch(n){return console.log("Error: Could not list discussions",n.message),[]}},load_discussion(n,e){n&&(console.log("Loading discussion",n),this.loading=!0,this.discussionArr=[],this.setDiscussionLoading(n,this.loading), $ e.on("discussion",t=>{this.loading=!1,this.setDiscussionLoading(n,this.loading),t&&(this.discussionArr=t.filter(i=>i.message_type==this.msgTypes.MSG_TYPE_CHUNK||i.message_type==this.msgTypes.MSG_TYPE_FULL||i.message_type==this.msgTypes.MSG_TYPE_FULL_INVISIBLE_TO_AI||i.message_type==this.msgTypes.MSG_TYPE_CODE||i.message_type==this.msgTypes.MSG_TYPE_JSON_INFOS||i.message_type==this.msgTypes.MSG_TYPE_UI),console.log("this.discussionArr"),console.log(this.discussionArr),e&&e()), $ e.off("discussion")}), $ e.emit("load_discussion",{id:n}))},recoverFiles(){console.log("Recovering files"),Le.get("/get_current_personality_files_list").then(n=>{this. $ refs.chatBox.filesList=n.data.files,this. $ refs.chatBox.isFileSentList=n.data.files.map(e=>!0),console.log( ` Files recovered : $ { this . $refs . chatBox . filesList } ` )})},new_discussion(n){try{this.loading=!0, $ e.on("discussion_created",e=>{ $ e.off("discussion_created"),this.list_discussions().then(()=>{const t=this.list.findIndex(s=>s.id==e.id),i=this.list[t];this.selectDiscussion(i),this.load_discussion(e.id,()=>{this.loading=!1,this.recoverFiles(),Be(()=>{const s=document.getElementById("dis-"+e.id);this.scrollToElement(s),console.log("Scrolling tp "+s)})})})}),console.log("new_discussion ",n), $ e.emit("new_discussion",{title:n})}catch(e){return console.log("Error: Could not create new discussion",e.message),{}}},async delete_discussion(n){try{n&&(this.loading=!0,this.setDiscussionLoading(n,this.loading),await Le.post("/delete_discussion",{client_id:this.client_id,id:n}),this.loading=!1,this.setDiscussionLoading(n,this.loading))}ca
2024-02-08 22:04:27 +00:00
Personality : $ { n . message . personality } ` );let s="";n.created_at_parsed&&(s= `
Created : $ { n . created _at _parsed } ` );let r="";n.message.model&&(r= ` Model : $ { n . message . model } ` );let o="";n.message.seed&&(o= ` Seed : $ { n . message . seed } ` );let a="";n.time_spent&&(a= `
Time spent : $ { n . time _spent } ` );let l="";l= ` $ { t } $ { r } $ { o } $ { a } ` .trim();const c= ` $ { n . message . sender } $ { i } $ { s }
2024-01-11 01:32:21 +00:00
2024-02-08 22:04:27 +00:00
$ { e }
2024-01-11 01:32:21 +00:00
2024-02-10 10:33:09 +00:00
$ { l } ` ;navigator.clipboard.writeText(c)}else navigator.clipboard.writeText(e);this. $ store.state.toast.showToast("Copied to clipboard successfully",4,!0),Be(()=>{Ge.replace()})},closeToast(){this.showToast=!1},saveJSONtoFile(n,e){e=e||"data.json";const t=document.createElement("a");t.href=URL.createObjectURL(new Blob([JSON.stringify(n,null,2)],{type:"text/plain"})),t.setAttribute("download",e),document.body.appendChild(t),t.click(),document.body.removeChild(t)},saveMarkdowntoFile(n,e){e=e||"data.md";const t=document.createElement("a");t.href=URL.createObjectURL(new Blob([n],{type:"text/plain"})),t.setAttribute("download",e),document.body.appendChild(t),t.click(),document.body.removeChild(t)},parseJsonObj(n){try{return JSON.parse(n)}catch(e){return this. $ store.state.toast.showToast( ` Could not parse JSON .
2024-01-11 01:32:21 +00:00
` +e.message,4,!1),null}},async parseJsonFile(n){return new Promise((e,t)=>{const i=new FileReader;i.onload=s=>e(this.parseJsonObj(s.target.result)),i.onerror=s=>t(s),i.readAsText(n)})},async exportDiscussionsAsMarkdown(){const n=this.list.filter(e=>e.checkBoxValue==!0).map(e=>e.id);if(n.length>0){console.log("export",n);let e=new Date;const t=e.getFullYear(),i=(e.getMonth()+1).toString().padStart(2,"0"),s=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"),c="discussions_export_"+(t+"."+i+"."+s+"."+r+o+a)+".md";this.loading=!0;const d=await this.export_multiple_discussions(n,"markdown");d?(this.saveMarkdowntoFile(d,c),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 exportDiscussionsAsJson(){const n=this.list.filter(e=>e.checkBoxValue==!0).map(e=>e.id);if(n.length>0){console.log("export",n);let e=new Date;const t=e.getFullYear(),i=(e.getMonth()+1).toString().padStart(2,"0"),s=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"),c="discussions_export_"+(t+"."+i+"."+s+"."+r+o+a)+".json";this.loading=!0;const d=await this.export_multiple_discussions(n,"json");d?(this.saveJSONtoFile(d,c),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 importDiscussions(n){const e=await this.parseJsonFile(n.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 n=this. $ store.state.personalities;this.personalityAvatars=n.map(e=>({name:e.name,avatar:e.avatar}))},getAvatar(n){if(n.toLowerCase().trim()==this. $ store.state.config.user_name.toLowerCase().trim())return"user_infos/"+this. $ store.state.config.user_avatar;const e=this.personalityAvatars.findIndex(i=>i.name===n),t=this.personalityAvatars[e];if(t)return console.log("Avatar",t.avatar),t.avatar},setFileListChat(n){try{this. $ refs.chatBox.fileList=this. $ refs.chatBox.fileList.concat(n)}catch(e){this. $ store.state.toast.showToast( ` Failed to set filelist in chatbox
2024-02-10 21:10:19 +00:00
` +e.message,4,!1)}this.isDragOverChat=!1},async setFileListDiscussion(n){if(n.length>1){this. $ store.state.toast.showToast("Failed to import discussions. Too many files",4,!1);return}const e=await this.parseJsonFile(n[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(){for(this. $ nextTick(()=>{Ge.replace()}), $ e.on("disucssion_renamed",n=>{console.log("Received new title",n.discussion_id,n.title);const e=this.list.findIndex(i=>i.id==n.discussion_id),t=this.list[e];t.title=n.title}), $ e.onclose=n=>{console.log("WebSocket connection closed:",n.code,n.reason),this.socketIODisconnected()}, $ e.on("connect_error",n=>{n.message==="ERR_CONNECTION_REFUSED"?console.error("Connection refused. The server is not available."):console.error("Connection error:",n),this. $ store.state.isConnected=!1}), $ e.onerror=n=>{console.log("WebSocket connection error:",n.code,n.reason),this.socketIODisconnected(), $ e.disconnect()}, $ e.on("connected",this.socketIOConnected), $ e.on("disconnected",this.socketIODisconnected),console.log("Added events"),console.log("Waiting to be ready");this. $ store.state.ready===!1;)await new Promise(n=>setTimeout(n,100)),console.log(this. $ store.state.ready);console.log("Ready"),this.setPageTitle(),await this.list_discussions(),this.loadLastUsedDiscussion(), $ e.on("show_progress",this.show_progress), $ e.on("hide_progress",this.hide_progress), $ e.on("update_progress",this.update_progress), $ e.on("notification",this.notify), $ e.on("new_message",this.new_message), $ e.on("update_message",this.streamMessageContent), $ e.on("close_message",this.finalMsgEvent), $ e.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.isCreated=!0},async mounted(){this. $ nextTick(()=>{Ge.replace()})},async activated(){for(;this.isReady===!1;)await new Promise(n=>setTimeout(n,100));await this.getPersonalityAvatars(),console.log("Avatars found:",this.personalityAvatars),this.isCreated&&Be(()=>{const n=document.getElementById("messages-list");this.scrollBottom(n)})},components:{Discussion:UN,Message:BN,ChatBox:GN,WelcomeComponent:VN,ChoiceDialog:oE,ProgressBar:Kl,InputBox:FN},watch:{progress_visibility_val(n){console.log("progress_visibility changed")},filterTitle(n){n==""&&(this.filterInProgress=!0,this.list=this.tempList,this.filterInProgress=!1)},isCheckbox(n){Be(()=>{Ge.replace()}),n||(this.isSelectAll=!1)},socketConnected(n){console.log("Websocket connected (watch)",n)},showConfirmation(){Be(()=>{Ge.replace()})},isSearch(){Be(()=>{Ge.replace()})}},computed:{progress_visibility:{get(){return self.progress_visibility_val}},version_info:{get(){return this. $ store.state.version!=null&&this. $ store.state.version!="unknown"?" v"+this. $ store.state.version:""}},loading_infos:{get(){return this. $ store.state.loading_infos}},loading_progress:{get(){return this. $ store.state.loading_progress}},isModelOk:{get(){return this. $ store.state.isModelOk},set(n){this. $ store.state.isModelOk=n}},isGenerating:{get(){return this. $ store.state.isGenerating},set(n){this. $ store.state.isGenerating=n}},formatted_database_name(){const n=this. $ store.state.config.db_path;return n.slice(0,n.length-3)},UseDiscussionHistory(){return this. $ store.state.config.activate_ltm},isReady:{get(){return this. $ store.state.ready}},databases(){return this. $ store.state.databases},client_id(){return $ e.id},isReady(){return console.log("verify ready",this.isCreated),this.isCreated},showPanel(){return this. $ store.state.ready&&!this.panelCollapsed},socketConnected(){return console.log(" --- > Websocket connected"),this. $ store.commit("setIsConne
2024-01-11 01:32:21 +00:00
* @ license
* Copyright 2010 - 2023 Three . js Authors
* SPDX - License - Identifier : MIT
2024-02-10 20:35:27 +00:00
* / c o n s t A E = " 1 5 9 " , z S t = 0 , f C = 1 , H S t = 2 , l O = 1 , q S t = 2 , g s = 3 , O s = 0 , K n = 1 , H i = 2 , c r = 0 , J o = 1 , m C = 2 , g C = 3 , b C = 4 , Y S t = 5 , G r = 1 0 0 , $ S t = 1 0 1 , W S t = 1 0 2 , E C = 1 0 3 , v C = 1 0 4 , K S t = 2 0 0 , j S t = 2 0 1 , Q S t = 2 0 2 , X S t = 2 0 3 , G g = 2 0 4 , V g = 2 0 5 , Z S t = 2 0 6 , J S t = 2 0 7 , e y t = 2 0 8 , t y t = 2 0 9 , n y t = 2 1 0 , i y t = 2 1 1 , s y t = 2 1 2 , r y t = 2 1 3 , o y t = 2 1 4 , a y t = 0 , l y t = 1 , c y t = 2 , s u = 3 , d y t = 4 , u y t = 5 , p y t = 6 , _ y t = 7 , w E = 0 , h y t = 1 , f y t = 2 , d r = 0 , m y t = 1 , g y t = 2 , b y t = 3 , E y t = 4 , v y t = 5 , S C = " a t t a c h e d " , S y t = " d e t a c h e d " , c O = 3 0 0 , m a = 3 0 1 , g a = 3 0 2 , z g = 3 0 3 , H g = 3 0 4 , X u = 3 0 6 , b a = 1 e 3 , d i = 1 0 0 1 , r u = 1 0 0 2 , g n = 1 0 0 3 , q g = 1 0 0 4 , O d = 1 0 0 5 , Y n = 1 0 0 6 , d O = 1 0 0 7 , i o = 1 0 0 8 , u r = 1 0 0 9 , y y t = 1 0 1 0 , T y t = 1 0 1 1 , N E = 1 0 1 2 , u O = 1 0 1 3 , r r = 1 0 1 4 , v s = 1 0 1 5 , X l = 1 0 1 6 , p O = 1 0 1 7 , _ O = 1 0 1 8 , j r = 1 0 2 0 , x y t = 1 0 2 1 , u i = 1 0 2 3 , C y t = 1 0 2 4 , R y t = 1 0 2 5 , Q r = 1 0 2 6 , E a = 1 0 2 7 , A y t = 1 0 2 8 , h O = 1 0 2 9 , w y t = 1 0 3 0 , f O = 1 0 3 1 , m O = 1 0 3 3 , v m = 3 3 7 7 6 , S m = 3 3 7 7 7 , y m = 3 3 7 7 8 , T m = 3 3 7 7 9 , y C = 3 5 8 4 0 , T C = 3 5 8 4 1 , x C = 3 5 8 4 2 , C C = 3 5 8 4 3 , g O = 3 6 1 9 6 , R C = 3 7 4 9 2 , A C = 3 7 4 9 6 , w C = 3 7 8 0 8 , N C = 3 7 8 0 9 , O C = 3 7 8 1 0 , I C = 3 7 8 1 1 , M C = 3 7 8 1 2 , D C = 3 7 8 1 3 , k C = 3 7 8 1 4 , L C = 3 7 8 1 5 , P C = 3 7 8 1 6 , U C = 3 7 8 1 7 , F C = 3 7 8 1 8 , B C = 3 7 8 1 9 , G C = 3 7 8 2 0 , V C = 3 7 8 2 1 , x m = 3 6 4 9 2 , z C = 3 6 4 9 4 , H C = 3 6 4 9 5 , N y t = 3 6 2 8 3 , q C = 3 6 2 8 4 , Y C = 3 6 2 8 5 , $ C = 3 6 2 8 6 , Z l = 2 3 0 0 , v a = 2 3 0 1 , C m = 2 3 0 2 , W C = 2 4 0 0 , K C = 2 4 0 1 , j C = 2 4 0 2 , O y t = 2 5 0 0 , I y t = 0 , b O = 1 , Y g = 2 , E O = 3 e 3 , X r = 3 0 0 1 , M y t = 3 2 0 0 , D y t = 3 2 0 1 , O E = 0 , k y t = 1 , p i = " " , n n = " s r g b " , C n = " s r g b - l i n e a r " , I E = " d i s p l a y - p 3 " , Z u = " d i s p l a y - p 3 - l i n e a r " , o u = " l i n e a r " , W t = " s r g b " , a u = " r e c 7 0 9 " , l u = " p 3 " , y o = 7 6 8 0 , Q C = 5 1 9 , L y t = 5 1 2 , P y t = 5 1 3 , U y t = 5 1 4 , v O = 5 1 5 , F y t = 5 1 6 , B y t = 5 1 7 , G y t = 5 1 8 , V y t = 5 1 9 , $ g = 3 5 0 4 4 , X C = " 3 0 0 e s " , W g = 1 0 3 5 , S s = 2 e 3 , c u = 2 0 0 1 ; c l a s s V a { a d d E v e n t L i s t e n e r ( e , t ) { t h i s . _ l i s t e n e r s = = = v o i d 0 & & ( t h i s . _ l i s t e n e r s = { } ) ; c o n s t i = t h i s . _ l i s t e n e r s ; i [ e ] = = = v o i d 0 & & ( i [ e ] = [ ] ) , i [ e ] . i n d e x O f ( t ) = = = - 1 & & i [ e ] . p u s h ( t ) } h a s E v e n t L i s t e n e r ( e , t ) { i f ( t h i s . _ l i s t e n e r s = = = v o i d 0 ) r e t u r n ! 1 ; c o n s t i = t h i s . _ l i s t e n e r s ; r e t u r n i [ e ] ! = = v o i d 0 & & i [ e ] . i n d e x O f ( t ) ! = = - 1 } r e m o v e E v e n t L i s t e n e r ( e , t ) { i f ( t h i s . _ l i s t e n e r s = = = v o i d 0 ) r e t u r n ; c o n s t s = t h i s . _ l i s t e n e r s [ e ] ; i f ( s ! = = v o i d 0 ) { c o n s t r = s . i n d e x O f ( t ) ; r ! = = - 1 & & s . s p l i c e ( r , 1 ) } } d i s p a t c h E v e n t ( e ) { i f ( t h i s . _ l i s t e n e r s = = = v o i d 0 ) r e t u r n ; c o n s t i = t h i s . _ l i s t e n e r s [ e . t y p e ] ; i f ( i ! = = v o i d 0 ) { e . t a r g e t = t h i s ; c o n s t s = i . s l i c e ( 0 ) ; f o r ( l e t r = 0 , o = s . l e n g t h ; r < o ; r + + ) s [ r ] . c a l l ( t h i s , e ) ; e . t a r g e t = n u l l } } } c o n s t A n = [ " 0 0 " , " 0 1 " , " 0 2 " , " 0 3 " , " 0 4 " , " 0 5 " , " 0 6 " , " 0 7 " , " 0 8 " , " 0 9 " , " 0 a " , " 0 b " , " 0 c " , " 0 d " , " 0 e " , " 0 f " , " 1 0 " , " 1 1 " , " 1 2 " , " 1 3 " , " 1 4 " , " 1 5 " , " 1 6 " , " 1 7 " , " 1 8 " , " 1 9 " , " 1 a " , " 1 b " , " 1 c " , " 1 d " , " 1 e " , " 1 f " , " 2 0 " , " 2 1 " , " 2 2 " , " 2 3 " , " 2 4 " , " 2 5 " , " 2 6 " , " 2 7 " , " 2 8 " , " 2 9 " , " 2 a " , " 2 b " , " 2 c " , " 2 d " , " 2 e " , " 2 f " , " 3 0 " , " 3 1 " , " 3 2 " , " 3 3 " , " 3 4 " , " 3 5 " , " 3 6 " , " 3 7 " , " 3 8 " , " 3 9 " , " 3 a " , " 3 b " , " 3 c " , " 3 d " , " 3 e " , " 3 f " , " 4 0 " , " 4 1 " , " 4 2 " , " 4 3 " , " 4 4 " , " 4 5 " , " 4 6 " , " 4 7 " , " 4 8 " , " 4 9 " , " 4 a " , " 4 b " , " 4 c " , " 4 d " , " 4 e " , " 4 f " , " 5 0 " , " 5 1 " , " 5 2 " , " 5 3 " , " 5 4 " , " 5 5 " , " 5 6 " , " 5 7 " , " 5 8 " , " 5 9 " , " 5 a " , " 5 b " , " 5 c " , " 5 d " , " 5 e " , " 5 f " , " 6 0 " , " 6 1 " , " 6 2 " , " 6 3 " , " 6 4 " , " 6 5 " , " 6 6 " , " 6 7 " , " 6 8 " , " 6 9 " , " 6 a " , " 6 b " , " 6 c " , " 6 d " , " 6 e " , " 6 f " , " 7 0 " , " 7 1 " , " 7 2 " , " 7 3 " , " 7 4 " , " 7 5 " , " 7 6 " , " 7 7 " , " 7 8 " , " 7 9 " , " 7 a " , " 7 b " , " 7 c " , " 7 d " , " 7 e " , " 7 f " , " 8 0 " , " 8 1 " , " 8 2 " , " 8 3 " , " 8 4 " , " 8 5 " , " 8 6 " , " 8 7 " , " 8 8 " , " 8 9 " , " 8 a " , " 8 b " , " 8 c " , " 8 d " , " 8 e " , " 8 f " , " 9 0 " , " 9 1 " , " 9 2 " , " 9 3 " , " 9 4 " , " 9 5 " , " 9 6 " , " 9 7 " , " 9 8 " , " 9 9 " , " 9 a " , " 9 b " , " 9 c " , " 9 d " , " 9 e " , " 9 f " , " a 0 " , " a 1 " , " a 2 " , " a 3 " , " a 4 " , " a 5 " , " a 6 " , " a 7 " , " a 8 " , " a 9 " , " a a " , " a b " , " a c " , " a d " , " a e " , " a f " , " b 0 " , " b 1 " , " b 2 " , " b 3 " , " b 4 " , " b 5 " , " b 6 " , " b 7 " , " b 8 " , " b 9 " , " b a " , " b b " , " b c " , " b d " , " b e " , " b f " , " c 0 " , " c 1 " , " c 2 " , " c 3 " , " c 4 " , " c 5 " , " c 6 " , " c 7 " , " c 8 " , " c 9 " , " c a " , " c b " , " c c " , " c d " , " c e " , " c f " , " d 0 " , " d 1 " , " d 2 " , " d 3 " , " d 4 " , " d 5 " , " d 6 " , " d 7 " , " d 8 " , " d 9 " , " d a " , " d b " , " d c " , " d d " , " d e " , " d f " , " e 0 " , " e 1 " , " e 2 " , " e 3 " , " e 4 " , " e 5 " , " e 6 " , " e 7 " , " e 8 " , " e 9 " , " e a " , " e b " , " e c " , " e d " , " e e " , " e f " , " f 0 " , " f 1 " , " f 2 " , " f 3 " , " f 4 " , " f 5 " , " f 6 " , " f 7 " , " f 8 " , " f 9 " , " f a " , " f b " , " f c " , " f d " , " f e " , " f f " ] ; l e t Z C = 1 2 3 4 5 6 7 ; c o n s t N l = M a t h . P I / 1 8 0 , S a = 1 8 0 / M a t h . P I ; f u n c t i o n D i ( ) { c o n s t n = M a t h . r a n d o m ( ) * 4 2 9 4 9 6 7 2 9 5 | 0 , e = M a t h . r a n d o m ( ) * 4 2 9 4 9 6 7 2 9 5 | 0 , t = M a t h . r a n d o m ( ) * 4 2 9 4 9 6 7 2 9 5 | 0 , i = M a t h . r a n d o m ( ) * 4 2 9 4 9 6 7 2 9 5 | 0 ; r e t u r n ( A n [ n & 2 5 5 ] + A n [ n > > 8 & 2 5 5 ] + A n [ n > > 1 6 & 2 5 5 ] + A n [ n > > 2 4 & 2 5 5 ] + " - " + A n [ e & 2 5 5 ] + A n [ e > > 8 & 2 5 5 ] + " - " + A n [ e > > 1 6 & 1 5 | 6 4 ] + A n [ e > > 2 4 & 2 5 5 ] + " - " + A n [ t & 6 3 | 1 2 8 ] + A n [ t > > 8 & 2 5 5 ] + " - " + A n [ t > > 1 6 & 2 5 5 ] + A n [ t > > 2 4 & 2 5 5 ] + A n [ i & 2 5 5 ] + A n [ i > > 8 & 2 5 5 ] + A n [ i > > 1 6 & 2 5 5 ] + A n [ i > > 2 4 & 2 5 5 ] ) . t o L o w e r C a s e ( ) } f u n c t i o n O n ( n , e , t ) { r e t u r n M a t h . m a x ( e , M a t h . m i n ( t , n ) ) } f u n c t i o n M E ( n , e ) { r e t u r n ( n % e + e ) % e } f u n c t i o n z y t ( n , e , t , i , s ) { r e t u r n i + ( n - e ) * ( s - i ) / ( t - e ) } f u n c t i o n H y t ( n , e , t ) { r e t u r n n ! = = e ? ( t - n ) / ( e - n ) : 0 } f u n c t i o n O l ( n , e , t ) { r e t u r n ( 1 - t ) * n + t * e } f u n c t i o n q y t ( n , e , t , i ) { r e t u r n O l ( n , e , 1 - M a t h . e x p ( - t * i ) ) } f u n c t i o n Y y t ( n , e = 1 ) { r e t u r n e - M a t h . a b s ( M E ( n , e * 2 ) - e ) } f u n c t i o n $ y t ( n , e , t ) { r e t u r n n < = e ? 0 : n > = t ? 1 : ( n = ( n - e ) / ( t - e ) , n * n * ( 3 - 2 * n ) ) } f u n c t i o n W y t ( n , e , t ) { r e t u r n
2024-01-11 01:32:21 +00:00
gl _Position = projectionMatrix * modelViewMatrix * vec4 ( position , 1.0 ) ;
2024-02-10 20:35:27 +00:00
} ` ,T0t= ` void main ( ) {
2024-01-11 01:32:21 +00:00
gl _FragColor = vec4 ( 1.0 , 0.0 , 0.0 , 1.0 ) ;
2024-02-10 20:35:27 +00:00
} ` ;class ro extends ki{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=y0t,this.fragmentShader=T0t,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=ya(e.uniforms),this.uniformsGroups=v0t(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 t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const s in this.uniforms){const o=this.uniforms[s].value;o&&o.isTexture?t.uniforms[s]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[s]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[s]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[s]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[s]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[s]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[s]={type:"m4",value:o.toArray()}:t.uniforms[s]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const i={};for(const s in this.extensions)this.extensions[s]===!0&&(i[s]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}class OO extends en{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Tt,this.projectionMatrix=new Tt,this.projectionMatrixInverse=new Tt,this.coordinateSystem=Ss}copy(e,t){return super.copy(e,t),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,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class Un extends OO{constructor(e=50,t=1,i=.1,s=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=s,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),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 t=.5*this.getFilmHeight()/e;this.fov=Sa*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Nl*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Sa*2*Math.atan(Math.tan(Nl*.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,t,i,s,r,o){this.aspect=e/t,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=t,this.view.offsetX=i,this.view.offsetY=s,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 t=e*Math.tan(Nl*.5*this.fov)/this.zoom,i=2*t,s=this.aspect*i,r=-
2024-01-11 01:32:21 +00:00
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 ) ;
}
2024-02-10 20:35:27 +00:00
` },s=new pr(5,5,5),r=new ro({name:"CubemapFromEquirect",uniforms:ya(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Kn,blending:cr});r.uniforms.tEquirect.value=t;const o=new Fn(s,r),a=t.minFilter;return t.minFilter===io&&(t.minFilter=Yn),new x0t(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,i,s){const r=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,i,s);e.setRenderTarget(r)}}const zm=new he,R0t=new he,A0t=new yt;class Dr{constructor(e=new he(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,s){return this.normal.set(e,t,i),this.constant=s,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const s=zm.subVectors(i,t).cross(R0t.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(s,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,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const i=e.delta(zm),s=this.normal.dot(i);if(s===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const r=-(e.start.dot(this.normal)+this.constant)/s;return r<0||r>1?null:t.copy(e.start).addScaledVector(i,r)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>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,t){const i=t||A0t.getNormalMatrix(e),s=this.coplanarPoint(zm).applyMatrix4(e),r=this.normal.applyMatrix3(i).normalize();return this.constant=-s.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 Or=new ns,ad=new he;class DE{constructor(e=new Dr,t=new Dr,i=new Dr,s=new Dr,r=new Dr,o=new Dr){this.planes=[e,t,i,s,r,o]}set(e,t,i,s,r,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(i),a[3].copy(s),a[4].copy(r),a[5].copy(o),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=Ss){const i=this.planes,s=e.elements,r=s[0],o=s[1],a=s[2],l=s[3],c=s[4],d=s[5],_=s[6],h=s[7],m=s[8],f=s[9],E=s[10],b=s[11],g=s[12],v=s[13],y=s[14],T=s[15];if(i[0].setComponents(l-r,h-c,b-m,T-g).normalize(),i[1].setComponents(l+r,h+c,b+m,T+g).normalize(),i[2].setComponents(l+o,h+d,b+f,T+v).normalize(),i[3].setComponents(l-o,h-d,b-f,T-v).normalize(),i[4].setComponents(l-a,h-_,b-E,T-y).normalize(),t===Ss)i[5].setComponents(l+a,h+_,b+E,T+y).normalize();else if(t===cu)i[5].setComponents(a,_,E,y).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Or.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Or.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Or)}intersectsSprite(e){return Or.center.set(0,0,0),Or.radius=.7071067811865476,Or.applyMatrix4(e.matrixWorld),this.intersectsSphere(Or)}intersectsSphere(e){const t=this.planes,i=e.center,s=-e.radius;for(let r=0;r<6;r++)if(t[r].distanceToPoint(i)<s)return!1;return!0}intersectsBox(e){const t=this.planes;for(let i=0;i<6;i++){const s=t[i];if(ad.x=s.normal.x>0?e.max.x:e.min.x,ad.y=s.normal.y>0?e.max.y:e.min.y,ad.z=s.normal.z>0?e.max.z:e.min.z,s.distanceToPoint(ad)<0)return!1}ret
2024-01-11 01:32:21 +00:00
if ( diffuseColor . a < getAlphaHashThreshold ( vPosition ) ) discard ;
2024-02-10 20:35:27 +00:00
# endif ` ,O0t= ` # ifdef USE _ALPHAHASH
2024-01-11 01:32:21 +00:00
const float ALPHA _HASH _SCALE = 0.05 ;
float hash2D ( vec2 value ) {
return fract ( 1.0 e4 * 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.0 e - 6 , 1.0 ) ;
}
2024-02-10 20:35:27 +00:00
# endif ` ,I0t= ` # ifdef USE _ALPHAMAP
2024-02-07 19:55:49 +00:00
diffuseColor . a *= texture2D ( alphaMap , vAlphaMapUv ) . g ;
2024-02-10 20:35:27 +00:00
# endif ` ,M0t= ` # ifdef USE _ALPHAMAP
2024-01-11 01:32:21 +00:00
uniform sampler2D alphaMap ;
2024-02-10 20:35:27 +00:00
# endif ` ,D0t= ` # ifdef USE _ALPHATEST
2024-02-07 19:55:49 +00:00
if ( diffuseColor . a < alphaTest ) discard ;
2024-02-10 20:35:27 +00:00
# endif ` ,k0t= ` # ifdef USE _ALPHATEST
2024-01-11 01:32:21 +00:00
uniform float alphaTest ;
2024-02-10 20:35:27 +00:00
# endif ` ,L0t= ` # ifdef USE _AOMAP
2024-01-11 01:32:21 +00:00
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
2024-02-10 20:35:27 +00:00
# endif ` ,P0t= ` # ifdef USE _AOMAP
2024-01-11 01:32:21 +00:00
uniform sampler2D aoMap ;
uniform float aoMapIntensity ;
2024-02-10 20:35:27 +00:00
# endif ` ,U0t= ` # ifdef USE _BATCHING
2024-01-11 01:32:21 +00:00
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 ) ;
}
2024-02-10 20:35:27 +00:00
# endif ` ,F0t= ` # ifdef USE _BATCHING
2024-01-11 01:32:21 +00:00
mat4 batchingMatrix = getBatchingMatrix ( batchId ) ;
2024-02-10 20:35:27 +00:00
# endif ` ,B0t= ` vec3 transformed = vec3 ( position ) ;
2024-01-11 01:32:21 +00:00
# ifdef USE _ALPHAHASH
vPosition = vec3 ( position ) ;
2024-02-10 20:35:27 +00:00
# endif ` ,G0t= ` vec3 objectNormal = vec3 ( normal ) ;
2024-01-11 01:32:21 +00:00
# ifdef USE _TANGENT
vec3 objectTangent = vec3 ( tangent . xyz ) ;
2024-02-10 20:35:27 +00:00
# endif ` ,V0t= ` float G _BlinnPhong _Implicit ( ) {
2024-01-11 01:32:21 +00:00
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 ) ;
2024-02-10 20:35:27 +00:00
} // validated`,z0t=`#ifdef USE_IRIDESCENCE
2024-01-11 01:32:21 +00:00
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.0 e - 9 ;
vec3 val = vec3 ( 5.4856 e - 13 , 4.4201 e - 13 , 5.2481 e - 13 ) ;
vec3 pos = vec3 ( 1.6810 e + 06 , 1.7953 e + 06 , 2.2084 e + 06 ) ;
vec3 var = vec3 ( 4.3278 e + 09 , 9.3046 e + 09 , 6.6121 e + 09 ) ;
vec3 xyz = val * sqrt ( 2.0 * PI * var ) * cos ( pos * phase + shift ) * exp ( - pow2 ( phase ) * var ) ;
xyz . x += 9.7470 e - 14 * sqrt ( 2.0 * PI * 4.5282 e + 09 ) * cos ( 2.2399 e + 06 * phase + shift [ 0 ] ) * exp ( - 4.5282 e + 09 * pow2 ( phase ) ) ;
xyz /= 1.0685 e - 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 ) ) ;
}
2024-02-10 20:35:27 +00:00
# endif ` ,H0t= ` # ifdef USE _BUMPMAP
2024-01-11 01:32:21 +00:00
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 ) ;
}
2024-02-10 20:35:27 +00:00
# endif ` ,q0t= ` # if NUM _CLIPPING _PLANES > 0
2024-01-11 01:32:21 +00:00
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
2024-02-10 20:35:27 +00:00
# endif ` ,Y0t= ` # if NUM _CLIPPING _PLANES > 0
2024-02-03 18:04:43 +00:00
varying vec3 vClipPosition ;
2024-02-07 19:55:49 +00:00
uniform vec4 clippingPlanes [ NUM _CLIPPING _PLANES ] ;
2024-02-10 20:35:27 +00:00
# endif ` , $ 0t= ` # if NUM _CLIPPING _PLANES > 0
2024-02-07 19:55:49 +00:00
varying vec3 vClipPosition ;
2024-02-10 20:35:27 +00:00
# endif ` ,W0t= ` # if NUM _CLIPPING _PLANES > 0
2024-01-11 01:32:21 +00:00
vClipPosition = - mvPosition . xyz ;
2024-02-10 20:35:27 +00:00
# endif ` ,K0t= ` # if defined ( USE _COLOR _ALPHA )
2024-01-11 01:32:21 +00:00
diffuseColor *= vColor ;
# elif defined ( USE _COLOR )
diffuseColor . rgb *= vColor ;
2024-02-10 20:35:27 +00:00
# endif ` ,j0t= ` # if defined ( USE _COLOR _ALPHA )
2024-01-11 01:32:21 +00:00
varying vec4 vColor ;
# elif defined ( USE _COLOR )
varying vec3 vColor ;
2024-02-10 20:35:27 +00:00
# endif ` ,Q0t= ` # if defined ( USE _COLOR _ALPHA )
2024-01-11 01:32:21 +00:00
varying vec4 vColor ;
# elif defined ( USE _COLOR ) || defined ( USE _INSTANCING _COLOR )
varying vec3 vColor ;
2024-02-10 20:35:27 +00:00
# endif ` ,X0t= ` # if defined ( USE _COLOR _ALPHA )
2024-01-11 01:32:21 +00:00
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 ;
2024-02-10 20:35:27 +00:00
# endif ` ,Z0t= ` # define PI 3.141592653589793
2024-01-11 01:32:21 +00:00
# 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 ) ;
2024-02-10 20:35:27 +00:00
} // validated`,J0t=`#ifdef ENVMAP_TYPE_CUBE_UV
2024-01-11 01:32:21 +00:00
# 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 ) ;
}
}
2024-02-10 20:35:27 +00:00
# endif ` ,eTt= ` vec3 transformedNormal = objectNormal ;
2024-01-11 01:32:21 +00:00
# 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
2024-02-10 20:35:27 +00:00
# endif ` ,tTt= ` # ifdef USE _DISPLACEMENTMAP
2024-01-11 01:32:21 +00:00
uniform sampler2D displacementMap ;
uniform float displacementScale ;
uniform float displacementBias ;
2024-02-10 20:35:27 +00:00
# endif ` ,nTt= ` # ifdef USE _DISPLACEMENTMAP
2024-01-11 01:32:21 +00:00
transformed += normalize ( objectNormal ) * ( texture2D ( displacementMap , vDisplacementMapUv ) . x * displacementScale + displacementBias ) ;
2024-02-10 20:35:27 +00:00
# endif ` ,iTt= ` # ifdef USE _EMISSIVEMAP
2024-01-11 01:32:21 +00:00
vec4 emissiveColor = texture2D ( emissiveMap , vEmissiveMapUv ) ;
totalEmissiveRadiance *= emissiveColor . rgb ;
2024-02-10 20:35:27 +00:00
# endif ` ,sTt= ` # ifdef USE _EMISSIVEMAP
2024-01-11 01:32:21 +00:00
uniform sampler2D emissiveMap ;
2024-02-10 20:35:27 +00:00
# endif ` ,rTt="gl_FragColor = linearToOutputTexel( gl_FragColor );",oTt= `
2024-01-11 01:32:21 +00:00
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 ) ;
2024-02-10 20:35:27 +00:00
} ` ,aTt= ` # ifdef USE _ENVMAP
2024-01-11 01:32:21 +00:00
# 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
2024-02-10 20:35:27 +00:00
# endif ` ,lTt= ` # ifdef USE _ENVMAP
2024-01-11 01:32:21 +00:00
uniform float envMapIntensity ;
uniform float flipEnvMap ;
# ifdef ENVMAP _TYPE _CUBE
uniform samplerCube envMap ;
# else
uniform sampler2D envMap ;
# endif
2024-02-10 20:35:27 +00:00
# endif ` ,cTt= ` # ifdef USE _ENVMAP
2024-01-11 01:32:21 +00:00
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
2024-02-10 20:35:27 +00:00
# endif ` ,dTt= ` # ifdef USE _ENVMAP
2024-01-11 01:32:21 +00:00
# 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
2024-02-10 20:35:27 +00:00
# endif ` ,uTt= ` # ifdef USE _ENVMAP
2024-01-11 01:32:21 +00:00
# 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
2024-02-10 20:35:27 +00:00
# endif ` ,pTt= ` # ifdef USE _FOG
2024-02-07 19:55:49 +00:00
vFogDepth = - mvPosition . z ;
2024-02-10 20:35:27 +00:00
# endif ` ,_Tt= ` # ifdef USE _FOG
2024-02-07 19:55:49 +00:00
varying float vFogDepth ;
2024-02-10 20:35:27 +00:00
# endif ` ,hTt= ` # ifdef USE _FOG
2024-01-11 01:32:21 +00:00
# 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 ) ;
2024-02-10 20:35:27 +00:00
# endif ` ,fTt= ` # ifdef USE _FOG
2024-01-11 01:32:21 +00:00
uniform vec3 fogColor ;
varying float vFogDepth ;
# ifdef FOG _EXP2
uniform float fogDensity ;
# else
uniform float fogNear ;
uniform float fogFar ;
# endif
2024-02-10 20:35:27 +00:00
# endif ` ,mTt= ` # ifdef USE _GRADIENTMAP
2024-01-11 01:32:21 +00:00
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
2024-02-10 20:35:27 +00:00
} ` ,gTt= ` # ifdef USE _LIGHTMAP
2024-01-11 01:32:21 +00:00
vec4 lightMapTexel = texture2D ( lightMap , vLightMapUv ) ;
vec3 lightMapIrradiance = lightMapTexel . rgb * lightMapIntensity ;
reflectedLight . indirectDiffuse += lightMapIrradiance ;
2024-02-10 20:35:27 +00:00
# endif ` ,bTt= ` # ifdef USE _LIGHTMAP
2024-01-11 01:32:21 +00:00
uniform sampler2D lightMap ;
uniform float lightMapIntensity ;
2024-02-10 20:35:27 +00:00
# endif ` ,ETt= ` LambertMaterial material ;
2024-01-11 01:32:21 +00:00
material . diffuseColor = diffuseColor . rgb ;
2024-02-10 20:35:27 +00:00
material . specularStrength = specularStrength ; ` ,vTt= ` varying vec3 vViewPosition ;
2024-01-11 01:32:21 +00:00
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
2024-02-10 20:35:27 +00:00
# define RE _IndirectDiffuse RE _IndirectDiffuse _Lambert ` ,STt= ` uniform bool receiveShadow ;
2024-01-11 01:32:21 +00:00
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 ;
}
2024-02-10 20:35:27 +00:00
# endif ` ,yTt= ` # ifdef USE _ENVMAP
2024-01-11 01:32:21 +00:00
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
2024-02-10 20:35:27 +00:00
# endif ` ,TTt= ` ToonMaterial material ;
material . diffuseColor = diffuseColor . rgb ; ` ,xTt= ` varying vec3 vViewPosition ;
2024-01-11 01:32:21 +00:00
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
2024-02-10 20:35:27 +00:00
# define RE _IndirectDiffuse RE _IndirectDiffuse _Toon ` ,CTt= ` BlinnPhongMaterial material ;
2024-01-11 01:32:21 +00:00
material . diffuseColor = diffuseColor . rgb ;
material . specularColor = specular ;
material . specularShininess = shininess ;
2024-02-10 20:35:27 +00:00
material . specularStrength = specularStrength ; ` ,RTt= ` varying vec3 vViewPosition ;
2024-01-11 01:32:21 +00:00
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
2024-02-10 20:35:27 +00:00
# define RE _IndirectDiffuse RE _IndirectDiffuse _BlinnPhong ` ,ATt= ` PhysicalMaterial material ;
2024-01-11 01:32:21 +00:00
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 ;
2024-02-10 20:35:27 +00:00
# endif ` ,wTt= ` struct PhysicalMaterial {
2024-01-11 01:32:21 +00:00
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 ) ;
2024-02-10 20:35:27 +00:00
} ` ,NTt= `
2024-01-11 01:32:21 +00:00
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 ) ;
2024-02-10 20:35:27 +00:00
# endif ` ,OTt= ` # if defined ( RE _IndirectDiffuse )
2024-01-11 01:32:21 +00:00
# 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
2024-02-10 20:35:27 +00:00
# endif ` ,ITt= ` # if defined ( RE _IndirectDiffuse )
2024-01-11 01:32:21 +00:00
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 ) ;
2024-02-10 20:35:27 +00:00
# endif ` ,MTt= ` # if defined ( USE _LOGDEPTHBUF ) && defined ( USE _LOGDEPTHBUF _EXT )
2024-02-07 19:55:49 +00:00
gl _FragDepthEXT = vIsPerspective == 0.0 ? gl _FragCoord . z : log2 ( vFragDepth ) * logDepthBufFC * 0.5 ;
2024-02-10 20:35:27 +00:00
# endif ` ,DTt= ` # if defined ( USE _LOGDEPTHBUF ) && defined ( USE _LOGDEPTHBUF _EXT )
2024-01-11 01:32:21 +00:00
uniform float logDepthBufFC ;
varying float vFragDepth ;
varying float vIsPerspective ;
2024-02-10 20:35:27 +00:00
# endif ` ,kTt= ` # ifdef USE _LOGDEPTHBUF
2024-01-11 01:32:21 +00:00
# ifdef USE _LOGDEPTHBUF _EXT
varying float vFragDepth ;
varying float vIsPerspective ;
# else
uniform float logDepthBufFC ;
# endif
2024-02-10 20:35:27 +00:00
# endif ` ,LTt= ` # ifdef USE _LOGDEPTHBUF
2024-01-11 01:32:21 +00:00
# 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
2024-02-10 20:35:27 +00:00
# endif ` ,PTt= ` # ifdef USE _MAP
2024-01-11 01:32:21 +00:00
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 ;
2024-02-10 20:35:27 +00:00
# endif ` ,UTt= ` # ifdef USE _MAP
2024-01-11 01:32:21 +00:00
uniform sampler2D map ;
2024-02-10 20:35:27 +00:00
# endif ` ,FTt= ` # if defined ( USE _MAP ) || defined ( USE _ALPHAMAP )
2024-01-11 01:32:21 +00:00
# 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 ;
2024-02-10 20:35:27 +00:00
# endif ` ,BTt= ` # if defined ( USE _POINTS _UV )
2024-01-11 01:32:21 +00:00
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 ;
2024-02-10 20:35:27 +00:00
# endif ` ,GTt= ` float metalnessFactor = metalness ;
2024-01-11 01:32:21 +00:00
# ifdef USE _METALNESSMAP
vec4 texelMetalness = texture2D ( metalnessMap , vMetalnessMapUv ) ;
metalnessFactor *= texelMetalness . b ;
2024-02-10 20:35:27 +00:00
# endif ` ,VTt= ` # ifdef USE _METALNESSMAP
2024-01-11 01:32:21 +00:00
uniform sampler2D metalnessMap ;
2024-02-10 20:35:27 +00:00
# endif ` ,zTt= ` # if defined ( USE _MORPHCOLORS ) && defined ( MORPHTARGETS _TEXTURE )
2024-01-11 01:32:21 +00:00
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
}
2024-02-10 20:35:27 +00:00
# endif ` ,HTt= ` # ifdef USE _MORPHNORMALS
2024-01-11 01:32:21 +00:00
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
2024-02-10 20:35:27 +00:00
# endif ` ,qTt= ` # ifdef USE _MORPHTARGETS
2024-01-11 01:32:21 +00:00
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
2024-02-10 20:35:27 +00:00
# endif ` ,YTt= ` # ifdef USE _MORPHTARGETS
2024-01-11 01:32:21 +00:00
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
2024-02-10 20:35:27 +00:00
# endif ` , $ Tt= ` float faceDirection = gl _FrontFacing ? 1.0 : - 1.0 ;
2024-01-11 01:32:21 +00:00
# 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
2024-02-10 20:35:27 +00:00
vec3 nonPerturbedNormal = normal ; ` ,WTt= ` # ifdef USE _NORMALMAP _OBJECTSPACE
2024-01-11 01:32:21 +00:00
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 ) ;
2024-02-10 20:35:27 +00:00
# endif ` ,KTt= ` # ifndef FLAT _SHADED
2024-01-11 01:32:21 +00:00
varying vec3 vNormal ;
# ifdef USE _TANGENT
varying vec3 vTangent ;
varying vec3 vBitangent ;
# endif
2024-02-10 20:35:27 +00:00
# endif ` ,jTt= ` # ifndef FLAT _SHADED
2024-01-11 01:32:21 +00:00
varying vec3 vNormal ;
# ifdef USE _TANGENT
varying vec3 vTangent ;
varying vec3 vBitangent ;
# endif
2024-02-10 20:35:27 +00:00
# endif ` ,QTt= ` # ifndef FLAT _SHADED
2024-01-11 01:32:21 +00:00
vNormal = normalize ( transformedNormal ) ;
# ifdef USE _TANGENT
vTangent = normalize ( transformedTangent ) ;
vBitangent = normalize ( cross ( vNormal , vTangent ) * tangent . w ) ;
# endif
2024-02-10 20:35:27 +00:00
# endif ` ,XTt= ` # ifdef USE _NORMALMAP
2024-01-11 01:32:21 +00:00
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 ) ;
}
2024-02-10 20:35:27 +00:00
# endif ` ,ZTt= ` # ifdef USE _CLEARCOAT
2024-01-11 01:32:21 +00:00
vec3 clearcoatNormal = nonPerturbedNormal ;
2024-02-10 20:35:27 +00:00
# endif ` ,JTt= ` # ifdef USE _CLEARCOAT _NORMALMAP
2024-01-11 01:32:21 +00:00
vec3 clearcoatMapN = texture2D ( clearcoatNormalMap , vClearcoatNormalMapUv ) . xyz * 2.0 - 1.0 ;
clearcoatMapN . xy *= clearcoatNormalScale ;
clearcoatNormal = normalize ( tbn2 * clearcoatMapN ) ;
2024-02-10 20:35:27 +00:00
# endif ` ,ext= ` # ifdef USE _CLEARCOATMAP
2024-01-11 01:32:21 +00:00
uniform sampler2D clearcoatMap ;
# endif
# ifdef USE _CLEARCOAT _NORMALMAP
uniform sampler2D clearcoatNormalMap ;
uniform vec2 clearcoatNormalScale ;
# endif
# ifdef USE _CLEARCOAT _ROUGHNESSMAP
uniform sampler2D clearcoatRoughnessMap ;
2024-02-10 20:35:27 +00:00
# endif ` ,txt= ` # ifdef USE _IRIDESCENCEMAP
2024-01-11 01:32:21 +00:00
uniform sampler2D iridescenceMap ;
# endif
# ifdef USE _IRIDESCENCE _THICKNESSMAP
uniform sampler2D iridescenceThicknessMap ;
2024-02-10 20:35:27 +00:00
# endif ` ,nxt= ` # ifdef OPAQUE
2024-01-11 01:32:21 +00:00
diffuseColor . a = 1.0 ;
# endif
# ifdef USE _TRANSMISSION
diffuseColor . a *= material . transmissionAlpha ;
# endif
2024-02-10 20:35:27 +00:00
gl _FragColor = vec4 ( outgoingLight , diffuseColor . a ) ; ` ,ixt= ` vec3 packNormalToRGB ( const in vec3 normal ) {
2024-01-11 01:32:21 +00:00
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 ) ;
2024-02-10 20:35:27 +00:00
} ` ,sxt= ` # ifdef PREMULTIPLIED _ALPHA
2024-01-11 01:32:21 +00:00
gl _FragColor . rgb *= gl _FragColor . a ;
2024-02-10 20:35:27 +00:00
# endif ` ,rxt= ` vec4 mvPosition = vec4 ( transformed , 1.0 ) ;
2024-01-11 01:32:21 +00:00
# ifdef USE _BATCHING
mvPosition = batchingMatrix * mvPosition ;
# endif
# ifdef USE _INSTANCING
mvPosition = instanceMatrix * mvPosition ;
# endif
mvPosition = modelViewMatrix * mvPosition ;
2024-02-10 20:35:27 +00:00
gl _Position = projectionMatrix * mvPosition ; ` ,oxt= ` # ifdef DITHERING
2024-01-11 01:32:21 +00:00
gl _FragColor . rgb = dithering ( gl _FragColor . rgb ) ;
2024-02-10 20:35:27 +00:00
# endif ` ,axt= ` # ifdef DITHERING
2024-01-11 01:32:21 +00:00
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 ;
}
2024-02-10 20:35:27 +00:00
# endif ` ,lxt= ` float roughnessFactor = roughness ;
2024-01-11 01:32:21 +00:00
# ifdef USE _ROUGHNESSMAP
vec4 texelRoughness = texture2D ( roughnessMap , vRoughnessMapUv ) ;
roughnessFactor *= texelRoughness . g ;
2024-02-10 20:35:27 +00:00
# endif ` ,cxt= ` # ifdef USE _ROUGHNESSMAP
2024-01-11 01:32:21 +00:00
uniform sampler2D roughnessMap ;
2024-02-10 20:35:27 +00:00
# endif ` ,dxt= ` # if NUM _SPOT _LIGHT _COORDS > 0
2024-01-11 01:32:21 +00:00
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
}
2024-02-10 20:35:27 +00:00
# endif ` ,uxt= ` # if NUM _SPOT _LIGHT _COORDS > 0
2024-01-11 01:32:21 +00:00
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
2024-02-10 20:35:27 +00:00
# endif ` ,pxt= ` # if ( defined ( USE _SHADOWMAP ) && ( NUM _DIR _LIGHT _SHADOWS > 0 || NUM _POINT _LIGHT _SHADOWS > 0 ) ) || ( NUM _SPOT _LIGHT _COORDS > 0 )
2024-01-11 01:32:21 +00:00
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
2024-02-10 20:35:27 +00:00
# endif ` ,_xt= ` float getShadowMask ( ) {
2024-01-11 01:32:21 +00:00
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 ;
2024-02-10 20:35:27 +00:00
} ` ,hxt= ` # ifdef USE _SKINNING
2024-01-11 01:32:21 +00:00
mat4 boneMatX = getBoneMatrix ( skinIndex . x ) ;
mat4 boneMatY = getBoneMatrix ( skinIndex . y ) ;
mat4 boneMatZ = getBoneMatrix ( skinIndex . z ) ;
mat4 boneMatW = getBoneMatrix ( skinIndex . w ) ;
2024-02-10 20:35:27 +00:00
# endif ` ,fxt= ` # ifdef USE _SKINNING
2024-01-11 01:32:21 +00:00
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 ) ;
}
2024-02-10 20:35:27 +00:00
# endif ` ,mxt= ` # ifdef USE _SKINNING
2024-01-11 01:32:21 +00:00
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 ;
2024-02-10 20:35:27 +00:00
# endif ` ,gxt= ` # ifdef USE _SKINNING
2024-01-11 01:32:21 +00:00
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
2024-02-10 20:35:27 +00:00
# endif ` ,bxt= ` float specularStrength ;
2024-01-11 01:32:21 +00:00
# ifdef USE _SPECULARMAP
vec4 texelSpecular = texture2D ( specularMap , vSpecularMapUv ) ;
specularStrength = texelSpecular . r ;
# else
specularStrength = 1.0 ;
2024-02-10 20:35:27 +00:00
# endif ` ,Ext= ` # ifdef USE _SPECULARMAP
2024-01-11 01:32:21 +00:00
uniform sampler2D specularMap ;
2024-02-10 20:35:27 +00:00
# endif ` ,vxt= ` # if defined ( TONE _MAPPING )
2024-01-11 01:32:21 +00:00
gl _FragColor . rgb = toneMapping ( gl _FragColor . rgb ) ;
2024-02-10 20:35:27 +00:00
# endif ` ,Sxt= ` # ifndef saturate
2024-01-11 01:32:21 +00:00
# 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 ) ;
}
2024-02-10 20:35:27 +00:00
vec3 CustomToneMapping ( vec3 color ) { return color ; } ` ,yxt= ` # ifdef USE _TRANSMISSION
2024-01-11 01:32:21 +00:00
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 ) ;
2024-02-10 20:35:27 +00:00
# endif ` ,Txt= ` # ifdef USE _TRANSMISSION
2024-01-11 01:32:21 +00:00
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 ) ;
}
2024-02-10 20:35:27 +00:00
# endif ` ,xxt= ` # if defined ( USE _UV ) || defined ( USE _ANISOTROPY )
2024-01-11 01:32:21 +00:00
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 ;
2024-02-10 20:35:27 +00:00
# endif ` ,Cxt= ` # if defined ( USE _UV ) || defined ( USE _ANISOTROPY )
2024-01-11 01:32:21 +00:00
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 ;
2024-02-10 20:35:27 +00:00
# endif ` ,Rxt= ` # if defined ( USE _UV ) || defined ( USE _ANISOTROPY )
2024-01-11 01:32:21 +00:00
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 ;
2024-02-10 20:35:27 +00:00
# endif ` ,Axt= ` # if defined ( USE _ENVMAP ) || defined ( DISTANCE ) || defined ( USE _SHADOWMAP ) || defined ( USE _TRANSMISSION ) || NUM _SPOT _LIGHT _COORDS > 0
2024-01-11 01:32:21 +00:00
vec4 worldPosition = vec4 ( transformed , 1.0 ) ;
# ifdef USE _BATCHING
worldPosition = batchingMatrix * worldPosition ;
# endif
# ifdef USE _INSTANCING
worldPosition = instanceMatrix * worldPosition ;
# endif
worldPosition = modelMatrix * worldPosition ;
2024-02-10 20:35:27 +00:00
# endif ` ;const wxt= ` varying vec2 vUv ;
2024-01-11 01:32:21 +00:00
uniform mat3 uvTransform ;
void main ( ) {
vUv = ( uvTransform * vec3 ( uv , 1 ) ) . xy ;
gl _Position = vec4 ( position . xy , 1.0 , 1.0 ) ;
2024-02-10 20:35:27 +00:00
} ` ,Nxt= ` uniform sampler2D t2D ;
2024-01-11 01:32:21 +00:00
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 >
2024-02-10 20:35:27 +00:00
} ` ,Oxt= ` varying vec3 vWorldDirection ;
2024-01-11 01:32:21 +00:00
# include < common >
void main ( ) {
vWorldDirection = transformDirection ( position , modelMatrix ) ;
# include < begin _vertex >
# include < project _vertex >
gl _Position . z = gl _Position . w ;
2024-02-10 20:35:27 +00:00
} ` ,Ixt= ` # ifdef ENVMAP _TYPE _CUBE
2024-01-11 01:32:21 +00:00
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 >
2024-02-10 20:35:27 +00:00
} ` ,Mxt= ` varying vec3 vWorldDirection ;
2024-01-11 01:32:21 +00:00
# include < common >
void main ( ) {
vWorldDirection = transformDirection ( position , modelMatrix ) ;
# include < begin _vertex >
# include < project _vertex >
gl _Position . z = gl _Position . w ;
2024-02-10 20:35:27 +00:00
} ` ,Dxt= ` uniform samplerCube tCube ;
2024-01-11 01:32:21 +00:00
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 >
2024-02-10 20:35:27 +00:00
} ` ,kxt= ` # include < common >
2024-01-11 01:32:21 +00:00
# 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 ;
2024-02-10 20:35:27 +00:00
} ` ,Lxt= ` # if DEPTH _PACKING == 3200
2024-01-11 01:32:21 +00:00
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
2024-02-10 20:35:27 +00:00
} ` ,Pxt= ` # define DISTANCE
2024-01-11 01:32:21 +00:00
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 ;
2024-02-10 20:35:27 +00:00
} ` ,Uxt= ` # define DISTANCE
2024-01-11 01:32:21 +00:00
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 ) ;
2024-02-10 20:35:27 +00:00
} ` ,Fxt= ` varying vec3 vWorldDirection ;
2024-01-11 01:32:21 +00:00
# include < common >
void main ( ) {
vWorldDirection = transformDirection ( position , modelMatrix ) ;
# include < begin _vertex >
# include < project _vertex >
2024-02-10 20:35:27 +00:00
} ` ,Bxt= ` uniform sampler2D tEquirect ;
2024-01-11 01:32:21 +00:00
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 >
2024-02-10 20:35:27 +00:00
} ` ,Gxt= ` uniform float scale ;
2024-01-11 01:32:21 +00:00
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 >
2024-02-10 20:35:27 +00:00
} ` ,Vxt= ` uniform vec3 diffuse ;
2024-01-11 01:32:21 +00:00
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 >
2024-02-10 20:35:27 +00:00
} ` ,zxt= ` # include < common >
2024-01-11 01:32:21 +00:00
# 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 >
2024-02-10 20:35:27 +00:00
} ` ,Hxt= ` uniform vec3 diffuse ;
2024-01-11 01:32:21 +00:00
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 >
2024-02-10 20:35:27 +00:00
} ` ,qxt= ` # define LAMBERT
2024-01-11 01:32:21 +00:00
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 >
2024-02-10 20:35:27 +00:00
} ` ,Yxt= ` # define LAMBERT
2024-01-11 01:32:21 +00:00
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 >
2024-02-10 20:35:27 +00:00
} ` , $ xt= ` # define MATCAP
2024-01-11 01:32:21 +00:00
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 ;
2024-02-10 20:35:27 +00:00
} ` ,Wxt= ` # define MATCAP
2024-01-11 01:32:21 +00:00
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 >
2024-02-10 20:35:27 +00:00
} ` ,Kxt= ` # define NORMAL
2024-01-11 01:32:21 +00:00
# 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
2024-02-10 20:35:27 +00:00
} ` ,jxt= ` # define NORMAL
2024-01-11 01:32:21 +00:00
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
2024-02-10 20:35:27 +00:00
} ` ,Qxt= ` # define PHONG
2024-01-11 01:32:21 +00:00
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 >
2024-02-10 20:35:27 +00:00
} ` ,Xxt= ` # define PHONG
2024-01-11 01:32:21 +00:00
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 >
2024-02-10 20:35:27 +00:00
} ` ,Zxt= ` # define STANDARD
2024-01-11 01:32:21 +00:00
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
2024-02-10 20:35:27 +00:00
} ` ,Jxt= ` # define STANDARD
2024-01-11 01:32:21 +00:00
# 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 >
2024-02-10 20:35:27 +00:00
} ` ,eCt= ` # define TOON
2024-01-11 01:32:21 +00:00
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 >
2024-02-10 20:35:27 +00:00
} ` ,tCt= ` # define TOON
2024-01-11 01:32:21 +00:00
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 >
2024-02-10 20:35:27 +00:00
} ` ,nCt= ` uniform float size ;
2024-01-11 01:32:21 +00:00
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 >
2024-02-10 20:35:27 +00:00
} ` ,iCt= ` uniform vec3 diffuse ;
2024-01-11 01:32:21 +00:00
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 >
2024-02-10 20:35:27 +00:00
} ` ,sCt= ` # include < common >
2024-01-11 01:32:21 +00:00
# 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 >
2024-02-10 20:35:27 +00:00
} ` ,rCt= ` uniform vec3 color ;
2024-01-11 01:32:21 +00:00
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 >
2024-02-10 20:35:27 +00:00
} ` ,oCt= ` uniform float rotation ;
2024-01-11 01:32:21 +00:00
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 >
2024-02-10 20:35:27 +00:00
} ` ,aCt= ` uniform vec3 diffuse ;
2024-01-11 01:32:21 +00:00
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 >
2024-02-10 20:35:27 +00:00
} ` ,vt={alphahash_fragment:N0t,alphahash_pars_fragment:O0t,alphamap_fragment:I0t,alphamap_pars_fragment:M0t,alphatest_fragment:D0t,alphatest_pars_fragment:k0t,aomap_fragment:L0t,aomap_pars_fragment:P0t,batching_pars_vertex:U0t,batching_vertex:F0t,begin_vertex:B0t,beginnormal_vertex:G0t,bsdfs:V0t,iridescence_fragment:z0t,bumpmap_pars_fragment:H0t,clipping_planes_fragment:q0t,clipping_planes_pars_fragment:Y0t,clipping_planes_pars_vertex: $ 0t,clipping_planes_vertex:W0t,color_fragment:K0t,color_pars_fragment:j0t,color_pars_vertex:Q0t,color_vertex:X0t,common:Z0t,cube_uv_reflection_fragment:J0t,defaultnormal_vertex:eTt,displacementmap_pars_vertex:tTt,displacementmap_vertex:nTt,emissivemap_fragment:iTt,emissivemap_pars_fragment:sTt,colorspace_fragment:rTt,colorspace_pars_fragment:oTt,envmap_fragment:aTt,envmap_common_pars_fragment:lTt,envmap_pars_fragment:cTt,envmap_pars_vertex:dTt,envmap_physical_pars_fragment:yTt,envmap_vertex:uTt,fog_vertex:pTt,fog_pars_vertex:_Tt,fog_fragment:hTt,fog_pars_fragment:fTt,gradientmap_pars_fragment:mTt,lightmap_fragment:gTt,lightmap_pars_fragment:bTt,lights_lambert_fragment:ETt,lights_lambert_pars_fragment:vTt,lights_pars_begin:STt,lights_toon_fragment:TTt,lights_toon_pars_fragment:xTt,lights_phong_fragment:CTt,lights_phong_pars_fragment:RTt,lights_physical_fragment:ATt,lights_physical_pars_fragment:wTt,lights_fragment_begin:NTt,lights_fragment_maps:OTt,lights_fragment_end:ITt,logdepthbuf_fragment:MTt,logdepthbuf_pars_fragment:DTt,logdepthbuf_pars_vertex:kTt,logdepthbuf_vertex:LTt,map_fragment:PTt,map_pars_fragment:UTt,map_particle_fragment:FTt,map_particle_pars_fragment:BTt,metalnessmap_fragment:GTt,metalnessmap_pars_fragment:VTt,morphcolor_vertex:zTt,morphnormal_vertex:HTt,morphtarget_pars_vertex:qTt,morphtarget_vertex:YTt,normal_fragment_begin: $ Tt,normal_fragment_maps:WTt,normal_pars_fragment:KTt,normal_pars_vertex:jTt,normal_vertex:QTt,normalmap_pars_fragment:XTt,clearcoat_normal_fragment_begin:ZTt,clearcoat_normal_fragment_maps:JTt,clearcoat_pars_fragment:ext,iridescence_pars_fragment:txt,opaque_fragment:nxt,packing:ixt,premultiplied_alpha_fragment:sxt,project_vertex:rxt,dithering_fragment:oxt,dithering_pars_fragment:axt,roughnessmap_fragment:lxt,roughnessmap_pars_fragment:cxt,shadowmap_pars_fragment:dxt,shadowmap_pars_vertex:uxt,shadowmap_vertex:pxt,shadowmask_pars_fragment:_xt,skinbase_vertex:hxt,skinning_pars_vertex:fxt,skinning_vertex:mxt,skinnormal_vertex:gxt,specularmap_fragment:bxt,specularmap_pars_fragment:Ext,tonemapping_fragment:vxt,tonemapping_pars_fragment:Sxt,transmission_fragment:yxt,transmission_pars_fragment:Txt,uv_pars_fragment:xxt,uv_pars_vertex:Cxt,uv_vertex:Rxt,worldpos_vertex:Axt,background_vert:wxt,background_frag:Nxt,backgroundCube_vert:Oxt,backgroundCube_frag:Ixt,cube_vert:Mxt,cube_frag:Dxt,depth_vert:kxt,depth_frag:Lxt,distanceRGBA_vert:Pxt,distanceRGBA_frag:Uxt,equirect_vert:Fxt,equirect_frag:Bxt,linedashed_vert:Gxt,linedashed_frag:Vxt,meshbasic_vert:zxt,meshbasic_frag:Hxt,meshlambert_vert:qxt,meshlambert_frag:Yxt,meshmatcap_vert: $ xt,meshmatcap_frag:Wxt,meshnormal_vert:Kxt,meshnormal_frag:jxt,meshphong_vert:Qxt,meshphong_frag:Xxt,meshphysical_vert:Zxt,meshphysical_frag:Jxt,meshtoon_vert:eCt,meshtoon_frag:tCt,points_vert:nCt,points_frag:iCt,shadow_vert:sCt,shadow_frag:rCt,sprite_vert:oCt,sprite_frag:aCt},He={common:{diffuse:{value:new pt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new yt},alphaMap:{value:null},alphaMapTransform:{value:new yt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new yt}},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 yt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new yt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new yt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new yt},normalScale:{value:new At(1,1)}},displacementmap:{displacementMap:{value:
2024-01-11 01:32:21 +00:00
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 ) ;
}
}
2024-02-10 00:32:22 +00:00
` ,blending:cr,depthTest:!1,depthWrite:!1})}function v1(){return new ro({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:PE(),fragmentShader: `
2024-01-11 01:32:21 +00:00
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 ) ;
}
2024-02-10 00:32:22 +00:00
` ,blending:cr,depthTest:!1,depthWrite:!1})}function S1(){return new ro({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:PE(),fragmentShader: `
2024-01-11 01:32:21 +00:00
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 ) ) ;
}
2024-02-04 10:11:55 +00:00
` ,blending:cr,depthTest:!1,depthWrite:!1})}function PE(){return `
2024-01-11 01:32:21 +00:00
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 ) ;
}
2024-02-10 20:35:27 +00:00
` }function mCt(n){let e=new WeakMap,t=null;function i(a){if(a&&a.isTexture){const l=a.mapping,c=l===zg||l===Hg,d=l===ma||l===ga;if(c||d)if(a.isRenderTargetTexture&&a.needsPMREMUpdate===!0){a.needsPMREMUpdate=!1;let _=e.get(a);return t===null&&(t=new b1(n)),_=c?t.fromEquirectangular(a,_):t.fromCubemap(a,_),e.set(a,_),_.texture}else{if(e.has(a))return e.get(a).texture;{const _=a.image;if(c&&_&&_.height>0||d&&_&&s(_)){t===null&&(t=new b1(n));const h=c?t.fromEquirectangular(a):t.fromCubemap(a);return e.set(a,h),a.addEventListener("dispose",r),h.texture}else return null}}}return a}function s(a){let l=0;const c=6;for(let d=0;d<c;d++)a[d]!==void 0&&l++;return l===c}function r(a){const l=a.target;l.removeEventListener("dispose",r);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function o(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:i,dispose:o}}function gCt(n){const e={};function t(i){if(e[i]!==void 0)return e[i];let s;switch(i){case"WEBGL_depth_texture":s=n.getExtension("WEBGL_depth_texture")||n.getExtension("MOZ_WEBGL_depth_texture")||n.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":s=n.getExtension("EXT_texture_filter_anisotropic")||n.getExtension("MOZ_EXT_texture_filter_anisotropic")||n.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":s=n.getExtension("WEBGL_compressed_texture_s3tc")||n.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":s=n.getExtension("WEBGL_compressed_texture_pvrtc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:s=n.getExtension(i)}return e[i]=s,s}return{has:function(i){return t(i)!==null},init:function(i){i.isWebGL2?t("EXT_color_buffer_float"):(t("WEBGL_depth_texture"),t("OES_texture_float"),t("OES_texture_half_float"),t("OES_texture_half_float_linear"),t("OES_standard_derivatives"),t("OES_element_index_uint"),t("OES_vertex_array_object"),t("ANGLE_instanced_arrays")),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture")},get:function(i){const s=t(i);return s===null&&console.warn("THREE.WebGLRenderer: "+i+" extension not supported."),s}}}function bCt(n,e,t,i){const s={},r=new WeakMap;function o(_){const h=_.target;h.index!==null&&e.remove(h.index);for(const f in h.attributes)e.remove(h.attributes[f]);for(const f in h.morphAttributes){const E=h.morphAttributes[f];for(let b=0,g=E.length;b<g;b++)e.remove(E[b])}h.removeEventListener("dispose",o),delete s[h.id];const m=r.get(h);m&&(e.remove(m),r.delete(h)),i.releaseStatesOfGeometry(h),h.isInstancedBufferGeometry===!0&&delete h._maxInstanceCount,t.memory.geometries--}function a(_,h){return s[h.id]===!0||(h.addEventListener("dispose",o),s[h.id]=!0,t.memory.geometries++),h}function l(_){const h=_.attributes;for(const f in h)e.update(h[f],n.ARRAY_BUFFER);const m=_.morphAttributes;for(const f in m){const E=m[f];for(let b=0,g=E.length;b<g;b++)e.update(E[b],n.ARRAY_BUFFER)}}function c(_){const h=[],m=_.index,f=_.attributes.position;let E=0;if(m!==null){const v=m.array;E=m.version;for(let y=0,T=v.length;y<T;y+=3){const C=v[y+0],x=v[y+1],w=v[y+2];h.push(C,x,x,w,w,C)}}else if(f!==void 0){const v=f.array;E=f.version;for(let y=0,T=v.length/3-1;y<T;y+=3){const C=y+0,x=y+1,w=y+2;h.push(C,x,x,w,w,C)}}else return;const b=new(SO(h)?wO:AO)(h,1);b.version=E;const g=r.get(_);g&&e.remove(g),r.set(_,b)}function d(_){const h=r.get(_);if(h){const m=_.index;m!==null&&h.version<m.version&&c(_)}else c(_);return r.get(_)}return{get:a,update:l,getWireframeAttribute:d}}function ECt(n,e,t,i){const s=i.isWebGL2;let r;function o(m){r=m}let a,l;function c(m){a=m.type,l=m.bytesPerElement}function d(m,f){n.drawElements(r,f,a,m*l),t.update(f,r,1)}function _(m,f,E){if(E===0)return;let b,g;if(s)b=n,g="drawElementsInstanced";else if(b=e.get("ANGLE_instanced_arrays"),g="drawElementsInstancedANGLE",b===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support ex
2024-01-11 01:32:21 +00:00
` ),i=[],s=Math.max(e-6,0),r=Math.min(e+6,t.length);for(let o=s;o<r;o++){const a=o+1;i.push( ` $ { a === e ? ">" : " " } $ { a } : $ { t [ o ] } ` )}return i.join( `
2024-02-10 20:35:27 +00:00
` )}function b1t(n){const e=Pt.getPrimaries(Pt.workingColorSpace),t=Pt.getPrimaries(n);let i;switch(e===t?i="":e===lu&&t===au?i="LinearDisplayP3ToLinearSRGB":e===au&&t===lu&&(i="LinearSRGBToLinearDisplayP3"),n){case Cn:case Zu:return[i,"LinearTransferOETF"];case nn:case IE:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",n),[i,"LinearTransferOETF"]}}function N1(n,e,t){const i=n.getShaderParameter(e,n.COMPILE_STATUS),s=n.getShaderInfoLog(e).trim();if(i&&s==="")return"";const r=/ERROR: 0:( \d +)/.exec(s);if(r){const o=parseInt(r[1]);return t.toUpperCase()+ `
2024-01-11 01:32:21 +00:00
` +s+ `
2024-02-10 20:35:27 +00:00
` +g1t(n.getShaderSource(e),o)}else return s}function E1t(n,e){const t=b1t(e);return ` vec4 $ { n } ( vec4 value ) { return $ { t [ 0 ] } ( $ { t [ 1 ] } ( value ) ) ; } ` }function v1t(n,e){let t;switch(e){case myt:t="Linear";break;case gyt:t="Reinhard";break;case byt:t="OptimizedCineon";break;case Eyt:t="ACESFilmic";break;case vyt:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function S1t(n){return[n.extensionDerivatives||n.envMapCubeUVHeight||n.bumpMap||n.normalMapTangentSpace||n.clearcoatNormalMap||n.flatShading||n.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(n.extensionFragDepth||n.logarithmicDepthBuffer)&&n.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",n.extensionDrawBuffers&&n.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(n.extensionShaderTextureLOD||n.envMap||n.transmission)&&n.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(El).join( `
` )}function y1t(n){const e=[];for(const t in n){const i=n[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join( `
` )}function T1t(n,e){const t={},i=n.getProgramParameter(e,n.ACTIVE_ATTRIBUTES);for(let s=0;s<i;s++){const r=n.getActiveAttrib(e,s),o=r.name;let a=1;r.type===n.FLOAT_MAT2&&(a=2),r.type===n.FLOAT_MAT3&&(a=3),r.type===n.FLOAT_MAT4&&(a=4),t[o]={type:r.type,location:n.getAttribLocation(e,o),locationSize:a}}return t}function El(n){return n!==""}function O1(n,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return n.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,t).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 I1(n,e){return n.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const x1t=/^[ \t ]*#include +<([ \w \d ./]+)>/gm;function jg(n){return n.replace(x1t,R1t)}const C1t=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function R1t(n,e){let t=vt[e];if(t===void 0){const i=C1t.get(e);if(i!==void 0)t=vt[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return jg(t)}const A1t=/#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 M1(n){return n.replace(A1t,w1t)}function w1t(n,e,t,i){let s="";for(let r=parseInt(e);r<parseInt(t);r++)s+=i.replace(/ \[ \s *i \s * \] /g,"[ "+r+" ]").replace(/UNROLLED_LOOP_INDEX/g,r);return s}function D1(n){let e="precision "+n.precision+ ` float ;
2024-01-11 01:32:21 +00:00
precision ` +n.precision+" int;";return n.precision==="highp"?e+= `
# define HIGH _PRECISION ` :n.precision==="mediump"?e+= `
# define MEDIUM _PRECISION ` :n.precision==="lowp"&&(e+= `
2024-02-10 20:35:27 +00:00
# define LOW _PRECISION ` ),e}function N1t(n){let e="SHADOWMAP_TYPE_BASIC";return n.shadowMapType===lO?e="SHADOWMAP_TYPE_PCF":n.shadowMapType===qSt?e="SHADOWMAP_TYPE_PCF_SOFT":n.shadowMapType===gs&&(e="SHADOWMAP_TYPE_VSM"),e}function O1t(n){let e="ENVMAP_TYPE_CUBE";if(n.envMap)switch(n.envMapMode){case ma:case ga:e="ENVMAP_TYPE_CUBE";break;case Xu:e="ENVMAP_TYPE_CUBE_UV";break}return e}function I1t(n){let e="ENVMAP_MODE_REFLECTION";if(n.envMap)switch(n.envMapMode){case ga:e="ENVMAP_MODE_REFRACTION";break}return e}function M1t(n){let e="ENVMAP_BLENDING_NONE";if(n.envMap)switch(n.combine){case wE:e="ENVMAP_BLENDING_MULTIPLY";break;case hyt:e="ENVMAP_BLENDING_MIX";break;case fyt:e="ENVMAP_BLENDING_ADD";break}return e}function D1t(n){const e=n.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:i,maxMip:t}}function k1t(n,e,t,i){const s=n.getContext(),r=t.defines;let o=t.vertexShader,a=t.fragmentShader;const l=N1t(t),c=O1t(t),d=I1t(t),_=M1t(t),h=D1t(t),m=t.isWebGL2?"":S1t(t),f=y1t(r),E=s.createProgram();let b,g,v=t.glslVersion?"#version "+t.glslVersion+ `
2024-02-08 22:04:27 +00:00
` :"";t.isRawShaderMaterial?(b=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,f].filter(El).join( `
2024-02-04 10:11:55 +00:00
` ),b.length>0&&(b+= `
2024-02-08 22:04:27 +00:00
` ),g=[m,"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,f].filter(El).join( `
` ),g.length>0&&(g+= `
` )):(b=[D1(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,f,t.batching?"#define USE_BATCHING":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+d:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors&&t.isWebGL2?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?
2024-02-04 10:11:55 +00:00
` ].filter(El).join( `
2024-02-10 20:35:27 +00:00
` ),g=[m,D1(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,f,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+d:"",t.envMap?"#define "+_:"",h?"#define CUBEUV_TEXEL_WIDTH "+h.texelWidth:"",h?"#define CUBEUV_TEXEL_HEIGHT "+h.texelHeight:"",h?"#define CUBEUV_MAX_MIP "+h.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==dr?"#define TONE_MAPPING":"",t.toneMapping!==dr?vt.tonemapping_pars_fragment:"",t.toneMapping!==dr?v1t("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",vt.colorspace_pars_fragment,E1t("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"", `
2024-02-04 10:11:55 +00:00
` ].filter(El).join( `
2024-02-10 00:32:22 +00:00
` )),o=jg(o),o=O1(o,t),o=I1(o,t),a=jg(a),a=O1(a,t),a=I1(a,t),o=M1(o),a=M1(a),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(v= ` # version 300 es
2024-02-08 22:04:27 +00:00
` ,b=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join( `
2024-01-11 01:32:21 +00:00
` )+ `
2024-02-08 22:04:27 +00:00
` +b,g=["precision mediump sampler2DArray;","#define varying in",t.glslVersion===XC?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===XC?"":"#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( `
2024-01-11 01:32:21 +00:00
` )+ `
2024-02-10 10:33:09 +00:00
` +g);const y=v+b+o,T=v+g+a,C=w1(s,s.VERTEX_SHADER,y),x=w1(s,s.FRAGMENT_SHADER,T);s.attachShader(E,C),s.attachShader(E,x),t.index0AttributeName!==void 0?s.bindAttribLocation(E,0,t.index0AttributeName):t.morphTargets===!0&&s.bindAttribLocation(E,0,"position"),s.linkProgram(E);function w(P){if(n.debug.checkShaderErrors){const U=s.getProgramInfoLog(E).trim(),Y=s.getShaderInfoLog(C).trim(),k=s.getShaderInfoLog(x).trim();let H=!0,B=!0;if(s.getProgramParameter(E,s.LINK_STATUS)===!1)if(H=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(s,E,C,x);else{const L=N1(s,C,"vertex"), $ =N1(s,x,"fragment");console.error("THREE.WebGLProgram: Shader Error "+s.getError()+" - VALIDATE_STATUS "+s.getProgramParameter(E,s.VALIDATE_STATUS)+ `
2024-01-11 01:32:21 +00:00
Program Info Log : ` +U+ `
2024-02-10 00:32:22 +00:00
` +L+ `
2024-02-10 20:35:27 +00:00
` + $ )}else U!==""?console.warn("THREE.WebGLProgram: Program Info Log:",U):(Y===""||k==="")&&(B=!1);B&&(P.diagnostics={runnable:H,programLog:U,vertexShader:{log:Y,prefix:b},fragmentShader:{log:k,prefix:g}})}s.deleteShader(C),s.deleteShader(x),R=new Id(s,E),S=T1t(s,E)}let R;this.getUniforms=function(){return R===void 0&&w(this),R};let S;this.getAttributes=function(){return S===void 0&&w(this),S};let A=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return A===!1&&(A=s.getProgramParameter(E,f1t)),A},this.destroy=function(){i.releaseStatesOfProgram(this),s.deleteProgram(E),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=m1t++,this.cacheKey=e,this.usedTimes=1,this.program=E,this.vertexShader=C,this.fragmentShader=x,this}let L1t=0;class P1t{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,i=e.fragmentShader,s=this._getShaderStage(t),r=this._getShaderStage(i),o=this._getShaderCacheForMaterial(e);return o.has(s)===!1&&(o.add(s),s.usedTimes++),o.has(r)===!1&&(o.add(r),r.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.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 t=this.materialCache;let i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){const t=this.shaderCache;let i=t.get(e);return i===void 0&&(i=new U1t(e),t.set(e,i)),i}}class U1t{constructor(e){this.id=L1t++,this.code=e,this.usedTimes=0}}function F1t(n,e,t,i,s,r,o){const a=new CO,l=new P1t,c=[],d=s.isWebGL2,_=s.logarithmicDepthBuffer,h=s.vertexTextures;let m=s.precision;const f={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 E(S){return S===0?"uv": ` uv$ { S } ` }function b(S,A,P,U,Y){const k=U.fog,H=Y.geometry,B=S.isMeshStandardMaterial?U.environment:null,L=(S.isMeshStandardMaterial?t:e).get(S.envMap||B), $ =L&&L.mapping===Xu?L.image.height:null,j=f[S.type];S.precision!==null&&(m=s.getMaxPrecision(S.precision),m!==S.precision&&console.warn("THREE.WebGLProgram.getParameters:",S.precision,"not supported, using",m,"instead."));const W=H.morphAttributes.position||H.morphAttributes.normal||H.morphAttributes.color,le=W!==void 0?W.length:0;let J=0;H.morphAttributes.position!==void 0&&(J=1),H.morphAttributes.normal!==void 0&&(J=2),H.morphAttributes.color!==void 0&&(J=3);let ee,fe,be,Ce;if(j){const un=Vi[j];ee=un.vertexShader,fe=un.fragmentShader}else ee=S.vertexShader,fe=S.fragmentShader,l.update(S),be=l.getVertexShaderID(S),Ce=l.getFragmentShaderID(S);const X=n.getRenderTarget(),_e=Y.isInstancedMesh===!0,Z=Y.isBatchedMesh===!0,Ee=!!S.map,Ie=!!S.matcap,M=!!L,G=!!S.aoMap,q=!!S.lightMap,oe=!!S.bumpMap,ne=!!S.normalMap,Te=!!S.displacementMap,we=!!S.emissiveMap,V=!!S.metalnessMap,ce=!!S.roughnessMap,ie=S.anisotropy>0,re=S.clearcoat>0,I=S.iridescence>0,N=S.sheen>0,z=S.transmission>0,de=ie&&!!S.anisotropyMap,Q=re&&!!S.clearcoatMap,te=re&&!!S.clearcoatNormalMap,Re=re&&!!S.clearcoatRoughnessMap,Se=I&&!!S.iridescenceMap,ke=I&&!!S.iridescenceThicknessMap,ze=N&&!!S.sheenColorMap,it=N&&!!S.sheenRoughnessMap,De=!!S.specularMap,st=!!S.specularColorMap,Xe=!!S.specularIntensityMap,Ve=z&&!!S.transmissionMap,Ze=z&&!!S.thicknessMap,Ke=!!S.gradientMap,ht=!!S.alphaMap,ae=S.alphaTest>0,Ye=!!S.alphaHash,Pe=!!S.extensions,Ne=!!H.attributes.uv1,Fe=!!H.attributes.uv2,ot=!!H.attributes.uv3;let bt=dr;return S.toneMapped&&(X===null||X.isXRRenderTarget===!0)&&(bt=n.toneMapping),{isWebGL2:d,shaderID:j,shad
2024-01-11 01:32:21 +00:00
gl _Position = vec4 ( position , 1.0 ) ;
2024-02-10 20:35:27 +00:00
} ` ,X1t= ` uniform sampler2D shadow _pass ;
2024-01-11 01:32:21 +00:00
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 ) ) ;
2024-02-10 20:35:27 +00:00
} ` ;function Z1t(n,e,t){let i=new DE;const s=new At,r=new At,o=new qt,a=new K1t({depthPacking:Dyt}),l=new j1t,c={},d=t.maxTextureSize,_={[Os]:Kn,[Kn]:Os,[Hi]:Hi},h=new ro({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new At},radius:{value:4}},vertexShader:Q1t,fragmentShader:X1t}),m=h.clone();m.defines.HORIZONTAL_PASS=1;const f=new is;f.setAttribute("position",new Gn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const E=new Fn(f,h),b=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=lO;let g=this.type;this.render=function(C,x,w){if(b.enabled===!1||b.autoUpdate===!1&&b.needsUpdate===!1||C.length===0)return;const R=n.getRenderTarget(),S=n.getActiveCubeFace(),A=n.getActiveMipmapLevel(),P=n.state;P.setBlending(cr),P.buffers.color.setClear(1,1,1,1),P.buffers.depth.setTest(!0),P.setScissorTest(!1);const U=g!==gs&&this.type===gs,Y=g===gs&&this.type!==gs;for(let k=0,H=C.length;k<H;k++){const B=C[k],L=B.shadow;if(L===void 0){console.warn("THREE.WebGLShadowMap:",B,"has no shadow.");continue}if(L.autoUpdate===!1&&L.needsUpdate===!1)continue;s.copy(L.mapSize);const $ =L.getFrameExtents();if(s.multiply( $ ),r.copy(L.mapSize),(s.x>d||s.y>d)&&(s.x>d&&(r.x=Math.floor(d/ $ .x),s.x=r.x* $ .x,L.mapSize.x=r.x),s.y>d&&(r.y=Math.floor(d/ $ .y),s.y=r.y* $ .y,L.mapSize.y=r.y)),L.map===null||U===!0||Y===!0){const W=this.type!==gs?{minFilter:gn,magFilter:gn}:{};L.map!==null&&L.map.dispose(),L.map=new so(s.x,s.y,W),L.map.texture.name=B.name+".shadowMap",L.camera.updateProjectionMatrix()}n.setRenderTarget(L.map),n.clear();const j=L.getViewportCount();for(let W=0;W<j;W++){const le=L.getViewport(W);o.set(r.x*le.x,r.y*le.y,r.x*le.z,r.y*le.w),P.viewport(o),L.updateMatrices(B,W),i=L.getFrustum(),T(x,w,L.camera,B,this.type)}L.isPointLightShadow!==!0&&this.type===gs&&v(L,w),L.needsUpdate=!1}g=this.type,b.needsUpdate=!1,n.setRenderTarget(R,S,A)};function v(C,x){const w=e.update(E);h.defines.VSM_SAMPLES!==C.blurSamples&&(h.defines.VSM_SAMPLES=C.blurSamples,m.defines.VSM_SAMPLES=C.blurSamples,h.needsUpdate=!0,m.needsUpdate=!0),C.mapPass===null&&(C.mapPass=new so(s.x,s.y)),h.uniforms.shadow_pass.value=C.map.texture,h.uniforms.resolution.value=C.mapSize,h.uniforms.radius.value=C.radius,n.setRenderTarget(C.mapPass),n.clear(),n.renderBufferDirect(x,null,w,h,E,null),m.uniforms.shadow_pass.value=C.mapPass.texture,m.uniforms.resolution.value=C.mapSize,m.uniforms.radius.value=C.radius,n.setRenderTarget(C.map),n.clear(),n.renderBufferDirect(x,null,w,m,E,null)}function y(C,x,w,R){let S=null;const A=w.isPointLight===!0?C.customDistanceMaterial:C.customDepthMaterial;if(A!==void 0)S=A;else if(S=w.isPointLight===!0?l:a,n.localClippingEnabled&&x.clipShadows===!0&&Array.isArray(x.clippingPlanes)&&x.clippingPlanes.length!==0||x.displacementMap&&x.displacementScale!==0||x.alphaMap&&x.alphaTest>0||x.map&&x.alphaTest>0){const P=S.uuid,U=x.uuid;let Y=c[P];Y===void 0&&(Y={},c[P]=Y);let k=Y[U];k===void 0&&(k=S.clone(),Y[U]=k),S=k}if(S.visible=x.visible,S.wireframe=x.wireframe,R===gs?S.side=x.shadowSide!==null?x.shadowSide:x.side:S.side=x.shadowSide!==null?x.shadowSide:_[x.side],S.alphaMap=x.alphaMap,S.alphaTest=x.alphaTest,S.map=x.map,S.clipShadows=x.clipShadows,S.clippingPlanes=x.clippingPlanes,S.clipIntersection=x.clipIntersection,S.displacementMap=x.displacementMap,S.displacementScale=x.displacementScale,S.displacementBias=x.displacementBias,S.wireframeLinewidth=x.wireframeLinewidth,S.linewidth=x.linewidth,w.isPointLight===!0&&S.isMeshDistanceMaterial===!0){const P=n.properties.get(S);P.light=w}return S}function T(C,x,w,R,S){if(C.visible===!1)return;if(C.layers.test(x.layers)&&(C.isMesh||C.isLine||C.isPoints)&&(C.castShadow||C.receiveShadow&&S===gs)&&(!C.frustumCulled||i.intersectsObject(C))){C.modelViewMatrix.multiplyMatrices(w.matrixWorldInverse,C.matrixWorld);const U=e.update(C),Y=C.material;if(Array.isArray(Y)){const k=U.groups;for(let H=0,B=k.length;H<B;H++){const L=k[H], $ =Y[L.materialIndex];if( $ && $ .visible){const j=y(C, $ ,R,S);C.onBeforeShadow(n,C,x,w,U,j,L),n.renderBufferDirect(w,null,U,j,C,L),C.onAfterShadow(n,C,x,w,U,j,L)}}}els
2024-01-11 01:32:21 +00:00
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,t),this._listeners.push(t)}unsubscribe(e){if(this.listenerMap.has(e)){const t=this.listenerMap.get(e);this.listenerMap.delete(e);const i=this._listeners.indexOf(t);i>=0&&this._listeners.splice(i,1)}}registerProxy(e,t){this.proxyMap.has(e)&&(console.warn( ` Already subscribed . Unsubscribing for you .
2024-02-10 20:35:27 +00:00
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,t),this.proxies.push(t)}unregisterProxy(e){if(!this.proxyMap.has(e))return;const t=this.proxyMap.get(e);this.proxyMap.delete(e);const i=this.proxies.indexOf(t);i>=0&&this.proxies.splice(i,1)}}class zt extends Zr{constructor(e){super(),this.entity=e}emit(e){this.listeners.forEach(t=>t(e,this.entity))}}class Mn extends Zr{constructor(e){super(),this.entity=e}emit(e){let t=!1;const i=()=>[t=!0];for(const s of Array.from(this.listeners.values()))if(s(e,i,this.entity),t)return{prevented:!0};return{prevented:!1}}}class QO extends Zr{execute(e,t){let i=e;for(const s of this.listeners)i=s(i,t);return i}}class ii extends QO{constructor(e){super(),this.entity=e}execute(e){return super.execute(e,this.entity)}}class lwt extends Zr{constructor(e){super(),this.entity=e}execute(e){const t=[];for(const i of this.listeners)t.push(i(e,this.entity));return t}}function Bi(){const n=Symbol(),e=new Map,t=new Set,i=(l,c)=>{c instanceof Zr&&c.registerProxy(n,()=>{var d,_;return(_=(d=e.get(l))===null||d===void 0?void 0:d.listeners)!==null&&_!==void 0?_:[]})},s=l=>{const c=new Zr;e.set(l,c),t.forEach(d=>i(l,d[l]))},r=l=>{t.add(l);for(const c of e.keys())i(c,l[c])},o=l=>{for(const c of e.keys())l[c]instanceof Zr&&l[c].unregisterProxy(n);t.delete(l)},a=()=>{t.forEach(l=>o(l)),e.clear()};return new Proxy({},{get(l,c){return c==="addTarget"?r:c==="removeTarget"?o:c==="destroy"?a:typeof c!="string"||c.startsWith("_")?l[c]:(e.has(c)||s(c),e.get(c))}})}class cR{constructor(e,t){if(this.destructed=!1,this.events={destruct:new zt(this)},!e||!t)throw new Error("Cannot initialize connection with null/undefined for ' from ' or ' to ' values");this.id=Cs(),this.from=e,this.to=t,this.from.connectionCount++,this.to.connectionCount++}destruct(){this.events.destruct.emit(),this.from.connectionCount--,this.to.connectionCount--,this.destructed=!0}}class XO{constructor(e,t){if(!e||!t)throw new Error("Cannot initialize connection with null/undefined for ' from ' or ' to ' values ");this.id=Cs(),this.from=e,this.to=t}}function eb(n,e){return Object.fromEntries(Object.entries(n).map(([t,i])=>[t,e(i)]))}class ZO{constructor(){this._title=" ",this.id=Cs(),this.events={loaded:new zt(this),beforeAddInput:new Mn(this),addInput:new zt(this),beforeRemoveInput:new Mn(this),removeInput:new zt(this),beforeAddOutput:new Mn(this),addOutput:new zt(this),beforeRemoveOutput:new Mn(this),removeOutput:new zt(this),beforeTitleChanged:new Mn(this),titleChanged:new zt(this),update:new zt(this)},this.hooks={beforeLoad:new ii(this),afterSave:new ii(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,t){return this.addInterface(" input ",e,t)}addOutput(e,t){return this.addInterface(" output ",e,t)}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(([t,i])=>{this.inputs[t]&&(this.inputs[t].load(i),this.inputs[t].nodeId=this.id)}),Object.entries(e.outputs).forEach(([t,i])=>{this.outputs[t]&&(this.outputs[t].load(i),this.outputs[t].nodeId=this.id)}),this.events.loaded.emit(this)}save(){const e=eb(this.inputs,s=>s.save()),t=eb(this.outputs,s=>s.save()),i={type:this.type,id:this.id,title:this.title,inputs:e,outputs:t};return this.hooks.afterSave.execute(i)}onPlaced(){}onDestroy(){}initializeIo(){Object.entries(this.inputs).forEach(([e,t])=>this.initializeIntf(" input ",e,t)),Object.entries(this.outputs).forEach(([e,t])=>this.initializeIntf(" output ",e,t))}initializeIntf(e,t,i){i.isInput=e===" input ",i.nodeId=this.id,i.events.setValue.subscribe(this,()=>this.events.update.emit({type:e,name:t,intf:i}))}addInterface(e,t,i){const s=e===" input " ? this . events . beforeAddInput : this . events . beforeAddOutput , r = e ===
2024-01-11 01:32:21 +00:00
This is likely a Baklava internal issue . Please report it on GitHub . ` );const m=this.hooks.transferData.execute(c[h],d);d.to.allowMultipleConnections?t.has(d.to.id)?t.get(d.to.id).push(m):t.set(d.to.id,[m]):t.set(d.to.id,m)})}return o}async execute(e){this.recalculateOrder&&(this.order.clear(),this.recalculateOrder=!1);const t=this.getInputValues(this.editor.graph);return await this.runGraph(this.editor.graph,t,e)}getInputValues(e){const t=new Map;for(const i of e.nodes)Object.values(i.inputs).forEach(s=>{s.connectionCount===0&&t.set(s.id,s.value)}),i.calculate||Object.values(i.outputs).forEach(s=>{t.set(s.id,s.value)});return t}onChange(e){this.recalculateOrder=e||this.recalculateOrder,this.calculateWithoutData()}getInterfaceValue(e,t){if(!e.has(t))throw new Error( ` Could not find value for interface $ { t }
2024-02-10 20:35:27 +00:00
This is likely a Baklava internal issue . Please report it on GitHub . ` );return e.get(t)}}let tb=null;function mwt(n){tb=n}function yi(){if(!tb)throw new Error("providePlugin() must be called before usePlugin()");return{viewModel:tb}}function Fi(){const{viewModel:n}=yi();return{graph:Ud(n.value,"displayedGraph"),switchGraph:n.value.switchGraph}}function rI(n){const{graph:e}=Fi(),t=dt(null),i=dt(null);return{dragging:et(()=>!!t.value),onPointerDown:l=>{t.value={x:l.pageX,y:l.pageY},i.value={x:n.value.x,y:n.value.y}},onPointerMove:l=>{if(t.value){const c=l.pageX-t.value.x,d=l.pageY-t.value.y;n.value.x=i.value.x+c/e.value.scaling,n.value.y=i.value.y+d/e.value.scaling}},onPointerUp:()=>{t.value=null,i.value=null}}}function oI(n,e,t){if(!e.template)return!1;if(wa(e.template)===t)return!0;const i=n.graphTemplates.find(r=>wa(r)===t);return i?i.nodes.filter(r=>r.type.startsWith(ec)).some(r=>oI(n,e,r.type)):!1}function aI(n){return et(()=>{const e=Array.from(n.value.editor.nodeTypes.entries()),t=new Set(e.map(([,s])=>s.category)),i=[];for(const s of t.values()){let r=e.filter(([,o])=>o.category===s);n.value.displayedGraph.template?r=r.filter(([o])=>!oI(n.value.editor,n.value.displayedGraph,o)):r=r.filter(([o])=>![Ra,Aa].includes(o)),r.length>0&&i.push({name:s,nodeTypes:Object.fromEntries(r)})}return i.sort((s,r)=>s.name==="default"?-1:r.name==="default"||s.name>r.name?1:-1),i})}function lI(){const{graph:n}=Fi();return{transform:(t,i)=>{const s=t/n.value.scaling-n.value.panning.x,r=i/n.value.scaling-n.value.panning.y;return[s,r]}}}function gwt(){const{graph:n}=Fi();let e=[],t=-1,i={x:0,y:0};const s=et(()=>n.value.panning),r=rI(s),o=et(()=>({"transform-origin":"0 0",transform: ` scale ( $ { n . value . scaling } ) translate ( $ { n . value . panning . x } px , $ { n . value . panning . y } px ) ` })),a=(m,f,E)=>{const b=[m/n.value.scaling-n.value.panning.x,f/n.value.scaling-n.value.panning.y],g=[m/E-n.value.panning.x,f/E-n.value.panning.y],v=[g[0]-b[0],g[1]-b[1]];n.value.panning.x+=v[0],n.value.panning.y+=v[1],n.value.scaling=E},l=m=>{m.preventDefault();let f=m.deltaY;m.deltaMode===1&&(f*=32);const E=n.value.scaling*(1-f/3e3);a(m.offsetX,m.offsetY,E)},c=()=>({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:f,ay:E,bx:b,by:g}=c();i={x:f+(b-f)/2,y:E+(g-E)/2}}},onPointerMove:m=>{for(let f=0;f<e.length;f++)if(m.pointerId==e[f].pointerId){e[f]=m;break}if(e.length==2){const{ax:f,ay:E,bx:b,by:g}=c(),v=f-b,y=E-g,T=Math.sqrt(v*v+y*y);if(t>0){const C=n.value.scaling*(1+(T-t)/500);a(i.x,i.y,C)}t=T}else r.onPointerMove(m)},onPointerUp:m=>{e=e.filter(f=>f.pointerId!==m.pointerId),t=-1,r.onPointerUp()},onMouseWheel:l}}var _i=(n=>(n[n.NONE=0]="NONE",n[n.ALLOWED=1]="ALLOWED",n[n.FORBIDDEN=2]="FORBIDDEN",n))(_i||{});const cI=Symbol();function bwt(){const{graph:n}=Fi(),e=dt(null),t=dt(null),i=a=>{e.value&&(e.value.mx=a.offsetX/n.value.scaling-n.value.panning.x,e.value.my=a.offsetY/n.value.scaling-n.value.panning.y)},s=()=>{if(t.value){if(e.value)return;const a=n.value.connections.find(l=>l.to===t.value);t.value.isInput&&a?(e.value={status:_i.NONE,from:a.from},n.value.removeConnection(a)):e.value={status:_i.NONE,from:t.value},e.value.mx=void 0,e.value.my=void 0}},r=()=>{if(e.value&&t.value){if(e.value.from===t.value)return;n.value.addConnection(e.value.from,e.value.to)}e.value=null},o=a=>{if(t.value=a??null,a&&e.value){e.value.to=a;const l=n.value.checkConnection(e.value.from,e.value.to);if(e.value.status=l.connectionAllowed?_i.ALLOWED:_i.FORBIDDEN,l.connectionAllowed){const c=l.connectionsInDanger.map(d=>d.id);n.value.connections.forEach(d=>{c.includes(d.id)&&(d.isInDanger=!0)})}}else!a&&e.value&&(e.value.to=void 0,e.value.status=_i.NONE,n.value.connections.forEach(l=>{l.isInDanger=!1}))};return Qo(cI,{temporaryConnection:e,hoveredOver:o}),{temporaryConnection:e,onMouseMove:i,onMouseDown:s,onMouseUp:r,hoveredOver:o}}function Ewt(n){const e=dt(!1),t=dt(0),i=dt(0),s=aI(n),{transform:r}=lI(),o=et(()=>{let d=[];const _={};for(const m of s.value){const f=Object.entries(m.nodeTypes).m