2026-08-16 16:35:50 +02:00
import { renderEveSurface } from "@gamecult/eve-browser-lowering" ;
import "@gamecult/eve-browser-lowering/styles.css" ;
import "./style.css" ;
const host = document . querySelector < HTMLElement > ( "#surface" ) ! ;
const status = document . querySelector < HTMLElement > ( "#status" ) ! ;
const receipt = document . querySelector < HTMLElement > ( "#receipt" ) ! ;
2026-08-16 20:12:53 +02:00
const compiler = document . querySelector < HTMLElement > ( "#compiler" ) ! ;
const composer = document . querySelector < HTMLFormElement > ( "#composer" ) ! ;
2026-08-16 20:36:01 +02:00
const destinationForm = document . querySelector < HTMLFormElement > ( "#destination-form" ) ! ;
2026-08-16 20:12:53 +02:00
const compilerResults = document . querySelector < HTMLElement > ( "#compiler-results" ) ! ;
2026-08-16 21:01:04 +02:00
const campaignLab = document . querySelector < HTMLElement > ( "#campaign-lab" ) ! ;
const campaignList = document . querySelector < HTMLElement > ( "#campaign-list" ) ! ;
2026-08-16 16:35:50 +02:00
let revision = 0 ;
2026-08-18 20:21:45 +02:00
let playerActorId = "" ;
2026-08-17 09:33:34 +02:00
let resolutionEpoch = 0 ;
let providerConfigurationEpoch = 0 ;
let resolutionPins : any [ ] = [ ] ;
2026-08-16 16:35:50 +02:00
2026-08-17 17:45:13 +02:00
function node < K extends keyof HTMLElementTagNameMap > (
tag : K ,
text? : string ,
className? : string ,
) : HTMLElementTagNameMap [ K ] {
const value = document . createElement ( tag ) ;
if ( text !== undefined ) value . textContent = text ;
if ( className ) value . className = className ;
return value ;
}
function showSummary ( title : string , lines : string [ ] ) {
const children : HTMLElement [ ] = [ node ( "h3" , title ) ] ;
for ( const line of lines . filter ( Boolean ) ) children . push ( node ( "p" , line ) ) ;
receipt . replaceChildren ( . . . children ) ;
receipt . hidden = false ;
}
function renderCommandReceipt ( body : any ) {
if ( body ? . kind === "assessed" ) {
const assessment = body . assessment ;
const children : HTMLElement [ ] = [ node ( "h3" , assessment . admissible ? "Action assessment" : "That attempt is not possible" ) ] ;
if ( assessment . admissible ) {
children . push ( node ( "p" , ` DC ${ assessment . dc } · modifier ${ assessment . modifier_total >= 0 ? "+" : "" } ${ assessment . modifier_total } ` ) ) ;
const modifiers = node ( "ul" ) ;
for ( const modifier of assessment . modifiers ? ? [ ] ) {
modifiers . append ( node ( "li" , ` ${ modifier . label } : ${ modifier . value >= 0 ? "+" : "" } ${ modifier . value } ` ) ) ;
}
children . push ( modifiers ) ;
children . push ( node ( "p" , ` Strong/success: ${ assessment . success_stake } ` ) ) ;
children . push ( node ( "p" , ` Mixed: ${ assessment . mixed_stake } ` ) ) ;
children . push ( node ( "p" , ` Failure: ${ assessment . failure_stake } ` ) ) ;
children . push ( node ( "p" , ` Effect ceiling: ${ assessment . effect_ceiling } ` , "quiet" ) ) ;
} else {
children . push ( node ( "p" , assessment . missing_permission ? ? "The attempt has no admissible path from current state." ) ) ;
for ( const bargain of assessment . bargains ? ? [ ] ) children . push ( node ( "p" , ` Possible bargain: ${ bargain } ` ) ) ;
}
receipt . replaceChildren ( . . . children ) ;
receipt . hidden = false ;
return ;
}
if ( body ? . kind === "committed" ) {
const roll = body . receipt ? . roll ;
if ( roll ) {
const outcome = String ( roll . outcome ) . replaceAll ( "_" , " " ) ;
showSummary ( outcome . charAt ( 0 ) . toUpperCase ( ) + outcome . slice ( 1 ) , [
` d20 ${ roll . d20 } ${ roll . modifier_total >= 0 ? "+" : "− " } ${ Math . abs ( roll . modifier_total ) } = ${ roll . total } against DC ${ roll . dc } ` ,
] ) ;
} else {
showSummary ( "World advanced" , [ ` Revision ${ body . revision } ` ] ) ;
}
return ;
}
if ( body ? . kind === "resolution_updated" ) {
showSummary ( "World resolution updated" , [ ` Resolution epoch ${ body . receipt ? . resolution_epoch ? ? "advanced" } ` ] ) ;
return ;
}
showSummary ( "Command result" , [ body ? . error ? ? "The world returned no player-facing detail." ] ) ;
}
2026-08-17 19:12:31 +02:00
function showAuthenticationGate() {
const message = "This laboratory requires an unused invite link." ;
status . textContent = message ;
compiler . hidden = true ;
composer . hidden = true ;
destinationForm . hidden = true ;
campaignLab . hidden = true ;
receipt . hidden = true ;
host . hidden = false ;
const gate = node ( "article" , undefined , "card" ) ;
gate . append (
node ( "h2" , "Private campaign laboratory" ) ,
node ( "p" , message ) ,
node ( "p" , "Open one of the two single-use tester invitations on this device. The resulting session stays separate from the other player's campaigns." , "quiet" ) ,
) ;
host . replaceChildren ( gate ) ;
}
2026-08-16 16:35:50 +02:00
async function refresh() {
const response = await fetch ( "/api/surface" ) ;
2026-08-17 19:12:31 +02:00
if ( response . status === 401 ) { showAuthenticationGate ( ) ; return ; }
2026-08-16 16:35:50 +02:00
const surface = await response . json ( ) ;
2026-08-16 20:12:53 +02:00
const needsCompilation = surface . surface_id === "ghostlight.compiler" ;
2026-08-16 21:01:04 +02:00
compiler . hidden = ! needsCompilation ; composer . hidden = needsCompilation ; destinationForm . hidden = needsCompilation ; host . hidden = needsCompilation ; campaignLab . hidden = needsCompilation ;
2026-08-16 20:12:53 +02:00
if ( needsCompilation ) { status . textContent = "No campaign exists. Retrieve the Vault and approve a world seed." ; return ; }
2026-08-17 09:33:34 +02:00
revision = Number ( surface . world_revision ? ? surface . version ? ? 0 ) ;
2026-08-18 20:21:45 +02:00
playerActorId = String ( surface . player_actor_id ? ? "" ) ;
if ( ! playerActorId ) throw new Error ( "Campaign surface omitted its canonical player actor ID." ) ;
2026-08-17 09:33:34 +02:00
resolutionEpoch = Number ( surface . resolution ? . policy ? . resolution_epoch ? ? 0 ) ;
providerConfigurationEpoch = Number ( surface . resolution ? . policy ? . provider_configuration_epoch ? ? 0 ) ;
resolutionPins = surface . resolution ? . pins ? ? [ ] ;
const budget = Number ( surface . resolution ? . policy ? . active_cell_budget ? ? 8 ) ;
const budgetInput = document . querySelector < HTMLInputElement > ( "#active-cell-budget" ) ! ;
budgetInput . value = String ( budget ) ;
document . querySelector < HTMLOutputElement > ( "#active-cell-budget-value" ) ! . value = String ( budget ) ;
document . querySelector < HTMLElement > ( "#resolution-status" ) ! . textContent = ` ${ surface . resolution ? . effective_budget ? ? budget } effective cells · ${ surface . resolution ? . mandatory_overage ? ? 0 } temporary overage · epoch ${ resolutionEpoch } ` ;
const providerParallelism = Number ( surface . resolution ? . policy ? . provider_parallelism ? ? 8 ) ;
document . querySelector < HTMLInputElement > ( "#provider-parallelism" ) ! . value = String ( providerParallelism ) ;
document . querySelector < HTMLOutputElement > ( "#provider-parallelism-value" ) ! . value = String ( providerParallelism ) ;
const pinList = document . querySelector < HTMLElement > ( "#pin-list" ) ! ;
2026-08-17 17:45:13 +02:00
pinList . replaceChildren ( ) ;
if ( resolutionPins . length === 0 ) pinList . append ( node ( "p" , "No persistent pins." ) ) ;
for ( const pin of resolutionPins ) {
const row = node ( "p" ) ;
row . append ( node ( "code" , String ( pin . kind ) ) , document . createTextNode ( ` ${ [ . . . pin . subject_ids ] . join ( ", " ) } — ${ pin . reason } ` ) ) ;
const remove = node ( "button" , "Remove" ) ;
remove . type = "button" ;
remove . addEventListener ( "click" , async ( ) = > {
await send ( { type : "replace_resolution_pins" , expected_revision : revision , expected_resolution_epoch : resolutionEpoch , pins : resolutionPins.filter ( candidate = > candidate . id !== pin . id ) } ) ;
} ) ;
row . append ( remove ) ;
pinList . append ( row ) ;
}
2026-08-17 09:33:34 +02:00
const fissionParent = document . querySelector < HTMLSelectElement > ( "#fission-parent" ) ! ;
2026-08-17 17:45:13 +02:00
fissionParent . replaceChildren ( . . . ( surface . resolution ? . fission_targets ? ? [ ] ) . map ( ( target : any ) = > {
const option = node ( "option" , ` ${ target . name } · ${ target . id } ` ) ;
option . value = target . id ;
return option ;
} ) ) ;
2026-08-17 09:33:34 +02:00
document . querySelector < HTMLFormElement > ( "#fission-form" ) ! . hidden = fissionParent . options . length === 0 ;
2026-08-16 16:35:50 +02:00
renderEveSurface ( surface , host , { body : document.body , clientId : "ghostlight.browser" , statusElement : status } ) ;
2026-08-16 21:01:04 +02:00
const campaigns = await fetch ( "/api/campaigns" ) . then ( response = > response . json ( ) ) ;
2026-08-17 17:45:13 +02:00
campaignList . replaceChildren ( . . . campaigns . campaigns . map ( ( item : any ) = > {
const button = node ( "button" , ` ${ item . selected ? "●" : "○" } ${ item . name } · revision ${ item . revision } ` ) ;
button . type = "button" ;
button . disabled = Boolean ( item . selected ) ;
if ( ! item . selected ) button . addEventListener ( "click" , async ( ) = > { await compilerPost ( ` /api/campaigns/select/ ${ item . id } ` , { } ) ; await refresh ( ) ; } ) ;
return button ;
} ) ) ;
2026-08-16 16:35:50 +02:00
}
2026-08-16 20:12:53 +02:00
async function compilerPost ( path : string , body : unknown ) {
status . textContent = "Retrieving evidence and compiling…" ;
const response = await fetch ( path , { method : "POST" , headers : { "content-type" : "application/json" } , body : JSON.stringify ( body ) } ) ;
const value = response . headers . get ( "content-type" ) ? . includes ( "json" ) ? await response . json ( ) : await response . text ( ) ;
2026-08-18 21:07:02 +02:00
if ( ! response . ok ) {
status . textContent = typeof value === "string" ? value : String ( value ? . error ? ? "Compilation failed" ) ;
throw new Error ( status . textContent ) ;
}
2026-08-16 20:12:53 +02:00
return value ;
2026-08-16 16:35:50 +02:00
}
2026-08-16 20:12:53 +02:00
function showCards ( items : any [ ] , action : string , choose : ( item : any ) = > void ) {
2026-08-17 17:45:13 +02:00
const cards = node ( "div" , undefined , "cards" ) ;
items . forEach ( ( item , index ) = > {
const card = node ( "article" , undefined , "card" ) ;
card . append ( node ( "h3" , item . title ? ? item . name ) , node ( "p" , item . player_hook ? ? item . premise ) ) ;
if ( item . era ) card . append ( node ( "p" , ` ${ item . era } · ${ item . place } · ${ item . pressure } ` ) ) ;
const button = node ( "button" , action ) ;
button . type = "button" ;
button . addEventListener ( "click" , ( ) = > choose ( items [ index ] ) ) ;
card . append ( button ) ;
cards . append ( card ) ;
} ) ;
compilerResults . replaceChildren ( cards ) ;
2026-08-16 20:12:53 +02:00
}
document . querySelector < HTMLFormElement > ( "#suggest-form" ) ! . addEventListener ( "submit" , async event = > {
2026-08-16 16:35:50 +02:00
event . preventDefault ( ) ;
2026-08-16 20:12:53 +02:00
const result = await compilerPost ( "/api/compiler/openings" , { setting : document.querySelector < HTMLInputElement > ( "#setting" ) ! . value , constraints : [ ] } ) ;
showCards ( result . openings , "Choose opening" , async opening = > {
const roles = await compilerPost ( "/api/compiler/roles" , opening ) ;
showCards ( roles . roles , "Choose role" , async role = > showPreview ( await compilerPost ( "/api/compiler/selected" , { campaign_name : opening.title , opening , role } ) ) ) ;
} ) ;
2026-08-16 16:35:50 +02:00
} ) ;
2026-08-16 20:12:53 +02:00
document . querySelector < HTMLFormElement > ( "#custom-form" ) ! . addEventListener ( "submit" , async event = > { event . preventDefault ( ) ; await showPreview ( await compilerPost ( "/api/compiler/custom" , Object . fromEntries ( new FormData ( event . currentTarget as HTMLFormElement ) ) ) ) ; } ) ;
async function showPreview ( result : any ) {
const preview = result . preview ;
2026-08-17 17:45:13 +02:00
const coverage = Array . isArray ( preview . evidence_coverage ) ? preview . evidence_coverage : [ ] ;
const evidenceCounts = coverage . reduce ( ( counts : Record < string , number > , item : any ) = > {
const lane = String ( item ? . lane ? ? "excluded" ) ;
counts [ lane ] = ( counts [ lane ] ? ? 0 ) + 1 ;
return counts ;
} , { } ) ;
const card = node ( "article" , undefined , "card" ) ;
card . append (
node ( "h3" , preview . title ) ,
2026-08-17 18:04:24 +02:00
node ( "p" , preview . opening ? ? "" ) ,
node ( "p" , ` ${ preview . locations ? . length ? ? 0 } locations · ${ ( preview . cast ? . length ? ? 0 ) + 1 } actors · ${ preview . institutions ? . length ? ? 0 } institutions ` ) ,
2026-08-17 17:45:13 +02:00
node ( "p" , preview . gaps . length ? ` Material gaps: ${ preview . gaps . join ( "; " ) } ` : "No declared material gaps." , "warning" ) ,
node ( "p" , ` Branch assumptions: ${ preview . branch_assumptions . join ( "; " ) || "none" } ` ) ,
node ( "p" , coverage . length
? ` Evidence use: ${ evidenceCounts . direct_seed ? ? 0 } direct · ${ evidenceCounts . setting_background ? ? 0 } background · ${ evidenceCounts . excluded ? ? 0 } excluded `
: "Evidence use: no retrieved sources were admitted to this seed." , "quiet" ) ,
) ;
const approve = node ( "button" , "Approve and enter" ) ;
approve . type = "button" ;
approve . addEventListener ( "click" , async ( ) = > { await compilerPost ( ` /api/compiler/approve/ ${ result . preview_id } ` , { } ) ; await refresh ( ) ; } ) ;
card . append ( approve ) ;
compilerResults . replaceChildren ( card ) ;
2026-08-16 20:12:53 +02:00
status . textContent = "Preview compiled. Nothing has entered world state yet." ;
}
2026-08-17 17:45:13 +02:00
async function send ( command : unknown ) { status . textContent = "The world is considering the command…" ; const response = await fetch ( "/api/command" , { method : "POST" , headers : { "content-type" : "application/json" } , body : JSON.stringify ( command ) } ) ; const body = await response . json ( ) ; renderCommandReceipt ( body ) ; if ( ! response . ok ) { status . textContent = body . error ? ? "The command was refused." ; await refresh ( ) ; return body ; } await refresh ( ) ; return body ; }
2026-08-16 23:16:18 +02:00
function installAssessment ( result : any ) {
if ( result ? . kind !== "assessed" ) return ;
const button = document . createElement ( "button" ) ;
button . type = "button" ;
button . textContent = result . assessment . admissible ? "Confirm server roll" : "Revise attempt" ;
button . addEventListener ( "click" , async ( ) = > {
if ( ! result . assessment . admissible ) {
document . querySelector < HTMLTextAreaElement > ( "#attempt" ) ! . focus ( ) ;
return ;
}
const attempted = await send ( { type : "attempt" , assessment_digest : result.assessment.digest } ) ;
// A stale preview is compiled again against the new revision. It still
// requires explicit confirmation; the server never rebases or auto-rolls it.
installAssessment ( attempted ) ;
} ) ;
2026-08-18 21:07:02 +02:00
// The receipt is the sole owner of a pending confirmation. A newer
// assessment or any other command receipt replaces this button together
// with the snapshot it represents.
receipt . append ( button ) ;
2026-08-16 23:16:18 +02:00
}
composer . addEventListener ( "submit" , async event = > {
event . preventDefault ( ) ;
2026-08-18 21:07:02 +02:00
const description = document . querySelector < HTMLTextAreaElement > ( "#attempt" ) ! . value . trim ( ) ;
const intendedEffect = document . querySelector < HTMLInputElement > ( "#intended-effect" ) ! . value . trim ( ) ;
if ( ! description || ! intendedEffect ) return ;
installAssessment ( await send ( {
type : "assess" ,
expected_revision : revision ,
intent : { actor_id : playerActorId , description , intended_effect : intendedEffect } ,
} ) ) ;
2026-08-16 23:16:18 +02:00
} ) ;
2026-08-16 16:35:50 +02:00
document . querySelector < HTMLButtonElement > ( "#wait" ) ! . addEventListener ( "click" , ( ) = > void send ( { type : "wait" , expected_revision : revision , minutes : 60 } ) ) ;
2026-08-17 09:33:34 +02:00
document . querySelector < HTMLInputElement > ( "#active-cell-budget" ) ! . addEventListener ( "input" , event = > {
document . querySelector < HTMLOutputElement > ( "#active-cell-budget-value" ) ! . value = ( event . currentTarget as HTMLInputElement ) . value ;
} ) ;
document . querySelector < HTMLFormElement > ( "#resolution-form" ) ! . addEventListener ( "submit" , async event = > {
event . preventDefault ( ) ;
await send ( {
type : "set_resolution_budget" ,
expected_revision : revision ,
expected_resolution_epoch : resolutionEpoch ,
active_cell_budget : Number ( document . querySelector < HTMLInputElement > ( "#active-cell-budget" ) ! . value ) ,
} ) ;
} ) ;
document . querySelector < HTMLInputElement > ( "#provider-parallelism" ) ! . addEventListener ( "input" , event = > {
document . querySelector < HTMLOutputElement > ( "#provider-parallelism-value" ) ! . value = ( event . currentTarget as HTMLInputElement ) . value ;
} ) ;
document . querySelector < HTMLFormElement > ( "#provider-parallelism-form" ) ! . addEventListener ( "submit" , async event = > {
event . preventDefault ( ) ;
status . textContent = "Applying the provider concurrency limit…" ;
const response = await fetch ( "/api/operator/provider-parallelism" , {
method : "POST" ,
headers : { "content-type" : "application/json" } ,
body : JSON.stringify ( {
expected_provider_configuration_epoch : providerConfigurationEpoch ,
provider_parallelism : Number ( document . querySelector < HTMLInputElement > ( "#provider-parallelism" ) ! . value ) ,
} ) ,
} ) ;
const body = await response . json ( ) ;
2026-08-17 17:45:13 +02:00
showSummary ( response . ok ? "Provider concurrency updated" : "Provider concurrency refused" , [ response . ok ? ` Parallel requests: ${ body . receipt ? . provider_parallelism ? ? body . provider_parallelism ? ? "updated" } ` : body . error ? ? "The operator limit was refused." ] ) ;
2026-08-17 09:33:34 +02:00
if ( ! response . ok ) status . textContent = body . error ? ? "The operator limit was refused." ;
await refresh ( ) ;
} ) ;
document . querySelector < HTMLFormElement > ( "#pin-form" ) ! . addEventListener ( "submit" , async event = > {
event . preventDefault ( ) ;
const data = new FormData ( event . currentTarget as HTMLFormElement ) ;
const subjectIds = String ( data . get ( "subject_ids" ) ? ? "" ) . split ( "," ) . map ( value = > value . trim ( ) ) . filter ( Boolean ) ;
const pin = {
schema : "ghostlight.resolution_pin.v1" ,
id : ` pin: ${ crypto . randomUUID ( ) } ` ,
kind : String ( data . get ( "kind" ) ) ,
subject_ids : subjectIds ,
reason : String ( data . get ( "reason" ) ? ? "" ) . trim ( ) ,
created_world_revision : revision ,
} ;
await send ( { type : "replace_resolution_pins" , expected_revision : revision , expected_resolution_epoch : resolutionEpoch , pins : [ . . . resolutionPins , pin ] } ) ;
} ) ;
2026-08-18 21:07:02 +02:00
destinationForm . addEventListener ( "submit" , async event = > { event . preventDefault ( ) ; const result = await compilerPost ( "/api/compiler/destination" , Object . fromEntries ( new FormData ( destinationForm ) ) ) ; const preview = result . preview ; showSummary ( "Destination preview" , [ . . . ( preview . locations ? ? [ ] ) . map ( ( location :any ) = > location . name ) , . . . ( preview . gaps ? ? [ ] ) . map ( ( gap :string ) = > ` Material gap: ${ gap } ` ) ] ) ; status . textContent = "Destination preview compiled; topology is unchanged until approval." ; const button = node ( "button" , "Approve destination" ) ; button . type = "button" ; button . addEventListener ( "click" , async ( ) = > { await compilerPost ( ` /api/compiler/destination/approve/ ${ result . preview_id } ` , { } ) ; button . remove ( ) ; await refresh ( ) ; } ) ; receipt . append ( button ) ; } ) ;
2026-08-17 09:33:34 +02:00
document . querySelector < HTMLFormElement > ( "#fission-form" ) ! . addEventListener ( "submit" , async event = > {
event . preventDefault ( ) ;
const data = new FormData ( event . currentTarget as HTMLFormElement ) ;
const result = await compilerPost ( "/api/compiler/gestalt/fission" , {
parent_gestalt_id : data.get ( "parent_gestalt_id" ) ,
partition_axis : data.get ( "partition_axis" ) ,
requested_partition_values : String ( data . get ( "requested_partition_values" ) ? ? "" ) . split ( "," ) . map ( value = > value . trim ( ) ) . filter ( Boolean ) ,
reason : data.get ( "reason" ) ,
} ) ;
2026-08-17 17:45:13 +02:00
showSummary ( "Population fission preview" , [
. . . ( result . preview ? . children ? ? [ ] ) . map ( ( child : any ) = > ` ${ child . name } · ${ child . id } ` ) ,
. . . ( result . preview ? . gaps ? ? [ ] ) . map ( ( gap : string ) = > ` Material gap: ${ gap } ` ) ,
] ) ;
2026-08-17 09:33:34 +02:00
status . textContent = "Fission preview compiled. Canonical leaves are unchanged until approval." ;
const button = document . createElement ( "button" ) ;
button . type = "button" ;
button . textContent = "Approve population fission" ;
button . addEventListener ( "click" , async ( ) = > {
await compilerPost ( ` /api/compiler/gestalt/fission/approve/ ${ result . preview_id } ` , { } ) ;
button . remove ( ) ;
await refresh ( ) ;
} ) ;
2026-08-18 21:07:02 +02:00
receipt . append ( button ) ;
2026-08-17 09:33:34 +02:00
} ) ;
2026-08-16 21:01:04 +02:00
document . querySelector < HTMLFormElement > ( "#fork-form" ) ! . addEventListener ( "submit" , async event = > { event . preventDefault ( ) ; await compilerPost ( "/api/campaigns/fork" , Object . fromEntries ( new FormData ( event . currentTarget as HTMLFormElement ) ) ) ; await refresh ( ) ; } ) ;
document . querySelector < HTMLFormElement > ( "#reset-form" ) ! . addEventListener ( "submit" , async event = > { event . preventDefault ( ) ; await compilerPost ( "/api/campaigns/reset" , Object . fromEntries ( new FormData ( event . currentTarget as HTMLFormElement ) ) ) ; await refresh ( ) ; } ) ;
2026-08-16 23:03:30 +02:00
document . querySelector < HTMLButtonElement > ( "#load-operator" ) ! . addEventListener ( "click" , async ( ) = > { const response = await fetch ( "/api/operator" ) ; const surface = await response . json ( ) ; renderEveSurface ( surface , document . querySelector < HTMLElement > ( "#operator-output" ) ! , { body :document.body , clientId : "ghostlight.operator" , statusElement :status } ) ; } ) ;
2026-08-16 16:35:50 +02:00
void refresh ( ) ;